Skip to content

Commit

Permalink
Merge branch 'main' into asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
iuioiua authored Jun 27, 2023
2 parents 0e4247a + deddc2a commit 7990014
Show file tree
Hide file tree
Showing 45 changed files with 583 additions and 156 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ jobs:
- name: Check non-test assertions
run: deno task lint:check-assertions

- name: Spell-check
uses: crate-ci/typos@master
with:
config: ./.github/workflows/typos.toml

wasm:
name: wasm
runs-on: ubuntu-22.04
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[default]
check-filename = false

[default.extend-identifiers]
# The typo also exists in https://github.com/WebAssembly/WASI/blob/main/legacy/preview1/witx/typenames.witx.
ERRNO_ACCES = "ERRNO_ACCES"

# variable name used by node-semver
_fpr = "_fpr"

[files]
extend-exclude = [
"*.json",
"*_test.ts",
"*.generated.mjs",
"media_types/vendor",
"http/testdata",
]
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ Before opening a PR make sure to:
- `deno task test` passes.
- `deno fmt --check` passes.
- `deno task lint` passes.
- (optionally) check for typos with `deno task typos` (requires
[typos](https://github.com/crate-ci/typos#install) to be installed)

Give the PR a descriptive title.

Expand Down
16 changes: 13 additions & 3 deletions Releases.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
### 0.192.0 / 2023.06.15

- BREAKING(semver): rewrite semver (#3385)
- feat(testing): report the number of removed snapshots (#3435)
- fix(datetime/day_of_year): respect time zone of date (#3443)
- fix(http/file_server): resolve empty subdir correctly on Windows (#3439)
- fix(testing/time): use real Date in FakeTime (#3414)
- fix(yaml): parse always return null when file is empty, whitespace or only
comments (#3442)

### 0.191.0 / 2023.06.08

- BREAKING(csv,http,path): remove deprecated APIs (#3418)
Expand Down Expand Up @@ -146,7 +156,7 @@
### 0.176.0 / 2023.02.02

- fix(node): disable worker_threads (#3151)
- fix(node): throw permisison error instead of unknown error (#3133)
- fix(node): throw permission error instead of unknown error (#3133)
- fix(node/util): stricter runtime type checking (#3122)
- fix: make encoding/front_matter work in a browser (#3154)

Expand Down Expand Up @@ -893,7 +903,7 @@ new feature added setNoDelay.
- feat(node): allow require with 'node:' prefix (#1438)
- feat(node/url): add `url.urlToHttpOptions(url)` (#1426)
- feat(testing): add assertIsError (#1376)
- fix(async): fix async/tee concurent .next calls error (#1425)
- fix(async): fix async/tee concurrent .next calls error (#1425)
- fix(crypto): support length option in crypto.subtle.digest (#1386)
- fix(http/file_server): fix encoded url in dir html (#1442)
- fix(http/file_server): fix leak file resource (#1443)
Expand Down Expand Up @@ -1173,7 +1183,7 @@ new feature added setNoDelay.
### 0.92.0 / 2021.04.02

- feat: make bufio compatible to Deno Deploy (#831)
- feat: add symlink adn symlinkSync to node/fs (#825)
- feat: add symlink and symlinkSync to node/fs (#825)
- feat: add format and improve deprecate in node/util (#693)
- feat: add io/buffer and io/util module (#808) …
- fix: handle upstream type changes (#834)
Expand Down
2 changes: 1 addition & 1 deletion async/retry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface RetryOptions {
maxTimeout?: number;
/** The maximum amount of attempts until failure. This is `5` by default. */
maxAttempts?: number;
/** The inital and minimum amount of milliseconds between attempts. This is `1000` by default. */
/** The initial and minimum amount of milliseconds between attempts. This is `1000` by default. */
minTimeout?: number;
/** Amount of jitter to introduce to the time between attempts. This is `1` for full jitter by default. */
jitter?: number;
Expand Down
2 changes: 1 addition & 1 deletion async/tee_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Deno.test("async/tee - 3 branches - delayed consumption", async () => {
);
});

Deno.test("async/tee - concurent .next calls", async () => {
Deno.test("async/tee - concurrent .next calls", async () => {
const [left] = tee(gen());
const l = left[Symbol.asyncIterator]();
assertEquals(await Promise.all([l.next(), l.next(), l.next(), l.next()]), [{
Expand Down
8 changes: 4 additions & 4 deletions bytes/equals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ function equalsNaive(a: Uint8Array, b: Uint8Array): boolean {
*/
function equals32Bit(a: Uint8Array, b: Uint8Array): boolean {
const len = a.length;
const compressable = Math.floor(len / 4);
const compressedA = new Uint32Array(a.buffer, 0, compressable);
const compressedB = new Uint32Array(b.buffer, 0, compressable);
for (let i = compressable * 4; i < len; i++) {
const compressible = Math.floor(len / 4);
const compressedA = new Uint32Array(a.buffer, 0, compressible);
const compressedB = new Uint32Array(b.buffer, 0, compressible);
for (let i = compressible * 4; i < len; i++) {
if (a[i] !== b[i]) return false;
}
for (let i = 0; i < compressedA.length; i++) {
Expand Down
2 changes: 1 addition & 1 deletion bytes/index_of_needle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* A start index can be specified as the third argument that begins the search
* at that given index. The start index defaults to the start of the array.
*
* The complexity of this function is O(source.lenth * needle.length).
* The complexity of this function is O(source.length * needle.length).
*
* ```ts
* import { indexOfNeedle } from "https://deno.land/std@$STD_VERSION/bytes/index_of_needle.ts";
Expand Down
2 changes: 1 addition & 1 deletion bytes/last_index_of_needle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* A start index can be specified as the third argument that begins the search
* at that given index. The start index defaults to the end of the array.
*
* The complexity of this function is O(source.lenth * needle.length).
* The complexity of this function is O(source.length * needle.length).
*
* ```ts
* import { lastIndexOfNeedle } from "https://deno.land/std@$STD_VERSION/bytes/last_index_of_needle.ts";
Expand Down
2 changes: 1 addition & 1 deletion csv/csv_parse_stream_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ Deno.test({
}
{
// `skipFirstRow` may be `true` or `false`.
// `coloums` may be `undefined` or `string[]`.
// `columns` may be `undefined` or `string[]`.
// If you don't know exactly what the value of the option is,
// the return type is ReadableStream<string[] | Record<string, string | undefined>>
const options: CsvParseStreamOptions = {};
Expand Down
2 changes: 1 addition & 1 deletion csv/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ export interface ParseOptions extends ReadOptions {
* @param input Input to parse.
* @param opt options of the parser.
* @returns If you don't provide `opt.skipFirstRow` and `opt.columns`, it returns `string[][]`.
* If you provide `opt.skipFirstRow` or `opt.columns`, it returns `Record<string, unkown>[]`.
* If you provide `opt.skipFirstRow` or `opt.columns`, it returns `Record<string, unknown>[]`.
*/
export function parse(input: string, opt?: undefined): string[][];
export function parse<const T extends ParseOptions>(
Expand Down
2 changes: 1 addition & 1 deletion csv/parse_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ Deno.test({
}
{
// `skipFirstRow` may be `true` or `false`.
// `coloums` may be `undefined` or `string[]`.
// `columns` may be `undefined` or `string[]`.
// If you don't know exactly what the value of the option is,
// the return type is string[][] | Record<string, string|undefined>[]
const options: ParseOptions = {};
Expand Down
29 changes: 27 additions & 2 deletions datetime/day_of_year.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { DAY } from "./constants.ts";

/**
* Returns the number of the day in the year.
* Returns the number of the day in the year in the local time zone.
*
* @example
* ```ts
Expand All @@ -13,14 +13,39 @@ import { DAY } from "./constants.ts";
* dayOfYear(new Date("2019-03-11T03:24:00")); // output: 70
* ```
*
* @return Number of the day in year
* @return Number of the day in the year in the local time zone
*/
export function dayOfYear(date: Date): number {
// Values from 0 to 99 map to the years 1900 to 1999. All other values are the actual year. (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date)
// Using setFullYear as a workaround

const yearStart = new Date(date);

yearStart.setFullYear(date.getFullYear(), 0, 0);
const diff = date.getTime() -
yearStart.getTime();

return Math.floor(diff / DAY);
}

/**
* Returns the number of the day in the year in UTC time.
*
* @example
* ```ts
* import { dayOfYearUtc } from "https://deno.land/std@$STD_VERSION/datetime/mod.ts";
*
* dayOfYearUtc(new Date("2019-03-11T03:24:00.000Z")) // output 70
* ```
*
* @return Number of the day in the year in UTC time
*/
export function dayOfYearUtc(date: Date): number {
// Values from 0 to 99 map to the years 1900 to 1999. All other values are the actual year. (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date)
// Using setUTCFullYear as a workaround

const yearStart = new Date(date);

yearStart.setUTCFullYear(date.getUTCFullYear(), 0, 0);
const diff = date.getTime() -
yearStart.getTime();
Expand Down
Loading

0 comments on commit 7990014

Please sign in to comment.