summaryrefslogtreecommitdiff
path: root/std
diff options
context:
space:
mode:
Diffstat (limited to 'std')
-rw-r--r--std/archive/tar.ts46
-rw-r--r--std/archive/tar_test.ts6
-rw-r--r--std/bytes/test.ts4
-rw-r--r--std/datetime/README.md2
-rw-r--r--std/datetime/mod.ts2
-rw-r--r--std/datetime/test.ts4
-rw-r--r--std/encoding/README.md6
-rw-r--r--std/encoding/base32_test.ts38
-rw-r--r--std/encoding/binary.ts2
-rw-r--r--std/encoding/binary_test.ts2
-rw-r--r--std/encoding/csv.ts8
-rw-r--r--std/encoding/csv_test.ts204
-rw-r--r--std/encoding/hex_test.ts24
-rw-r--r--std/encoding/mod.ts4
-rw-r--r--std/encoding/toml_test.ts118
-rw-r--r--std/encoding/yaml.ts2
-rw-r--r--std/encoding/yaml/dumper/dumper.ts2
-rw-r--r--std/encoding/yaml/dumper/dumper_state.ts2
-rw-r--r--std/encoding/yaml/example/dump.ts10
-rw-r--r--std/encoding/yaml/example/inout.ts10
-rw-r--r--std/encoding/yaml/loader/loader.ts22
-rw-r--r--std/encoding/yaml/loader/loader_state.ts2
-rw-r--r--std/encoding/yaml/parse_test.ts12
-rw-r--r--std/encoding/yaml/schema.ts2
-rw-r--r--std/encoding/yaml/schema/core.ts2
-rw-r--r--std/encoding/yaml/schema/default.ts2
-rw-r--r--std/encoding/yaml/schema/failsafe.ts2
-rw-r--r--std/encoding/yaml/schema/json.ts2
-rw-r--r--std/encoding/yaml/stringify_test.ts12
-rw-r--r--std/encoding/yaml/type/binary.ts2
-rw-r--r--std/encoding/yaml/type/bool.ts4
-rw-r--r--std/encoding/yaml/type/float.ts2
-rw-r--r--std/encoding/yaml/type/int.ts21
-rw-r--r--std/encoding/yaml/type/map.ts2
-rw-r--r--std/encoding/yaml/type/merge.ts2
-rw-r--r--std/encoding/yaml/type/nil.ts4
-rw-r--r--std/encoding/yaml/type/omap.ts2
-rw-r--r--std/encoding/yaml/type/pairs.ts2
-rw-r--r--std/encoding/yaml/type/seq.ts2
-rw-r--r--std/encoding/yaml/type/set.ts2
-rw-r--r--std/encoding/yaml/type/str.ts2
-rw-r--r--std/encoding/yaml/type/timestamp.ts2
-rw-r--r--std/examples/chat/server.ts20
-rw-r--r--std/examples/chat/server_test.ts6
-rwxr-xr-xstd/examples/gist.ts6
-rw-r--r--std/examples/test.ts4
-rw-r--r--std/examples/tests/cat_test.ts4
-rw-r--r--std/examples/tests/catj_test.ts6
-rw-r--r--std/examples/tests/colors_test.ts2
-rw-r--r--std/examples/tests/curl_test.ts4
-rw-r--r--std/examples/tests/echo_server_test.ts2
-rw-r--r--std/examples/tests/welcome_test.ts2
-rw-r--r--std/examples/tests/xeval_test.ts12
-rw-r--r--std/examples/xeval.ts8
-rwxr-xr-xstd/flags/all_bool_test.ts8
-rwxr-xr-xstd/flags/bool_test.ts42
-rwxr-xr-xstd/flags/dash_test.ts2
-rwxr-xr-xstd/flags/default_bool_test.ts8
-rwxr-xr-xstd/flags/dotted_test.ts2
-rwxr-xr-xstd/flags/long_test.ts4
-rw-r--r--std/flags/mod.ts12
-rwxr-xr-xstd/flags/num_test.ts4
-rwxr-xr-xstd/flags/parse_test.ts28
-rwxr-xr-xstd/flags/short_test.ts8
-rwxr-xr-xstd/flags/stop_early_test.ts4
-rwxr-xr-xstd/flags/unknown_test.ts14
-rw-r--r--std/fmt/colors.ts2
-rw-r--r--std/fmt/sprintf.ts6
-rw-r--r--std/fmt/sprintf_test.ts11
-rw-r--r--std/fs/README.md6
-rw-r--r--std/fs/copy_test.ts14
-rw-r--r--std/fs/empty_dir_test.ts24
-rw-r--r--std/fs/ensure_link_test.ts2
-rw-r--r--std/fs/ensure_symlink_test.ts2
-rw-r--r--std/fs/eol.ts2
-rw-r--r--std/fs/eol_test.ts10
-rw-r--r--std/fs/exists_test.ts38
-rw-r--r--std/fs/expand_glob.ts24
-rw-r--r--std/fs/expand_glob_test.ts18
-rw-r--r--std/fs/move_test.ts10
-rw-r--r--std/fs/read_json_test.ts2
l---------std/fs/testdata/0-link1
l---------std/fs/testdata/0-link.ts1
-rw-r--r--std/fs/testdata/empty_dir.ts6
-rw-r--r--std/fs/testdata/exists_sync.ts8
-rw-r--r--std/fs/utils_test.ts8
-rw-r--r--std/fs/walk.ts8
-rw-r--r--std/fs/write_json_test.ts6
-rw-r--r--std/http/cookie.ts2
-rw-r--r--std/http/cookie_test.ts28
-rwxr-xr-xstd/http/file_server.ts37
-rw-r--r--std/http/file_server_test.ts8
-rw-r--r--std/http/http_bench.ts2
-rw-r--r--std/http/http_status.ts8
-rw-r--r--std/http/io.ts10
-rw-r--r--std/http/io_test.ts48
-rw-r--r--std/http/mock.ts6
-rw-r--r--std/http/racing_server_test.ts4
-rw-r--r--std/http/server.ts4
-rw-r--r--std/http/server_test.ts38
-rw-r--r--std/io/bufio.ts3
-rw-r--r--std/io/bufio_test.ts12
-rw-r--r--std/io/ioutil_test.ts2
-rw-r--r--std/io/util_test.ts8
-rw-r--r--std/log/README.md12
-rw-r--r--std/log/handlers_test.ts22
-rw-r--r--std/log/levels.ts4
-rw-r--r--std/log/logger.ts2
-rw-r--r--std/log/logger_test.ts4
-rw-r--r--std/log/mod.ts16
-rw-r--r--std/log/test.ts28
-rw-r--r--std/manual.md24
-rw-r--r--std/media_types/test.ts2
-rw-r--r--std/mime/multipart.ts6
-rw-r--r--std/mime/multipart_test.ts4
-rw-r--r--std/node/_fs/_fs_appendFile.ts2
-rw-r--r--std/node/_fs/_fs_appendFile_test.ts30
-rw-r--r--std/node/_fs/_fs_chmod.ts2
-rw-r--r--std/node/_fs/_fs_chmod_test.ts6
-rw-r--r--std/node/_fs/_fs_chown.ts2
-rw-r--r--std/node/_fs/_fs_chown_test.ts6
-rw-r--r--std/node/_fs/_fs_close.ts2
-rw-r--r--std/node/_fs/_fs_close_test.ts6
-rw-r--r--std/node/_fs/_fs_dir.ts4
-rw-r--r--std/node/_fs/_fs_dir_test.ts16
-rw-r--r--std/node/_fs/_fs_dirent_test.ts14
-rw-r--r--std/node/_fs/_fs_readFile.ts2
-rw-r--r--std/node/_fs/_fs_readlink.ts2
-rw-r--r--std/node/_fs/_fs_readlink_test.ts8
-rw-r--r--std/node/_utils.ts8
-rw-r--r--std/node/events.ts8
-rw-r--r--std/node/events_test.ts78
-rwxr-xr-xstd/node/fs.ts2
-rw-r--r--std/node/module.ts46
-rw-r--r--std/node/os.ts2
-rw-r--r--std/node/os_test.ts32
-rw-r--r--std/node/process.ts4
-rw-r--r--std/node/process_test.ts18
-rw-r--r--std/node/querystring.ts2
-rw-r--r--std/node/querystring_test.ts8
-rw-r--r--std/node/tests/cjs/cjs_builtin.js2
-rw-r--r--std/node/tests/node_modules/left-pad/index.js34
-rw-r--r--std/node/util_test.ts26
-rw-r--r--std/path/extname_test.ts6
-rw-r--r--std/path/glob.ts2
-rw-r--r--std/path/glob_test.ts24
-rw-r--r--std/path/globrex.ts4
-rw-r--r--std/path/globrex_test.ts66
-rw-r--r--std/path/join_test.ts10
-rw-r--r--std/path/parse_format_test.ts35
-rw-r--r--std/path/posix.ts5
-rw-r--r--std/path/relative_test.ts94
-rw-r--r--std/path/resolve_test.ts10
-rw-r--r--std/path/utils.ts2
-rw-r--r--std/path/win32.ts15
-rw-r--r--std/permissions/mod.ts2
-rw-r--r--std/permissions/test.ts14
-rw-r--r--std/signal/mod.ts4
-rw-r--r--std/signal/test.ts2
-rw-r--r--std/strings/README.md2
-rw-r--r--std/strings/pad.ts2
-rw-r--r--std/strings/pad_test.ts12
-rw-r--r--std/testing/README.md4
-rw-r--r--std/testing/asserts.ts2
-rw-r--r--std/testing/asserts_test.ts28
-rw-r--r--std/testing/bench.ts6
-rw-r--r--std/testing/bench_example.ts2
-rw-r--r--std/testing/bench_test.ts6
-rw-r--r--std/testing/diff.ts15
-rw-r--r--std/testing/diff_test.ts32
-rw-r--r--std/testing/format.ts12
-rw-r--r--std/testing/format_test.ts184
-rwxr-xr-xstd/testing/runner.ts16
-rw-r--r--std/textproto/test.ts24
-rw-r--r--std/types/react-dom.d.ts2
-rw-r--r--std/types/react.d.ts4
-rw-r--r--std/types/tests/react-dom_mock.js2
-rw-r--r--std/types/tests/react_mock.js2
-rw-r--r--std/util/deep_assign_test.ts4
-rw-r--r--std/uuid/mod.ts2
-rw-r--r--std/uuid/tests/isNil.ts2
-rw-r--r--std/uuid/tests/v4/generate.ts4
-rw-r--r--std/uuid/tests/v4/validate.ts2
-rw-r--r--std/uuid/v4.ts2
-rw-r--r--std/ws/README.md8
-rw-r--r--std/ws/example_client.ts4
-rw-r--r--std/ws/example_server.ts4
-rw-r--r--std/ws/mod.ts28
-rw-r--r--std/ws/sha1.ts2
-rw-r--r--std/ws/test.ts46
190 files changed, 1247 insertions, 1253 deletions
diff --git a/std/archive/tar.ts b/std/archive/tar.ts
index 2680bcff2..cafef8723 100644
--- a/std/archive/tar.ts
+++ b/std/archive/tar.ts
@@ -104,68 +104,68 @@ struct posix_header { // byte offset
const ustarStructure: Array<{ field: string; length: number }> = [
{
field: "fileName",
- length: 100
+ length: 100,
},
{
field: "fileMode",
- length: 8
+ length: 8,
},
{
field: "uid",
- length: 8
+ length: 8,
},
{
field: "gid",
- length: 8
+ length: 8,
},
{
field: "fileSize",
- length: 12
+ length: 12,
},
{
field: "mtime",
- length: 12
+ length: 12,
},
{
field: "checksum",
- length: 8
+ length: 8,
},
{
field: "type",
- length: 1
+ length: 1,
},
{
field: "linkName",
- length: 100
+ length: 100,
},
{
field: "ustar",
- length: 8
+ length: 8,
},
{
field: "owner",
- length: 32
+ length: 32,
},
{
field: "group",
- length: 32
+ length: 32,
},
{
field: "majorNumber",
- length: 8
+ length: 8,
},
{
field: "minorNumber",
- length: 8
+ length: 8,
},
{
field: "fileNamePrefix",
- length: 155
+ length: 155,
},
{
field: "padding",
- length: 12
- }
+ length: 12,
+ },
];
/**
@@ -175,7 +175,7 @@ function formatHeader(data: TarData): Uint8Array {
const encoder = new TextEncoder(),
buffer = clean(512);
let offset = 0;
- ustarStructure.forEach(function(value): void {
+ ustarStructure.forEach(function (value): void {
const entry = encoder.encode(data[value.field as keyof TarData] || "");
buffer.set(entry, offset);
offset += value.length; // space it out with nulls
@@ -190,7 +190,7 @@ function formatHeader(data: TarData): Uint8Array {
function parseHeader(buffer: Uint8Array): { [key: string]: Uint8Array } {
const data: { [key: string]: Uint8Array } = {};
let offset = 0;
- ustarStructure.forEach(function(value): void {
+ ustarStructure.forEach(function (value): void {
const arr = buffer.subarray(offset, offset + value.length);
data[value.field] = arr;
offset += value.length;
@@ -350,7 +350,7 @@ export class Tar {
owner: opts.owner || "",
group: opts.group || "",
filePath: opts.filePath,
- reader: opts.reader
+ reader: opts.reader,
};
// calculate the checksum
@@ -358,7 +358,7 @@ export class Tar {
const encoder = new TextEncoder();
Object.keys(tarData)
.filter((key): boolean => ["filePath", "reader"].indexOf(key) < 0)
- .forEach(function(key): void {
+ .forEach(function (key): void {
checksum += encoder
.encode(tarData[key as keyof TarData])
.reduce((p, c): number => p + c, 0);
@@ -424,7 +424,7 @@ export class Untar {
decoder = new TextDecoder("ascii");
Object.keys(header)
.filter((key): boolean => key !== "checksum")
- .forEach(function(key): void {
+ .forEach(function (key): void {
checksum += header[key].reduce((p, c): number => p + c, 0);
});
checksum += encoder.encode(" ").reduce((p, c): number => p + c, 0);
@@ -440,7 +440,7 @@ export class Untar {
// get meta data
const meta: UntarOptions = {
- fileName: decoder.decode(trim(header.fileName))
+ fileName: decoder.decode(trim(header.fileName)),
};
const fileNamePrefix = trim(header.fileNamePrefix);
if (fileNamePrefix.byteLength > 0) {
diff --git a/std/archive/tar_test.ts b/std/archive/tar_test.ts
index 1bac623b0..ae3ee8138 100644
--- a/std/archive/tar_test.ts
+++ b/std/archive/tar_test.ts
@@ -23,7 +23,7 @@ Deno.test(async function createTarArchive(): Promise<void> {
const content = new TextEncoder().encode("hello tar world!");
await tar.append("output.txt", {
reader: new Deno.Buffer(content),
- contentSize: content.byteLength
+ contentSize: content.byteLength,
});
// put a file
@@ -49,7 +49,7 @@ Deno.test(async function deflateTarArchive(): Promise<void> {
const content = new TextEncoder().encode(text);
await tar.append(fileName, {
reader: new Deno.Buffer(content),
- contentSize: content.byteLength
+ contentSize: content.byteLength,
});
// read data from a tar archive
@@ -73,7 +73,7 @@ Deno.test(async function appendFileWithLongNameToTarArchive(): Promise<void> {
const content = new TextEncoder().encode(text);
await tar.append(fileName, {
reader: new Deno.Buffer(content),
- contentSize: content.byteLength
+ contentSize: content.byteLength,
});
// read data from a tar archive
diff --git a/std/bytes/test.ts b/std/bytes/test.ts
index 3ded0cd85..5efddf77f 100644
--- a/std/bytes/test.ts
+++ b/std/bytes/test.ts
@@ -6,7 +6,7 @@ import {
equal,
hasPrefix,
repeat,
- concat
+ concat,
} from "./mod.ts";
import { assertEquals, assertThrows, assert } from "../testing/asserts.ts";
import { encode, decode } from "../strings/mod.ts";
@@ -58,7 +58,7 @@ Deno.test("[bytes] repeat", () => {
["-", "", 0],
["-", "-", -1, "bytes: negative repeat count"],
["-", "----------", 10],
- ["abc ", "abc abc abc ", 3]
+ ["abc ", "abc abc abc ", 3],
];
for (const [input, output, count, errMsg] of repeatTestCase) {
if (errMsg) {
diff --git a/std/datetime/README.md b/std/datetime/README.md
index e3d935bc0..6c29f65e4 100644
--- a/std/datetime/README.md
+++ b/std/datetime/README.md
@@ -31,7 +31,7 @@ parseDateTime("16:34 01-20-2019", "hh:mm mm-dd-yyyy") // output : new Date(2019,
```ts
import {
dayOfYear,
- currentDayOfYear
+ currentDayOfYear,
} from "https://deno.land/std/datetime/mod.ts";
dayOfYear(new Date("2019-03-11T03:24:00")); // output: 70
diff --git a/std/datetime/mod.ts b/std/datetime/mod.ts
index 124f73911..036cd2cc5 100644
--- a/std/datetime/mod.ts
+++ b/std/datetime/mod.ts
@@ -145,7 +145,7 @@ export function toIMF(date: Date): string {
"Sep",
"Oct",
"Nov",
- "Dec"
+ "Dec",
];
return `${days[date.getUTCDay()]}, ${d} ${
months[date.getUTCMonth()]
diff --git a/std/datetime/test.ts b/std/datetime/test.ts
index 979fd34be..dc93095f4 100644
--- a/std/datetime/test.ts
+++ b/std/datetime/test.ts
@@ -82,7 +82,7 @@ Deno.test({
const actual = datetime.toIMF(new Date(Date.UTC(1994, 3, 5, 15, 32)));
const expected = "Tue, 05 Apr 1994 15:32:00 GMT";
assertEquals(actual, expected);
- }
+ },
});
Deno.test({
@@ -91,5 +91,5 @@ Deno.test({
const actual = datetime.toIMF(new Date(0));
const expected = "Thu, 01 Jan 1970 00:00:00 GMT";
assertEquals(actual, expected);
- }
+ },
});
diff --git a/std/encoding/README.md b/std/encoding/README.md
index 2b2d416b1..e6604c605 100644
--- a/std/encoding/README.md
+++ b/std/encoding/README.md
@@ -39,7 +39,7 @@ const string = "a,b,c\nd,e,f";
console.log(
await parseCsv(string, {
- header: false
+ header: false,
})
);
// output:
@@ -161,9 +161,9 @@ import { stringify } from "./parser.ts";
const obj = {
bin: [
{ name: "deno", path: "cli/main.rs" },
- { name: "deno_core", path: "src/foo.rs" }
+ { name: "deno_core", path: "src/foo.rs" },
],
- nib: [{ name: "node", path: "not_found" }]
+ nib: [{ name: "node", path: "not_found" }],
};
const tomlString = stringify(obj);
```
diff --git a/std/encoding/base32_test.ts b/std/encoding/base32_test.ts
index 28550d57a..2bd7acea1 100644
--- a/std/encoding/base32_test.ts
+++ b/std/encoding/base32_test.ts
@@ -6,7 +6,7 @@ import { encode, decode } from "./base32.ts";
// Lifted from https://stackoverflow.com/questions/38987784
const fromHexString = (hexString: string): Uint8Array =>
- new Uint8Array(hexString.match(/.{1,2}/g)!.map(byte => parseInt(byte, 16)));
+ new Uint8Array(hexString.match(/.{1,2}/g)!.map((byte) => parseInt(byte, 16)));
const toHexString = (bytes: Uint8Array): string =>
bytes.reduce((str, byte) => str + byte.toString(16).padStart(2, "0"), "");
@@ -34,56 +34,56 @@ const testCases = [
["ddf80ebe21bf1b1e12a64c5cc6a74b5d92dd", "3X4A5PRBX4NR4EVGJROMNJ2LLWJN2==="],
[
"c0cae52c6f641ce04a7ee5b9a8fa8ded121bca",
- "YDFOKLDPMQOOAST64W42R6UN5UJBXSQ="
+ "YDFOKLDPMQOOAST64W42R6UN5UJBXSQ=",
],
[
"872840a355c8c70586f462c9e669ee760cb3537e",
- "Q4UEBI2VZDDQLBXUMLE6M2POOYGLGU36"
+ "Q4UEBI2VZDDQLBXUMLE6M2POOYGLGU36",
],
[
"5773fe22662818a120c5688824c935fe018208a496",
- "K5Z74ITGFAMKCIGFNCECJSJV7YAYECFESY======"
+ "K5Z74ITGFAMKCIGFNCECJSJV7YAYECFESY======",
],
[
"416e23abc524d1b85736e2bea6cfecd5192789034a28",
- "IFXCHK6FETI3QVZW4K7KNT7M2UMSPCIDJIUA===="
+ "IFXCHK6FETI3QVZW4K7KNT7M2UMSPCIDJIUA====",
],
[
"83d2386ebdd7e8e818ec00e3ccd882aa933b905b7e2e44",
- "QPJDQ3V527UOQGHMADR4ZWECVKJTXEC3PYXEI==="
+ "QPJDQ3V527UOQGHMADR4ZWECVKJTXEC3PYXEI===",
],
[
"a2fa8b881f3b8024f52745763c4ae08ea12bdf8bef1a72f8",
- "UL5IXCA7HOACJ5JHIV3DYSXAR2QSXX4L54NHF6A="
+ "UL5IXCA7HOACJ5JHIV3DYSXAR2QSXX4L54NHF6A=",
],
[
"b074ae8b9efde0f17f37bccadde006d039997b59c8efb05add",
- "WB2K5C467XQPC7ZXXTFN3YAG2A4ZS62ZZDX3AWW5"
+ "WB2K5C467XQPC7ZXXTFN3YAG2A4ZS62ZZDX3AWW5",
],
[
"764fef941aee7e416dc204ae5ab9c5b9ce644567798e6849aea9",
- "OZH67FA25Z7EC3OCASXFVOOFXHHGIRLHPGHGQSNOVE======"
+ "OZH67FA25Z7EC3OCASXFVOOFXHHGIRLHPGHGQSNOVE======",
],
[
"4995d9811f37f59797d7c3b9b9e5325aa78277415f70f4accf588c",
- "JGK5TAI7G72ZPF6XYO43TZJSLKTYE52BL5YPJLGPLCGA===="
+ "JGK5TAI7G72ZPF6XYO43TZJSLKTYE52BL5YPJLGPLCGA====",
],
[
"24f0812ca8eed58374c11a7008f0b262698b72fd2792709208eaacb2",
- "ETYICLFI53KYG5GBDJYAR4FSMJUYW4X5E6JHBEQI5KWLE==="
+ "ETYICLFI53KYG5GBDJYAR4FSMJUYW4X5E6JHBEQI5KWLE===",
],
[
"d70692543810d4bf50d81cf44a55801a557a388a341367c7ea077ca306",
- "24DJEVBYCDKL6UGYDT2EUVMADJKXUOEKGQJWPR7KA56KGBQ="
+ "24DJEVBYCDKL6UGYDT2EUVMADJKXUOEKGQJWPR7KA56KGBQ=",
],
[
"6e08a89ca36b677ff8fe99e68a1241c8d8cef2570a5f60b6417d2538b30c",
- "NYEKRHFDNNTX76H6THTIUESBZDMM54SXBJPWBNSBPUSTRMYM"
+ "NYEKRHFDNNTX76H6THTIUESBZDMM54SXBJPWBNSBPUSTRMYM",
],
[
"f2fc2319bd29457ccd01e8e194ee9bd7e97298b6610df4ab0f3d5baa0b2d7ccf69829edb74edef",
- "6L6CGGN5FFCXZTIB5DQZJ3U327UXFGFWMEG7JKYPHVN2UCZNPTHWTAU63N2O33Y="
- ]
+ "6L6CGGN5FFCXZTIB5DQZJ3U327UXFGFWMEG7JKYPHVN2UCZNPTHWTAU63N2O33Y=",
+ ],
];
Deno.test({
@@ -92,7 +92,7 @@ Deno.test({
for (const [bin, b32] of testCases) {
assertEquals(encode(fromHexString(bin)), b32);
}
- }
+ },
});
Deno.test({
@@ -101,7 +101,7 @@ Deno.test({
for (const [bin, b32] of testCases) {
assertEquals(toHexString(decode(b32)), bin);
}
- }
+ },
});
Deno.test({
@@ -117,7 +117,7 @@ Deno.test({
errorCaught = true;
}
assert(errorCaught);
- }
+ },
});
Deno.test({
@@ -131,5 +131,5 @@ Deno.test({
errorCaught = true;
}
assert(errorCaught);
- }
+ },
});
diff --git a/std/encoding/binary.ts b/std/encoding/binary.ts
index 2eec9b4ab..cd338703b 100644
--- a/std/encoding/binary.ts
+++ b/std/encoding/binary.ts
@@ -34,7 +34,7 @@ const rawTypeSizes = {
int64: 8,
uint64: 8,
float32: 4,
- float64: 8
+ float64: 8,
};
/** Returns the number of bytes required to store the given data-type. */
diff --git a/std/encoding/binary_test.ts b/std/encoding/binary_test.ts
index 54f8cbded..084ca2fa4 100644
--- a/std/encoding/binary_test.ts
+++ b/std/encoding/binary_test.ts
@@ -11,7 +11,7 @@ import {
varbig,
varnum,
writeVarbig,
- writeVarnum
+ writeVarnum,
} from "./binary.ts";
Deno.test(async function testGetNBytes(): Promise<void> {
diff --git a/std/encoding/csv.ts b/std/encoding/csv.ts
index 12336b10d..c8c7719ca 100644
--- a/std/encoding/csv.ts
+++ b/std/encoding/csv.ts
@@ -118,7 +118,7 @@ export async function readMatrix(
opt: ReadOptions = {
comma: ",",
trimLeadingSpace: false,
- lazyQuotes: false
+ lazyQuotes: false,
}
): Promise<string[][]> {
const result: string[][] = [];
@@ -195,7 +195,7 @@ export interface ParseOptions extends ReadOptions {
export async function parse(
input: string | BufReader,
opt: ParseOptions = {
- header: false
+ header: false,
}
): Promise<unknown[]> {
let r: string[][];
@@ -215,7 +215,7 @@ export async function parse(
headers = h.map(
(e): HeaderOptions => {
return {
- name: e
+ name: e,
};
}
);
@@ -226,7 +226,7 @@ export async function parse(
headers = head.map(
(e): HeaderOptions => {
return {
- name: e
+ name: e,
};
}
);
diff --git a/std/encoding/csv_test.ts b/std/encoding/csv_test.ts
index 74ad00c72..cb61de433 100644
--- a/std/encoding/csv_test.ts
+++ b/std/encoding/csv_test.ts
@@ -14,20 +14,20 @@ const testCases = [
{
Name: "Simple",
Input: "a,b,c\n",
- Output: [["a", "b", "c"]]
+ Output: [["a", "b", "c"]],
},
{
Name: "CRLF",
Input: "a,b\r\nc,d\r\n",
Output: [
["a", "b"],
- ["c", "d"]
- ]
+ ["c", "d"],
+ ],
},
{
Name: "BareCR",
Input: "a,b\rc,d\r\n",
- Output: [["a", "b\rc", "d"]]
+ Output: [["a", "b\rc", "d"]],
},
{
Name: "RFC4180test",
@@ -41,20 +41,20 @@ zzz,yyy,xxx`,
["#field1", "field2", "field3"],
["aaa", "bbb", "ccc"],
["a,a", `bbb`, "ccc"],
- ["zzz", "yyy", "xxx"]
+ ["zzz", "yyy", "xxx"],
],
- ignore: true
+ ignore: true,
},
{
Name: "NoEOLTest",
Input: "a,b,c",
- Output: [["a", "b", "c"]]
+ Output: [["a", "b", "c"]],
},
{
Name: "Semicolon",
Input: "a;b;c\n",
Output: [["a", "b", "c"]],
- Comma: ";"
+ Comma: ";",
},
{
Name: "MultiLine",
@@ -63,103 +63,103 @@ line","one line","three
line
field"`,
Output: [["two\nline"], ["one line"], ["three\nline\nfield"]],
- ignore: true
+ ignore: true,
},
{
Name: "BlankLine",
Input: "a,b,c\n\nd,e,f\n\n",
Output: [
["a", "b", "c"],
- ["d", "e", "f"]
- ]
+ ["d", "e", "f"],
+ ],
},
{
Name: "BlankLineFieldCount",
Input: "a,b,c\n\nd,e,f\n\n",
Output: [
["a", "b", "c"],
- ["d", "e", "f"]
+ ["d", "e", "f"],
],
UseFieldsPerRecord: true,
- FieldsPerRecord: 0
+ FieldsPerRecord: 0,
},
{
Name: "TrimSpace",
Input: " a, b, c\n",
Output: [["a", "b", "c"]],
- TrimLeadingSpace: true
+ TrimLeadingSpace: true,
},
{
Name: "LeadingSpace",
Input: " a, b, c\n",
- Output: [[" a", " b", " c"]]
+ Output: [[" a", " b", " c"]],
},
{
Name: "Comment",
Input: "#1,2,3\na,b,c\n#comment",
Output: [["a", "b", "c"]],
- Comment: "#"
+ Comment: "#",
},
{
Name: "NoComment",
Input: "#1,2,3\na,b,c",
Output: [
["#1", "2", "3"],
- ["a", "b", "c"]
- ]
+ ["a", "b", "c"],
+ ],
},
{
Name: "LazyQuotes",
Input: `a "word","1"2",a","b`,
Output: [[`a "word"`, `1"2`, `a"`, `b`]],
- LazyQuotes: true
+ LazyQuotes: true,
},
{
Name: "BareQuotes",
Input: `a "word","1"2",a"`,
Output: [[`a "word"`, `1"2`, `a"`]],
- LazyQuotes: true
+ LazyQuotes: true,
},
{
Name: "BareDoubleQuotes",
Input: `a""b,c`,
Output: [[`a""b`, `c`]],
- LazyQuotes: true
+ LazyQuotes: true,
},
{
Name: "BadDoubleQuotes",
Input: `a""b,c`,
- Error: ErrBareQuote
+ Error: ErrBareQuote,
// Error: &ParseError{StartLine: 1, Line: 1, Column: 1, Err: ErrBareQuote},
},
{
Name: "TrimQuote",
Input: ` "a"," b",c`,
Output: [["a", " b", "c"]],
- TrimLeadingSpace: true
+ TrimLeadingSpace: true,
},
{
Name: "BadBareQuote",
Input: `a "word","b"`,
- Error: ErrBareQuote
+ Error: ErrBareQuote,
// &ParseError{StartLine: 1, Line: 1, Column: 2, Err: ErrBareQuote}
},
{
Name: "BadTrailingQuote",
Input: `"a word",b"`,
- Error: ErrBareQuote
+ Error: ErrBareQuote,
},
{
Name: "ExtraneousQuote",
Input: `"a "word","b"`,
- Error: ErrBareQuote
+ Error: ErrBareQuote,
},
{
Name: "BadFieldCount",
Input: "a,b,c\nd,e",
Error: ErrFieldCount,
UseFieldsPerRecord: true,
- FieldsPerRecord: 0
+ FieldsPerRecord: 0,
},
{
Name: "BadFieldCount1",
@@ -167,37 +167,37 @@ field"`,
// Error: &ParseError{StartLine: 1, Line: 1, Err: ErrFieldCount},
UseFieldsPerRecord: true,
FieldsPerRecord: 2,
- Error: ErrFieldCount
+ Error: ErrFieldCount,
},
{
Name: "FieldCount",
Input: "a,b,c\nd,e",
Output: [
["a", "b", "c"],
- ["d", "e"]
- ]
+ ["d", "e"],
+ ],
},
{
Name: "TrailingCommaEOF",
Input: "a,b,c,",
- Output: [["a", "b", "c", ""]]
+ Output: [["a", "b", "c", ""]],
},
{
Name: "TrailingCommaEOL",
Input: "a,b,c,\n",
- Output: [["a", "b", "c", ""]]
+ Output: [["a", "b", "c", ""]],
},
{
Name: "TrailingCommaSpaceEOF",
Input: "a,b,c, ",
Output: [["a", "b", "c", ""]],
- TrimLeadingSpace: true
+ TrimLeadingSpace: true,
},
{
Name: "TrailingCommaSpaceEOL",
Input: "a,b,c, \n",
Output: [["a", "b", "c", ""]],
- TrimLeadingSpace: true
+ TrimLeadingSpace: true,
},
{
Name: "TrailingCommaLine3",
@@ -205,14 +205,14 @@ field"`,
Output: [
["a", "b", "c"],
["d", "e", "f"],
- ["g", "hi", ""]
+ ["g", "hi", ""],
],
- TrimLeadingSpace: true
+ TrimLeadingSpace: true,
},
{
Name: "NotTrailingComma3",
Input: "a,b,c, \n",
- Output: [["a", "b", "c", " "]]
+ Output: [["a", "b", "c", " "]],
},
{
Name: "CommaFieldTest",
@@ -237,98 +237,98 @@ x,,,
["x", "y", "z", ""],
["x", "y", "", ""],
["x", "", "", ""],
- ["", "", "", ""]
- ]
+ ["", "", "", ""],
+ ],
},
{
Name: "TrailingCommaIneffective1",
Input: "a,b,\nc,d,e",
Output: [
["a", "b", ""],
- ["c", "d", "e"]
+ ["c", "d", "e"],
],
- TrimLeadingSpace: true
+ TrimLeadingSpace: true,
},
{
Name: "ReadAllReuseRecord",
Input: "a,b\nc,d",
Output: [
["a", "b"],
- ["c", "d"]
+ ["c", "d"],
],
- ReuseRecord: true
+ ReuseRecord: true,
},
{
Name: "StartLine1", // Issue 19019
Input: 'a,"b\nc"d,e',
Error: true,
// Error: &ParseError{StartLine: 1, Line: 2, Column: 1, Err: ErrQuote},
- ignore: true
+ ignore: true,
},
{
Name: "StartLine2",
Input: 'a,b\n"d\n\n,e',
Error: true,
// Error: &ParseError{StartLine: 2, Line: 5, Column: 0, Err: ErrQuote},
- ignore: true
+ ignore: true,
},
{
Name: "CRLFInQuotedField", // Issue 21201
Input: 'A,"Hello\r\nHi",B\r\n',
Output: [["A", "Hello\nHi", "B"]],
- ignore: true
+ ignore: true,
},
{
Name: "BinaryBlobField", // Issue 19410
Input: "x09\x41\xb4\x1c,aktau",
- Output: [["x09A\xb4\x1c", "aktau"]]
+ Output: [["x09A\xb4\x1c", "aktau"]],
},
{
Name: "TrailingCR",
Input: "field1,field2\r",
Output: [["field1", "field2"]],
- ignore: true
+ ignore: true,
},
{
Name: "QuotedTrailingCR",
Input: '"field"\r',
Output: [['"field"']],
- ignore: true
+ ignore: true,
},
{
Name: "QuotedTrailingCRCR",
Input: '"field"\r\r',
Error: true,
// Error: &ParseError{StartLine: 1, Line: 1, Column: 6, Err: ErrQuote},
- ignore: true
+ ignore: true,
},
{
Name: "FieldCR",
Input: "field\rfield\r",
Output: [["field\rfield"]],
- ignore: true
+ ignore: true,
},
{
Name: "FieldCRCR",
Input: "field\r\rfield\r\r",
Output: [["field\r\rfield\r"]],
- ignore: true
+ ignore: true,
},
{
Name: "FieldCRCRLF",
Input: "field\r\r\nfield\r\r\n",
- Output: [["field\r"], ["field\r"]]
+ Output: [["field\r"], ["field\r"]],
},
{
Name: "FieldCRCRLFCR",
Input: "field\r\r\n\rfield\r\r\n\r",
- Output: [["field\r"], ["\rfield\r"]]
+ Output: [["field\r"], ["\rfield\r"]],
},
{
Name: "FieldCRCRLFCRCR",
Input: "field\r\r\n\r\rfield\r\r\n\r\r",
Output: [["field\r"], ["\r\rfield\r"], ["\r"]],
- ignore: true
+ ignore: true,
},
{
Name: "MultiFieldCRCRLFCRCR",
@@ -336,9 +336,9 @@ x,,,
Output: [
["field1", "field2\r"],
["\r\rfield1", "field2\r"],
- ["\r\r", ""]
+ ["\r\r", ""],
],
- ignore: true
+ ignore: true,
},
{
Name: "NonASCIICommaAndComment",
@@ -346,14 +346,14 @@ x,,,
Output: [["a", "b,c", "d,e"]],
TrimLeadingSpace: true,
Comma: "£",
- Comment: "€"
+ Comment: "€",
},
{
Name: "NonASCIICommaAndCommentWithQuotes",
Input: 'a€" b,"€ c\nλ comment\n',
Output: [["a", " b,", " c"]],
Comma: "€",
- Comment: "λ"
+ Comment: "λ",
},
{
// λ and θ start with the same byte.
@@ -362,24 +362,24 @@ x,,,
Input: '"abθcd"λefθgh',
Output: [["abθcd", "efθgh"]],
Comma: "λ",
- Comment: "€"
+ Comment: "€",
},
{
Name: "NonASCIICommentConfusion",
Input: "λ\nλ\nθ\nλ\n",
Output: [["λ"], ["λ"], ["λ"]],
- Comment: "θ"
+ Comment: "θ",
},
{
Name: "QuotedFieldMultipleLF",
Input: '"\n\n\n\n"',
Output: [["\n\n\n\n"]],
- ignore: true
+ ignore: true,
},
{
Name: "MultipleCRLF",
Input: "\r\n\r\n\r\n\r\n",
- ignore: true
+ ignore: true,
},
/**
* The implementation may read each line in several chunks if
@@ -392,77 +392,77 @@ x,,,
"#ignore\n".repeat(10000) + "@".repeat(5000) + "," + "*".repeat(5000),
Output: [["@".repeat(5000), "*".repeat(5000)]],
Comment: "#",
- ignore: true
+ ignore: true,
},
{
Name: "QuoteWithTrailingCRLF",
Input: '"foo"bar"\r\n',
- Error: ErrBareQuote
+ Error: ErrBareQuote,
// Error: &ParseError{StartLine: 1, Line: 1, Column: 4, Err: ErrQuote},
},
{
Name: "LazyQuoteWithTrailingCRLF",
Input: '"foo"bar"\r\n',
Output: [[`foo"bar`]],
- LazyQuotes: true
+ LazyQuotes: true,
},
{
Name: "DoubleQuoteWithTrailingCRLF",
Input: '"foo""bar"\r\n',
Output: [[`foo"bar`]],
- ignore: true
+ ignore: true,
},
{
Name: "EvenQuotes",
Input: `""""""""`,
Output: [[`"""`]],
- ignore: true
+ ignore: true,
},
{
Name: "OddQuotes",
Input: `"""""""`,
Error: true,
// Error:" &ParseError{StartLine: 1, Line: 1, Column: 7, Err: ErrQuote}",
- ignore: true
+ ignore: true,
},
{
Name: "LazyOddQuotes",
Input: `"""""""`,
Output: [[`"""`]],
LazyQuotes: true,
- ignore: true
+ ignore: true,
},
{
Name: "BadComma1",
Comma: "\n",
- Error: ErrInvalidDelim
+ Error: ErrInvalidDelim,
},
{
Name: "BadComma2",
Comma: "\r",
- Error: ErrInvalidDelim
+ Error: ErrInvalidDelim,
},
{
Name: "BadComma3",
Comma: '"',
- Error: ErrInvalidDelim
+ Error: ErrInvalidDelim,
},
{
Name: "BadComment1",
Comment: "\n",
- Error: ErrInvalidDelim
+ Error: ErrInvalidDelim,
},
{
Name: "BadComment2",
Comment: "\r",
- Error: ErrInvalidDelim
+ Error: ErrInvalidDelim,
},
{
Name: "BadCommaComment",
Comma: "X",
Comment: "X",
- Error: ErrInvalidDelim
- }
+ Error: ErrInvalidDelim,
+ },
];
for (const t of testCases) {
Deno.test({
@@ -500,7 +500,7 @@ for (const t of testCases) {
comment: comment,
trimLeadingSpace: trim,
fieldsPerRecord: fieldsPerRec,
- lazyQuotes: lazyquote
+ lazyQuotes: lazyquote,
}
);
} catch (e) {
@@ -516,13 +516,13 @@ for (const t of testCases) {
comment: comment,
trimLeadingSpace: trim,
fieldsPerRecord: fieldsPerRec,
- lazyQuotes: lazyquote
+ lazyQuotes: lazyquote,
}
);
const expected = t.Output;
assertEquals(actual, expected);
}
- }
+ },
});
}
@@ -531,13 +531,13 @@ const parseTestCases = [
name: "simple",
in: "a,b,c",
header: false,
- result: [["a", "b", "c"]]
+ result: [["a", "b", "c"]],
},
{
name: "simple Bufreader",
in: new BufReader(new StringReader("a,b,c")),
header: false,
- result: [["a", "b", "c"]]
+ result: [["a", "b", "c"]],
},
{
name: "multiline",
@@ -545,14 +545,14 @@ const parseTestCases = [
header: false,
result: [
["a", "b", "c"],
- ["e", "f", "g"]
- ]
+ ["e", "f", "g"],
+ ],
},
{
name: "header mapping boolean",
in: "a,b,c\ne,f,g\n",
header: true,
- result: [{ a: "e", b: "f", c: "g" }]
+ result: [{ a: "e", b: "f", c: "g" }],
},
{
name: "header mapping array",
@@ -560,8 +560,8 @@ const parseTestCases = [
header: ["this", "is", "sparta"],
result: [
{ this: "a", is: "b", sparta: "c" },
- { this: "e", is: "f", sparta: "g" }
- ]
+ { this: "e", is: "f", sparta: "g" },
+ ],
},
{
name: "header mapping object",
@@ -569,8 +569,8 @@ const parseTestCases = [
header: [{ name: "this" }, { name: "is" }, { name: "sparta" }],
result: [
{ this: "a", is: "b", sparta: "c" },
- { this: "e", is: "f", sparta: "g" }
- ]
+ { this: "e", is: "f", sparta: "g" },
+ ],
},
{
name: "header mapping parse entry",
@@ -580,25 +580,25 @@ const parseTestCases = [
name: "this",
parse: (e: string): string => {
return `b${e}$$`;
- }
+ },
},
{
name: "is",
parse: (e: string): number => {
return e.length;
- }
+ },
},
{
name: "sparta",
parse: (e: string): unknown => {
return { bim: `boom-${e}` };
- }
- }
+ },
+ },
],
result: [
{ this: "ba$$", is: 1, sparta: { bim: `boom-c` } },
- { this: "be$$", is: 1, sparta: { bim: `boom-g` } }
- ]
+ { this: "be$$", is: 1, sparta: { bim: `boom-g` } },
+ ],
},
{
name: "multiline parse",
@@ -609,8 +609,8 @@ const parseTestCases = [
header: false,
result: [
{ super: "a", street: "b", fighter: "c" },
- { super: "e", street: "f", fighter: "g" }
- ]
+ { super: "e", street: "f", fighter: "g" },
+ ],
},
{
name: "header mapping object parseline",
@@ -621,9 +621,9 @@ const parseTestCases = [
},
result: [
{ super: "a", street: "b", fighter: "c" },
- { super: "e", street: "f", fighter: "g" }
- ]
- }
+ { super: "e", street: "f", fighter: "g" },
+ ],
+ },
];
for (const testCase of parseTestCases) {
@@ -632,9 +632,9 @@ for (const testCase of parseTestCases) {
async fn(): Promise<void> {
const r = await parse(testCase.in, {
header: testCase.header,
- parse: testCase.parse as (input: unknown) => unknown
+ parse: testCase.parse as (input: unknown) => unknown,
});
assertEquals(r, testCase.result);
- }
+ },
});
}
diff --git a/std/encoding/hex_test.ts b/std/encoding/hex_test.ts
index f98fe5422..56bdbf4f0 100644
--- a/std/encoding/hex_test.ts
+++ b/std/encoding/hex_test.ts
@@ -14,7 +14,7 @@ import {
decode,
decodeString,
errLength,
- errInvalidByte
+ errInvalidByte,
} from "./hex.ts";
function toByte(s: string): number {
@@ -29,7 +29,7 @@ const testCases = [
["f0f1f2f3f4f5f6f7", [0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7]],
["f8f9fafbfcfdfeff", [0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff]],
["67", Array.from(new TextEncoder().encode("g"))],
- ["e3a1", [0xe3, 0xa1]]
+ ["e3a1", [0xe3, 0xa1]],
];
const errCases = [
@@ -42,7 +42,7 @@ const errCases = [
["0g", "", errInvalidByte(new TextEncoder().encode("g")[0])],
["00gg", "\x00", errInvalidByte(new TextEncoder().encode("g")[0])],
["0\x01", "", errInvalidByte(new TextEncoder().encode("\x01")[0])],
- ["ffeed", "\xff\xee", errLength()]
+ ["ffeed", "\xff\xee", errLength()],
];
Deno.test({
@@ -53,7 +53,7 @@ Deno.test({
assertEquals(encodedLen(2), 4);
assertEquals(encodedLen(3), 6);
assertEquals(encodedLen(4), 8);
- }
+ },
});
Deno.test({
@@ -88,7 +88,7 @@ Deno.test({
assertEquals(dest.length, n);
assertEquals(new TextDecoder().decode(dest), enc);
}
- }
+ },
});
Deno.test({
@@ -97,7 +97,7 @@ Deno.test({
for (const [enc, dec] of testCases) {
assertEquals(encodeToString(new Uint8Array(dec as number[])), enc);
}
- }
+ },
});
Deno.test({
@@ -108,7 +108,7 @@ Deno.test({
assertEquals(decodedLen(4), 2);
assertEquals(decodedLen(6), 3);
assertEquals(decodedLen(8), 4);
- }
+ },
});
Deno.test({
@@ -117,7 +117,7 @@ Deno.test({
// Case for decoding uppercase hex characters, since
// Encode always uses lowercase.
const extraTestcase = [
- ["F8F9FAFBFCFDFEFF", [0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff]]
+ ["F8F9FAFBFCFDFEFF", [0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff]],
];
const cases = testCases.concat(extraTestcase);
@@ -129,7 +129,7 @@ Deno.test({
assertEquals(err, undefined);
assertEquals(Array.from(dest), Array.from(dec as number[]));
}
- }
+ },
});
Deno.test({
@@ -140,7 +140,7 @@ Deno.test({
assertEquals(dec, Array.from(dst));
}
- }
+ },
});
Deno.test({
@@ -155,7 +155,7 @@ Deno.test({
);
assertEquals(err, expectedErr);
}
- }
+ },
});
Deno.test({
@@ -175,5 +175,5 @@ Deno.test({
assertEquals(new TextDecoder("ascii").decode(out), output as string);
}
}
- }
+ },
});
diff --git a/std/encoding/mod.ts b/std/encoding/mod.ts
index d63cf47f3..eaa28ae27 100644
--- a/std/encoding/mod.ts
+++ b/std/encoding/mod.ts
@@ -2,13 +2,13 @@ export {
HeaderOptions as CsvHeaderOptions,
ParseError as CsvParseError,
ParseOptions as ParseCsvOptions,
- parse as parseCsv
+ parse as parseCsv,
} from "./csv.ts";
export {
decode as decodeHex,
decodeString as decodeHexString,
encode as encodeToHex,
- encodeToString as encodeToHexString
+ encodeToString as encodeToHexString,
} from "./hex.ts";
export { parse as parseToml, stringify as tomlStringify } from "./toml.ts";
export { parse as parseYaml, stringify as yamlStringify } from "./yaml.ts";
diff --git a/std/encoding/toml_test.ts b/std/encoding/toml_test.ts
index 425b8a22c..d272a29ff 100644
--- a/std/encoding/toml_test.ts
+++ b/std/encoding/toml_test.ts
@@ -29,12 +29,12 @@ Deno.test({
str6: "The quick brown\nfox jumps over\nthe lazy dog.",
lines:
"The first newline is\ntrimmed in raw strings.\n All other " +
- "whitespace\n is preserved."
- }
+ "whitespace\n is preserved.",
+ },
};
const actual = parseFile(path.join(testFilesDir, "string.toml"));
assertEquals(actual, expected);
- }
+ },
});
Deno.test({
@@ -43,7 +43,7 @@ Deno.test({
const expected = { boolean: { bool1: true, bool2: false } };
const actual = parseFile(path.join(testFilesDir, "CRLF.toml"));
assertEquals(actual, expected);
- }
+ },
});
Deno.test({
@@ -52,7 +52,7 @@ Deno.test({
const expected = { boolean: { bool1: true, bool2: false } };
const actual = parseFile(path.join(testFilesDir, "boolean.toml"));
assertEquals(actual, expected);
- }
+ },
});
Deno.test({
@@ -72,12 +72,12 @@ Deno.test({
hex3: "0xdead_beef",
oct1: "0o01234567",
oct2: "0o755",
- bin1: "0b11010110"
- }
+ bin1: "0b11010110",
+ },
};
const actual = parseFile(path.join(testFilesDir, "integer.toml"));
assertEquals(actual, expected);
- }
+ },
});
Deno.test({
@@ -98,12 +98,12 @@ Deno.test({
sf3: -Infinity,
sf4: NaN,
sf5: NaN,
- sf6: NaN
- }
+ sf6: NaN,
+ },
};
const actual = parseFile(path.join(testFilesDir, "float.toml"));
assertEquals(actual, expected);
- }
+ },
});
Deno.test({
@@ -113,14 +113,14 @@ Deno.test({
arrays: {
data: [
["gamma", "delta"],
- [1, 2]
+ [1, 2],
],
- hosts: ["alpha", "omega"]
- }
+ hosts: ["alpha", "omega"],
+ },
};
const actual = parseFile(path.join(testFilesDir, "arrays.toml"));
assertEquals(actual, expected);
- }
+ },
});
Deno.test({
@@ -133,27 +133,27 @@ Deno.test({
in: {
the: {
toml: {
- name: "Tom Preston-Werner"
- }
- }
- }
- }
- }
+ name: "Tom Preston-Werner",
+ },
+ },
+ },
+ },
+ },
},
servers: {
alpha: {
ip: "10.0.0.1",
- dc: "eqdc10"
+ dc: "eqdc10",
},
beta: {
ip: "10.0.0.2",
- dc: "eqdc20"
- }
- }
+ dc: "eqdc20",
+ },
+ },
};
const actual = parseFile(path.join(testFilesDir, "table.toml"));
assertEquals(actual, expected);
- }
+ },
});
Deno.test({
@@ -164,11 +164,11 @@ Deno.test({
not: "[node]",
regex: "<ic*s*>",
NANI: "何?!",
- comment: "Comment inside # the comment"
+ comment: "Comment inside # the comment",
};
const actual = parseFile(path.join(testFilesDir, "simple.toml"));
assertEquals(actual, expected);
- }
+ },
});
Deno.test({
@@ -182,12 +182,12 @@ Deno.test({
odt4: new Date("1979-05-27 07:32:00Z"),
ld1: new Date("1979-05-27"),
lt1: "07:32:00",
- lt2: "00:32:00.999999"
- }
+ lt2: "00:32:00.999999",
+ },
};
const actual = parseFile(path.join(testFilesDir, "datetime.toml"));
assertEquals(actual, expected);
- }
+ },
});
Deno.test({
@@ -200,39 +200,39 @@ Deno.test({
malevolant: {
creation: {
drum: {
- kit: "Tama"
- }
- }
- }
+ kit: "Tama",
+ },
+ },
+ },
},
derek: {
- roddy: "drummer"
- }
+ roddy: "drummer",
+ },
},
name: {
first: "Tom",
- last: "Preston-Werner"
+ last: "Preston-Werner",
},
point: {
x: 1,
- y: 2
+ y: 2,
},
dog: {
type: {
- name: "pug"
- }
+ name: "pug",
+ },
},
"tosin.abasi": "guitarist",
animal: {
as: {
- leaders: "tosin"
- }
- }
- }
+ leaders: "tosin",
+ },
+ },
+ },
};
const actual = parseFile(path.join(testFilesDir, "inlineTable.toml"));
assertEquals(actual, expected);
- }
+ },
});
Deno.test({
@@ -241,13 +241,13 @@ Deno.test({
const expected = {
bin: [
{ name: "deno", path: "cli/main.rs" },
- { name: "deno_core", path: "src/foo.rs" }
+ { name: "deno_core", path: "src/foo.rs" },
],
- nib: [{ name: "node", path: "not_found" }]
+ nib: [{ name: "node", path: "not_found" }],
};
const actual = parseFile(path.join(testFilesDir, "arrayTable.toml"));
assertEquals(actual, expected);
- }
+ },
});
Deno.test({
@@ -286,14 +286,14 @@ Deno.test({
"tokio-io": "0.1.11",
"tokio-process": "0.2.3",
"tokio-threadpool": "0.1.11",
- url: "1.7.2"
+ url: "1.7.2",
},
- target: { "cfg(windows)": { dependencies: { winapi: "0.3.6" } } }
+ target: { "cfg(windows)": { dependencies: { winapi: "0.3.6" } } },
};
/* eslint-enable @typescript-eslint/camelcase */
const actual = parseFile(path.join(testFilesDir, "cargo.toml"));
assertEquals(actual, expected);
- }
+ },
});
Deno.test({
@@ -303,15 +303,15 @@ Deno.test({
foo: { bar: "deno" },
this: { is: { nested: "denonono" } },
"https://deno.land/std": {
- $: "doller"
+ $: "doller",
},
"##": {
deno: {
"https://deno.land": {
proto: "https",
- ":80": "port"
- }
- }
+ ":80": "port",
+ },
+ },
},
arrayObjects: [{ stuff: "in" }, {}, { the: "array" }],
deno: "is",
@@ -347,9 +347,9 @@ Deno.test({
sf6: NaN,
data: [
["gamma", "delta"],
- [1, 2]
+ [1, 2],
],
- hosts: ["alpha", "omega"]
+ hosts: ["alpha", "omega"],
};
const expected = `deno = "is"
not = "[node]"
@@ -408,5 +408,5 @@ the = "array"
`;
const actual = stringify(src);
assertEquals(actual, expected);
- }
+ },
});
diff --git a/std/encoding/yaml.ts b/std/encoding/yaml.ts
index a8784319b..76b1b8379 100644
--- a/std/encoding/yaml.ts
+++ b/std/encoding/yaml.ts
@@ -6,6 +6,6 @@
export { ParseOptions, parse, parseAll } from "./yaml/parse.ts";
export {
DumpOptions as StringifyOptions,
- stringify
+ stringify,
} from "./yaml/stringify.ts";
export * from "./yaml/schema/mod.ts";
diff --git a/std/encoding/yaml/dumper/dumper.ts b/std/encoding/yaml/dumper/dumper.ts
index 3a34e14cc..1280ee757 100644
--- a/std/encoding/yaml/dumper/dumper.ts
+++ b/std/encoding/yaml/dumper/dumper.ts
@@ -73,7 +73,7 @@ const DEPRECATED_BOOLEANS_SYNTAX = [
"NO",
"off",
"Off",
- "OFF"
+ "OFF",
];
function encodeHex(character: number): string {
diff --git a/std/encoding/yaml/dumper/dumper_state.ts b/std/encoding/yaml/dumper/dumper_state.ts
index 88164a0d2..94cd84878 100644
--- a/std/encoding/yaml/dumper/dumper_state.ts
+++ b/std/encoding/yaml/dumper/dumper_state.ts
@@ -121,7 +121,7 @@ export class DumperState extends State {
lineWidth = 80,
noRefs = false,
noCompatMode = false,
- condenseFlow = false
+ condenseFlow = false,
}: DumperStateOptions) {
super(schema);
this.indent = Math.max(1, indent);
diff --git a/std/encoding/yaml/example/dump.ts b/std/encoding/yaml/example/dump.ts
index 746c3be01..db3647274 100644
--- a/std/encoding/yaml/example/dump.ts
+++ b/std/encoding/yaml/example/dump.ts
@@ -10,13 +10,13 @@ console.log(
"a",
"b",
{
- a: false
+ a: false,
},
{
- a: false
- }
- ]
+ a: false,
+ },
+ ],
},
- test: "foobar"
+ test: "foobar",
})
);
diff --git a/std/encoding/yaml/example/inout.ts b/std/encoding/yaml/example/inout.ts
index 80cad8258..b0b47e3fe 100644
--- a/std/encoding/yaml/example/inout.ts
+++ b/std/encoding/yaml/example/inout.ts
@@ -9,14 +9,14 @@ const test = {
"a",
"b",
{
- a: false
+ a: false,
},
{
- a: false
- }
- ]
+ a: false,
+ },
+ ],
},
- test: "foobar"
+ test: "foobar",
};
const string = stringify(test);
diff --git a/std/encoding/yaml/loader/loader.ts b/std/encoding/yaml/loader/loader.ts
index 1ab4fc7f5..f0d535624 100644
--- a/std/encoding/yaml/loader/loader.ts
+++ b/std/encoding/yaml/loader/loader.ts
@@ -37,11 +37,11 @@ function _class(obj: unknown): string {
}
function isEOL(c: number): boolean {
- return c === 0x0a /* LF */ || c === 0x0d /* CR */;
+ return c === 0x0a || /* LF */ c === 0x0d /* CR */;
}
function isWhiteSpace(c: number): boolean {
- return c === 0x09 /* Tab */ || c === 0x20 /* Space */;
+ return c === 0x09 || /* Tab */ c === 0x20 /* Space */;
}
function isWsOrEol(c: number): boolean {
@@ -64,13 +64,13 @@ function isFlowIndicator(c: number): boolean {
}
function fromHexCode(c: number): number {
- if (0x30 /* 0 */ <= c && c <= 0x39 /* 9 */) {
+ if (0x30 <= /* 0 */ c && c <= 0x39 /* 9 */) {
return c - 0x30;
}
const lc = c | 0x20;
- if (0x61 /* a */ <= lc && lc <= 0x66 /* f */) {
+ if (0x61 <= /* a */ lc && lc <= 0x66 /* f */) {
return lc - 0x61 + 10;
}
@@ -91,7 +91,7 @@ function escapedHexLen(c: number): number {
}
function fromDecimalCode(c: number): number {
- if (0x30 /* 0 */ <= c && c <= 0x39 /* 9 */) {
+ if (0x30 <= /* 0 */ c && c <= 0x39 /* 9 */) {
return c - 0x30;
}
@@ -251,7 +251,7 @@ const directiveHandlers: DirectiveHandlers = {
state.tagMap = {};
}
state.tagMap[handle] = prefix;
- }
+ },
};
function captureSegment(
@@ -414,7 +414,7 @@ function skipSeparationSpace(
if (allowComments && ch === 0x23 /* # */) {
do {
ch = state.input.charCodeAt(++state.position);
- } while (ch !== 0x0a /* LF */ && ch !== 0x0d /* CR */ && ch !== 0);
+ } while (ch !== 0x0a && /* LF */ ch !== 0x0d && /* CR */ ch !== 0);
}
if (isEOL(ch)) {
@@ -451,7 +451,7 @@ function testDocumentSeparator(state: LoaderState): boolean {
// Condition state.position === state.lineStart is tested
// in parent on each call, for efficiency. No needs to test here again.
if (
- (ch === 0x2d /* - */ || ch === 0x2e) /* . */ &&
+ (ch === 0x2d || /* - */ ch === 0x2e) /* . */ &&
ch === state.input.charCodeAt(_position + 1) &&
ch === state.input.charCodeAt(_position + 2)
) {
@@ -503,7 +503,7 @@ function readPlainScalar(
}
let following: number;
- if (ch === 0x3f /* ? */ || ch === 0x2d /* - */) {
+ if (ch === 0x3f || /* ? */ ch === 0x2d /* - */) {
following = state.input.charCodeAt(state.position + 1);
if (
@@ -869,7 +869,7 @@ function readBlockScalar(state: LoaderState, nodeIndent: number): boolean {
while (ch !== 0) {
ch = state.input.charCodeAt(++state.position);
- if (ch === 0x2b /* + */ || ch === 0x2d /* - */) {
+ if (ch === 0x2b || /* + */ ch === 0x2d /* - */) {
if (CHOMPING_CLIP === chomping) {
chomping = ch === 0x2b /* + */ ? CHOMPING_KEEP : CHOMPING_STRIP;
} else {
@@ -1103,7 +1103,7 @@ function readBlockMapping(
// Explicit notation case. There are two separate blocks:
// first for the key (denoted by "?") and second for the value (denoted by ":")
//
- if ((ch === 0x3f /* ? */ || ch === 0x3a) /* : */ && isWsOrEol(following)) {
+ if ((ch === 0x3f || /* ? */ ch === 0x3a) && /* : */ isWsOrEol(following)) {
if (ch === 0x3f /* ? */) {
if (atExplicitKey) {
storeMappingPair(
diff --git a/std/encoding/yaml/loader/loader_state.ts b/std/encoding/yaml/loader/loader_state.ts
index 1e136025c..ca50fcaf1 100644
--- a/std/encoding/yaml/loader/loader_state.ts
+++ b/std/encoding/yaml/loader/loader_state.ts
@@ -56,7 +56,7 @@ export class LoaderState extends State {
onWarning,
legacy = false,
json = false,
- listener = null
+ listener = null,
}: LoaderStateOptions
) {
super(schema);
diff --git a/std/encoding/yaml/parse_test.ts b/std/encoding/yaml/parse_test.ts
index bdcd8db62..21f1b893b 100644
--- a/std/encoding/yaml/parse_test.ts
+++ b/std/encoding/yaml/parse_test.ts
@@ -20,7 +20,7 @@ Deno.test({
const expected = { test: "toto", foo: { bar: true, baz: 1, qux: null } };
assertEquals(parse(yaml), expected);
- }
+ },
});
Deno.test({
@@ -40,17 +40,17 @@ name: Eve
const expected = [
{
id: 1,
- name: "Alice"
+ name: "Alice",
},
{
id: 2,
- name: "Bob"
+ name: "Bob",
},
{
id: 3,
- name: "Eve"
- }
+ name: "Eve",
+ },
];
assertEquals(parseAll(yaml), expected);
- }
+ },
});
diff --git a/std/encoding/yaml/schema.ts b/std/encoding/yaml/schema.ts
index 1968e34c1..579644dbb 100644
--- a/std/encoding/yaml/schema.ts
+++ b/std/encoding/yaml/schema.ts
@@ -45,7 +45,7 @@ function compileMap(...typesList: Type[][]): TypeMap {
fallback: {},
mapping: {},
scalar: {},
- sequence: {}
+ sequence: {},
};
for (const types of typesList) {
diff --git a/std/encoding/yaml/schema/core.ts b/std/encoding/yaml/schema/core.ts
index 82a512a1e..4fadc9bfe 100644
--- a/std/encoding/yaml/schema/core.ts
+++ b/std/encoding/yaml/schema/core.ts
@@ -9,5 +9,5 @@ import { json } from "./json.ts";
// Standard YAML's Core schema.
// http://www.yaml.org/spec/1.2/spec.html#id2804923
export const core = new Schema({
- include: [json]
+ include: [json],
});
diff --git a/std/encoding/yaml/schema/default.ts b/std/encoding/yaml/schema/default.ts
index 0fe1dbf12..4c5ceeba7 100644
--- a/std/encoding/yaml/schema/default.ts
+++ b/std/encoding/yaml/schema/default.ts
@@ -12,5 +12,5 @@ import { core } from "./core.ts";
export const def = new Schema({
explicit: [binary, omap, pairs, set],
implicit: [timestamp, merge],
- include: [core]
+ include: [core],
});
diff --git a/std/encoding/yaml/schema/failsafe.ts b/std/encoding/yaml/schema/failsafe.ts
index 0fbb74ca9..74e1897be 100644
--- a/std/encoding/yaml/schema/failsafe.ts
+++ b/std/encoding/yaml/schema/failsafe.ts
@@ -9,5 +9,5 @@ import { map, seq, str } from "../type/mod.ts";
// Standard YAML's Failsafe schema.
// http://www.yaml.org/spec/1.2/spec.html#id2802346
export const failsafe = new Schema({
- explicit: [str, seq, map]
+ explicit: [str, seq, map],
});
diff --git a/std/encoding/yaml/schema/json.ts b/std/encoding/yaml/schema/json.ts
index dae469f35..c30166fdf 100644
--- a/std/encoding/yaml/schema/json.ts
+++ b/std/encoding/yaml/schema/json.ts
@@ -11,5 +11,5 @@ import { failsafe } from "./failsafe.ts";
// http://www.yaml.org/spec/1.2/spec.html#id2803231
export const json = new Schema({
implicit: [nil, bool, int, float],
- include: [failsafe]
+ include: [failsafe],
});
diff --git a/std/encoding/yaml/stringify_test.ts b/std/encoding/yaml/stringify_test.ts
index 941beb789..03a3090d9 100644
--- a/std/encoding/yaml/stringify_test.ts
+++ b/std/encoding/yaml/stringify_test.ts
@@ -16,14 +16,14 @@ Deno.test({
"a",
"b",
{
- a: false
+ a: false,
},
{
- a: false
- }
- ]
+ a: false,
+ },
+ ],
},
- test: "foobar"
+ test: "foobar",
};
const ASSERTS = `foo:
@@ -37,5 +37,5 @@ test: foobar
`;
assertEquals(stringify(FIXTURE), ASSERTS);
- }
+ },
});
diff --git a/std/encoding/yaml/type/binary.ts b/std/encoding/yaml/type/binary.ts
index 8cfe54f79..f4823b3f7 100644
--- a/std/encoding/yaml/type/binary.ts
+++ b/std/encoding/yaml/type/binary.ts
@@ -135,5 +135,5 @@ export const binary = new Type("tag:yaml.org,2002:binary", {
kind: "scalar",
predicate: isBinary,
represent: representYamlBinary,
- resolve: resolveYamlBinary
+ resolve: resolveYamlBinary,
});
diff --git a/std/encoding/yaml/type/bool.ts b/std/encoding/yaml/type/bool.ts
index e39823872..a5a85cf9e 100644
--- a/std/encoding/yaml/type/bool.ts
+++ b/std/encoding/yaml/type/bool.ts
@@ -33,7 +33,7 @@ export const bool = new Type("tag:yaml.org,2002:bool", {
},
camelcase(object: boolean): string {
return object ? "True" : "False";
- }
+ },
},
- resolve: resolveYamlBoolean
+ resolve: resolveYamlBoolean,
});
diff --git a/std/encoding/yaml/type/float.ts b/std/encoding/yaml/type/float.ts
index acb12f5b0..5ae0689b2 100644
--- a/std/encoding/yaml/type/float.ts
+++ b/std/encoding/yaml/type/float.ts
@@ -121,5 +121,5 @@ export const float = new Type("tag:yaml.org,2002:float", {
kind: "scalar",
predicate: isFloat,
represent: representYamlFloat,
- resolve: resolveYamlFloat
+ resolve: resolveYamlFloat,
});
diff --git a/std/encoding/yaml/type/int.ts b/std/encoding/yaml/type/int.ts
index 93ec8260e..6a86aafe9 100644
--- a/std/encoding/yaml/type/int.ts
+++ b/std/encoding/yaml/type/int.ts
@@ -8,18 +8,18 @@ import { isNegativeZero, Any } from "../utils.ts";
function isHexCode(c: number): boolean {
return (
- (0x30 /* 0 */ <= c && c <= 0x39) /* 9 */ ||
- (0x41 /* A */ <= c && c <= 0x46) /* F */ ||
- (0x61 /* a */ <= c && c <= 0x66) /* f */
+ (0x30 <= /* 0 */ c && c <= 0x39) /* 9 */ ||
+ (0x41 <= /* A */ c && c <= 0x46) /* F */ ||
+ (0x61 <= /* a */ c && c <= 0x66) /* f */
);
}
function isOctCode(c: number): boolean {
- return 0x30 /* 0 */ <= c && c <= 0x37 /* 7 */;
+ return 0x30 <= /* 0 */ c && c <= 0x37 /* 7 */;
}
function isDecCode(c: number): boolean {
- return 0x30 /* 0 */ <= c && c <= 0x39 /* 9 */;
+ return 0x30 <= /* 0 */ c && c <= 0x39 /* 9 */;
}
function resolveYamlInteger(data: string): boolean {
@@ -175,17 +175,14 @@ export const int = new Type("tag:yaml.org,2002:int", {
hexadecimal(obj: number): string {
return obj >= 0
? `0x${obj.toString(16).toUpperCase()}`
- : `-0x${obj
- .toString(16)
- .toUpperCase()
- .slice(1)}`;
- }
+ : `-0x${obj.toString(16).toUpperCase().slice(1)}`;
+ },
},
resolve: resolveYamlInteger,
styleAliases: {
binary: [2, "bin"],
decimal: [10, "dec"],
hexadecimal: [16, "hex"],
- octal: [8, "oct"]
- }
+ octal: [8, "oct"],
+ },
});
diff --git a/std/encoding/yaml/type/map.ts b/std/encoding/yaml/type/map.ts
index 60e678657..dcd99abca 100644
--- a/std/encoding/yaml/type/map.ts
+++ b/std/encoding/yaml/type/map.ts
@@ -10,5 +10,5 @@ export const map = new Type("tag:yaml.org,2002:map", {
construct(data): Any {
return data !== null ? data : {};
},
- kind: "mapping"
+ kind: "mapping",
});
diff --git a/std/encoding/yaml/type/merge.ts b/std/encoding/yaml/type/merge.ts
index 77b34025b..68314bf2e 100644
--- a/std/encoding/yaml/type/merge.ts
+++ b/std/encoding/yaml/type/merge.ts
@@ -11,5 +11,5 @@ function resolveYamlMerge(data: string): boolean {
export const merge = new Type("tag:yaml.org,2002:merge", {
kind: "scalar",
- resolve: resolveYamlMerge
+ resolve: resolveYamlMerge,
});
diff --git a/std/encoding/yaml/type/nil.ts b/std/encoding/yaml/type/nil.ts
index 00627514c..8a48d02fb 100644
--- a/std/encoding/yaml/type/nil.ts
+++ b/std/encoding/yaml/type/nil.ts
@@ -39,7 +39,7 @@ export const nil = new Type("tag:yaml.org,2002:null", {
},
camelcase(): string {
return "Null";
- }
+ },
},
- resolve: resolveYamlNull
+ resolve: resolveYamlNull,
});
diff --git a/std/encoding/yaml/type/omap.ts b/std/encoding/yaml/type/omap.ts
index 541e31df6..d6d751505 100644
--- a/std/encoding/yaml/type/omap.ts
+++ b/std/encoding/yaml/type/omap.ts
@@ -42,5 +42,5 @@ function constructYamlOmap(data: Any): Any {
export const omap = new Type("tag:yaml.org,2002:omap", {
construct: constructYamlOmap,
kind: "sequence",
- resolve: resolveYamlOmap
+ resolve: resolveYamlOmap,
});
diff --git a/std/encoding/yaml/type/pairs.ts b/std/encoding/yaml/type/pairs.ts
index c964524b5..e999748ae 100644
--- a/std/encoding/yaml/type/pairs.ts
+++ b/std/encoding/yaml/type/pairs.ts
@@ -45,5 +45,5 @@ function constructYamlPairs(data: string): Any[] {
export const pairs = new Type("tag:yaml.org,2002:pairs", {
construct: constructYamlPairs,
kind: "sequence",
- resolve: resolveYamlPairs
+ resolve: resolveYamlPairs,
});
diff --git a/std/encoding/yaml/type/seq.ts b/std/encoding/yaml/type/seq.ts
index bd7ceb945..b19565dbc 100644
--- a/std/encoding/yaml/type/seq.ts
+++ b/std/encoding/yaml/type/seq.ts
@@ -10,5 +10,5 @@ export const seq = new Type("tag:yaml.org,2002:seq", {
construct(data): Any {
return data !== null ? data : [];
},
- kind: "sequence"
+ kind: "sequence",
});
diff --git a/std/encoding/yaml/type/set.ts b/std/encoding/yaml/type/set.ts
index 3b7fca0e9..0bfe1c8db 100644
--- a/std/encoding/yaml/type/set.ts
+++ b/std/encoding/yaml/type/set.ts
@@ -27,5 +27,5 @@ function constructYamlSet(data: string): Any {
export const set = new Type("tag:yaml.org,2002:set", {
construct: constructYamlSet,
kind: "mapping",
- resolve: resolveYamlSet
+ resolve: resolveYamlSet,
});
diff --git a/std/encoding/yaml/type/str.ts b/std/encoding/yaml/type/str.ts
index c7227743e..cd6e9430f 100644
--- a/std/encoding/yaml/type/str.ts
+++ b/std/encoding/yaml/type/str.ts
@@ -8,5 +8,5 @@ export const str = new Type("tag:yaml.org,2002:str", {
construct(data): string {
return data !== null ? data : "";
},
- kind: "scalar"
+ kind: "scalar",
});
diff --git a/std/encoding/yaml/type/timestamp.ts b/std/encoding/yaml/type/timestamp.ts
index 14d24077a..eb03b3825 100644
--- a/std/encoding/yaml/type/timestamp.ts
+++ b/std/encoding/yaml/type/timestamp.ts
@@ -92,5 +92,5 @@ export const timestamp = new Type("tag:yaml.org,2002:timestamp", {
instanceOf: Date,
kind: "scalar",
represent: representYamlTimestamp,
- resolve: resolveYamlTimestamp
+ resolve: resolveYamlTimestamp,
});
diff --git a/std/examples/chat/server.ts b/std/examples/chat/server.ts
index 08aede05b..eb5b2f7d4 100644
--- a/std/examples/chat/server.ts
+++ b/std/examples/chat/server.ts
@@ -3,7 +3,7 @@ import {
acceptWebSocket,
acceptable,
WebSocket,
- isWebSocketCloseEvent
+ isWebSocketCloseEvent,
} from "../../ws/mod.ts";
const clients = new Map<number, WebSocket>();
@@ -29,19 +29,19 @@ async function wsHandler(ws: WebSocket): Promise<void> {
}
}
-listenAndServe({ port: 8080 }, async req => {
+listenAndServe({ port: 8080 }, async (req) => {
if (req.method === "GET" && req.url === "/") {
//Serve with hack
const u = new URL("./index.html", import.meta.url);
if (u.protocol.startsWith("http")) {
// server launched by deno run http(s)://.../server.ts,
- fetch(u.href).then(resp => {
+ fetch(u.href).then((resp) => {
return req.respond({
status: resp.status,
headers: new Headers({
- "content-type": "text/html"
+ "content-type": "text/html",
}),
- body: resp.body
+ body: resp.body,
});
});
} else {
@@ -50,9 +50,9 @@ listenAndServe({ port: 8080 }, async req => {
req.respond({
status: 200,
headers: new Headers({
- "content-type": "text/html"
+ "content-type": "text/html",
}),
- body: file
+ body: file,
});
}
}
@@ -60,8 +60,8 @@ listenAndServe({ port: 8080 }, async req => {
req.respond({
status: 302,
headers: new Headers({
- location: "https://deno.land/favicon.ico"
- })
+ location: "https://deno.land/favicon.ico",
+ }),
});
}
if (req.method === "GET" && req.url === "/ws") {
@@ -70,7 +70,7 @@ listenAndServe({ port: 8080 }, async req => {
conn: req.conn,
bufReader: req.r,
bufWriter: req.w,
- headers: req.headers
+ headers: req.headers,
}).then(wsHandler);
}
}
diff --git a/std/examples/chat/server_test.ts b/std/examples/chat/server_test.ts
index 13a5c337c..673b61174 100644
--- a/std/examples/chat/server_test.ts
+++ b/std/examples/chat/server_test.ts
@@ -11,7 +11,7 @@ async function startServer(): Promise<Deno.Process> {
const server = Deno.run({
cmd: [Deno.execPath(), "--allow-net", "--allow-read", "server.ts"],
cwd: "examples/chat",
- stdout: "piped"
+ stdout: "piped",
});
try {
assert(server.stdout != null);
@@ -45,7 +45,7 @@ test({
server.stdout!.close();
}
await delay(10);
- }
+ },
});
test({
@@ -65,5 +65,5 @@ test({
server.stdout!.close();
ws!.conn.close();
}
- }
+ },
});
diff --git a/std/examples/gist.ts b/std/examples/gist.ts
index 15f00ff5d..a11a92383 100755
--- a/std/examples/gist.ts
+++ b/std/examples/gist.ts
@@ -35,7 +35,7 @@ for (const filename of parsedArgs._) {
const content = {
description: parsedArgs.title || parsedArgs.t || "Example",
public: false,
- files: files
+ files: files,
};
const body = JSON.stringify(content);
@@ -44,9 +44,9 @@ const res = await fetch("https://api.github.com/gists", {
headers: [
["Content-Type", "application/json"],
["User-Agent", "Deno-Gist"],
- ["Authorization", `token ${token}`]
+ ["Authorization", `token ${token}`],
],
- body
+ body,
});
if (res.ok) {
diff --git a/std/examples/test.ts b/std/examples/test.ts
index d5dd8bedc..6e26407fb 100644
--- a/std/examples/test.ts
+++ b/std/examples/test.ts
@@ -19,10 +19,10 @@ Deno.test(async function catSmoke(): Promise<void> {
"run",
"--allow-read",
"examples/cat.ts",
- "README.md"
+ "README.md",
],
stdout: "null",
- stderr: "null"
+ stderr: "null",
});
const s = await p.status();
assertEquals(s.code, 0);
diff --git a/std/examples/tests/cat_test.ts b/std/examples/tests/cat_test.ts
index 0f17b798d..b12a6916f 100644
--- a/std/examples/tests/cat_test.ts
+++ b/std/examples/tests/cat_test.ts
@@ -9,10 +9,10 @@ Deno.test("[examples/cat] print multiple files", async () => {
"--allow-read",
"cat.ts",
"testdata/cat/hello.txt",
- "testdata/cat/world.txt"
+ "testdata/cat/world.txt",
],
cwd: "examples",
- stdout: "piped"
+ stdout: "piped",
});
try {
diff --git a/std/examples/tests/catj_test.ts b/std/examples/tests/catj_test.ts
index 3f246a65f..53b36bef8 100644
--- a/std/examples/tests/catj_test.ts
+++ b/std/examples/tests/catj_test.ts
@@ -12,7 +12,7 @@ Deno.test("[examples/catj] print an array", async () => {
".[1] = 100",
'.[2].key = "value"',
'.[2].array[0] = "foo"',
- '.[2].array[1] = "bar"'
+ '.[2].array[1] = "bar"',
].join("\n");
assertStrictEq(actual, expected);
@@ -31,7 +31,7 @@ Deno.test("[examples/catj] print an object", async () => {
const expected = [
'.string = "foobar"',
".number = 123",
- '.array[0].message = "hello"'
+ '.array[0].message = "hello"',
].join("\n");
assertStrictEq(actual, expected);
@@ -81,6 +81,6 @@ function catj(...files: string[]): Deno.Process {
cwd: "examples",
stdin: "piped",
stdout: "piped",
- env: { NO_COLOR: "true" }
+ env: { NO_COLOR: "true" },
});
}
diff --git a/std/examples/tests/colors_test.ts b/std/examples/tests/colors_test.ts
index 7c01cd8d6..ac779adb8 100644
--- a/std/examples/tests/colors_test.ts
+++ b/std/examples/tests/colors_test.ts
@@ -6,7 +6,7 @@ Deno.test("[examples/colors] print a colored text", async () => {
const process = Deno.run({
cmd: [Deno.execPath(), "colors.ts"],
cwd: "examples",
- stdout: "piped"
+ stdout: "piped",
});
try {
const output = await process.output();
diff --git a/std/examples/tests/curl_test.ts b/std/examples/tests/curl_test.ts
index 8d7634525..9b2870216 100644
--- a/std/examples/tests/curl_test.ts
+++ b/std/examples/tests/curl_test.ts
@@ -16,7 +16,7 @@ Deno.test({
const process = Deno.run({
cmd: [Deno.execPath(), "--allow-net", "curl.ts", "http://localhost:8081"],
cwd: "examples",
- stdout: "piped"
+ stdout: "piped",
});
try {
@@ -30,5 +30,5 @@ Deno.test({
process.close();
await serverPromise;
}
- }
+ },
});
diff --git a/std/examples/tests/echo_server_test.ts b/std/examples/tests/echo_server_test.ts
index dd7336023..fecc7d6a6 100644
--- a/std/examples/tests/echo_server_test.ts
+++ b/std/examples/tests/echo_server_test.ts
@@ -8,7 +8,7 @@ Deno.test("[examples/echo_server]", async () => {
const process = Deno.run({
cmd: [Deno.execPath(), "--allow-net", "echo_server.ts"],
cwd: "examples",
- stdout: "piped"
+ stdout: "piped",
});
let conn: Deno.Conn | undefined;
diff --git a/std/examples/tests/welcome_test.ts b/std/examples/tests/welcome_test.ts
index 60c55dc0b..cacb77ab9 100644
--- a/std/examples/tests/welcome_test.ts
+++ b/std/examples/tests/welcome_test.ts
@@ -6,7 +6,7 @@ Deno.test("[examples/welcome] print a welcome message", async () => {
const process = Deno.run({
cmd: [Deno.execPath(), "welcome.ts"],
cwd: "examples",
- stdout: "piped"
+ stdout: "piped",
});
try {
const output = await process.output();
diff --git a/std/examples/tests/xeval_test.ts b/std/examples/tests/xeval_test.ts
index 92e9e1bfe..25f99c9f0 100644
--- a/std/examples/tests/xeval_test.ts
+++ b/std/examples/tests/xeval_test.ts
@@ -5,7 +5,7 @@ import { decode, encode } from "../../strings/mod.ts";
import {
assertEquals,
assertStrContains,
- assert
+ assert,
} from "../../testing/asserts.ts";
const { execPath, run } = Deno;
@@ -18,7 +18,7 @@ Deno.test(async function xevalSuccess(): Promise<void> {
Deno.test(async function xevalDelimiter(): Promise<void> {
const chunks: string[] = [];
await xeval(stringsReader("!MADMADAMADAM!"), ($): number => chunks.push($), {
- delimiter: "MADAM"
+ delimiter: "MADAM",
});
assertEquals(chunks, ["!MAD", "ADAM!"]);
});
@@ -27,12 +27,12 @@ const xevalPath = "examples/xeval.ts";
Deno.test({
name: "xevalCliReplvar",
- fn: async function(): Promise<void> {
+ fn: async function (): Promise<void> {
const p = run({
cmd: [execPath(), xevalPath, "--replvar=abc", "console.log(abc)"],
stdin: "piped",
stdout: "piped",
- stderr: "null"
+ stderr: "null",
});
assert(p.stdin != null);
await p.stdin.write(encode("hello"));
@@ -40,7 +40,7 @@ Deno.test({
assertEquals(await p.status(), { code: 0, success: true });
assertEquals(decode(await p.output()).trimEnd(), "hello");
p.close();
- }
+ },
});
Deno.test(async function xevalCliSyntaxError(): Promise<void> {
@@ -48,7 +48,7 @@ Deno.test(async function xevalCliSyntaxError(): Promise<void> {
cmd: [execPath(), xevalPath, "("],
stdin: "null",
stdout: "piped",
- stderr: "piped"
+ stderr: "piped",
});
assertEquals(await p.status(), { code: 1, success: false });
assertEquals(decode(await p.output()), "");
diff --git a/std/examples/xeval.ts b/std/examples/xeval.ts
index 16ce37fb4..6589fec16 100644
--- a/std/examples/xeval.ts
+++ b/std/examples/xeval.ts
@@ -5,7 +5,7 @@ type Reader = Deno.Reader;
/* eslint-disable-next-line max-len */
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncFunction.
-const AsyncFunction = Object.getPrototypeOf(async function(): Promise<void> {})
+const AsyncFunction = Object.getPrototypeOf(async function (): Promise<void> {})
.constructor;
/* eslint-disable max-len */
@@ -59,12 +59,12 @@ async function main(): Promise<void> {
alias: {
delim: ["d"],
replvar: ["I"],
- help: ["h"]
+ help: ["h"],
},
default: {
delim: DEFAULT_DELIMITER,
- replvar: "$"
- }
+ replvar: "$",
+ },
});
if (parsedArgs._.length != 1) {
console.error(HELP_MSG);
diff --git a/std/flags/all_bool_test.ts b/std/flags/all_bool_test.ts
index 6516f48ed..cb5a36710 100755
--- a/std/flags/all_bool_test.ts
+++ b/std/flags/all_bool_test.ts
@@ -5,12 +5,12 @@ import { parse } from "./mod.ts";
// flag boolean true (default all --args to boolean)
Deno.test(function flagBooleanTrue(): void {
const argv = parse(["moo", "--honk", "cow"], {
- boolean: true
+ boolean: true,
});
assertEquals(argv, {
honk: true,
- _: ["moo", "cow"]
+ _: ["moo", "cow"],
});
assertEquals(typeof argv.honk, "boolean");
@@ -19,14 +19,14 @@ Deno.test(function flagBooleanTrue(): void {
// flag boolean true only affects double hyphen arguments without equals signs
Deno.test(function flagBooleanTrueOnlyAffectsDoubleDash(): void {
const argv = parse(["moo", "--honk", "cow", "-p", "55", "--tacos=good"], {
- boolean: true
+ boolean: true,
});
assertEquals(argv, {
honk: true,
tacos: "good",
p: 55,
- _: ["moo", "cow"]
+ _: ["moo", "cow"],
});
assertEquals(typeof argv.honk, "boolean");
diff --git a/std/flags/bool_test.ts b/std/flags/bool_test.ts
index 2d6a8b938..f2d88e617 100755
--- a/std/flags/bool_test.ts
+++ b/std/flags/bool_test.ts
@@ -5,13 +5,13 @@ import { parse } from "./mod.ts";
Deno.test(function flagBooleanDefaultFalse(): void {
const argv = parse(["moo"], {
boolean: ["t", "verbose"],
- default: { verbose: false, t: false }
+ default: { verbose: false, t: false },
});
assertEquals(argv, {
verbose: false,
t: false,
- _: ["moo"]
+ _: ["moo"],
});
assertEquals(typeof argv.verbose, "boolean");
@@ -20,14 +20,14 @@ Deno.test(function flagBooleanDefaultFalse(): void {
Deno.test(function booleanGroups(): void {
const argv = parse(["-x", "-z", "one", "two", "three"], {
- boolean: ["x", "y", "z"]
+ boolean: ["x", "y", "z"],
});
assertEquals(argv, {
x: true,
y: false,
z: true,
- _: ["one", "two", "three"]
+ _: ["one", "two", "three"],
});
assertEquals(typeof argv.x, "boolean");
@@ -40,16 +40,16 @@ Deno.test(function booleanAndAliasWithChainableApi(): void {
const regular = ["--herp", "derp"];
const aliasedArgv = parse(aliased, {
boolean: "herp",
- alias: { h: "herp" }
+ alias: { h: "herp" },
});
const propertyArgv = parse(regular, {
boolean: "herp",
- alias: { h: "herp" }
+ alias: { h: "herp" },
});
const expected = {
herp: true,
h: true,
- _: ["derp"]
+ _: ["derp"],
};
assertEquals(aliasedArgv, expected);
@@ -61,14 +61,14 @@ Deno.test(function booleanAndAliasWithOptionsHash(): void {
const regular = ["--herp", "derp"];
const opts = {
alias: { h: "herp" },
- boolean: "herp"
+ boolean: "herp",
};
const aliasedArgv = parse(aliased, opts);
const propertyArgv = parse(regular, opts);
const expected = {
herp: true,
h: true,
- _: ["derp"]
+ _: ["derp"],
};
assertEquals(aliasedArgv, expected);
assertEquals(propertyArgv, expected);
@@ -80,7 +80,7 @@ Deno.test(function booleanAndAliasArrayWithOptionsHash(): void {
const alt = ["--harp", "derp"];
const opts = {
alias: { h: ["herp", "harp"] },
- boolean: "h"
+ boolean: "h",
};
const aliasedArgv = parse(aliased, opts);
const propertyArgv = parse(regular, opts);
@@ -89,7 +89,7 @@ Deno.test(function booleanAndAliasArrayWithOptionsHash(): void {
harp: true,
herp: true,
h: true,
- _: ["derp"]
+ _: ["derp"],
};
assertEquals(aliasedArgv, expected);
assertEquals(propertyArgv, expected);
@@ -101,14 +101,14 @@ Deno.test(function booleanAndAliasUsingExplicitTrue(): void {
const regular = ["--herp", "true"];
const opts = {
alias: { h: "herp" },
- boolean: "h"
+ boolean: "h",
};
const aliasedArgv = parse(aliased, opts);
const propertyArgv = parse(regular, opts);
const expected = {
herp: true,
h: true,
- _: []
+ _: [],
};
assertEquals(aliasedArgv, expected);
@@ -119,14 +119,14 @@ Deno.test(function booleanAndAliasUsingExplicitTrue(): void {
// boolean and --x=true
Deno.test(function booleanAndNonBoolean(): void {
const parsed = parse(["--boool", "--other=true"], {
- boolean: "boool"
+ boolean: "boool",
});
assertEquals(parsed.boool, true);
assertEquals(parsed.other, "true");
const parsed2 = parse(["--boool", "--other=false"], {
- boolean: "boool"
+ boolean: "boool",
});
assertEquals(parsed2.boool, true);
@@ -136,9 +136,9 @@ Deno.test(function booleanAndNonBoolean(): void {
Deno.test(function booleanParsingTrue(): void {
const parsed = parse(["--boool=true"], {
default: {
- boool: false
+ boool: false,
},
- boolean: ["boool"]
+ boolean: ["boool"],
});
assertEquals(parsed.boool, true);
@@ -147,9 +147,9 @@ Deno.test(function booleanParsingTrue(): void {
Deno.test(function booleanParsingFalse(): void {
const parsed = parse(["--boool=false"], {
default: {
- boool: true
+ boool: true,
},
- boolean: ["boool"]
+ boolean: ["boool"],
});
assertEquals(parsed.boool, false);
@@ -187,7 +187,7 @@ Deno.test(function latestFlagIsBooleanNegation(): void {
assertEquals(parsed.foo, false);
const parsed2 = parse(["--no-foo", "--foo", "--no-foo", "123"], {
- boolean: ["foo"]
+ boolean: ["foo"],
});
assertEquals(parsed2.foo, false);
});
@@ -197,7 +197,7 @@ Deno.test(function latestFlagIsBoolean(): void {
assertEquals(parsed.foo, true);
const parsed2 = parse(["--foo", "--no-foo", "--foo", "123"], {
- boolean: ["foo"]
+ boolean: ["foo"],
});
assertEquals(parsed2.foo, true);
});
diff --git a/std/flags/dash_test.ts b/std/flags/dash_test.ts
index bdf8f502d..3df169291 100755
--- a/std/flags/dash_test.ts
+++ b/std/flags/dash_test.ts
@@ -22,7 +22,7 @@ Deno.test(function moveArgsAfterDoubleDashIntoOwnArray(): void {
{
name: "John",
_: ["before"],
- "--": ["after"]
+ "--": ["after"],
}
);
});
diff --git a/std/flags/default_bool_test.ts b/std/flags/default_bool_test.ts
index 813b6870b..4376038fe 100755
--- a/std/flags/default_bool_test.ts
+++ b/std/flags/default_bool_test.ts
@@ -5,7 +5,7 @@ import { parse } from "./mod.ts";
Deno.test(function booleanDefaultTrue(): void {
const argv = parse([], {
boolean: "sometrue",
- default: { sometrue: true }
+ default: { sometrue: true },
});
assertEquals(argv.sometrue, true);
});
@@ -13,7 +13,7 @@ Deno.test(function booleanDefaultTrue(): void {
Deno.test(function booleanDefaultFalse(): void {
const argv = parse([], {
boolean: "somefalse",
- default: { somefalse: false }
+ default: { somefalse: false },
});
assertEquals(argv.somefalse, false);
});
@@ -21,12 +21,12 @@ Deno.test(function booleanDefaultFalse(): void {
Deno.test(function booleanDefaultNull(): void {
const argv = parse([], {
boolean: "maybe",
- default: { maybe: null }
+ default: { maybe: null },
});
assertEquals(argv.maybe, null);
const argv2 = parse(["--maybe"], {
boolean: "maybe",
- default: { maybe: null }
+ default: { maybe: null },
});
assertEquals(argv2.maybe, true);
});
diff --git a/std/flags/dotted_test.ts b/std/flags/dotted_test.ts
index 93dd3031f..c86392f2a 100755
--- a/std/flags/dotted_test.ts
+++ b/std/flags/dotted_test.ts
@@ -5,7 +5,7 @@ import { parse } from "./mod.ts";
Deno.test(function dottedAlias(): void {
const argv = parse(["--a.b", "22"], {
default: { "a.b": 11 },
- alias: { "a.b": "aa.bb" }
+ alias: { "a.b": "aa.bb" },
});
assertEquals(argv.a.b, 22);
assertEquals(argv.aa.bb, 22);
diff --git a/std/flags/long_test.ts b/std/flags/long_test.ts
index e5b68f8c0..f0f4d7545 100755
--- a/std/flags/long_test.ts
+++ b/std/flags/long_test.ts
@@ -9,11 +9,11 @@ Deno.test(function longOpts(): void {
assertEquals(parse(["--host", "localhost", "--port", "555"]), {
host: "localhost",
port: 555,
- _: []
+ _: [],
});
assertEquals(parse(["--host=localhost", "--port=555"]), {
host: "localhost",
port: 555,
- _: []
+ _: [],
});
});
diff --git a/std/flags/mod.ts b/std/flags/mod.ts
index 18727a665..b334cb5b8 100644
--- a/std/flags/mod.ts
+++ b/std/flags/mod.ts
@@ -85,7 +85,7 @@ function isNumber(x: unknown): boolean {
function hasKey(obj: NestedMapping, keys: string[]): boolean {
let o = obj;
- keys.slice(0, -1).forEach(key => {
+ keys.slice(0, -1).forEach((key) => {
o = (get(o, key) ?? {}) as NestedMapping;
});
@@ -107,14 +107,14 @@ export function parse(
default: defaults = {},
stopEarly = false,
string = [],
- unknown = (i: unknown): unknown => i
+ unknown = (i: unknown): unknown => i,
}: ArgParsingOptions = {}
): Args {
const flags: Flags = {
bools: {},
strings: {},
unknownFn: unknown,
- allBools: false
+ allBools: false,
};
if (boolean !== undefined) {
@@ -139,7 +139,7 @@ export function parse(
aliases[key] = val;
}
for (const alias of getForce(aliases, key)) {
- aliases[alias] = [key].concat(aliases[key].filter(y => alias !== y));
+ aliases[alias] = [key].concat(aliases[key].filter((y) => alias !== y));
}
}
}
@@ -171,7 +171,7 @@ export function parse(
function setKey(obj: NestedMapping, keys: string[], value: unknown): void {
let o = obj;
- keys.slice(0, -1).forEach(function(key): void {
+ keys.slice(0, -1).forEach(function (key): void {
if (get(o, key) === undefined) {
o[key] = {};
}
@@ -214,7 +214,7 @@ export function parse(
function aliasIsBoolean(key: string): boolean {
return getForce(aliases, key).some(
- x => typeof get(flags.bools, x) === "boolean"
+ (x) => typeof get(flags.bools, x) === "boolean"
);
}
diff --git a/std/flags/num_test.ts b/std/flags/num_test.ts
index 0d6b634b9..f8a0d11ac 100755
--- a/std/flags/num_test.ts
+++ b/std/flags/num_test.ts
@@ -14,7 +14,7 @@ Deno.test(function nums(): void {
"10f",
"--hex",
"0xdeadbeef",
- "789"
+ "789",
]);
assertEquals(argv, {
x: 1234,
@@ -22,7 +22,7 @@ Deno.test(function nums(): void {
z: 1e7,
w: "10f",
hex: 0xdeadbeef,
- _: [789]
+ _: [789],
});
assertEquals(typeof argv.x, "number");
assertEquals(typeof argv.y, "number");
diff --git a/std/flags/parse_test.ts b/std/flags/parse_test.ts
index cd93c1f81..abba42e16 100755
--- a/std/flags/parse_test.ts
+++ b/std/flags/parse_test.ts
@@ -6,7 +6,7 @@ Deno.test(function parseArgs(): void {
assertEquals(parse(["--no-moo"]), { moo: false, _: [] });
assertEquals(parse(["-v", "a", "-v", "b", "-v", "c"]), {
v: ["a", "b", "c"],
- _: []
+ _: [],
});
});
@@ -28,7 +28,7 @@ Deno.test(function comprehensive(): void {
"--multi=baz",
"--",
"--not-a-flag",
- "eek"
+ "eek",
]),
{
c: true,
@@ -42,7 +42,7 @@ Deno.test(function comprehensive(): void {
multi: ["quux", "baz"],
meep: false,
name: "meowmers",
- _: ["bare", "--not-a-flag", "eek"]
+ _: ["bare", "--not-a-flag", "eek"],
}
);
});
@@ -56,13 +56,13 @@ Deno.test(function flagBoolean(): void {
Deno.test(function flagBooleanValue(): void {
const argv = parse(["--verbose", "false", "moo", "-t", "true"], {
boolean: ["t", "verbose"],
- default: { verbose: true }
+ default: { verbose: true },
});
assertEquals(argv, {
verbose: false,
t: true,
- _: ["moo"]
+ _: ["moo"],
});
assertEquals(typeof argv.verbose, "boolean");
@@ -110,7 +110,7 @@ Deno.test(function emptyStrings(): void {
assertEquals(typeof str, "string");
const letters = parse(["-art"], {
- string: ["a", "t"]
+ string: ["a", "t"],
});
assertEquals(letters.a, "");
@@ -121,7 +121,7 @@ Deno.test(function emptyStrings(): void {
Deno.test(function stringAndAlias(): void {
const x = parse(["--str", "000123"], {
string: "s",
- alias: { s: "str" }
+ alias: { s: "str" },
});
assertEquals(x.str, "000123");
@@ -131,7 +131,7 @@ Deno.test(function stringAndAlias(): void {
const y = parse(["-s", "000123"], {
string: "str",
- alias: { str: "s" }
+ alias: { str: "s" },
});
assertEquals(y.str, "000123");
@@ -146,13 +146,13 @@ Deno.test(function slashBreak(): void {
x: true,
y: true,
z: "/foo/bar/baz",
- _: []
+ _: [],
});
});
Deno.test(function alias(): void {
const argv = parse(["-f", "11", "--zoom", "55"], {
- alias: { z: "zoom" }
+ alias: { z: "zoom" },
});
assertEquals(argv.zoom, 55);
assertEquals(argv.z, argv.zoom);
@@ -161,7 +161,7 @@ Deno.test(function alias(): void {
Deno.test(function multiAlias(): void {
const argv = parse(["-f", "11", "--zoom", "55"], {
- alias: { z: ["zm", "zoom"] }
+ alias: { z: ["zm", "zoom"] },
});
assertEquals(argv.zoom, 55);
assertEquals(argv.z, argv.zoom);
@@ -178,7 +178,7 @@ Deno.test(function nestedDottedObjects(): void {
"--foo.quux.quibble",
"5",
"--foo.quux.oO",
- "--beep.boop"
+ "--beep.boop",
]);
assertEquals(argv.foo, {
@@ -186,8 +186,8 @@ Deno.test(function nestedDottedObjects(): void {
baz: 4,
quux: {
quibble: 5,
- oO: true
- }
+ oO: true,
+ },
});
assertEquals(argv.beep, { boop: true });
});
diff --git a/std/flags/short_test.ts b/std/flags/short_test.ts
index d7171b920..6305bbb94 100755
--- a/std/flags/short_test.ts
+++ b/std/flags/short_test.ts
@@ -16,13 +16,13 @@ Deno.test(function short(): void {
a: true,
t: true,
s: "meow",
- _: []
+ _: [],
});
assertEquals(parse(["-h", "localhost"]), { h: "localhost", _: [] });
assertEquals(parse(["-h", "localhost", "-p", "555"]), {
h: "localhost",
p: 555,
- _: []
+ _: [],
});
});
@@ -31,7 +31,7 @@ Deno.test(function mixedShortBoolAndCapture(): void {
f: true,
p: 555,
h: "localhost",
- _: ["script.js"]
+ _: ["script.js"],
});
});
@@ -40,6 +40,6 @@ Deno.test(function shortAndLong(): void {
f: true,
p: 555,
h: "localhost",
- _: ["script.js"]
+ _: ["script.js"],
});
});
diff --git a/std/flags/stop_early_test.ts b/std/flags/stop_early_test.ts
index d1996e7aa..4b7eac097 100755
--- a/std/flags/stop_early_test.ts
+++ b/std/flags/stop_early_test.ts
@@ -5,11 +5,11 @@ import { parse } from "./mod.ts";
// stops parsing on the first non-option when stopEarly is set
Deno.test(function stopParsing(): void {
const argv = parse(["--aaa", "bbb", "ccc", "--ddd"], {
- stopEarly: true
+ stopEarly: true,
});
assertEquals(argv, {
aaa: "bbb",
- _: ["ccc", "--ddd"]
+ _: ["ccc", "--ddd"],
});
});
diff --git a/std/flags/unknown_test.ts b/std/flags/unknown_test.ts
index acbb131ee..90c638b67 100755
--- a/std/flags/unknown_test.ts
+++ b/std/flags/unknown_test.ts
@@ -13,7 +13,7 @@ Deno.test(function booleanAndAliasIsNotUnknown(): void {
const opts = {
alias: { h: "herp" },
boolean: "h",
- unknown: unknownFn
+ unknown: unknownFn,
};
parse(aliased, opts);
parse(regular, opts);
@@ -29,12 +29,12 @@ Deno.test(function flagBooleanTrueAnyDoubleHyphenArgumentIsNotUnknown(): void {
}
const argv = parse(["--honk", "--tacos=good", "cow", "-p", "55"], {
boolean: true,
- unknown: unknownFn
+ unknown: unknownFn,
});
assertEquals(unknown, ["--tacos=good", "cow", "-p"]);
assertEquals(argv, {
honk: true,
- _: []
+ _: [],
});
});
@@ -49,7 +49,7 @@ Deno.test(function stringAndAliasIsNotUnkown(): void {
const opts = {
alias: { h: "herp" },
string: "h",
- unknown: unknownFn
+ unknown: unknownFn,
};
parse(aliased, opts);
parse(regular, opts);
@@ -68,7 +68,7 @@ Deno.test(function defaultAndAliasIsNotUnknown(): void {
const opts = {
default: { h: "bar" },
alias: { h: "herp" },
- unknown: unknownFn
+ unknown: unknownFn,
};
parse(aliased, opts);
parse(regular, opts);
@@ -85,13 +85,13 @@ Deno.test(function valueFollowingDoubleHyphenIsNotUnknown(): void {
const aliased = ["--bad", "--", "good", "arg"];
const opts = {
"--": true,
- unknown: unknownFn
+ unknown: unknownFn,
};
const argv = parse(aliased, opts);
assertEquals(unknown, ["--bad"]);
assertEquals(argv, {
"--": ["good", "arg"],
- _: []
+ _: [],
});
});
diff --git a/std/fmt/colors.ts b/std/fmt/colors.ts
index 9476ce076..ad2a6a1be 100644
--- a/std/fmt/colors.ts
+++ b/std/fmt/colors.ts
@@ -37,7 +37,7 @@ function code(open: number, close: number): Code {
return {
open: `\x1b[${open}m`,
close: `\x1b[${close}m`,
- regexp: new RegExp(`\\x1b\\[${close}m`, "g")
+ regexp: new RegExp(`\\x1b\\[${close}m`, "g"),
};
}
diff --git a/std/fmt/sprintf.ts b/std/fmt/sprintf.ts
index dd7ac7f55..d79b9095e 100644
--- a/std/fmt/sprintf.ts
+++ b/std/fmt/sprintf.ts
@@ -3,11 +3,11 @@ enum State {
PERCENT,
POSITIONAL,
PRECISION,
- WIDTH
+ WIDTH,
}
enum WorP {
WIDTH,
- PRECISION
+ PRECISION,
}
class Flags {
@@ -34,7 +34,7 @@ enum F {
mantissa,
fractional,
esign,
- exponent
+ exponent,
}
class Printf {
diff --git a/std/fmt/sprintf_test.ts b/std/fmt/sprintf_test.ts
index 917878bc1..24d0b4727 100644
--- a/std/fmt/sprintf_test.ts
+++ b/std/fmt/sprintf_test.ts
@@ -229,7 +229,6 @@ const tests: Array<[string, any, string]> = [
["%d", 12345, "12345"],
["%v", 12345, "12345"],
["%t", true, "true"],
-
// basic string
["%s", "abc", "abc"],
// ["%q", "abc", `"abc"`], // TODO: need %q?
@@ -248,7 +247,6 @@ const tests: Array<[string, any, string]> = [
["%#X", "xyz", "0X78797A"],
["%# x", "xyz", "0x78 0x79 0x7a"],
["%# X", "xyz", "0X78 0X79 0X7A"],
-
// basic bytes : TODO special handling for Buffer? other std types?
// escaped strings : TODO decide whether to have %q
@@ -261,7 +259,6 @@ const tests: Array<[string, any, string]> = [
["%.0c", "⌘".charCodeAt(0), "⌘"],
["%3c", "⌘".charCodeAt(0), " ⌘"],
["%-3c", "⌘".charCodeAt(0), "⌘ "],
-
// Runes that are not printable.
// {"%c", '\U00000e00', "\u0e00"}, // TODO check if \U escape exists in js
//["%c", '\U0010ffff'.codePointAt(0), "\U0010ffff"],
@@ -273,7 +270,6 @@ const tests: Array<[string, any, string]> = [
// ["%c", 0xDC80, "�"],
["%c", 0x110000, "�"],
["%c", 0xfffffffff, "�"],
-
// TODO
// escaped characters
// Runes that are not printable.
@@ -351,7 +347,6 @@ const tests: Array<[string, any, string]> = [
["%-#20.8x", 0x1234abc, "0x01234abc "],
["%-#20.8X", 0x1234abc, "0X01234ABC "],
["%-#20.8o", parseInt("01234", 8), "00001234 "],
-
// Test correct f.intbuf overflow checks. // TODO, lazy
// unicode format // TODO, decide whether unicode verb makes sense %U
@@ -433,7 +428,6 @@ const tests: Array<[string, any, string]> = [
["%+020e", Number.POSITIVE_INFINITY, " +Inf"],
["%-020f", Number.NEGATIVE_INFINITY, "-Inf "],
["%-020E", NaN, "NaN "],
-
// complex values // go specific
// old test/fmt_test.go
["%e", 1.0, "1.000000e+00"],
@@ -490,7 +484,6 @@ const tests: Array<[string, any, string]> = [
["%g", 1.23456789e-3, "0.00123457"], // see above prec6 = precdef6 - (-3+1)
//["%g", 1.23456789e20, "1.23456789e+20"],
["%g", 1.23456789e20, "1.23457e+20"],
-
// arrays // TODO
// slice : go specific
@@ -527,7 +520,6 @@ const tests: Array<[string, any, string]> = [
["% -010X", "\xab", "AB "],
["%#-10X", "\xab\xcd", "0XABCD "],
["%# -010X", "\xab\xcd", "0XAB 0XCD "],
-
// renamings
// Formatter
// GoStringer
@@ -541,7 +533,6 @@ const tests: Array<[string, any, string]> = [
["%T", S, "function"],
["%T", true, "boolean"],
["%T", Symbol(), "symbol"],
-
// %p with pointers
// erroneous things
@@ -582,7 +573,7 @@ const tests: Array<[string, any, string]> = [
["%+07.2f", 1.0, "+001.00"],
["%+07.2f", -1.0, "-001.00"],
["% +07.2f", 1.0, "+001.00"],
- ["% +07.2f", -1.0, "-001.00"]
+ ["% +07.2f", -1.0, "-001.00"],
];
Deno.test(function testThorough(): void {
diff --git a/std/fs/README.md b/std/fs/README.md
index 56c190ccc..8c69faa76 100644
--- a/std/fs/README.md
+++ b/std/fs/README.md
@@ -52,7 +52,7 @@ created.
```ts
import {
ensureSymlink,
- ensureSymlinkSync
+ ensureSymlinkSync,
} from "https://deno.land/std/fs/mod.ts";
ensureSymlink(
@@ -110,7 +110,7 @@ import { globToRegExp } from "https://deno.land/std/fs/mod.ts";
globToRegExp("foo/**/*.json", {
flags: "g",
extended: true,
- globstar: true
+ globstar: true,
}); // returns the regex to find all .json files in the folder foo
```
@@ -212,7 +212,7 @@ Write the string to file.
```ts
import {
writeFileStr,
- writeFileStrSync
+ writeFileStrSync,
} from "https://deno.land/std/fs/mod.ts";
writeFileStr("./target.dat", "file content"); // returns a promise
diff --git a/std/fs/copy_test.ts b/std/fs/copy_test.ts
index 9ba5f2b21..0fbc90579 100644
--- a/std/fs/copy_test.ts
+++ b/std/fs/copy_test.ts
@@ -3,7 +3,7 @@ import {
assertEquals,
assertThrows,
assertThrowsAsync,
- assert
+ assert,
} from "../testing/asserts.ts";
import * as path from "../path/mod.ts";
import { copy, copySync } from "./copy.ts";
@@ -22,11 +22,11 @@ function testCopy(name: string, cb: (tempDir: string) => Promise<void>): void {
name,
async fn(): Promise<void> {
const tempDir = await Deno.makeTempDir({
- prefix: "deno_std_copy_async_test_"
+ prefix: "deno_std_copy_async_test_",
});
await cb(tempDir);
await Deno.remove(tempDir, { recursive: true });
- }
+ },
});
}
@@ -35,11 +35,11 @@ function testCopySync(name: string, cb: (tempDir: string) => void): void {
name,
fn: (): void => {
const tempDir = Deno.makeTempDirSync({
- prefix: "deno_std_copy_sync_test_"
+ prefix: "deno_std_copy_sync_test_",
});
cb(tempDir);
Deno.removeSync(tempDir, { recursive: true });
- }
+ },
});
}
@@ -149,7 +149,7 @@ testCopy(
// Copy with overwrite and preserve timestamps options.
await copy(srcFile, destFile, {
overwrite: true,
- preserveTimestamps: true
+ preserveTimestamps: true,
});
const destStatInfo = await Deno.stat(destFile);
@@ -333,7 +333,7 @@ testCopySync(
// Copy with overwrite and preserve timestamps options.
copySync(srcFile, destFile, {
overwrite: true,
- preserveTimestamps: true
+ preserveTimestamps: true,
});
const destStatInfo = Deno.statSync(destFile);
diff --git a/std/fs/empty_dir_test.ts b/std/fs/empty_dir_test.ts
index 7015516ab..f30f434df 100644
--- a/std/fs/empty_dir_test.ts
+++ b/std/fs/empty_dir_test.ts
@@ -4,7 +4,7 @@ import {
assertEquals,
assertStrContains,
assertThrows,
- assertThrowsAsync
+ assertThrowsAsync,
} from "../testing/asserts.ts";
import * as path from "../path/mod.ts";
import { emptyDir, emptyDirSync } from "./empty_dir.ts";
@@ -137,59 +137,59 @@ const scenes: Scenes[] = [
read: false,
write: false,
async: true,
- output: "run again with the --allow-read flag"
+ output: "run again with the --allow-read flag",
},
{
read: false,
write: false,
async: false,
- output: "run again with the --allow-read flag"
+ output: "run again with the --allow-read flag",
},
// 2
{
read: true,
write: false,
async: true,
- output: "run again with the --allow-write flag"
+ output: "run again with the --allow-write flag",
},
{
read: true,
write: false,
async: false,
- output: "run again with the --allow-write flag"
+ output: "run again with the --allow-write flag",
},
// 3
{
read: false,
write: true,
async: true,
- output: "run again with the --allow-read flag"
+ output: "run again with the --allow-read flag",
},
{
read: false,
write: true,
async: false,
- output: "run again with the --allow-read flag"
+ output: "run again with the --allow-read flag",
},
// 4
{
read: true,
write: true,
async: true,
- output: "success"
+ output: "success",
},
{
read: true,
write: true,
async: false,
- output: "success"
- }
+ output: "success",
+ },
];
for (const s of scenes) {
let title = `test ${s.async ? "emptyDir" : "emptyDirSync"}`;
title += `("testdata/testfolder") ${s.read ? "with" : "without"}`;
title += ` --allow-read & ${s.write ? "with" : "without"} --allow-write`;
- Deno.test(`[fs] emptyDirPermission ${title}`, async function(): Promise<
+ Deno.test(`[fs] emptyDirPermission ${title}`, async function (): Promise<
void
> {
const testfolder = path.join(testdataDir, "testfolder");
@@ -221,7 +221,7 @@ for (const s of scenes) {
const p = Deno.run({
stdout: "piped",
cwd: testdataDir,
- cmd: args
+ cmd: args,
});
assert(p.stdout);
diff --git a/std/fs/ensure_link_test.ts b/std/fs/ensure_link_test.ts
index 7549814a2..3c7720dc0 100644
--- a/std/fs/ensure_link_test.ts
+++ b/std/fs/ensure_link_test.ts
@@ -3,7 +3,7 @@
import {
assertEquals,
assertThrows,
- assertThrowsAsync
+ assertThrowsAsync,
} from "../testing/asserts.ts";
import * as path from "../path/mod.ts";
import { ensureLink, ensureLinkSync } from "./ensure_link.ts";
diff --git a/std/fs/ensure_symlink_test.ts b/std/fs/ensure_symlink_test.ts
index f0dc4fbe4..5188dc035 100644
--- a/std/fs/ensure_symlink_test.ts
+++ b/std/fs/ensure_symlink_test.ts
@@ -3,7 +3,7 @@
import {
assertEquals,
assertThrows,
- assertThrowsAsync
+ assertThrowsAsync,
} from "../testing/asserts.ts";
import * as path from "../path/mod.ts";
import { ensureSymlink, ensureSymlinkSync } from "./ensure_symlink.ts";
diff --git a/std/fs/eol.ts b/std/fs/eol.ts
index d4bb8032c..2f15be269 100644
--- a/std/fs/eol.ts
+++ b/std/fs/eol.ts
@@ -3,7 +3,7 @@
/** EndOfLine character enum */
export enum EOL {
LF = "\n",
- CRLF = "\r\n"
+ CRLF = "\r\n",
}
const regDetect = /(?:\r?\n)/g;
diff --git a/std/fs/eol_test.ts b/std/fs/eol_test.ts
index aa2dcf395..35b3e0d9a 100644
--- a/std/fs/eol_test.ts
+++ b/std/fs/eol_test.ts
@@ -12,21 +12,21 @@ Deno.test({
name: "[EOL] Detect CR LF",
fn(): void {
assertEquals(detect(CRLFinput), EOL.CRLF);
- }
+ },
});
Deno.test({
name: "[EOL] Detect LF",
fn(): void {
assertEquals(detect(LFinput), EOL.LF);
- }
+ },
});
Deno.test({
name: "[EOL] Detect No New Line",
fn(): void {
assertEquals(detect(NoNLinput), null);
- }
+ },
});
Deno.test({
@@ -34,7 +34,7 @@ Deno.test({
fn(): void {
assertEquals(detect(Mixedinput), EOL.CRLF);
assertEquals(detect(Mixedinput2), EOL.CRLF);
- }
+ },
});
Deno.test({
@@ -50,5 +50,5 @@ Deno.test({
assertEquals(format(Mixedinput, EOL.LF), LFinput);
assertEquals(format(Mixedinput2, EOL.CRLF), CRLFinput);
assertEquals(format(Mixedinput2, EOL.LF), LFinput);
- }
+ },
});
diff --git a/std/fs/exists_test.ts b/std/fs/exists_test.ts
index 1f296538c..04c58d8d6 100644
--- a/std/fs/exists_test.ts
+++ b/std/fs/exists_test.ts
@@ -5,7 +5,7 @@ import { exists, existsSync } from "./exists.ts";
const testdataDir = path.resolve("fs", "testdata");
-Deno.test("[fs] existsFile", async function(): Promise<void> {
+Deno.test("[fs] existsFile", async function (): Promise<void> {
assertEquals(
await exists(path.join(testdataDir, "not_exist_file.ts")),
false
@@ -13,12 +13,12 @@ Deno.test("[fs] existsFile", async function(): Promise<void> {
assertEquals(await existsSync(path.join(testdataDir, "0.ts")), true);
});
-Deno.test("[fs] existsFileSync", function(): void {
+Deno.test("[fs] existsFileSync", function (): void {
assertEquals(existsSync(path.join(testdataDir, "not_exist_file.ts")), false);
assertEquals(existsSync(path.join(testdataDir, "0.ts")), true);
});
-Deno.test("[fs] existsDirectory", async function(): Promise<void> {
+Deno.test("[fs] existsDirectory", async function (): Promise<void> {
assertEquals(
await exists(path.join(testdataDir, "not_exist_directory")),
false
@@ -26,7 +26,7 @@ Deno.test("[fs] existsDirectory", async function(): Promise<void> {
assertEquals(existsSync(testdataDir), true);
});
-Deno.test("[fs] existsDirectorySync", function(): void {
+Deno.test("[fs] existsDirectorySync", function (): void {
assertEquals(
existsSync(path.join(testdataDir, "not_exist_directory")),
false
@@ -34,16 +34,16 @@ Deno.test("[fs] existsDirectorySync", function(): void {
assertEquals(existsSync(testdataDir), true);
});
-Deno.test("[fs] existsLinkSync", function(): void {
+Deno.test("[fs] existsLinkSync", function (): void {
// TODO(axetroy): generate link file use Deno api instead of set a link file
// in repository
- assertEquals(existsSync(path.join(testdataDir, "0-link.ts")), true);
+ assertEquals(existsSync(path.join(testdataDir, "0-link")), true);
});
-Deno.test("[fs] existsLink", async function(): Promise<void> {
+Deno.test("[fs] existsLink", async function (): Promise<void> {
// TODO(axetroy): generate link file use Deno api instead of set a link file
// in repository
- assertEquals(await exists(path.join(testdataDir, "0-link.ts")), true);
+ assertEquals(await exists(path.join(testdataDir, "0-link")), true);
});
interface Scenes {
@@ -59,59 +59,59 @@ const scenes: Scenes[] = [
read: false,
async: true,
output: "run again with the --allow-read flag",
- file: "0.ts"
+ file: "0.ts",
},
{
read: false,
async: false,
output: "run again with the --allow-read flag",
- file: "0.ts"
+ file: "0.ts",
},
// 2
{
read: true,
async: true,
output: "exist",
- file: "0.ts"
+ file: "0.ts",
},
{
read: true,
async: false,
output: "exist",
- file: "0.ts"
+ file: "0.ts",
},
// 3
{
read: false,
async: true,
output: "run again with the --allow-read flag",
- file: "no_exist_file_for_test.ts"
+ file: "no_exist_file_for_test.ts",
},
{
read: false,
async: false,
output: "run again with the --allow-read flag",
- file: "no_exist_file_for_test.ts"
+ file: "no_exist_file_for_test.ts",
},
// 4
{
read: true,
async: true,
output: "not exist",
- file: "no_exist_file_for_test.ts"
+ file: "no_exist_file_for_test.ts",
},
{
read: true,
async: false,
output: "not exist",
- file: "no_exist_file_for_test.ts"
- }
+ file: "no_exist_file_for_test.ts",
+ },
];
for (const s of scenes) {
let title = `test ${s.async ? "exists" : "existsSync"}("testdata/${s.file}")`;
title += ` ${s.read ? "with" : "without"} --allow-read`;
- Deno.test(`[fs] existsPermission ${title}`, async function(): Promise<void> {
+ Deno.test(`[fs] existsPermission ${title}`, async function (): Promise<void> {
const args = [Deno.execPath(), "run"];
if (s.read) {
@@ -124,7 +124,7 @@ for (const s of scenes) {
const p = Deno.run({
stdout: "piped",
cwd: testdataDir,
- cmd: args
+ cmd: args,
});
const output = await p.output();
diff --git a/std/fs/expand_glob.ts b/std/fs/expand_glob.ts
index c6653eda1..10a8c2c52 100644
--- a/std/fs/expand_glob.ts
+++ b/std/fs/expand_glob.ts
@@ -6,7 +6,7 @@ import {
isGlob,
isWindows,
joinGlobs,
- normalize
+ normalize,
} from "../path/mod.ts";
import { WalkInfo, walk, walkSync } from "./walk.ts";
import { assert } from "../testing/asserts.ts";
@@ -38,7 +38,7 @@ function split(path: string): SplitPath {
segments,
isAbsolute: isAbsolute_,
hasTrailingSep: !!path.match(new RegExp(`${s}$`)),
- winRoot: isWindows && isAbsolute_ ? segments.shift() : undefined
+ winRoot: isWindows && isAbsolute_ ? segments.shift() : undefined,
};
}
@@ -59,7 +59,7 @@ export async function* expandGlob(
exclude = [],
includeDirs = true,
extended = false,
- globstar = false
+ globstar = false,
}: ExpandGlobOptions = {}
): AsyncIterableIterator<WalkInfo> {
const globOptions: GlobOptions = { extended, globstar };
@@ -110,7 +110,7 @@ export async function* expandGlob(
} else if (globSegment == "**") {
return yield* walk(walkInfo.filename, {
includeFiles: false,
- skip: excludePatterns
+ skip: excludePatterns,
});
}
yield* walk(walkInfo.filename, {
@@ -119,9 +119,9 @@ export async function* expandGlob(
globToRegExp(
joinGlobs([walkInfo.filename, globSegment], globOptions),
globOptions
- )
+ ),
],
- skip: excludePatterns
+ skip: excludePatterns,
});
}
@@ -138,7 +138,7 @@ export async function* expandGlob(
currentMatches = [...nextMatchMap].sort().map(
([filename, info]): WalkInfo => ({
filename,
- info
+ info,
})
);
}
@@ -163,7 +163,7 @@ export function* expandGlobSync(
exclude = [],
includeDirs = true,
extended = false,
- globstar = false
+ globstar = false,
}: ExpandGlobOptions = {}
): IterableIterator<WalkInfo> {
const globOptions: GlobOptions = { extended, globstar };
@@ -214,7 +214,7 @@ export function* expandGlobSync(
} else if (globSegment == "**") {
return yield* walkSync(walkInfo.filename, {
includeFiles: false,
- skip: excludePatterns
+ skip: excludePatterns,
});
}
yield* walkSync(walkInfo.filename, {
@@ -223,9 +223,9 @@ export function* expandGlobSync(
globToRegExp(
joinGlobs([walkInfo.filename, globSegment], globOptions),
globOptions
- )
+ ),
],
- skip: excludePatterns
+ skip: excludePatterns,
});
}
@@ -242,7 +242,7 @@ export function* expandGlobSync(
currentMatches = [...nextMatchMap].sort().map(
([filename, info]): WalkInfo => ({
filename,
- info
+ info,
})
);
}
diff --git a/std/fs/expand_glob_test.ts b/std/fs/expand_glob_test.ts
index adc94c1e9..6be9c518f 100644
--- a/std/fs/expand_glob_test.ts
+++ b/std/fs/expand_glob_test.ts
@@ -6,12 +6,12 @@ import {
join,
joinGlobs,
normalize,
- relative
+ relative,
} from "../path/mod.ts";
import {
ExpandGlobOptions,
expandGlob,
- expandGlobSync
+ expandGlobSync,
} from "./expand_glob.ts";
async function expandGlobArray(
@@ -48,7 +48,7 @@ const EG_OPTIONS: ExpandGlobOptions = {
root: urlToFilePath(new URL(join("testdata", "glob"), import.meta.url)),
includeDirs: true,
extended: false,
- globstar: false
+ globstar: false,
};
Deno.test(async function expandGlobWildcard(): Promise<void> {
@@ -57,7 +57,7 @@ Deno.test(async function expandGlobWildcard(): Promise<void> {
"abc",
"abcdef",
"abcdefghi",
- "subdir"
+ "subdir",
]);
});
@@ -72,7 +72,7 @@ Deno.test(async function expandGlobParent(): Promise<void> {
"abc",
"abcdef",
"abcdefghi",
- "subdir"
+ "subdir",
]);
});
@@ -80,16 +80,16 @@ Deno.test(async function expandGlobExt(): Promise<void> {
const options = { ...EG_OPTIONS, extended: true };
assertEquals(await expandGlobArray("abc?(def|ghi)", options), [
"abc",
- "abcdef"
+ "abcdef",
]);
assertEquals(await expandGlobArray("abc*(def|ghi)", options), [
"abc",
"abcdef",
- "abcdefghi"
+ "abcdefghi",
]);
assertEquals(await expandGlobArray("abc+(def|ghi)", options), [
"abcdef",
- "abcdefghi"
+ "abcdefghi",
]);
assertEquals(await expandGlobArray("abc@(def|ghi)", options), ["abcdef"]);
assertEquals(await expandGlobArray("abc{def,ghi}", options), ["abcdef"]);
@@ -123,7 +123,7 @@ Deno.test(async function expandGlobPermError(): Promise<void> {
cmd: [execPath(), exampleUrl.toString()],
stdin: "null",
stdout: "piped",
- stderr: "piped"
+ stderr: "piped",
});
assertEquals(await p.status(), { code: 1, success: false });
assertEquals(decode(await p.output()), "");
diff --git a/std/fs/move_test.ts b/std/fs/move_test.ts
index b835e6dfa..999b67cf0 100644
--- a/std/fs/move_test.ts
+++ b/std/fs/move_test.ts
@@ -2,7 +2,7 @@
import {
assertEquals,
assertThrows,
- assertThrowsAsync
+ assertThrowsAsync,
} from "../testing/asserts.ts";
import * as path from "../path/mod.ts";
import { move, moveSync } from "./move.ts";
@@ -68,7 +68,7 @@ Deno.test(async function moveFileIfDestExists(): Promise<void> {
// write file content
await Promise.all([
Deno.writeFile(srcFile, srcContent),
- Deno.writeFile(destFile, destContent)
+ Deno.writeFile(destFile, destContent),
]);
// make sure the test file have been created
@@ -100,7 +100,7 @@ Deno.test(async function moveFileIfDestExists(): Promise<void> {
// clean up
await Promise.all([
Deno.remove(srcDir, { recursive: true }),
- Deno.remove(destDir, { recursive: true })
+ Deno.remove(destDir, { recursive: true }),
]);
});
@@ -141,13 +141,13 @@ Deno.test(async function moveIfSrcAndDestDirectoryExistsAndOverwrite(): Promise<
await Promise.all([
Deno.mkdir(srcDir, { recursive: true }),
- Deno.mkdir(destDir, { recursive: true })
+ Deno.mkdir(destDir, { recursive: true }),
]);
assertEquals(await exists(srcDir), true);
assertEquals(await exists(destDir), true);
await Promise.all([
Deno.writeFile(srcFile, srcContent),
- Deno.writeFile(destFile, destContent)
+ Deno.writeFile(destFile, destContent),
]);
await move(srcDir, destDir, { overwrite: true });
diff --git a/std/fs/read_json_test.ts b/std/fs/read_json_test.ts
index c394963b0..bdb5edbe5 100644
--- a/std/fs/read_json_test.ts
+++ b/std/fs/read_json_test.ts
@@ -2,7 +2,7 @@
import {
assertEquals,
assertThrowsAsync,
- assertThrows
+ assertThrows,
} from "../testing/asserts.ts";
import * as path from "../path/mod.ts";
import { readJson, readJsonSync } from "./read_json.ts";
diff --git a/std/fs/testdata/0-link b/std/fs/testdata/0-link
new file mode 120000
index 000000000..937f1e899
--- /dev/null
+++ b/std/fs/testdata/0-link
@@ -0,0 +1 @@
+0.ts \ No newline at end of file
diff --git a/std/fs/testdata/0-link.ts b/std/fs/testdata/0-link.ts
deleted file mode 120000
index 24c6b8053..000000000
--- a/std/fs/testdata/0-link.ts
+++ /dev/null
@@ -1 +0,0 @@
-./fs/testdata/0.ts \ No newline at end of file
diff --git a/std/fs/testdata/empty_dir.ts b/std/fs/testdata/empty_dir.ts
index aa9cf60a1..f8fcc1ceb 100644
--- a/std/fs/testdata/empty_dir.ts
+++ b/std/fs/testdata/empty_dir.ts
@@ -2,8 +2,8 @@ import { emptyDir } from "../empty_dir.ts";
emptyDir(Deno.args[0])
.then(() => {
- Deno.stdout.write(new TextEncoder().encode("success"))
+ Deno.stdout.write(new TextEncoder().encode("success"));
})
.catch((err) => {
- Deno.stdout.write(new TextEncoder().encode(err.message))
- }) \ No newline at end of file
+ Deno.stdout.write(new TextEncoder().encode(err.message));
+ });
diff --git a/std/fs/testdata/exists_sync.ts b/std/fs/testdata/exists_sync.ts
index 27dee268b..8cc51e9f8 100644
--- a/std/fs/testdata/exists_sync.ts
+++ b/std/fs/testdata/exists_sync.ts
@@ -1,10 +1,8 @@
import { existsSync } from "../exists.ts";
try {
- const isExist = existsSync(Deno.args[0])
- Deno.stdout.write(new TextEncoder().encode(isExist ? 'exist' :'not exist'))
+ const isExist = existsSync(Deno.args[0]);
+ Deno.stdout.write(new TextEncoder().encode(isExist ? "exist" : "not exist"));
} catch (err) {
- Deno.stdout.write(new TextEncoder().encode(err.message))
+ Deno.stdout.write(new TextEncoder().encode(err.message));
}
-
-
diff --git a/std/fs/utils_test.ts b/std/fs/utils_test.ts
index 93f4664e7..95686d824 100644
--- a/std/fs/utils_test.ts
+++ b/std/fs/utils_test.ts
@@ -17,10 +17,10 @@ Deno.test(function _isSubdir(): void {
["first", "first/second", true, path.posix.sep],
["../first", "../first/second", true, path.posix.sep],
["c:\\first", "c:\\first", false, path.win32.sep],
- ["c:\\first", "c:\\first\\second", true, path.win32.sep]
+ ["c:\\first", "c:\\first\\second", true, path.win32.sep],
];
- pairs.forEach(function(p): void {
+ pairs.forEach(function (p): void {
const src = p[0] as string;
const dest = p[1] as string;
const expected = p[2] as boolean;
@@ -36,10 +36,10 @@ Deno.test(function _isSubdir(): void {
Deno.test(function _getFileInfoType(): void {
const pairs = [
[path.join(testdataDir, "file_type_1"), "file"],
- [path.join(testdataDir, "file_type_dir_1"), "dir"]
+ [path.join(testdataDir, "file_type_dir_1"), "dir"],
];
- pairs.forEach(function(p): void {
+ pairs.forEach(function (p): void {
const filePath = p[0] as string;
const type = p[1] as PathType;
switch (type) {
diff --git a/std/fs/walk.ts b/std/fs/walk.ts
index fbd14740b..3f178c0c5 100644
--- a/std/fs/walk.ts
+++ b/std/fs/walk.ts
@@ -67,7 +67,7 @@ export async function* walk(
followSymlinks = false,
exts = undefined,
match = undefined,
- skip = undefined
+ skip = undefined,
}: WalkOptions = {}
): AsyncIterableIterator<WalkInfo> {
if (maxDepth < 0) {
@@ -105,7 +105,7 @@ export async function* walk(
followSymlinks,
exts,
match,
- skip
+ skip,
});
}
}
@@ -121,7 +121,7 @@ export function* walkSync(
followSymlinks = false,
exts = undefined,
match = undefined,
- skip = undefined
+ skip = undefined,
}: WalkOptions = {}
): IterableIterator<WalkInfo> {
if (maxDepth < 0) {
@@ -158,7 +158,7 @@ export function* walkSync(
followSymlinks,
exts,
match,
- skip
+ skip,
});
}
}
diff --git a/std/fs/write_json_test.ts b/std/fs/write_json_test.ts
index 09fa05d60..335d35bfe 100644
--- a/std/fs/write_json_test.ts
+++ b/std/fs/write_json_test.ts
@@ -2,7 +2,7 @@
import {
assertEquals,
assertThrowsAsync,
- assertThrows
+ assertThrows,
} from "../testing/asserts.ts";
import * as path from "../path/mod.ts";
import { writeJson, writeJsonSync } from "./write_json.ts";
@@ -108,7 +108,7 @@ Deno.test(async function writeJsonWithReplacer(): Promise<void> {
existsJsonFile,
{ a: "1", b: "2", c: "3" },
{
- replacer: ["a"]
+ replacer: ["a"],
}
);
throw new Error("should write success");
@@ -226,7 +226,7 @@ Deno.test(function writeJsonWithReplacer(): void {
existsJsonFile,
{ a: "1", b: "2", c: "3" },
{
- replacer: ["a"]
+ replacer: ["a"],
}
);
throw new Error("should write success");
diff --git a/std/http/cookie.ts b/std/http/cookie.ts
index 10c9bd689..062019f14 100644
--- a/std/http/cookie.ts
+++ b/std/http/cookie.ts
@@ -130,6 +130,6 @@ export function delCookie(res: Response, name: string): void {
setCookie(res, {
name: name,
value: "",
- expires: new Date(0)
+ expires: new Date(0),
});
}
diff --git a/std/http/cookie_test.ts b/std/http/cookie_test.ts
index 8ab862bb3..1b78b2bff 100644
--- a/std/http/cookie_test.ts
+++ b/std/http/cookie_test.ts
@@ -27,9 +27,9 @@ test({
assertEquals(getCookies(req), {
PREF: "al=en-GB&f1=123",
wide: "1",
- SID: "123"
+ SID: "123",
});
- }
+ },
});
test({
@@ -41,7 +41,7 @@ test({
res.headers?.get("Set-Cookie"),
"deno=; Expires=Thu, 01 Jan 1970 00:00:00 GMT"
);
- }
+ },
});
test({
@@ -66,7 +66,7 @@ test({
name: "Space",
value: "Cat",
httpOnly: true,
- secure: true
+ secure: true,
});
assertEquals(res.headers.get("Set-Cookie"), "Space=Cat; Secure; HttpOnly");
@@ -76,7 +76,7 @@ test({
value: "Cat",
httpOnly: true,
secure: true,
- maxAge: 2
+ maxAge: 2,
});
assertEquals(
res.headers.get("Set-Cookie"),
@@ -91,7 +91,7 @@ test({
value: "Cat",
httpOnly: true,
secure: true,
- maxAge: 0
+ maxAge: 0,
});
} catch (e) {
error = true;
@@ -105,7 +105,7 @@ test({
httpOnly: true,
secure: true,
maxAge: 2,
- domain: "deno.land"
+ domain: "deno.land",
});
assertEquals(
res.headers.get("Set-Cookie"),
@@ -120,7 +120,7 @@ test({
secure: true,
maxAge: 2,
domain: "deno.land",
- sameSite: "Strict"
+ sameSite: "Strict",
});
assertEquals(
res.headers.get("Set-Cookie"),
@@ -136,7 +136,7 @@ test({
secure: true,
maxAge: 2,
domain: "deno.land",
- sameSite: "Lax"
+ sameSite: "Lax",
});
assertEquals(
res.headers.get("Set-Cookie"),
@@ -151,7 +151,7 @@ test({
secure: true,
maxAge: 2,
domain: "deno.land",
- path: "/"
+ path: "/",
});
assertEquals(
res.headers.get("Set-Cookie"),
@@ -167,7 +167,7 @@ test({
maxAge: 2,
domain: "deno.land",
path: "/",
- unparsed: ["unparsed=keyvalue", "batman=Bruce"]
+ unparsed: ["unparsed=keyvalue", "batman=Bruce"],
});
assertEquals(
res.headers.get("Set-Cookie"),
@@ -184,7 +184,7 @@ test({
maxAge: 2,
domain: "deno.land",
path: "/",
- expires: new Date(Date.UTC(1983, 0, 7, 15, 32))
+ expires: new Date(Date.UTC(1983, 0, 7, 15, 32)),
});
assertEquals(
res.headers.get("Set-Cookie"),
@@ -200,11 +200,11 @@ test({
setCookie(res, {
name: "__Host-Kitty",
value: "Meow",
- domain: "deno.land"
+ domain: "deno.land",
});
assertEquals(
res.headers.get("Set-Cookie"),
"__Host-Kitty=Meow; Secure; Path=/"
);
- }
+ },
});
diff --git a/std/http/file_server.ts b/std/http/file_server.ts
index 20d5d61e6..5582afd07 100755
--- a/std/http/file_server.ts
+++ b/std/http/file_server.ts
@@ -108,7 +108,7 @@ async function serveFile(
const res = {
status: 200,
body: file,
- headers
+ headers,
};
return res;
}
@@ -137,7 +137,7 @@ async function serveDir(
mode: modeToString(fileInfo.isDirectory(), mode),
size: fileInfo.isFile() ? fileLenToString(fileInfo.size) : "",
name: fileInfo.name ?? "",
- url: fileUrl
+ url: fileUrl,
});
}
listEntry.sort((a, b) =>
@@ -152,7 +152,7 @@ async function serveDir(
const res = {
status: 200,
body: page,
- headers
+ headers,
};
setContentLength(res);
return res;
@@ -162,12 +162,12 @@ function serveFallback(req: ServerRequest, e: Error): Promise<Response> {
if (e instanceof Deno.errors.NotFound) {
return Promise.resolve({
status: 404,
- body: encoder.encode("Not found")
+ body: encoder.encode("Not found"),
});
} else {
return Promise.resolve({
status: 500,
- body: encoder.encode("Internal server error")
+ body: encoder.encode("Internal server error"),
});
}
}
@@ -258,19 +258,20 @@ function dirViewerTemplate(dirname: string, entries: EntryInfo[]): string {
<th>Name</th>
</tr>
${entries.map(
- entry => html`
- <tr>
- <td class="mode">
- ${entry.mode}
- </td>
- <td>
- ${entry.size}
- </td>
- <td>
- <a href="${entry.url}">${entry.name}</a>
- </td>
- </tr>
- `
+ (entry) =>
+ html`
+ <tr>
+ <td class="mode">
+ ${entry.mode}
+ </td>
+ <td>
+ ${entry.size}
+ </td>
+ <td>
+ <a href="${entry.url}">${entry.name}</a>
+ </td>
+ </tr>
+ `
)}
</table>
</main>
diff --git a/std/http/file_server_test.ts b/std/http/file_server_test.ts
index fcf776ea2..3a3817ce0 100644
--- a/std/http/file_server_test.ts
+++ b/std/http/file_server_test.ts
@@ -14,10 +14,10 @@ async function startFileServer(): Promise<void> {
"--allow-net",
"http/file_server.ts",
".",
- "--cors"
+ "--cors",
],
stdout: "piped",
- stderr: "null"
+ stderr: "null",
});
// Once fileServer is ready it will write to its stdout.
assert(fileServer.stdout != null);
@@ -106,7 +106,7 @@ test(async function servePermissionDenied(): Promise<void> {
const deniedServer = Deno.run({
cmd: [Deno.execPath(), "run", "--allow-net", "http/file_server.ts"],
stdout: "piped",
- stderr: "piped"
+ stderr: "piped",
});
assert(deniedServer.stdout != null);
const reader = new TextProtoReader(new BufReader(deniedServer.stdout));
@@ -132,7 +132,7 @@ test(async function servePermissionDenied(): Promise<void> {
test(async function printHelp(): Promise<void> {
const helpProcess = Deno.run({
cmd: [Deno.execPath(), "run", "http/file_server.ts", "--help"],
- stdout: "piped"
+ stdout: "piped",
});
assert(helpProcess.stdout != null);
const r = new TextProtoReader(new BufReader(helpProcess.stdout));
diff --git a/std/http/http_bench.ts b/std/http/http_bench.ts
index 9d1912831..15f223323 100644
--- a/std/http/http_bench.ts
+++ b/std/http/http_bench.ts
@@ -9,7 +9,7 @@ console.log(`http://${addr}/`);
for await (const req of server) {
const res = {
body,
- headers: new Headers()
+ headers: new Headers(),
};
res.headers.set("Date", new Date().toUTCString());
res.headers.set("Connection", "keep-alive");
diff --git a/std/http/http_status.ts b/std/http/http_status.ts
index ead1e1ff0..ce4338705 100644
--- a/std/http/http_status.ts
+++ b/std/http/http_status.ts
@@ -125,14 +125,13 @@ export enum Status {
/** RFC 2774, 7 */
NotExtended = 510,
/** RFC 6585, 6 */
- NetworkAuthenticationRequired = 511
+ NetworkAuthenticationRequired = 511,
}
export const STATUS_TEXT = new Map<Status, string>([
[Status.Continue, "Continue"],
[Status.SwitchingProtocols, "Switching Protocols"],
[Status.Processing, "Processing"],
-
[Status.OK, "OK"],
[Status.Created, "Created"],
[Status.Accepted, "Accepted"],
@@ -143,7 +142,6 @@ export const STATUS_TEXT = new Map<Status, string>([
[Status.MultiStatus, "Multi-Status"],
[Status.AlreadyReported, "Already Reported"],
[Status.IMUsed, "IM Used"],
-
[Status.MultipleChoices, "Multiple Choices"],
[Status.MovedPermanently, "Moved Permanently"],
[Status.Found, "Found"],
@@ -152,7 +150,6 @@ export const STATUS_TEXT = new Map<Status, string>([
[Status.UseProxy, "Use Proxy"],
[Status.TemporaryRedirect, "Temporary Redirect"],
[Status.PermanentRedirect, "Permanent Redirect"],
-
[Status.BadRequest, "Bad Request"],
[Status.Unauthorized, "Unauthorized"],
[Status.PaymentRequired, "Payment Required"],
@@ -181,7 +178,6 @@ export const STATUS_TEXT = new Map<Status, string>([
[Status.TooManyRequests, "Too Many Requests"],
[Status.RequestHeaderFieldsTooLarge, "Request Header Fields Too Large"],
[Status.UnavailableForLegalReasons, "Unavailable For Legal Reasons"],
-
[Status.InternalServerError, "Internal Server Error"],
[Status.NotImplemented, "Not Implemented"],
[Status.BadGateway, "Bad Gateway"],
@@ -192,5 +188,5 @@ export const STATUS_TEXT = new Map<Status, string>([
[Status.InsufficientStorage, "Insufficient Storage"],
[Status.LoopDetected, "Loop Detected"],
[Status.NotExtended, "Not Extended"],
- [Status.NetworkAuthenticationRequired, "Network Authentication Required"]
+ [Status.NetworkAuthenticationRequired, "Network Authentication Required"],
]);
diff --git a/std/http/io.ts b/std/http/io.ts
index 6d5d1f665..2875be44f 100644
--- a/std/http/io.ts
+++ b/std/http/io.ts
@@ -9,7 +9,7 @@ export function emptyReader(): Deno.Reader {
return {
read(_: Uint8Array): Promise<number | Deno.EOF> {
return Promise.resolve(Deno.EOF);
- }
+ },
};
}
@@ -83,7 +83,7 @@ export function chunkedBodyReader(h: Headers, r: BufReader): Deno.Reader {
} else {
chunks.push({
offset: 0,
- data: restChunk
+ data: restChunk,
});
}
return buf.byteLength;
@@ -116,7 +116,7 @@ export function chunkedBodyReader(h: Headers, r: BufReader): Deno.Reader {
const kProhibitedTrailerHeaders = [
"transfer-encoding",
"content-length",
- "trailer"
+ "trailer",
];
/**
@@ -147,7 +147,7 @@ function parseTrailer(field: string | null): Set<string> | undefined {
if (field == null) {
return undefined;
}
- const keys = field.split(",").map(v => v.trim());
+ const keys = field.split(",").map((v) => v.trim());
if (keys.length === 0) {
throw new Error("Empty trailer");
}
@@ -196,7 +196,7 @@ export async function writeTrailers(
const writer = BufWriter.create(w);
const trailerHeaderFields = trailer
.split(",")
- .map(s => s.trim().toLowerCase());
+ .map((s) => s.trim().toLowerCase());
for (const f of trailerHeaderFields) {
assert(
!kProhibitedTrailerHeaders.includes(f),
diff --git a/std/http/io_test.ts b/std/http/io_test.ts
index 6c96d0b95..7261964d0 100644
--- a/std/http/io_test.ts
+++ b/std/http/io_test.ts
@@ -4,7 +4,7 @@ import {
assertEquals,
assert,
assertNotEOF,
- assertNotEquals
+ assertNotEquals,
} from "../testing/asserts.ts";
import {
bodyReader,
@@ -12,7 +12,7 @@ import {
readTrailers,
parseHTTPVersion,
readRequest,
- writeResponse
+ writeResponse,
} from "./io.ts";
import { encode, decode } from "../strings/mod.ts";
import { BufReader, ReadLineResult } from "../io/bufio.ts";
@@ -39,7 +39,7 @@ test("chunkedBodyReader", async () => {
chunkify(5, "b"),
chunkify(11, "c"),
chunkify(22, "d"),
- chunkify(0, "")
+ chunkify(0, ""),
].join("");
const h = new Headers();
const r = chunkedBodyReader(h, new BufReader(new Buffer(encode(body))));
@@ -64,10 +64,10 @@ test("chunkedBodyReader with trailers", async () => {
chunkify(0, ""),
"deno: land\r\n",
"node: js\r\n",
- "\r\n"
+ "\r\n",
].join("");
const h = new Headers({
- trailer: "deno,node"
+ trailer: "deno,node",
});
const r = chunkedBodyReader(h, new BufReader(new Buffer(encode(body))));
assertEquals(h.has("trailer"), true);
@@ -83,7 +83,7 @@ test("chunkedBodyReader with trailers", async () => {
test("readTrailers", async () => {
const h = new Headers({
- trailer: "deno,node"
+ trailer: "deno,node",
});
const trailer = ["deno: land", "node: js", "", ""].join("\r\n");
await readTrailers(h, new BufReader(new Buffer(encode(trailer))));
@@ -96,11 +96,11 @@ test("readTrailer should throw if undeclared headers found in trailer", async ()
const patterns = [
["deno,node", "deno: land\r\nnode: js\r\ngo: lang\r\n\r\n"],
["deno", "node: js\r\n\r\n"],
- ["deno", "node:js\r\ngo: lang\r\n\r\n"]
+ ["deno", "node:js\r\ngo: lang\r\n\r\n"],
];
for (const [header, trailer] of patterns) {
const h = new Headers({
- trailer: header
+ trailer: header,
});
await assertThrowsAsync(
async () => {
@@ -115,7 +115,7 @@ test("readTrailer should throw if undeclared headers found in trailer", async ()
test("readTrailer should throw if trailer contains prohibited fields", async () => {
for (const f of ["content-length", "trailer", "transfer-encoding"]) {
const h = new Headers({
- trailer: f
+ trailer: f,
});
await assertThrowsAsync(
async () => {
@@ -192,7 +192,7 @@ test("parseHttpVersion", (): void => {
{ in: "HTTP/-1.0", err: true },
{ in: "HTTP/0.-1", err: true },
{ in: "HTTP/", err: true },
- { in: "HTTP/1,0", err: true }
+ { in: "HTTP/1,0", err: true },
];
for (const t of testCases) {
let r, err;
@@ -320,10 +320,10 @@ test("writeResponse with trailer", async () => {
status: 200,
headers: new Headers({
"transfer-encoding": "chunked",
- trailer: "deno,node"
+ trailer: "deno,node",
}),
body,
- trailers: () => new Headers({ deno: "land", node: "js" })
+ trailers: () => new Headers({ deno: "land", node: "js" }),
});
const ret = w.toString();
const exp = [
@@ -338,7 +338,7 @@ test("writeResponse with trailer", async () => {
"deno: land",
"node: js",
"",
- ""
+ "",
].join("\r\n");
assertEquals(ret, exp);
});
@@ -365,20 +365,20 @@ test(async function testReadRequestError(): Promise<void> {
const testCases = [
{
in: "GET / HTTP/1.1\r\nheader: foo\r\n\r\n",
- headers: [{ key: "header", value: "foo" }]
+ headers: [{ key: "header", value: "foo" }],
},
{
in: "GET / HTTP/1.1\r\nheader:foo\r\n",
- err: Deno.errors.UnexpectedEof
+ err: Deno.errors.UnexpectedEof,
},
{ in: "", err: Deno.EOF },
{
in: "HEAD / HTTP/1.1\r\nContent-Length:4\r\n\r\n",
- err: "http: method cannot contain a Content-Length"
+ err: "http: method cannot contain a Content-Length",
},
{
in: "HEAD / HTTP/1.1\r\n\r\n",
- headers: []
+ headers: [],
},
// Multiple Content-Length values should either be
// deduplicated if same or reject otherwise
@@ -387,23 +387,23 @@ test(async function testReadRequestError(): Promise<void> {
in:
"POST / HTTP/1.1\r\nContent-Length: 10\r\nContent-Length: 0\r\n\r\n" +
"Gopher hey\r\n",
- err: "cannot contain multiple Content-Length headers"
+ err: "cannot contain multiple Content-Length headers",
},
{
in:
"POST / HTTP/1.1\r\nContent-Length: 10\r\nContent-Length: 6\r\n\r\n" +
"Gopher\r\n",
- err: "cannot contain multiple Content-Length headers"
+ err: "cannot contain multiple Content-Length headers",
},
{
in:
"PUT / HTTP/1.1\r\nContent-Length: 6 \r\nContent-Length: 6\r\n" +
"Content-Length:6\r\n\r\nGopher\r\n",
- headers: [{ key: "Content-Length", value: "6" }]
+ headers: [{ key: "Content-Length", value: "6" }],
},
{
in: "PUT / HTTP/1.1\r\nContent-Length: 1\r\nContent-Length: 6 \r\n\r\n",
- err: "cannot contain multiple Content-Length headers"
+ err: "cannot contain multiple Content-Length headers",
},
// Setting an empty header is swallowed by textproto
// see: readMIMEHeader()
@@ -413,15 +413,15 @@ test(async function testReadRequestError(): Promise<void> {
// },
{
in: "HEAD / HTTP/1.1\r\nContent-Length:0\r\nContent-Length: 0\r\n\r\n",
- headers: [{ key: "Content-Length", value: "0" }]
+ headers: [{ key: "Content-Length", value: "0" }],
},
{
in:
"POST / HTTP/1.1\r\nContent-Length:0\r\ntransfer-encoding: " +
"chunked\r\n\r\n",
headers: [],
- err: "http: Transfer-Encoding and Content-Length cannot be send together"
- }
+ err: "http: Transfer-Encoding and Content-Length cannot be send together",
+ },
];
for (const test of testCases) {
const reader = new BufReader(new StringReader(test.in));
diff --git a/std/http/mock.ts b/std/http/mock.ts
index cee697bed..64bd3fcb9 100644
--- a/std/http/mock.ts
+++ b/std/http/mock.ts
@@ -4,12 +4,12 @@ export function mockConn(base: Partial<Deno.Conn> = {}): Deno.Conn {
localAddr: {
transport: "tcp",
hostname: "",
- port: 0
+ port: 0,
},
remoteAddr: {
transport: "tcp",
hostname: "",
- port: 0
+ port: 0,
},
rid: -1,
closeRead: (): void => {},
@@ -21,6 +21,6 @@ export function mockConn(base: Partial<Deno.Conn> = {}): Deno.Conn {
return Promise.resolve(-1);
},
close: (): void => {},
- ...base
+ ...base,
};
}
diff --git a/std/http/racing_server_test.ts b/std/http/racing_server_test.ts
index 865777599..037e91ef9 100644
--- a/std/http/racing_server_test.ts
+++ b/std/http/racing_server_test.ts
@@ -7,7 +7,7 @@ let server: Deno.Process;
async function startServer(): Promise<void> {
server = run({
cmd: [Deno.execPath(), "run", "-A", "http/racing_server.ts"],
- stdout: "piped"
+ stdout: "piped",
});
// Once racing server is ready it will write to its stdout.
assert(server.stdout != null);
@@ -27,7 +27,7 @@ const input = [
"POST / HTTP/1.1\r\ncontent-length: 4\r\n\r\ndeno",
"POST / HTTP/1.1\r\ntransfer-encoding: chunked\r\n\r\n4\r\ndeno\r\n0\r\n\r\n",
"POST / HTTP/1.1\r\ntransfer-encoding: chunked\r\ntrailer: deno\r\n\r\n4\r\ndeno\r\n0\r\n\r\ndeno: land\r\n\r\n",
- "GET / HTTP/1.1\r\n\r\n"
+ "GET / HTTP/1.1\r\n\r\n",
].join("");
const HUGE_BODY_SIZE = 1024 * 1024;
const output = `HTTP/1.1 200 OK
diff --git a/std/http/server.ts b/std/http/server.ts
index 2cd51b005..00f401f62 100644
--- a/std/http/server.ts
+++ b/std/http/server.ts
@@ -7,7 +7,7 @@ import {
chunkedBodyReader,
emptyReader,
writeResponse,
- readRequest
+ readRequest,
} from "./io.ts";
import Listener = Deno.Listener;
import Conn = Deno.Conn;
@@ -298,7 +298,7 @@ export type HTTPSOptions = Omit<Deno.ListenTLSOptions, "transport">;
export function serveTLS(options: HTTPSOptions): Server {
const tlsOptions: Deno.ListenTLSOptions = {
...options,
- transport: "tcp"
+ transport: "tcp",
};
const listener = listenTLS(tlsOptions);
return new Server(listener);
diff --git a/std/http/server_test.ts b/std/http/server_test.ts
index f66b190b2..d6b2be053 100644
--- a/std/http/server_test.ts
+++ b/std/http/server_test.ts
@@ -11,7 +11,7 @@ import {
assertEquals,
assertNotEOF,
assertStrContains,
- assertThrowsAsync
+ assertThrowsAsync,
} from "../testing/asserts.ts";
import { Response, ServerRequest, Server, serve } from "./server.ts";
import { BufReader, BufWriter } from "../io/bufio.ts";
@@ -30,27 +30,27 @@ const responseTests: ResponseTest[] = [
// Default response
{
response: {},
- raw: "HTTP/1.1 200 OK\r\n" + "content-length: 0" + "\r\n\r\n"
+ raw: "HTTP/1.1 200 OK\r\n" + "content-length: 0" + "\r\n\r\n",
},
// Empty body with status
{
response: {
- status: 404
+ status: 404,
},
- raw: "HTTP/1.1 404 Not Found\r\n" + "content-length: 0" + "\r\n\r\n"
+ raw: "HTTP/1.1 404 Not Found\r\n" + "content-length: 0" + "\r\n\r\n",
},
// HTTP/1.1, chunked coding; empty trailer; close
{
response: {
status: 200,
- body: new Buffer(new TextEncoder().encode("abcdef"))
+ body: new Buffer(new TextEncoder().encode("abcdef")),
},
raw:
"HTTP/1.1 200 OK\r\n" +
"transfer-encoding: chunked\r\n\r\n" +
- "6\r\nabcdef\r\n0\r\n\r\n"
- }
+ "6\r\nabcdef\r\n0\r\n\r\n",
+ },
];
test(async function responseWrite(): Promise<void> {
@@ -118,7 +118,7 @@ function totalReader(r: Deno.Reader): TotalReader {
read,
get total(): number {
return _total;
- }
+ },
};
}
test(async function requestBodyWithContentLength(): Promise<void> {
@@ -169,7 +169,7 @@ test("ServerRequest.finalize() should consume unread body / chunked, trailers",
"deno: land",
"node: js",
"",
- ""
+ "",
].join("\r\n");
const req = new ServerRequest();
req.headers = new Headers();
@@ -357,7 +357,7 @@ test({
// Runs a simple server as another process
const p = Deno.run({
cmd: [Deno.execPath(), "--allow-net", "http/testdata/simple_server.ts"],
- stdout: "piped"
+ stdout: "piped",
});
let serverIsRunning = true;
@@ -387,7 +387,7 @@ test({
p.stdout!.close();
p.close();
}
- }
+ },
});
test({
@@ -401,9 +401,9 @@ test({
Deno.execPath(),
"--allow-net",
"--allow-read",
- "http/testdata/simple_https_server.ts"
+ "http/testdata/simple_https_server.ts",
],
- stdout: "piped"
+ stdout: "piped",
});
let serverIsRunning = true;
@@ -425,7 +425,7 @@ test({
const conn = await Deno.connectTLS({
hostname: "localhost",
port: 4503,
- certFile: "http/testdata/tls/RootCA.pem"
+ certFile: "http/testdata/tls/RootCA.pem",
});
await Deno.writeAll(
conn,
@@ -444,7 +444,7 @@ test({
p.stdout!.close();
p.close();
}
- }
+ },
});
test("close server while iterating", async (): Promise<void> => {
@@ -485,7 +485,7 @@ test({
const resources = Deno.resources();
assertEquals(resources[conn.rid], "tcpStream");
conn.close();
- }
+ },
});
test({
@@ -498,7 +498,7 @@ test({
await assertThrowsAsync(async () => {
await req.respond({
status: 12345,
- body: new TextEncoder().encode("Hello World")
+ body: new TextEncoder().encode("Hello World"),
});
}, Deno.errors.InvalidData);
// The connection should be destroyed
@@ -509,7 +509,7 @@ test({
const p = serverRoutine();
const conn = await Deno.connect({
hostname: "127.0.0.1",
- port: 8124
+ port: 8124,
});
await Deno.writeAll(
conn,
@@ -517,5 +517,5 @@ test({
);
conn.close();
await p;
- }
+ },
});
diff --git a/std/io/bufio.ts b/std/io/bufio.ts
index a944adfed..87613e341 100644
--- a/std/io/bufio.ts
+++ b/std/io/bufio.ts
@@ -212,8 +212,9 @@ export class BufReader implements Reader {
* For simple uses, a Scanner may be more convenient.
*/
async readString(delim: string): Promise<string | Deno.EOF> {
- if (delim.length !== 1)
+ if (delim.length !== 1) {
throw new Error("Delimiter should be a single character");
+ }
const buffer = await this.readSlice(delim.charCodeAt(0));
if (buffer == Deno.EOF) return Deno.EOF;
return new TextDecoder().decode(buffer);
diff --git a/std/io/bufio_test.ts b/std/io/bufio_test.ts
index ae38f6667..c1b1b856b 100644
--- a/std/io/bufio_test.ts
+++ b/std/io/bufio_test.ts
@@ -9,7 +9,7 @@ import {
assert,
assertEquals,
fail,
- assertNotEOF
+ assertNotEOF,
} from "../testing/asserts.ts";
import {
BufReader,
@@ -17,7 +17,7 @@ import {
BufferFullError,
PartialReadError,
readStringDelim,
- readLines
+ readLines,
} from "./bufio.ts";
import * as iotest from "./iotest.ts";
import { charCode, copyBytes, stringsReader } from "./util.ts";
@@ -55,9 +55,9 @@ const readMakers: ReadMaker[] = [
{ name: "full", fn: (r): Reader => r },
{
name: "byte",
- fn: (r): iotest.OneByteReader => new iotest.OneByteReader(r)
+ fn: (r): iotest.OneByteReader => new iotest.OneByteReader(r),
},
- { name: "half", fn: (r): iotest.HalfReader => new iotest.HalfReader(r) }
+ { name: "half", fn: (r): iotest.HalfReader => new iotest.HalfReader(r) },
// TODO { name: "data+err", r => new iotest.DataErrReader(r) },
// { name: "timeout", fn: r => new iotest.TimeoutReader(r) },
];
@@ -89,7 +89,7 @@ const bufreaders: NamedBufReader[] = [
{ name: "4", fn: (b: BufReader): Promise<string> => reads(b, 4) },
{ name: "5", fn: (b: BufReader): Promise<string> => reads(b, 5) },
{ name: "7", fn: (b: BufReader): Promise<string> => reads(b, 7) },
- { name: "bytes", fn: readBytes }
+ { name: "bytes", fn: readBytes },
// { name: "lines", fn: readLines },
];
@@ -104,7 +104,7 @@ const bufsizes: number[] = [
93,
128,
1024,
- 4096
+ 4096,
];
Deno.test(async function bufioBufReader(): Promise<void> {
diff --git a/std/io/ioutil_test.ts b/std/io/ioutil_test.ts
index 3d85a0fa1..d00986da5 100644
--- a/std/io/ioutil_test.ts
+++ b/std/io/ioutil_test.ts
@@ -7,7 +7,7 @@ import {
readInt,
readLong,
readShort,
- sliceLongToBytes
+ sliceLongToBytes,
} from "./ioutil.ts";
import { BufReader } from "./bufio.ts";
import { stringsReader } from "./util.ts";
diff --git a/std/io/util_test.ts b/std/io/util_test.ts
index 2fcad9305..17f11b945 100644
--- a/std/io/util_test.ts
+++ b/std/io/util_test.ts
@@ -4,7 +4,7 @@ import { assert, assertEquals } from "../testing/asserts.ts";
import * as path from "../path/mod.ts";
import { copyBytes, tempFile } from "./util.ts";
-test("[io/tuil] copyBytes", function(): void {
+test("[io/tuil] copyBytes", function (): void {
const dst = new Uint8Array(4);
dst.fill(0);
@@ -40,14 +40,14 @@ test("[io/tuil] copyBytes", function(): void {
test({
name: "[io/util] tempfile",
- fn: async function(): Promise<void> {
+ fn: async function (): Promise<void> {
const f = await tempFile(".", {
prefix: "prefix-",
- postfix: "-postfix"
+ postfix: "-postfix",
});
const base = path.basename(f.filepath);
assert(!!base.match(/^prefix-.+?-postfix$/));
f.file.close();
await remove(f.filepath);
- }
+ },
});
diff --git a/std/log/README.md b/std/log/README.md
index 613e69922..dea1e5fe7 100644
--- a/std/log/README.md
+++ b/std/log/README.md
@@ -21,22 +21,22 @@ await log.setup({
file: new log.handlers.FileHandler("WARNING", {
filename: "./log.txt",
// you can change format of output message
- formatter: "{levelName} {msg}"
- })
+ formatter: "{levelName} {msg}",
+ }),
},
loggers: {
// configure default logger available via short-hand methods above
default: {
level: "DEBUG",
- handlers: ["console", "file"]
+ handlers: ["console", "file"],
},
tasks: {
level: "ERROR",
- handlers: ["console"]
- }
- }
+ handlers: ["console"],
+ },
+ },
});
let logger;
diff --git a/std/log/handlers_test.ts b/std/log/handlers_test.ts
index 693d2a485..4feffdaf9 100644
--- a/std/log/handlers_test.ts
+++ b/std/log/handlers_test.ts
@@ -21,8 +21,8 @@ test(function simpleHandler(): void {
"INFO info-test",
"WARNING warning-test",
"ERROR error-test",
- "CRITICAL critical-test"
- ]
+ "CRITICAL critical-test",
+ ],
],
[
LogLevel.INFO,
@@ -30,15 +30,15 @@ test(function simpleHandler(): void {
"INFO info-test",
"WARNING warning-test",
"ERROR error-test",
- "CRITICAL critical-test"
- ]
+ "CRITICAL critical-test",
+ ],
],
[
LogLevel.WARNING,
- ["WARNING warning-test", "ERROR error-test", "CRITICAL critical-test"]
+ ["WARNING warning-test", "ERROR error-test", "CRITICAL critical-test"],
],
[LogLevel.ERROR, ["ERROR error-test", "CRITICAL critical-test"]],
- [LogLevel.CRITICAL, ["CRITICAL critical-test"]]
+ [LogLevel.CRITICAL, ["CRITICAL critical-test"]],
]);
for (const [testCase, messages] of cases.entries()) {
@@ -52,7 +52,7 @@ test(function simpleHandler(): void {
args: [],
datetime: new Date(),
level: level,
- levelName: levelName
+ levelName: levelName,
});
}
@@ -64,7 +64,7 @@ test(function simpleHandler(): void {
test(function testFormatterAsString(): void {
const handler = new TestHandler("DEBUG", {
- formatter: "test {levelName} {msg}"
+ formatter: "test {levelName} {msg}",
});
handler.handle({
@@ -72,7 +72,7 @@ test(function testFormatterAsString(): void {
args: [],
datetime: new Date(),
level: LogLevel.DEBUG,
- levelName: "DEBUG"
+ levelName: "DEBUG",
});
assertEquals(handler.messages, ["test DEBUG Hello, world!"]);
@@ -81,7 +81,7 @@ test(function testFormatterAsString(): void {
test(function testFormatterAsFunction(): void {
const handler = new TestHandler("DEBUG", {
formatter: (logRecord): string =>
- `fn formmatter ${logRecord.levelName} ${logRecord.msg}`
+ `fn formmatter ${logRecord.levelName} ${logRecord.msg}`,
});
handler.handle({
@@ -89,7 +89,7 @@ test(function testFormatterAsFunction(): void {
args: [],
datetime: new Date(),
level: LogLevel.ERROR,
- levelName: "ERROR"
+ levelName: "ERROR",
});
assertEquals(handler.messages, ["fn formmatter ERROR Hello, world!"]);
diff --git a/std/log/levels.ts b/std/log/levels.ts
index 599629f85..be960dd57 100644
--- a/std/log/levels.ts
+++ b/std/log/levels.ts
@@ -5,7 +5,7 @@ export const LogLevel: Record<string, number> = {
INFO: 20,
WARNING: 30,
ERROR: 40,
- CRITICAL: 50
+ CRITICAL: 50,
};
const byLevel = {
@@ -14,7 +14,7 @@ const byLevel = {
[LogLevel.INFO]: "INFO",
[LogLevel.WARNING]: "WARNING",
[LogLevel.ERROR]: "ERROR",
- [LogLevel.CRITICAL]: "CRITICAL"
+ [LogLevel.CRITICAL]: "CRITICAL",
};
export function getLevelByName(name: string): number {
diff --git a/std/log/logger.ts b/std/log/logger.ts
index 99d17ef48..226b8dba6 100644
--- a/std/log/logger.ts
+++ b/std/log/logger.ts
@@ -34,7 +34,7 @@ export class Logger {
args: args,
datetime: new Date(),
level: level,
- levelName: getLevelName(level)
+ levelName: getLevelName(level),
};
this.handlers.forEach((handler): void => {
handler.handle(record);
diff --git a/std/log/logger_test.ts b/std/log/logger_test.ts
index 76ff4cf95..3e8898afa 100644
--- a/std/log/logger_test.ts
+++ b/std/log/logger_test.ts
@@ -67,7 +67,7 @@ test(function logFunctions(): void {
"INFO bar",
"WARNING baz",
"ERROR boo",
- "CRITICAL doo"
+ "CRITICAL doo",
]);
handler = doLog("INFO");
@@ -76,7 +76,7 @@ test(function logFunctions(): void {
"INFO bar",
"WARNING baz",
"ERROR boo",
- "CRITICAL doo"
+ "CRITICAL doo",
]);
handler = doLog("WARNING");
diff --git a/std/log/mod.ts b/std/log/mod.ts
index b89896264..333e90fb9 100644
--- a/std/log/mod.ts
+++ b/std/log/mod.ts
@@ -4,7 +4,7 @@ import {
BaseHandler,
ConsoleHandler,
WriterHandler,
- FileHandler
+ FileHandler,
} from "./handlers.ts";
import { assert } from "../testing/asserts.ts";
@@ -25,28 +25,28 @@ export interface LogConfig {
const DEFAULT_LEVEL = "INFO";
const DEFAULT_CONFIG: LogConfig = {
handlers: {
- default: new ConsoleHandler(DEFAULT_LEVEL)
+ default: new ConsoleHandler(DEFAULT_LEVEL),
},
loggers: {
default: {
level: DEFAULT_LEVEL,
- handlers: ["default"]
- }
- }
+ handlers: ["default"],
+ },
+ },
};
const state = {
handlers: new Map<string, BaseHandler>(),
loggers: new Map<string, Logger>(),
- config: DEFAULT_CONFIG
+ config: DEFAULT_CONFIG,
};
export const handlers = {
BaseHandler,
ConsoleHandler,
WriterHandler,
- FileHandler
+ FileHandler,
};
export function getLogger(name?: string): Logger {
@@ -81,7 +81,7 @@ export const critical = (msg: string, ...args: unknown[]): void =>
export async function setup(config: LogConfig): Promise<void> {
state.config = {
handlers: { ...DEFAULT_CONFIG.handlers, ...config.handlers },
- loggers: { ...DEFAULT_CONFIG.loggers, ...config.loggers }
+ loggers: { ...DEFAULT_CONFIG.loggers, ...config.loggers },
};
// tear down existing handlers
diff --git a/std/log/test.ts b/std/log/test.ts
index d4385968c..858f722e2 100644
--- a/std/log/test.ts
+++ b/std/log/test.ts
@@ -20,7 +20,7 @@ test(async function defaultHandlers(): Promise<void> {
INFO: log.info,
WARNING: log.warning,
ERROR: log.error,
- CRITICAL: log.critical
+ CRITICAL: log.critical,
};
for (const levelName in LogLevel) {
@@ -33,14 +33,14 @@ test(async function defaultHandlers(): Promise<void> {
await log.setup({
handlers: {
- default: handler
+ default: handler,
},
loggers: {
default: {
level: levelName,
- handlers: ["default"]
- }
- }
+ handlers: ["default"],
+ },
+ },
});
logger("foo");
@@ -55,14 +55,14 @@ test(async function getLogger(): Promise<void> {
await log.setup({
handlers: {
- default: handler
+ default: handler,
},
loggers: {
default: {
level: "DEBUG",
- handlers: ["default"]
- }
- }
+ handlers: ["default"],
+ },
+ },
});
const logger = log.getLogger();
@@ -76,14 +76,14 @@ test(async function getLoggerWithName(): Promise<void> {
await log.setup({
handlers: {
- foo: fooHandler
+ foo: fooHandler,
},
loggers: {
bar: {
level: "INFO",
- handlers: ["foo"]
- }
- }
+ handlers: ["foo"],
+ },
+ },
});
const logger = log.getLogger("bar");
@@ -95,7 +95,7 @@ test(async function getLoggerWithName(): Promise<void> {
test(async function getLoggerUnknown(): Promise<void> {
await log.setup({
handlers: {},
- loggers: {}
+ loggers: {},
});
const logger = log.getLogger("nonexistent");
diff --git a/std/manual.md b/std/manual.md
index f073d1508..1e8fefcb1 100644
--- a/std/manual.md
+++ b/std/manual.md
@@ -366,7 +366,7 @@ Example:
```ts
// create subprocess
const p = Deno.run({
- cmd: ["echo", "hello"]
+ cmd: ["echo", "hello"],
});
// await its completion
@@ -398,10 +398,10 @@ const p = Deno.run({
"run",
"--allow-read",
"https://deno.land/std/examples/cat.ts",
- ...fileNames
+ ...fileNames,
],
stdout: "piped",
- stderr: "piped"
+ stderr: "piped",
});
const { code } = await p.status();
@@ -557,7 +557,7 @@ assertion library across a large project. Rather than importing
export {
assert,
assertEquals,
- assertStrContains
+ assertStrContains,
} from "https://deno.land/std/testing/asserts.ts";
```
@@ -676,10 +676,10 @@ TypeScript `"dom"` library:
const [errors, emitted] = await Deno.compile(
"main.ts",
{
- "main.ts": `document.getElementById("foo");\n`
+ "main.ts": `document.getElementById("foo");\n`,
},
{
- lib: ["dom", "esnext"]
+ lib: ["dom", "esnext"],
}
);
```
@@ -716,10 +716,10 @@ lib in the array. For example:
const [errors, emitted] = await Deno.compile(
"main.ts",
{
- "main.ts": `document.getElementById("foo");\n`
+ "main.ts": `document.getElementById("foo");\n`,
},
{
- lib: ["dom", "esnext", "deno.ns"]
+ lib: ["dom", "esnext", "deno.ns"],
}
);
```
@@ -745,7 +745,7 @@ It would compiler without errors like this:
```ts
const [errors, emitted] = await Deno.compile("./main.ts", undefined, {
- lib: ["esnext"]
+ lib: ["esnext"],
});
```
@@ -1059,7 +1059,7 @@ An example of providing sources:
```ts
const [diagnostics, emitMap] = await Deno.compile("/foo.ts", {
"/foo.ts": `import * as bar from "./bar.ts";\nconsole.log(bar);\n`,
- "/bar.ts": `export const bar = "bar";\n`
+ "/bar.ts": `export const bar = "bar";\n`,
});
assert(diagnostics == null); // ensuring no diagnostics are returned
@@ -1104,7 +1104,7 @@ An example of providing sources:
```ts
const [diagnostics, emit] = await Deno.bundle("/foo.ts", {
"/foo.ts": `import * as bar from "./bar.ts";\nconsole.log(bar);\n`,
- "/bar.ts": `export const bar = "bar";\n`
+ "/bar.ts": `export const bar = "bar";\n`,
});
assert(diagnostics == null); // ensuring no diagnostics are returned
@@ -1145,7 +1145,7 @@ An example:
```ts
const result = await Deno.transpileOnly({
- "/foo.ts": `enum Foo { Foo, Bar, Baz };\n`
+ "/foo.ts": `enum Foo { Foo, Bar, Baz };\n`,
});
console.log(result["/foo.ts"].source);
diff --git a/std/media_types/test.ts b/std/media_types/test.ts
index 3a9a7d9fe..c3caf71df 100644
--- a/std/media_types/test.ts
+++ b/std/media_types/test.ts
@@ -8,7 +8,7 @@ import {
extension,
charset,
extensions,
- types
+ types,
} from "./mod.ts";
test(function testLookup(): void {
diff --git a/std/mime/multipart.ts b/std/mime/multipart.ts
index d4bd693fd..a0f40f3b0 100644
--- a/std/mime/multipart.ts
+++ b/std/mime/multipart.ts
@@ -305,7 +305,7 @@ export class MultipartReader {
const ext = extname(p.fileName);
const { file, filepath } = await tempFile(".", {
prefix: "multipart-",
- postfix: ext
+ postfix: ext,
});
try {
const size = await copyN(
@@ -318,7 +318,7 @@ export class MultipartReader {
filename: p.fileName,
type: contentType,
tempfile: filepath,
- size
+ size,
};
} catch (e) {
await remove(filepath);
@@ -328,7 +328,7 @@ export class MultipartReader {
filename: p.fileName,
type: contentType,
content: buf.bytes(),
- size: buf.length
+ size: buf.length,
};
maxMemory -= n;
maxValueBytes -= n;
diff --git a/std/mime/multipart_test.ts b/std/mime/multipart_test.ts
index 7c383d447..9b96a2f4c 100644
--- a/std/mime/multipart_test.ts
+++ b/std/mime/multipart_test.ts
@@ -5,7 +5,7 @@ import {
assert,
assertEquals,
assertThrows,
- assertThrowsAsync
+ assertThrowsAsync,
} from "../testing/asserts.ts";
const { test } = Deno;
import * as path from "../path/mod.ts";
@@ -15,7 +15,7 @@ import {
MultipartWriter,
isFormFile,
matchAfterPrefix,
- scanUntilBoundary
+ scanUntilBoundary,
} from "./multipart.ts";
import { StringWriter } from "../io/writers.ts";
diff --git a/std/node/_fs/_fs_appendFile.ts b/std/node/_fs/_fs_appendFile.ts
index 49a4fc29f..f3b44dd7b 100644
--- a/std/node/_fs/_fs_appendFile.ts
+++ b/std/node/_fs/_fs_appendFile.ts
@@ -55,7 +55,7 @@ export function appendFile(
closeRidIfNecessary(typeof pathOrRid === "string", rid);
callbackFn();
})
- .catch(err => {
+ .catch((err) => {
closeRidIfNecessary(typeof pathOrRid === "string", rid);
callbackFn(err);
});
diff --git a/std/node/_fs/_fs_appendFile_test.ts b/std/node/_fs/_fs_appendFile_test.ts
index 47d552740..ca48dc5d3 100644
--- a/std/node/_fs/_fs_appendFile_test.ts
+++ b/std/node/_fs/_fs_appendFile_test.ts
@@ -15,7 +15,7 @@ test({
Error,
"No callback function supplied"
);
- }
+ },
});
test({
@@ -48,12 +48,12 @@ test({
assertThrows(
() =>
appendFileSync("some/path", "some data", {
- encoding: "made-up-encoding"
+ encoding: "made-up-encoding",
}),
Error,
"Only 'utf8' encoding is currently supported"
);
- }
+ },
});
test({
@@ -63,10 +63,10 @@ test({
const file: Deno.File = await Deno.open(tempFile, {
create: true,
write: true,
- read: true
+ read: true,
});
await new Promise((resolve, reject) => {
- appendFile(file.rid, "hello world", err => {
+ appendFile(file.rid, "hello world", (err) => {
if (err) reject();
else resolve();
});
@@ -82,7 +82,7 @@ test({
Deno.close(file.rid);
await Deno.remove(tempFile);
});
- }
+ },
});
test({
@@ -90,7 +90,7 @@ test({
async fn() {
const openResourcesBeforeAppend: Deno.ResourceMap = Deno.resources();
await new Promise((resolve, reject) => {
- appendFile("_fs_appendFile_test_file.txt", "hello world", err => {
+ appendFile("_fs_appendFile_test_file.txt", "hello world", (err) => {
if (err) reject(err);
else resolve();
});
@@ -100,13 +100,13 @@ test({
const data = await Deno.readFile("_fs_appendFile_test_file.txt");
assertEquals(decoder.decode(data), "hello world");
})
- .catch(err => {
+ .catch((err) => {
fail("No error was expected: " + err);
})
.finally(async () => {
await Deno.remove("_fs_appendFile_test_file.txt");
});
- }
+ },
});
test({
@@ -116,7 +116,7 @@ test({
const openResourcesBeforeAppend: Deno.ResourceMap = Deno.resources();
const tempFile: string = await Deno.makeTempFile();
await new Promise((resolve, reject) => {
- appendFile(tempFile, "hello world", { flag: "ax" }, err => {
+ appendFile(tempFile, "hello world", { flag: "ax" }, (err) => {
if (err) reject(err);
else resolve();
});
@@ -130,7 +130,7 @@ test({
.finally(async () => {
await Deno.remove(tempFile);
});
- }
+ },
});
test({
@@ -140,14 +140,14 @@ test({
const file: Deno.File = Deno.openSync(tempFile, {
create: true,
write: true,
- read: true
+ read: true,
});
appendFileSync(file.rid, "hello world");
Deno.close(file.rid);
const data = Deno.readFileSync(tempFile);
assertEquals(decoder.decode(data), "hello world");
Deno.removeSync(tempFile);
- }
+ },
});
test({
@@ -159,7 +159,7 @@ test({
const data = Deno.readFileSync("_fs_appendFile_test_file_sync.txt");
assertEquals(decoder.decode(data), "hello world");
Deno.removeSync("_fs_appendFile_test_file_sync.txt");
- }
+ },
});
test({
@@ -175,5 +175,5 @@ test({
);
assertEquals(Deno.resources(), openResourcesBeforeAppend);
Deno.removeSync(tempFile);
- }
+ },
});
diff --git a/std/node/_fs/_fs_chmod.ts b/std/node/_fs/_fs_chmod.ts
index cecb878ec..0eb01a8a6 100644
--- a/std/node/_fs/_fs_chmod.ts
+++ b/std/node/_fs/_fs_chmod.ts
@@ -24,7 +24,7 @@ export function chmod(
.then(() => {
callback();
})
- .catch(err => {
+ .catch((err) => {
callback(err);
});
}
diff --git a/std/node/_fs/_fs_chmod_test.ts b/std/node/_fs/_fs_chmod_test.ts
index 8d420b3be..a3d814b51 100644
--- a/std/node/_fs/_fs_chmod_test.ts
+++ b/std/node/_fs/_fs_chmod_test.ts
@@ -10,7 +10,7 @@ test({
const tempFile: string = await Deno.makeTempFile();
const originalFileMode: number | null = (await Deno.lstat(tempFile)).mode;
await new Promise((resolve, reject) => {
- chmod(tempFile, 0o777, err => {
+ chmod(tempFile, 0o777, (err) => {
if (err) reject(err);
else resolve();
});
@@ -26,7 +26,7 @@ test({
.finally(() => {
Deno.removeSync(tempFile);
});
- }
+ },
});
test({
@@ -41,5 +41,5 @@ test({
assert(newFileMode && originalFileMode);
assert(newFileMode === 33279 && newFileMode > originalFileMode);
Deno.removeSync(tempFile);
- }
+ },
});
diff --git a/std/node/_fs/_fs_chown.ts b/std/node/_fs/_fs_chown.ts
index 008b30c47..94b7401d0 100644
--- a/std/node/_fs/_fs_chown.ts
+++ b/std/node/_fs/_fs_chown.ts
@@ -23,7 +23,7 @@ export function chown(
.then(() => {
callback();
})
- .catch(err => {
+ .catch((err) => {
callback(err);
});
}
diff --git a/std/node/_fs/_fs_chown_test.ts b/std/node/_fs/_fs_chown_test.ts
index bdf2ae09a..fd31a8c62 100644
--- a/std/node/_fs/_fs_chown_test.ts
+++ b/std/node/_fs/_fs_chown_test.ts
@@ -14,7 +14,7 @@ test({
const originalUserId: number | null = (await Deno.lstat(tempFile)).uid;
const originalGroupId: number | null = (await Deno.lstat(tempFile)).gid;
await new Promise((resolve, reject) => {
- chown(tempFile, originalUserId!, originalGroupId!, err => {
+ chown(tempFile, originalUserId!, originalGroupId!, (err) => {
if (err) reject(err);
else resolve();
});
@@ -31,7 +31,7 @@ test({
.finally(() => {
Deno.removeSync(tempFile);
});
- }
+ },
});
test({
@@ -48,5 +48,5 @@ test({
assertEquals(newUserId, originalUserId);
assertEquals(newGroupId, originalGroupId);
Deno.removeSync(tempFile);
- }
+ },
});
diff --git a/std/node/_fs/_fs_close.ts b/std/node/_fs/_fs_close.ts
index 4ec10eefb..469bdc77b 100644
--- a/std/node/_fs/_fs_close.ts
+++ b/std/node/_fs/_fs_close.ts
@@ -14,7 +14,7 @@ export function close(fd: number, callback: CallbackWithError): void {
.then(() => {
callback();
})
- .catch(err => {
+ .catch((err) => {
callback(err);
});
}
diff --git a/std/node/_fs/_fs_close_test.ts b/std/node/_fs/_fs_close_test.ts
index 7c6dd684c..8bcd662c9 100644
--- a/std/node/_fs/_fs_close_test.ts
+++ b/std/node/_fs/_fs_close_test.ts
@@ -11,7 +11,7 @@ test({
assert(Deno.resources()[file.rid]);
await new Promise((resolve, reject) => {
- close(file.rid, err => {
+ close(file.rid, (err) => {
if (err) reject();
else resolve();
});
@@ -25,7 +25,7 @@ test({
.finally(async () => {
await Deno.remove(tempFile);
});
- }
+ },
});
test({
@@ -38,5 +38,5 @@ test({
closeSync(file.rid);
assert(!Deno.resources()[file.rid]);
Deno.removeSync(tempFile);
- }
+ },
});
diff --git a/std/node/_fs/_fs_dir.ts b/std/node/_fs/_fs_dir.ts
index e3830bb31..c5bb368c9 100644
--- a/std/node/_fs/_fs_dir.ts
+++ b/std/node/_fs/_fs_dir.ts
@@ -30,7 +30,7 @@ export default class Dir {
try {
if (this.initializationOfDirectoryFilesIsRequired()) {
const denoFiles: Deno.FileInfo[] = await Deno.readdir(this.path);
- this.files = denoFiles.map(file => new Dirent(file));
+ this.files = denoFiles.map((file) => new Dirent(file));
}
const nextFile = this.files.pop();
if (nextFile) {
@@ -55,7 +55,7 @@ export default class Dir {
readSync(): Dirent | null {
if (this.initializationOfDirectoryFilesIsRequired()) {
this.files.push(
- ...Deno.readdirSync(this.path).map(file => new Dirent(file))
+ ...Deno.readdirSync(this.path).map((file) => new Dirent(file))
);
}
const dirent: Dirent | undefined = this.files.pop();
diff --git a/std/node/_fs/_fs_dir_test.ts b/std/node/_fs/_fs_dir_test.ts
index be276887b..6ee044391 100644
--- a/std/node/_fs/_fs_dir_test.ts
+++ b/std/node/_fs/_fs_dir_test.ts
@@ -13,21 +13,21 @@ test({
calledBack = true;
});
assert(calledBack);
- }
+ },
});
test({
name: "Closing current directory without callback returns void Promise",
async fn() {
await new Dir(".").close();
- }
+ },
});
test({
name: "Closing current directory synchronously works",
fn() {
new Dir(".").closeSync();
- }
+ },
});
test({
@@ -37,7 +37,7 @@ test({
const enc: Uint8Array = new TextEncoder().encode("std/node");
assertEquals(new Dir(enc).path, "std/node");
- }
+ },
});
test({
@@ -64,7 +64,7 @@ test({
} finally {
Deno.removeSync(testDir);
}
- }
+ },
});
test({
@@ -103,7 +103,7 @@ test({
} finally {
Deno.removeSync(testDir, { recursive: true });
}
- }
+ },
});
test({
@@ -132,7 +132,7 @@ test({
} finally {
Deno.removeSync(testDir, { recursive: true });
}
- }
+ },
});
test({
@@ -158,5 +158,5 @@ test({
} finally {
Deno.removeSync(testDir, { recursive: true });
}
- }
+ },
});
diff --git a/std/node/_fs/_fs_dirent_test.ts b/std/node/_fs/_fs_dirent_test.ts
index 36091d3e1..1b1d38d38 100644
--- a/std/node/_fs/_fs_dirent_test.ts
+++ b/std/node/_fs/_fs_dirent_test.ts
@@ -40,7 +40,7 @@ test({
fileInfo.blocks = 5;
assert(new Dirent(fileInfo).isBlockDevice());
assert(!new Dirent(fileInfo).isCharacterDevice());
- }
+ },
});
test({
@@ -50,7 +50,7 @@ test({
fileInfo.blocks = null;
assert(new Dirent(fileInfo).isCharacterDevice());
assert(!new Dirent(fileInfo).isBlockDevice());
- }
+ },
});
test({
@@ -63,7 +63,7 @@ test({
assert(new Dirent(fileInfo).isDirectory());
assert(!new Dirent(fileInfo).isFile());
assert(!new Dirent(fileInfo).isSymbolicLink());
- }
+ },
});
test({
@@ -76,7 +76,7 @@ test({
assert(!new Dirent(fileInfo).isDirectory());
assert(new Dirent(fileInfo).isFile());
assert(!new Dirent(fileInfo).isSymbolicLink());
- }
+ },
});
test({
@@ -89,7 +89,7 @@ test({
assert(!new Dirent(fileInfo).isDirectory());
assert(!new Dirent(fileInfo).isFile());
assert(new Dirent(fileInfo).isSymbolicLink());
- }
+ },
});
test({
@@ -98,7 +98,7 @@ test({
const fileInfo: FileInfoMock = new FileInfoMock();
fileInfo.name = "my_file";
assertEquals(new Dirent(fileInfo).name, "my_file");
- }
+ },
});
test({
@@ -119,5 +119,5 @@ test({
Error,
"does not yet support"
);
- }
+ },
});
diff --git a/std/node/_fs/_fs_readFile.ts b/std/node/_fs/_fs_readFile.ts
index 05bad6f3d..13e82bfe1 100644
--- a/std/node/_fs/_fs_readFile.ts
+++ b/std/node/_fs/_fs_readFile.ts
@@ -3,7 +3,7 @@
import {
notImplemented,
intoCallbackAPIWithIntercept,
- MaybeEmpty
+ MaybeEmpty,
} from "../_utils.ts";
const { readFile: denoReadFile, readFileSync: denoReadFileSync } = Deno;
diff --git a/std/node/_fs/_fs_readlink.ts b/std/node/_fs/_fs_readlink.ts
index d1cb69f51..1fd7e3c14 100644
--- a/std/node/_fs/_fs_readlink.ts
+++ b/std/node/_fs/_fs_readlink.ts
@@ -2,7 +2,7 @@
import {
intoCallbackAPIWithIntercept,
MaybeEmpty,
- notImplemented
+ notImplemented,
} from "../_utils.ts";
const { readlink: denoReadlink, readlinkSync: denoReadlinkSync } = Deno;
diff --git a/std/node/_fs/_fs_readlink_test.ts b/std/node/_fs/_fs_readlink_test.ts
index 653d1a598..151d3f782 100644
--- a/std/node/_fs/_fs_readlink_test.ts
+++ b/std/node/_fs/_fs_readlink_test.ts
@@ -25,7 +25,7 @@ test({
assertEquals(typeof data, "string");
assertEquals(data as string, oldname);
- }
+ },
});
test({
@@ -43,7 +43,7 @@ test({
assert(data instanceof Uint8Array);
assertEquals(new TextDecoder().decode(data as Uint8Array), oldname);
- }
+ },
});
test({
@@ -53,7 +53,7 @@ test({
const data = readlinkSync(newname);
assertEquals(typeof data, "string");
assertEquals(data as string, oldname);
- }
+ },
});
test({
@@ -63,5 +63,5 @@ test({
const data = readlinkSync(newname, { encoding: "buffer" });
assert(data instanceof Uint8Array);
assertEquals(new TextDecoder().decode(data as Uint8Array), oldname);
- }
+ },
});
diff --git a/std/node/_utils.ts b/std/node/_utils.ts
index f0808e82b..ec89d11a8 100644
--- a/std/node/_utils.ts
+++ b/std/node/_utils.ts
@@ -17,8 +17,8 @@ export function intoCallbackAPI<T>(
...args: any[]
): void {
func(...args)
- .then(value => cb && cb(null, value))
- .catch(err => cb && cb(err, null));
+ .then((value) => cb && cb(null, value))
+ .catch((err) => cb && cb(err, null));
}
export function intoCallbackAPIWithIntercept<T1, T2>(
@@ -30,6 +30,6 @@ export function intoCallbackAPIWithIntercept<T1, T2>(
...args: any[]
): void {
func(...args)
- .then(value => cb && cb(null, interceptor(value)))
- .catch(err => cb && cb(err, null));
+ .then((value) => cb && cb(null, interceptor(value)))
+ .catch((err) => cb && cb(err, null));
}
diff --git a/std/node/events.ts b/std/node/events.ts
index b2f1d6026..aa62e4d43 100644
--- a/std/node/events.ts
+++ b/std/node/events.ts
@@ -219,7 +219,7 @@ export default class EventEmitter {
eventName: string | symbol,
listener: Function
): WrappedFunction {
- const wrapper = function(
+ const wrapper = function (
this: {
eventName: string | symbol;
listener: Function;
@@ -235,7 +235,7 @@ export default class EventEmitter {
eventName: eventName,
listener: listener,
rawListener: (wrapper as unknown) as WrappedFunction,
- context: this
+ context: this,
};
const wrapped = (wrapper.bind(
wrapperContext
@@ -462,7 +462,7 @@ export function on(
}
// Wait until an event happens
- return new Promise(function(resolve, reject) {
+ return new Promise(function (resolve, reject) {
unconsumedPromises.push({ resolve, reject });
});
},
@@ -489,7 +489,7 @@ export function on(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[Symbol.asyncIterator](): any {
return this;
- }
+ },
};
emitter.on(event, eventHandler);
diff --git a/std/node/events_test.ts b/std/node/events_test.ts
index b0b74e499..5960290af 100644
--- a/std/node/events_test.ts
+++ b/std/node/events_test.ts
@@ -3,7 +3,7 @@ import {
assert,
assertEquals,
fail,
- assertThrows
+ assertThrows,
} from "../testing/asserts.ts";
import EventEmitter, { WrappedFunction, once, on } from "./events.ts";
@@ -29,7 +29,7 @@ test({
eventsFired = [];
testEmitter.emit("event");
assertEquals(eventsFired, ["event"]);
- }
+ },
});
test({
@@ -41,7 +41,7 @@ test({
testEmitter.on("removeListener", () => {
eventsFired.push("removeListener");
});
- const eventFunction = function(): void {
+ const eventFunction = function (): void {
eventsFired.push("event");
};
testEmitter.on("event", eventFunction);
@@ -49,7 +49,7 @@ test({
assertEquals(eventsFired, []);
testEmitter.removeListener("event", eventFunction);
assertEquals(eventsFired, ["removeListener"]);
- }
+ },
});
test({
@@ -62,7 +62,7 @@ test({
EventEmitter.defaultMaxListeners = 20;
assertEquals(EventEmitter.defaultMaxListeners, 20);
EventEmitter.defaultMaxListeners = 10; //reset back to original value
- }
+ },
});
test({
@@ -73,7 +73,7 @@ test({
assertEquals(1, testEmitter.listenerCount("event"));
testEmitter.on("event", shouldNeverBeEmitted);
assertEquals(2, testEmitter.listenerCount("event"));
- }
+ },
});
test({
@@ -100,7 +100,7 @@ test({
);
testEmitter.emit("event", 1, 2, 3);
assertEquals(eventsFired, ["event(1)", "event(1, 2)", "event(1, 2, 3)"]);
- }
+ },
});
test({
@@ -112,7 +112,7 @@ test({
const sym = Symbol("symbol");
testEmitter.on(sym, shouldNeverBeEmitted);
assertEquals(testEmitter.eventNames(), ["event", sym]);
- }
+ },
});
test({
@@ -122,7 +122,7 @@ test({
assertEquals(testEmitter.getMaxListeners(), 10);
testEmitter.setMaxListeners(20);
assertEquals(testEmitter.getMaxListeners(), 20);
- }
+ },
});
test({
@@ -135,9 +135,9 @@ test({
testEmitter.on("event", testFunction);
assertEquals(testEmitter.listeners("event"), [
shouldNeverBeEmitted,
- testFunction
+ testFunction,
]);
- }
+ },
});
test({
@@ -148,7 +148,7 @@ test({
assertEquals(testEmitter.listenerCount("event"), 1);
testEmitter.off("event", shouldNeverBeEmitted);
assertEquals(testEmitter.listenerCount("event"), 0);
- }
+ },
});
test({
@@ -159,7 +159,7 @@ test({
.on("event", shouldNeverBeEmitted)
.on("event", shouldNeverBeEmitted);
assertEquals(testEmitter.listenerCount("event"), 2);
- }
+ },
});
test({
@@ -183,7 +183,7 @@ test({
testEmitter.emit("single event");
testEmitter.emit("single event");
assertEquals(eventsFired, ["single event"]);
- }
+ },
});
test({
@@ -203,7 +203,7 @@ test({
});
testEmitter.emit("event");
assertEquals(eventsFired, ["third", "first", "second"]);
- }
+ },
});
test({
@@ -223,7 +223,7 @@ test({
testEmitter.emit("event");
testEmitter.emit("event");
assertEquals(eventsFired, ["third", "first", "second", "first", "second"]);
- }
+ },
});
test({
@@ -242,7 +242,7 @@ test({
assertEquals(testEmitter.listenerCount("event"), 0);
assertEquals(testEmitter.listenerCount("other event"), 0);
- }
+ },
});
test({
@@ -265,7 +265,7 @@ test({
assertEquals(testEmitter.listenerCount("event"), 0);
assertEquals(testEmitter.listenerCount("other event"), 0);
- }
+ },
});
test({
@@ -284,7 +284,7 @@ test({
testEmitter.removeListener("non-existant event", madeUpEvent);
assertEquals(testEmitter.listenerCount("event"), 1);
- }
+ },
});
test({
@@ -307,7 +307,7 @@ test({
eventsProcessed = [];
testEmitter.emit("event");
assertEquals(eventsProcessed, ["A"]);
- }
+ },
});
test({
@@ -330,7 +330,7 @@ test({
(rawListenersForOnceEvent[0] as WrappedFunction).listener,
listenerB
);
- }
+ },
});
test({
@@ -353,7 +353,7 @@ test({
wrappedFn(); // executing the wrapped listener function will remove it from the event
assertEquals(eventsProcessed, ["A"]);
assertEquals(testEmitter.listeners("once-event").length, 0);
- }
+ },
});
test({
@@ -366,7 +366,7 @@ test({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const valueArr: any[] = await once(ee, "event");
assertEquals(valueArr, [42, "foo"]);
- }
+ },
});
test({
@@ -380,7 +380,7 @@ test({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const eventObj: any[] = await once(et, "event");
assert(!eventObj[0].isTrusted);
- }
+ },
});
test({
@@ -402,7 +402,7 @@ test({
Error,
"must be 'an integer'"
);
- }
+ },
});
test({
@@ -440,7 +440,7 @@ test({
});
ee.emit("error");
assertEquals(events, ["errorMonitor event", "error"]);
- }
+ },
});
test({
@@ -468,7 +468,7 @@ test({
}
assertEquals(ee.listenerCount("foo"), 0);
assertEquals(ee.listenerCount("error"), 0);
- }
+ },
});
test({
@@ -493,7 +493,7 @@ test({
assertEquals(err, _err);
}
assertEquals(thrown, true);
- }
+ },
});
test({
@@ -522,7 +522,7 @@ test({
assertEquals(thrown, true);
assertEquals(ee.listenerCount("foo"), 0);
assertEquals(ee.listenerCount("error"), 0);
- }
+ },
});
test({
@@ -548,7 +548,7 @@ test({
assertEquals(ee.listenerCount("foo"), 0);
assertEquals(ee.listenerCount("error"), 0);
- }
+ },
});
test({
@@ -557,7 +557,7 @@ test({
const ee = new EventEmitter();
const iterable = on(ee, "foo");
- setTimeout(function() {
+ setTimeout(function () {
ee.emit("foo", "bar");
ee.emit("foo", 42);
iterable.return();
@@ -566,29 +566,29 @@ test({
const results = await Promise.all([
iterable.next(),
iterable.next(),
- iterable.next()
+ iterable.next(),
]);
assertEquals(results, [
{
value: ["bar"],
- done: false
+ done: false,
},
{
value: [42],
- done: false
+ done: false,
},
{
value: undefined,
- done: true
- }
+ done: true,
+ },
]);
assertEquals(await iterable.next(), {
value: undefined,
- done: true
+ done: true,
});
- }
+ },
});
test({
@@ -620,5 +620,5 @@ test({
assertEquals(expected.length, 0);
assertEquals(ee.listenerCount("foo"), 0);
assertEquals(ee.listenerCount("error"), 0);
- }
+ },
});
diff --git a/std/node/fs.ts b/std/node/fs.ts
index 9135441bb..0681ee5a1 100755
--- a/std/node/fs.ts
+++ b/std/node/fs.ts
@@ -24,5 +24,5 @@ export {
readFile,
readFileSync,
readlink,
- readlinkSync
+ readlinkSync,
};
diff --git a/std/node/module.ts b/std/node/module.ts
index 21992f743..522eaec7e 100644
--- a/std/node/module.ts
+++ b/std/node/module.ts
@@ -108,7 +108,7 @@ class Module {
// Proxy related code removed.
static wrapper = [
"(function (exports, require, module, __filename, __dirname) { ",
- "\n});"
+ "\n});",
];
// Loads a module at the given file path. Returns that module's
@@ -235,7 +235,9 @@ class Module {
const lookupPaths = Module._resolveLookupPaths(request, fakeParent);
for (let j = 0; j < lookupPaths!.length; j++) {
- if (!paths.includes(lookupPaths![j])) paths.push(lookupPaths![j]);
+ if (!paths.includes(lookupPaths![j])) {
+ paths.push(lookupPaths![j]);
+ }
}
}
}
@@ -357,8 +359,9 @@ class Module {
const cachedModule = Module._cache[filename];
if (cachedModule !== undefined) {
updateChildren(parent, cachedModule, true);
- if (!cachedModule.loaded)
+ if (!cachedModule.loaded) {
return getExportsForCircularRequire(cachedModule);
+ }
return cachedModule.exports;
}
delete relativeResolveCache[relResolveCacheIdentifier];
@@ -370,8 +373,9 @@ class Module {
const cachedModule = Module._cache[filename];
if (cachedModule !== undefined) {
updateChildren(parent, cachedModule, true);
- if (!cachedModule.loaded)
+ if (!cachedModule.loaded) {
return getExportsForCircularRequire(cachedModule);
+ }
return cachedModule.exports;
}
@@ -436,8 +440,9 @@ class Module {
if (
from.charCodeAt(from.length - 1) === CHAR_BACKWARD_SLASH &&
from.charCodeAt(from.length - 2) === CHAR_COLON
- )
+ ) {
return [from + "node_modules"];
+ }
const paths = [];
for (let i = from.length - 1, p = 0, last = from.length; i >= 0; --i) {
@@ -663,7 +668,7 @@ function readPackage(requestPath: string): PackageInfo | null {
name: parsed.name,
main: parsed.main,
exports: parsed.exports,
- type: parsed.type
+ type: parsed.type,
};
packageJsonCache.set(jsonPath, filtered);
return filtered;
@@ -685,11 +690,12 @@ function readPackageScope(
checkPath = checkPath.slice(0, separatorIndex);
if (checkPath.endsWith(path.sep + "node_modules")) return false;
const pjson = readPackage(checkPath);
- if (pjson)
+ if (pjson) {
return {
path: checkPath,
- data: pjson
+ data: pjson,
};
+ }
}
return false;
}
@@ -822,11 +828,13 @@ function applyExports(basePath: string, expansion: string): string {
const mappingKey = `.${expansion}`;
let pkgExports = readPackageExports(basePath);
- if (pkgExports === undefined || pkgExports === null)
+ if (pkgExports === undefined || pkgExports === null) {
return path.resolve(basePath, mappingKey);
+ }
- if (isConditionalDotExportSugar(pkgExports, basePath))
+ if (isConditionalDotExportSugar(pkgExports, basePath)) {
pkgExports = { ".": pkgExports };
+ }
if (typeof pkgExports === "object") {
if (pkgExports.hasOwnProperty(mappingKey)) {
@@ -1005,11 +1013,12 @@ const CircularRequirePrototypeWarningProxy = new Proxy(
},
getOwnPropertyDescriptor(target, prop): PropertyDescriptor | undefined {
- if (target.hasOwnProperty(prop))
+ if (target.hasOwnProperty(prop)) {
return Object.getOwnPropertyDescriptor(target, prop);
+ }
emitCircularRequireWarning(prop);
return undefined;
- }
+ },
}
);
@@ -1230,16 +1239,21 @@ function pathToFileURL(filepath: string): URL {
(filePathLast === CHAR_FORWARD_SLASH ||
(isWindows && filePathLast === CHAR_BACKWARD_SLASH)) &&
resolved[resolved.length - 1] !== path.sep
- )
+ ) {
resolved += "/";
+ }
const outURL = new URL("file://");
if (resolved.includes("%")) resolved = resolved.replace(percentRegEx, "%25");
// In posix, "/" is a valid character in paths
- if (!isWindows && resolved.includes("\\"))
+ if (!isWindows && resolved.includes("\\")) {
resolved = resolved.replace(backslashRegEx, "%5C");
- if (resolved.includes("\n")) resolved = resolved.replace(newlineRegEx, "%0A");
- if (resolved.includes("\r"))
+ }
+ if (resolved.includes("\n")) {
+ resolved = resolved.replace(newlineRegEx, "%0A");
+ }
+ if (resolved.includes("\r")) {
resolved = resolved.replace(carriageReturnRegEx, "%0D");
+ }
if (resolved.includes("\t")) resolved = resolved.replace(tabRegEx, "%09");
outURL.pathname = resolved;
return outURL;
diff --git a/std/node/os.ts b/std/node/os.ts
index 4bc70d1ff..7c61e910b 100644
--- a/std/node/os.ts
+++ b/std/node/os.ts
@@ -219,7 +219,7 @@ export const constants = {
signals: Deno.Signal,
priority: {
// see https://nodejs.org/docs/latest-v12.x/api/os.html#os_priority_constants
- }
+ },
};
export const EOL = Deno.build.os == "win" ? fsEOL.CRLF : fsEOL.LF;
diff --git a/std/node/os_test.ts b/std/node/os_test.ts
index a73a2d4e9..f0b9ca79d 100644
--- a/std/node/os_test.ts
+++ b/std/node/os_test.ts
@@ -6,42 +6,42 @@ test({
name: "build architecture is a string",
fn() {
assertEquals(typeof os.arch(), "string");
- }
+ },
});
test({
name: "home directory is a string",
fn() {
assertEquals(typeof os.homedir(), "string");
- }
+ },
});
test({
name: "tmp directory is a string",
fn() {
assertEquals(typeof os.tmpdir(), "string");
- }
+ },
});
test({
name: "hostname is a string",
fn() {
assertEquals(typeof os.hostname(), "string");
- }
+ },
});
test({
name: "platform is a string",
fn() {
assertEquals(typeof os.platform(), "string");
- }
+ },
});
test({
name: "release is a string",
fn() {
assertEquals(typeof os.release(), "string");
- }
+ },
});
test({
@@ -61,7 +61,7 @@ test({
Error,
"must be >= -2147483648 && <= 2147483647"
);
- }
+ },
});
test({
@@ -81,7 +81,7 @@ test({
Error,
"pid must be >= -2147483648 && <= 2147483647"
);
- }
+ },
});
test({
@@ -115,7 +115,7 @@ test({
Error,
"priority must be >= -20 && <= 19"
);
- }
+ },
});
test({
@@ -150,7 +150,7 @@ test({
Error,
"priority must be >= -20 && <= 19"
);
- }
+ },
});
test({
@@ -160,21 +160,21 @@ test({
assertEquals(os.constants.signals.SIGKILL, Deno.Signal.SIGKILL);
assertEquals(os.constants.signals.SIGCONT, Deno.Signal.SIGCONT);
assertEquals(os.constants.signals.SIGXFSZ, Deno.Signal.SIGXFSZ);
- }
+ },
});
test({
name: "EOL is as expected",
fn() {
assert(os.EOL == "\r\n" || os.EOL == "\n");
- }
+ },
});
test({
name: "Endianness is determined",
fn() {
assert(["LE", "BE"].includes(os.endianness()));
- }
+ },
});
test({
@@ -185,7 +185,7 @@ test({
assertEquals(typeof result[0], "number");
assertEquals(typeof result[1], "number");
assertEquals(typeof result[2], "number");
- }
+ },
});
test({
@@ -196,7 +196,7 @@ test({
assertEquals(`${os.homedir}`, os.homedir());
assertEquals(`${os.hostname}`, os.hostname());
assertEquals(`${os.platform}`, os.platform());
- }
+ },
});
test({
@@ -265,5 +265,5 @@ test({
Error,
"Not implemented"
);
- }
+ },
});
diff --git a/std/node/process.ts b/std/node/process.ts
index 35de23b88..89d383e8e 100644
--- a/std/node/process.ts
+++ b/std/node/process.ts
@@ -4,7 +4,7 @@ const version = `v${Deno.version.deno}`;
const versions = {
node: Deno.version.deno,
- ...Deno.version
+ ...Deno.version,
};
const osToPlatform = (os: Deno.OperatingSystem): string =>
@@ -38,5 +38,5 @@ export const process = {
get argv(): string[] {
// Deno.execPath() also requires --allow-env
return [Deno.execPath(), ...Deno.args];
- }
+ },
};
diff --git a/std/node/process_test.ts b/std/node/process_test.ts
index f44143acb..b9d5388ea 100644
--- a/std/node/process_test.ts
+++ b/std/node/process_test.ts
@@ -14,7 +14,7 @@ test({
assert(process.cwd().match(/\Wnode$/));
process.chdir("..");
assert(process.cwd().match(/\Wstd$/));
- }
+ },
});
test({
@@ -30,7 +30,7 @@ test({
// "The system cannot find the file specified. (os error 2)" so "file" is
// the only common string here.
);
- }
+ },
});
test({
@@ -40,14 +40,14 @@ test({
assertEquals(typeof process.version, "string");
assertEquals(typeof process.versions, "object");
assertEquals(typeof process.versions.node, "string");
- }
+ },
});
test({
name: "process.platform",
fn() {
assertEquals(typeof process.platform, "string");
- }
+ },
});
test({
@@ -56,7 +56,7 @@ test({
assertEquals(typeof process.arch, "string");
// TODO(rsp): make sure that the arch strings should be the same in Node and Deno:
assertEquals(process.arch, Deno.build.arch);
- }
+ },
});
test({
@@ -64,7 +64,7 @@ test({
fn() {
assertEquals(typeof process.pid, "number");
assertEquals(process.pid, Deno.pid);
- }
+ },
});
test({
@@ -78,7 +78,7 @@ test({
Error,
"implemented"
);
- }
+ },
});
test({
@@ -90,12 +90,12 @@ test({
"deno included in the file name of argv[0]"
);
// we cannot test for anything else (we see test runner arguments here)
- }
+ },
});
test({
name: "process.env",
fn() {
assertEquals(typeof process.env.PATH, "string");
- }
+ },
});
diff --git a/std/node/querystring.ts b/std/node/querystring.ts
index fc5a00a13..427183bf0 100644
--- a/std/node/querystring.ts
+++ b/std/node/querystring.ts
@@ -13,7 +13,7 @@ export function parse(
): { [key: string]: string[] | string } {
const entries = str
.split(sep)
- .map(entry => entry.split(eq).map(decodeURIComponent));
+ .map((entry) => entry.split(eq).map(decodeURIComponent));
const final: { [key: string]: string[] | string } = {};
let i = 0;
diff --git a/std/node/querystring_test.ts b/std/node/querystring_test.ts
index d8cb1ec35..0a37eee6b 100644
--- a/std/node/querystring_test.ts
+++ b/std/node/querystring_test.ts
@@ -10,11 +10,11 @@ test({
a: "hello",
b: 5,
c: true,
- d: ["foo", "bar"]
+ d: ["foo", "bar"],
}),
"a=hello&b=5&c=true&d=foo&d=bar"
);
- }
+ },
});
test({
@@ -24,7 +24,7 @@ test({
a: "hello",
b: "5",
c: "true",
- d: ["foo", "bar"]
+ d: ["foo", "bar"],
});
- }
+ },
});
diff --git a/std/node/tests/cjs/cjs_builtin.js b/std/node/tests/cjs/cjs_builtin.js
index 3d182981a..d821d2558 100644
--- a/std/node/tests/cjs/cjs_builtin.js
+++ b/std/node/tests/cjs/cjs_builtin.js
@@ -6,5 +6,5 @@ const path = require("path");
module.exports = {
readFileSync: fs.readFileSync,
isNull: util.isNull,
- extname: path.extname
+ extname: path.extname,
};
diff --git a/std/node/tests/node_modules/left-pad/index.js b/std/node/tests/node_modules/left-pad/index.js
index e90aec35d..8501bca1b 100644
--- a/std/node/tests/node_modules/left-pad/index.js
+++ b/std/node/tests/node_modules/left-pad/index.js
@@ -3,37 +3,37 @@
* and/or modify it under the terms of the Do What The Fuck You Want
* To Public License, Version 2, as published by Sam Hocevar. See
* http://www.wtfpl.net/ for more details. */
-'use strict';
+"use strict";
module.exports = leftPad;
var cache = [
- '',
- ' ',
- ' ',
- ' ',
- ' ',
- ' ',
- ' ',
- ' ',
- ' ',
- ' '
+ "",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " ",
+ " "
];
-function leftPad (str, len, ch) {
+function leftPad(str, len, ch) {
// convert `str` to a `string`
- str = str + '';
+ str = str + "";
// `len` is the `pad`'s length now
len = len - str.length;
// doesn't need to pad
if (len <= 0) return str;
// `ch` defaults to `' '`
- if (!ch && ch !== 0) ch = ' ';
+ if (!ch && ch !== 0) ch = " ";
// convert `ch` to a `string` cuz it could be a number
- ch = ch + '';
+ ch = ch + "";
// cache common use cases
- if (ch === ' ' && len < 10) return cache[len] + str;
+ if (ch === " " && len < 10) return cache[len] + str;
// `pad` starts with an empty string
- var pad = '';
+ var pad = "";
// loop
while (true) {
// add `ch` to `pad` if `len` is odd
diff --git a/std/node/util_test.ts b/std/node/util_test.ts
index 751dba57e..05cec15df 100644
--- a/std/node/util_test.ts
+++ b/std/node/util_test.ts
@@ -11,7 +11,7 @@ test({
assert(util.isBoolean(false));
assert(!util.isBoolean("deno"));
assert(!util.isBoolean("true"));
- }
+ },
});
test({
@@ -22,7 +22,7 @@ test({
assert(!util.isNull(n));
assert(!util.isNull(0));
assert(!util.isNull({}));
- }
+ },
});
test({
@@ -33,7 +33,7 @@ test({
assert(util.isNullOrUndefined(n));
assert(!util.isNullOrUndefined({}));
assert(!util.isNullOrUndefined("undefined"));
- }
+ },
});
test({
@@ -43,7 +43,7 @@ test({
assert(util.isNumber(new Number(666)));
assert(!util.isNumber("999"));
assert(!util.isNumber(null));
- }
+ },
});
test({
@@ -52,7 +52,7 @@ test({
assert(util.isString("deno"));
assert(util.isString(new String("DIO")));
assert(!util.isString(1337));
- }
+ },
});
test({
@@ -61,7 +61,7 @@ test({
assert(util.isSymbol(Symbol()));
assert(!util.isSymbol(123));
assert(!util.isSymbol("string"));
- }
+ },
});
test({
@@ -71,7 +71,7 @@ test({
assert(util.isUndefined(t));
assert(!util.isUndefined("undefined"));
assert(!util.isUndefined({}));
- }
+ },
});
test({
@@ -81,7 +81,7 @@ test({
assert(util.isObject(dio));
assert(util.isObject(new RegExp(/Toki Wo Tomare/)));
assert(!util.isObject("Jotaro"));
- }
+ },
});
test({
@@ -93,17 +93,17 @@ test({
assert(util.isError(java));
assert(util.isError(nodejs));
assert(!util.isError(deno));
- }
+ },
});
test({
name: "[util] isFunction",
fn() {
- const f = function(): void {};
+ const f = function (): void {};
assert(util.isFunction(f));
assert(!util.isFunction({}));
assert(!util.isFunction(new RegExp(/f/)));
- }
+ },
});
test({
@@ -113,7 +113,7 @@ test({
assert(util.isRegExp(/fuManchu/));
assert(!util.isRegExp({ evil: "eye" }));
assert(!util.isRegExp(null));
- }
+ },
});
test({
@@ -122,5 +122,5 @@ test({
assert(util.isArray([]));
assert(!util.isArray({ yaNo: "array" }));
assert(!util.isArray(null));
- }
+ },
});
diff --git a/std/path/extname_test.ts b/std/path/extname_test.ts
index d9e14bb48..16ca7a2f9 100644
--- a/std/path/extname_test.ts
+++ b/std/path/extname_test.ts
@@ -49,11 +49,11 @@ const pairs = [
["file/", ""],
["file//", ""],
["file./", "."],
- ["file.//", "."]
+ ["file.//", "."],
];
test(function extname() {
- pairs.forEach(function(p) {
+ pairs.forEach(function (p) {
const input = p[0];
const expected = p[1];
assertEquals(expected, path.posix.extname(input));
@@ -71,7 +71,7 @@ test(function extname() {
});
test(function extnameWin32() {
- pairs.forEach(function(p) {
+ pairs.forEach(function (p) {
const input = p[0].replace(slashRE, "\\");
const expected = p[1];
assertEquals(expected, path.win32.extname(input));
diff --git a/std/path/glob.ts b/std/path/glob.ts
index 8eb106b25..a11865c26 100644
--- a/std/path/glob.ts
+++ b/std/path/glob.ts
@@ -44,7 +44,7 @@ export function globToRegExp(
extended,
globstar,
strict: false,
- filepath: true
+ filepath: true,
});
assert(result.path != null);
return result.path.regex;
diff --git a/std/path/glob_test.ts b/std/path/glob_test.ts
index d8da1a47b..8c49adeca 100644
--- a/std/path/glob_test.ts
+++ b/std/path/glob_test.ts
@@ -32,17 +32,17 @@ test({
);
assertEquals(
globToRegExp(join("unicorn", "!(sleeping)", "bathroom.ts"), {
- extended: true
+ extended: true,
}).test(join("unicorn", "flying", "bathroom.ts")),
true
);
assertEquals(
globToRegExp(join("unicorn", "(!sleeping)", "bathroom.ts"), {
- extended: true
+ extended: true,
}).test(join("unicorn", "sleeping", "bathroom.ts")),
false
);
- }
+ },
});
testWalk(
@@ -55,7 +55,7 @@ testWalk(
},
async function globInWalkWildcard(): Promise<void> {
const arr = await walkArray(".", {
- match: [globToRegExp(join("*", "*.ts"))]
+ match: [globToRegExp(join("*", "*.ts"))],
});
assertEquals(arr.length, 2);
assertEquals(arr[0], "a/x.ts");
@@ -74,9 +74,9 @@ testWalk(
match: [
globToRegExp(join("a", "**", "*.ts"), {
flags: "g",
- globstar: true
- })
- ]
+ globstar: true,
+ }),
+ ],
});
assertEquals(arr.length, 1);
assertEquals(arr[0], "a/yo/x.ts");
@@ -98,9 +98,9 @@ testWalk(
match: [
globToRegExp(join("a", "+(raptor|deno)", "*.ts"), {
flags: "g",
- extended: true
- })
- ]
+ extended: true,
+ }),
+ ],
});
assertEquals(arr.length, 2);
assertEquals(arr[0], "a/deno/x.ts");
@@ -116,7 +116,7 @@ testWalk(
},
async function globInWalkWildcardExtension(): Promise<void> {
const arr = await walkArray(".", {
- match: [globToRegExp("x.*", { flags: "g", globstar: true })]
+ match: [globToRegExp("x.*", { flags: "g", globstar: true })],
});
assertEquals(arr.length, 2);
assertEquals(arr[0], "x.js");
@@ -236,7 +236,7 @@ test({
assert(!isGlob("\\a/b/c/\\[a-z\\].js"));
assert(!isGlob("abc/\\(aaa|bbb).js"));
assert(!isGlob("abc/\\?.js"));
- }
+ },
});
test(function normalizeGlobGlobstar(): void {
diff --git a/std/path/globrex.ts b/std/path/globrex.ts
index 695294834..0fe833a52 100644
--- a/std/path/globrex.ts
+++ b/std/path/globrex.ts
@@ -54,7 +54,7 @@ export function globrex(
globstar = false,
strict = false,
filepath = false,
- flags = ""
+ flags = "",
}: GlobrexOptions = {}
): GlobrexResult {
const sepPattern = new RegExp(`^${SEP}${strict ? "" : "+"}$`);
@@ -319,7 +319,7 @@ export function globrex(
globstar: new RegExp(
!flags.includes("g") ? `^${GLOBSTAR_SEGMENT}$` : GLOBSTAR_SEGMENT,
flags
- )
+ ),
};
}
diff --git a/std/path/globrex_test.ts b/std/path/globrex_test.ts
index 29f039837..27541a5c8 100644
--- a/std/path/globrex_test.ts
+++ b/std/path/globrex_test.ts
@@ -34,7 +34,7 @@ test({
t.equal(typeof globrex, "function", "constructor is a typeof function");
t.equal(res instanceof Object, true, "returns object");
t.equal(res.regex.toString(), "/^.*\\.js$/", "returns regex object");
- }
+ },
});
test({
@@ -64,7 +64,7 @@ test({
true,
"match zero characters"
);
- }
+ },
});
test({
@@ -72,7 +72,7 @@ test({
fn(): void {
t.equal(
match("*.min.js", "http://example.com/jquery.min.js", {
- globstar: false
+ globstar: false,
}),
true,
"complex match"
@@ -84,7 +84,7 @@ test({
);
t.equal(
match("*/js/*.js", "http://example.com/js/jquery.min.js", {
- globstar: false
+ globstar: false,
}),
true,
"complex match"
@@ -171,11 +171,11 @@ test({
t.equal(match("/js*jq*.js", "http://example.com/js/jquery.min.js"), false);
t.equal(
match("/js*jq*.js", "http://example.com/js/jquery.min.js", {
- flags: "g"
+ flags: "g",
}),
true
);
- }
+ },
});
test({
@@ -215,7 +215,7 @@ test({
tester(true);
tester(false);
- }
+ },
});
test({
@@ -246,7 +246,7 @@ test({
tester(true);
tester(false);
- }
+ },
});
test({
@@ -304,7 +304,7 @@ test({
match("[[:digit:]b]/bar.txt", "a/bar.txt", { extended: true }),
false
);
- }
+ },
});
test({
@@ -320,7 +320,7 @@ test({
match("foo{bar,baaz}", "foobaaz", {
extended: true,
globstar,
- flag: "g"
+ flag: "g",
}),
true
);
@@ -328,7 +328,7 @@ test({
match("foo{bar,baaz}", "foobar", {
extended: true,
globstar,
- flag: "g"
+ flag: "g",
}),
true
);
@@ -336,7 +336,7 @@ test({
match("foo{bar,baaz}", "foobuzz", {
extended: true,
globstar,
- flag: "g"
+ flag: "g",
}),
false
);
@@ -344,7 +344,7 @@ test({
match("foo{bar,b*z}", "foobuzz", {
extended: true,
globstar,
- flag: "g"
+ flag: "g",
}),
true
);
@@ -352,7 +352,7 @@ test({
tester(true);
tester(false);
- }
+ },
});
test({
@@ -444,7 +444,7 @@ test({
tester(true);
tester(false);
- }
+ },
});
test({
@@ -471,7 +471,7 @@ test({
match("http://foo.com/**", "http://foo.com/bar/baz/jquery.min.js", {
extended: true,
globstar,
- flags: "g"
+ flags: "g",
}),
true
);
@@ -479,7 +479,7 @@ test({
tester(true);
tester(false);
- }
+ },
});
test({
@@ -496,7 +496,7 @@ test({
tester(true);
tester(false);
- }
+ },
});
test({
@@ -574,25 +574,25 @@ test({
t.equal(
match("http://foo.com/*", "http://foo.com/bar/baz/jquery.min.js", {
extended: true,
- globstar: true
+ globstar: true,
}),
false
);
t.equal(
match("http://foo.com/*", "http://foo.com/bar/baz/jquery.min.js", {
- globstar: true
+ globstar: true,
}),
false
);
t.equal(
match("http://foo.com/*", "http://foo.com/bar/baz/jquery.min.js", {
- globstar: false
+ globstar: false,
}),
true
);
t.equal(
match("http://foo.com/**", "http://foo.com/bar/baz/jquery.min.js", {
- globstar: true
+ globstar: true,
}),
true
);
@@ -636,7 +636,7 @@ test({
),
false
);
- }
+ },
});
test({
@@ -689,7 +689,7 @@ test({
match("?(ba[!zr]|qux)baz.txt", "bazbaz.txt", { extended: true }),
false
);
- }
+ },
});
test({
@@ -715,18 +715,18 @@ test({
t.equal(
match("*(foo|bar)/**/*.txt", "foo/hello/world/bar.txt", {
extended: true,
- globstar: true
+ globstar: true,
}),
true
);
t.equal(
match("*(foo|bar)/**/*.txt", "foo/world/bar.txt", {
extended: true,
- globstar: true
+ globstar: true,
}),
true
);
- }
+ },
});
test({
@@ -736,7 +736,7 @@ test({
t.equal(match("+foo.txt", "+foo.txt", { extended: true }), true);
t.equal(match("+(foo).txt", ".txt", { extended: true }), false);
t.equal(match("+(foo|bar).txt", "foobar.txt", { extended: true }), true);
- }
+ },
});
test({
@@ -757,7 +757,7 @@ test({
match("@(foo|baz)bar.txt", "toofoobar.txt", { extended: true }),
false
);
- }
+ },
});
test({
@@ -774,7 +774,7 @@ test({
match("!({foo,bar})baz.txt", "foobaz.txt", { extended: true }),
false
);
- }
+ },
});
test({
@@ -783,7 +783,7 @@ test({
t.equal(match("foo//bar.txt", "foo/bar.txt"), true);
t.equal(match("foo///bar.txt", "foo/bar.txt"), true);
t.equal(match("foo///bar.txt", "foo/bar.txt", { strict: true }), false);
- }
+ },
});
test({
@@ -791,7 +791,7 @@ test({
fn(): void {
t.equal(
match("**/*/?yfile.{md,js,txt}", "foo/bar/baz/myfile.md", {
- extended: true
+ extended: true,
}),
true
);
@@ -823,5 +823,5 @@ test({
match("[[:digit:]_.]/file.js", "z/file.js", { extended: true }),
false
);
- }
+ },
});
diff --git a/std/path/join_test.ts b/std/path/join_test.ts
index a73cf3679..d9a38fb82 100644
--- a/std/path/join_test.ts
+++ b/std/path/join_test.ts
@@ -53,7 +53,7 @@ const joinTests =
[["/", "//foo"], "/foo"],
[["/", "", "/foo"], "/foo"],
[["", "/", "foo"], "/foo"],
- [["", "/", "/foo"], "/foo"]
+ [["", "/", "/foo"], "/foo"],
];
// Windows-specific join tests
@@ -103,11 +103,11 @@ const windowsJoinTests = [
[["c:.", "/"], "c:.\\"],
[["c:.", "file"], "c:file"],
[["c:", "/"], "c:\\"],
- [["c:", "file"], "c:\\file"]
+ [["c:", "file"], "c:\\file"],
];
test(function join() {
- joinTests.forEach(function(p) {
+ joinTests.forEach(function (p) {
const _p = p[0] as string[];
const actual = path.posix.join.apply(null, _p);
assertEquals(actual, p[1]);
@@ -115,12 +115,12 @@ test(function join() {
});
test(function joinWin32() {
- joinTests.forEach(function(p) {
+ joinTests.forEach(function (p) {
const _p = p[0] as string[];
const actual = path.win32.join.apply(null, _p).replace(backslashRE, "/");
assertEquals(actual, p[1]);
});
- windowsJoinTests.forEach(function(p) {
+ windowsJoinTests.forEach(function (p) {
const _p = p[0] as string[];
const actual = path.win32.join.apply(null, _p);
assertEquals(actual, p[1]);
diff --git a/std/path/parse_format_test.ts b/std/path/parse_format_test.ts
index 0a7e83bba..60be3c9a1 100644
--- a/std/path/parse_format_test.ts
+++ b/std/path/parse_format_test.ts
@@ -24,15 +24,14 @@ const winPaths = [
["C:\\", "C:\\"],
["C:\\abc", "C:\\"],
["", ""],
-
// unc
["\\\\server\\share\\file_path", "\\\\server\\share\\"],
[
"\\\\server two\\shared folder\\file path.zip",
- "\\\\server two\\shared folder\\"
+ "\\\\server two\\shared folder\\",
],
["\\\\teela\\admin$\\system32", "\\\\teela\\admin$\\"],
- ["\\\\?\\UNC\\server\\share", "\\\\?\\UNC\\"]
+ ["\\\\?\\UNC\\server\\share", "\\\\?\\UNC\\"],
];
const winSpecialCaseParseTests = [["/foo/bar", { root: "/" }]];
@@ -44,7 +43,7 @@ const winSpecialCaseFormatTests = [
[{ name: "index", ext: ".html" }, "index.html"],
[{ dir: "some\\dir", name: "index", ext: ".html" }, "some\\dir\\index.html"],
[{ root: "C:\\", name: "index", ext: ".html" }, "C:\\index.html"],
- [{}, ""]
+ [{}, ""],
];
const unixPaths = [
@@ -68,7 +67,7 @@ const unixPaths = [
["/.", "/"],
["/.foo", "/"],
["/.foo.bar", "/"],
- ["/foo/bar.baz", "/"]
+ ["/foo/bar.baz", "/"],
];
const unixSpecialCaseFormatTests = [
@@ -78,11 +77,11 @@ const unixSpecialCaseFormatTests = [
[{ name: "index", ext: ".html" }, "index.html"],
[{ dir: "some/dir", name: "index", ext: ".html" }, "some/dir/index.html"],
[{ root: "/", name: "index", ext: ".html" }, "/index.html"],
- [{}, ""]
+ [{}, ""],
];
function checkParseFormat(path: any, paths: any): void {
- paths.forEach(function(p: Array<Record<string, unknown>>) {
+ paths.forEach(function (p: Array<Record<string, unknown>>) {
const element = p[0];
const output = path.parse(element);
assertEquals(typeof output.root, "string");
@@ -98,18 +97,18 @@ function checkParseFormat(path: any, paths: any): void {
}
function checkSpecialCaseParseFormat(path: any, testCases: any): void {
- testCases.forEach(function(testCase: Array<Record<string, unknown>>) {
+ testCases.forEach(function (testCase: Array<Record<string, unknown>>) {
const element = testCase[0];
const expect = testCase[1];
const output = path.parse(element);
- Object.keys(expect).forEach(function(key) {
+ Object.keys(expect).forEach(function (key) {
assertEquals(output[key], expect[key]);
});
});
}
function checkFormat(path: any, testCases: unknown[][]): void {
- testCases.forEach(function(testCase) {
+ testCases.forEach(function (testCase) {
assertEquals(path.format(testCase[0]), testCase[1]);
});
}
@@ -138,7 +137,7 @@ const windowsTrailingTests = [
["\\\\", { root: "\\", dir: "\\", base: "", ext: "", name: "" }],
[
"c:\\foo\\\\\\",
- { root: "c:\\", dir: "c:\\", base: "foo", ext: "", name: "foo" }
+ { root: "c:\\", dir: "c:\\", base: "foo", ext: "", name: "foo" },
],
[
"D:\\foo\\\\\\bar.baz",
@@ -147,9 +146,9 @@ const windowsTrailingTests = [
dir: "D:\\foo\\\\",
base: "bar.baz",
ext: ".baz",
- name: "bar"
- }
- ]
+ name: "bar",
+ },
+ ],
];
const posixTrailingTests = [
@@ -159,12 +158,12 @@ const posixTrailingTests = [
["/foo///", { root: "/", dir: "/", base: "foo", ext: "", name: "foo" }],
[
"/foo///bar.baz",
- { root: "/", dir: "/foo//", base: "bar.baz", ext: ".baz", name: "bar" }
- ]
+ { root: "/", dir: "/foo//", base: "bar.baz", ext: ".baz", name: "bar" },
+ ],
];
test(function parseTrailingWin32() {
- windowsTrailingTests.forEach(function(p) {
+ windowsTrailingTests.forEach(function (p) {
const actual = path.win32.parse(p[0] as string);
const expected = p[1];
assertEquals(actual, expected);
@@ -172,7 +171,7 @@ test(function parseTrailingWin32() {
});
test(function parseTrailing() {
- posixTrailingTests.forEach(function(p) {
+ posixTrailingTests.forEach(function (p) {
const actual = path.posix.parse(p[0] as string);
const expected = p[1];
assertEquals(actual, expected);
diff --git a/std/path/posix.ts b/std/path/posix.ts
index 4377fd542..ba4cf7499 100644
--- a/std/path/posix.ts
+++ b/std/path/posix.ts
@@ -9,7 +9,7 @@ import {
assertPath,
normalizeString,
isPosixPathSeparator,
- _format
+ _format,
} from "./utils.ts";
export const sep = "/";
@@ -205,8 +205,9 @@ export function dirname(path: string): string {
}
export function basename(path: string, ext = ""): string {
- if (ext !== undefined && typeof ext !== "string")
+ if (ext !== undefined && typeof ext !== "string") {
throw new TypeError('"ext" argument must be a string');
+ }
assertPath(path);
let start = 0;
diff --git a/std/path/relative_test.ts b/std/path/relative_test.ts
index 3fe5aab4b..af5896236 100644
--- a/std/path/relative_test.ts
+++ b/std/path/relative_test.ts
@@ -6,58 +6,52 @@ import { assertEquals } from "../testing/asserts.ts";
import * as path from "./mod.ts";
const relativeTests = {
- win32:
- // arguments result
- [
- ["c:/blah\\blah", "d:/games", "d:\\games"],
- ["c:/aaaa/bbbb", "c:/aaaa", ".."],
- ["c:/aaaa/bbbb", "c:/cccc", "..\\..\\cccc"],
- ["c:/aaaa/bbbb", "c:/aaaa/bbbb", ""],
- ["c:/aaaa/bbbb", "c:/aaaa/cccc", "..\\cccc"],
- ["c:/aaaa/", "c:/aaaa/cccc", "cccc"],
- ["c:/", "c:\\aaaa\\bbbb", "aaaa\\bbbb"],
- ["c:/aaaa/bbbb", "d:\\", "d:\\"],
- ["c:/AaAa/bbbb", "c:/aaaa/bbbb", ""],
- ["c:/aaaaa/", "c:/aaaa/cccc", "..\\aaaa\\cccc"],
- ["C:\\foo\\bar\\baz\\quux", "C:\\", "..\\..\\..\\.."],
- [
- "C:\\foo\\test",
- "C:\\foo\\test\\bar\\package.json",
- "bar\\package.json"
- ],
- ["C:\\foo\\bar\\baz-quux", "C:\\foo\\bar\\baz", "..\\baz"],
- ["C:\\foo\\bar\\baz", "C:\\foo\\bar\\baz-quux", "..\\baz-quux"],
- ["\\\\foo\\bar", "\\\\foo\\bar\\baz", "baz"],
- ["\\\\foo\\bar\\baz", "\\\\foo\\bar", ".."],
- ["\\\\foo\\bar\\baz-quux", "\\\\foo\\bar\\baz", "..\\baz"],
- ["\\\\foo\\bar\\baz", "\\\\foo\\bar\\baz-quux", "..\\baz-quux"],
- ["C:\\baz-quux", "C:\\baz", "..\\baz"],
- ["C:\\baz", "C:\\baz-quux", "..\\baz-quux"],
- ["\\\\foo\\baz-quux", "\\\\foo\\baz", "..\\baz"],
- ["\\\\foo\\baz", "\\\\foo\\baz-quux", "..\\baz-quux"],
- ["C:\\baz", "\\\\foo\\bar\\baz", "\\\\foo\\bar\\baz"],
- ["\\\\foo\\bar\\baz", "C:\\baz", "C:\\baz"]
- ],
- posix:
- // arguments result
- [
- ["/var/lib", "/var", ".."],
- ["/var/lib", "/bin", "../../bin"],
- ["/var/lib", "/var/lib", ""],
- ["/var/lib", "/var/apache", "../apache"],
- ["/var/", "/var/lib", "lib"],
- ["/", "/var/lib", "var/lib"],
- ["/foo/test", "/foo/test/bar/package.json", "bar/package.json"],
- ["/Users/a/web/b/test/mails", "/Users/a/web/b", "../.."],
- ["/foo/bar/baz-quux", "/foo/bar/baz", "../baz"],
- ["/foo/bar/baz", "/foo/bar/baz-quux", "../baz-quux"],
- ["/baz-quux", "/baz", "../baz"],
- ["/baz", "/baz-quux", "../baz-quux"]
- ]
+ // arguments result
+ win32: [
+ ["c:/blah\\blah", "d:/games", "d:\\games"],
+ ["c:/aaaa/bbbb", "c:/aaaa", ".."],
+ ["c:/aaaa/bbbb", "c:/cccc", "..\\..\\cccc"],
+ ["c:/aaaa/bbbb", "c:/aaaa/bbbb", ""],
+ ["c:/aaaa/bbbb", "c:/aaaa/cccc", "..\\cccc"],
+ ["c:/aaaa/", "c:/aaaa/cccc", "cccc"],
+ ["c:/", "c:\\aaaa\\bbbb", "aaaa\\bbbb"],
+ ["c:/aaaa/bbbb", "d:\\", "d:\\"],
+ ["c:/AaAa/bbbb", "c:/aaaa/bbbb", ""],
+ ["c:/aaaaa/", "c:/aaaa/cccc", "..\\aaaa\\cccc"],
+ ["C:\\foo\\bar\\baz\\quux", "C:\\", "..\\..\\..\\.."],
+ ["C:\\foo\\test", "C:\\foo\\test\\bar\\package.json", "bar\\package.json"],
+ ["C:\\foo\\bar\\baz-quux", "C:\\foo\\bar\\baz", "..\\baz"],
+ ["C:\\foo\\bar\\baz", "C:\\foo\\bar\\baz-quux", "..\\baz-quux"],
+ ["\\\\foo\\bar", "\\\\foo\\bar\\baz", "baz"],
+ ["\\\\foo\\bar\\baz", "\\\\foo\\bar", ".."],
+ ["\\\\foo\\bar\\baz-quux", "\\\\foo\\bar\\baz", "..\\baz"],
+ ["\\\\foo\\bar\\baz", "\\\\foo\\bar\\baz-quux", "..\\baz-quux"],
+ ["C:\\baz-quux", "C:\\baz", "..\\baz"],
+ ["C:\\baz", "C:\\baz-quux", "..\\baz-quux"],
+ ["\\\\foo\\baz-quux", "\\\\foo\\baz", "..\\baz"],
+ ["\\\\foo\\baz", "\\\\foo\\baz-quux", "..\\baz-quux"],
+ ["C:\\baz", "\\\\foo\\bar\\baz", "\\\\foo\\bar\\baz"],
+ ["\\\\foo\\bar\\baz", "C:\\baz", "C:\\baz"],
+ ],
+ // arguments result
+ posix: [
+ ["/var/lib", "/var", ".."],
+ ["/var/lib", "/bin", "../../bin"],
+ ["/var/lib", "/var/lib", ""],
+ ["/var/lib", "/var/apache", "../apache"],
+ ["/var/", "/var/lib", "lib"],
+ ["/", "/var/lib", "var/lib"],
+ ["/foo/test", "/foo/test/bar/package.json", "bar/package.json"],
+ ["/Users/a/web/b/test/mails", "/Users/a/web/b", "../.."],
+ ["/foo/bar/baz-quux", "/foo/bar/baz", "../baz"],
+ ["/foo/bar/baz", "/foo/bar/baz-quux", "../baz-quux"],
+ ["/baz-quux", "/baz", "../baz"],
+ ["/baz", "/baz-quux", "../baz-quux"],
+ ],
};
test(function relative() {
- relativeTests.posix.forEach(function(p) {
+ relativeTests.posix.forEach(function (p) {
const expected = p[2];
const actual = path.posix.relative(p[0], p[1]);
assertEquals(actual, expected);
@@ -65,7 +59,7 @@ test(function relative() {
});
test(function relativeWin32() {
- relativeTests.win32.forEach(function(p) {
+ relativeTests.win32.forEach(function (p) {
const expected = p[2];
const actual = path.win32.relative(p[0], p[1]);
assertEquals(actual, expected);
diff --git a/std/path/resolve_test.ts b/std/path/resolve_test.ts
index 2fc49e398..95aa84cce 100644
--- a/std/path/resolve_test.ts
+++ b/std/path/resolve_test.ts
@@ -20,8 +20,8 @@ const windowsTests =
[["c:/", "///some//dir"], "c:\\some\\dir"],
[
["C:\\foo\\tmp.3\\", "..\\tmp.3\\cycles\\root.js"],
- "C:\\foo\\tmp.3\\cycles\\root.js"
- ]
+ "C:\\foo\\tmp.3\\cycles\\root.js",
+ ],
];
const posixTests =
// arguments result
@@ -31,11 +31,11 @@ const posixTests =
[["a/b/c/", "../../.."], cwd()],
[["."], cwd()],
[["/some/dir", ".", "/absolute/"], "/absolute"],
- [["/foo/tmp.3/", "../tmp.3/cycles/root.js"], "/foo/tmp.3/cycles/root.js"]
+ [["/foo/tmp.3/", "../tmp.3/cycles/root.js"], "/foo/tmp.3/cycles/root.js"],
];
test(function resolve() {
- posixTests.forEach(function(p) {
+ posixTests.forEach(function (p) {
const _p = p[0] as string[];
const actual = path.posix.resolve.apply(null, _p);
assertEquals(actual, p[1]);
@@ -43,7 +43,7 @@ test(function resolve() {
});
test(function resolveWin32() {
- windowsTests.forEach(function(p) {
+ windowsTests.forEach(function (p) {
const _p = p[0] as string[];
const actual = path.win32.resolve.apply(null, _p);
assertEquals(actual, p[1]);
diff --git a/std/path/utils.ts b/std/path/utils.ts
index cb1c14c16..fc3dc5be9 100644
--- a/std/path/utils.ts
+++ b/std/path/utils.ts
@@ -9,7 +9,7 @@ import {
CHAR_LOWERCASE_Z,
CHAR_DOT,
CHAR_FORWARD_SLASH,
- CHAR_BACKWARD_SLASH
+ CHAR_BACKWARD_SLASH,
} from "./constants.ts";
export function assertPath(path: string): void {
diff --git a/std/path/win32.ts b/std/path/win32.ts
index 2f28d22c1..d4febf706 100644
--- a/std/path/win32.ts
+++ b/std/path/win32.ts
@@ -7,7 +7,7 @@ import {
CHAR_DOT,
CHAR_BACKWARD_SLASH,
CHAR_COLON,
- CHAR_QUESTION_MARK
+ CHAR_QUESTION_MARK,
} from "./constants.ts";
import {
@@ -15,7 +15,7 @@ import {
isPathSeparator,
isWindowsDeviceRoot,
normalizeString,
- _format
+ _format,
} from "./utils.ts";
import { assert } from "../testing/asserts.ts";
@@ -259,8 +259,9 @@ export function normalize(path: string): string {
tail = "";
}
if (tail.length === 0 && !isAbsolute) tail = ".";
- if (tail.length > 0 && isPathSeparator(path.charCodeAt(len - 1)))
+ if (tail.length > 0 && isPathSeparator(path.charCodeAt(len - 1))) {
tail += "\\";
+ }
if (device === undefined) {
if (isAbsolute) {
if (tail.length > 0) return `\\${tail}`;
@@ -459,8 +460,9 @@ export function relative(from: string, to: string): string {
// Lastly, append the rest of the destination (`to`) path that comes after
// the common path parts
- if (out.length > 0) return out + toOrig.slice(toStart + lastCommonSep, toEnd);
- else {
+ if (out.length > 0) {
+ return out + toOrig.slice(toStart + lastCommonSep, toEnd);
+ } else {
toStart += lastCommonSep;
if (toOrig.charCodeAt(toStart) === CHAR_BACKWARD_SLASH) ++toStart;
return toOrig.slice(toStart, toEnd);
@@ -590,8 +592,9 @@ export function dirname(path: string): string {
}
export function basename(path: string, ext = ""): string {
- if (ext !== undefined && typeof ext !== "string")
+ if (ext !== undefined && typeof ext !== "string") {
throw new TypeError('"ext" argument must be a string');
+ }
assertPath(path);
diff --git a/std/permissions/mod.ts b/std/permissions/mod.ts
index e11493426..b7f80117b 100644
--- a/std/permissions/mod.ts
+++ b/std/permissions/mod.ts
@@ -5,7 +5,7 @@ const { PermissionDenied } = Deno.errors;
function getPermissionString(descriptors: Deno.PermissionDescriptor[]): string {
return descriptors.length
? ` ${descriptors
- .map(pd => {
+ .map((pd) => {
switch (pd.name) {
case "read":
case "write":
diff --git a/std/permissions/test.ts b/std/permissions/test.ts
index 2c96dfea1..6a9955b6a 100644
--- a/std/permissions/test.ts
+++ b/std/permissions/test.ts
@@ -10,9 +10,9 @@ test({
async fn() {
assertEquals(await grant({ name: "net" }, { name: "env" }), [
{ name: "net" },
- { name: "env" }
+ { name: "env" },
]);
- }
+ },
});
test({
@@ -20,28 +20,28 @@ test({
async fn() {
assertEquals(await grant([{ name: "net" }, { name: "env" }]), [
{ name: "net" },
- { name: "env" }
+ { name: "env" },
]);
- }
+ },
});
test({
name: "grant logic",
async fn() {
assert(await grant({ name: "net" }));
- }
+ },
});
test({
name: "grantOrThrow basic",
async fn() {
await grantOrThrow({ name: "net" }, { name: "env" });
- }
+ },
});
test({
name: "grantOrThrow array",
async fn() {
await grantOrThrow([{ name: "net" }, { name: "env" }]);
- }
+ },
});
diff --git a/std/signal/mod.ts b/std/signal/mod.ts
index e368edbd1..0f2b47534 100644
--- a/std/signal/mod.ts
+++ b/std/signal/mod.ts
@@ -13,13 +13,13 @@ export function signal(
const streams = signos.map(Deno.signal);
- streams.forEach(stream => {
+ streams.forEach((stream) => {
mux.add(stream);
});
// Create dispose method for the muxer of signal streams.
const dispose = (): void => {
- streams.forEach(stream => {
+ streams.forEach((stream) => {
stream.dispose();
});
};
diff --git a/std/signal/test.ts b/std/signal/test.ts
index d59484e12..16d1458a2 100644
--- a/std/signal/test.ts
+++ b/std/signal/test.ts
@@ -56,6 +56,6 @@ if (Deno.build.os !== "win") {
// yet resolved, delay to next turn of event loop otherwise,
// we'll be leaking resources.
await delay(10);
- }
+ },
});
}
diff --git a/std/strings/README.md b/std/strings/README.md
index 7621248bb..43be553b8 100644
--- a/std/strings/README.md
+++ b/std/strings/README.md
@@ -21,6 +21,6 @@ pad("denosorusrex", 6, {
side: "left",
strict: true,
strictSide: "right",
- strictChar: "..."
+ strictChar: "...",
}); // output : "den..."
```
diff --git a/std/strings/pad.ts b/std/strings/pad.ts
index dc75a2954..b72ae2074 100644
--- a/std/strings/pad.ts
+++ b/std/strings/pad.ts
@@ -48,7 +48,7 @@ export function pad(
strict: false,
side: "left",
strictChar: "",
- strictSide: "right"
+ strictSide: "right",
}
): string {
let out = input;
diff --git a/std/strings/pad_test.ts b/std/strings/pad_test.ts
index 9a125b9d2..806874bd0 100644
--- a/std/strings/pad_test.ts
+++ b/std/strings/pad_test.ts
@@ -18,7 +18,7 @@ test(function padTest(): void {
pad("denosorusrex", 4, {
char: "*",
side: "right",
- strict: false
+ strict: false,
}),
expected4
);
@@ -27,7 +27,7 @@ test(function padTest(): void {
char: "*",
side: "left",
strict: true,
- strictSide: "right"
+ strictSide: "right",
}),
expected5
);
@@ -36,7 +36,7 @@ test(function padTest(): void {
char: "*",
side: "left",
strict: true,
- strictSide: "left"
+ strictSide: "left",
}),
expected6
);
@@ -46,7 +46,7 @@ test(function padTest(): void {
side: "left",
strict: true,
strictSide: "right",
- strictChar: "..."
+ strictChar: "...",
}),
expected7
);
@@ -56,7 +56,7 @@ test(function padTest(): void {
side: "left",
strict: true,
strictSide: "left",
- strictChar: "..."
+ strictChar: "...",
}),
expected8
);
@@ -66,7 +66,7 @@ test(function padTest(): void {
side: "left",
strict: true,
strictSide: "right",
- strictChar: "..."
+ strictChar: "...",
}),
expected2
);
diff --git a/std/testing/README.md b/std/testing/README.md
index a3640e728..c7c614103 100644
--- a/std/testing/README.md
+++ b/std/testing/README.md
@@ -44,7 +44,7 @@ Deno.test({
fn(): void {
assertEquals("world", "world");
assertEquals({ hello: "world" }, { hello: "world" });
- }
+ },
});
await Deno.runTests();
@@ -165,7 +165,7 @@ bench({
b.start();
for (let i = 0; i < 1e6; i++);
b.stop();
- }
+ },
});
```
diff --git a/std/testing/asserts.ts b/std/testing/asserts.ts
index 44c311204..19be68763 100644
--- a/std/testing/asserts.ts
+++ b/std/testing/asserts.ts
@@ -66,7 +66,7 @@ function buildMessage(diffResult: ReadonlyArray<DiffResult<string>>): string[] {
}
function isKeyedCollection(x: unknown): x is Set<unknown> {
- return [Symbol.iterator, "size"].every(k => k in (x as Set<unknown>));
+ return [Symbol.iterator, "size"].every((k) => k in (x as Set<unknown>));
}
export function equal(c: unknown, d: unknown): boolean {
diff --git a/std/testing/asserts_test.ts b/std/testing/asserts_test.ts
index 558ce1578..62e199298 100644
--- a/std/testing/asserts_test.ts
+++ b/std/testing/asserts_test.ts
@@ -12,7 +12,7 @@ import {
equal,
fail,
unimplemented,
- unreachable
+ unreachable,
} from "./asserts.ts";
import { red, green, white, gray, bold } from "../fmt/colors.ts";
const { test } = Deno;
@@ -53,11 +53,11 @@ test(function testingEqual(): void {
equal(
new Map([
["foo", "bar"],
- ["baz", "baz"]
+ ["baz", "baz"],
]),
new Map([
["foo", "bar"],
- ["baz", "baz"]
+ ["baz", "baz"],
])
)
);
@@ -77,11 +77,11 @@ test(function testingEqual(): void {
equal(
new Map([
["foo", "bar"],
- ["baz", "qux"]
+ ["baz", "qux"],
]),
new Map([
["baz", "qux"],
- ["foo", "bar"]
+ ["foo", "bar"],
])
)
);
@@ -92,7 +92,7 @@ test(function testingEqual(): void {
new Map([["foo", "bar"]]),
new Map([
["foo", "bar"],
- ["bar", "baz"]
+ ["bar", "baz"],
])
)
);
@@ -253,7 +253,7 @@ const createHeader = (): string[] => [
"",
` ${gray(bold("[Diff]"))} ${red(bold("Left"))} / ${green(bold("Right"))}`,
"",
- ""
+ "",
];
const added: (s: string) => string = (s: string): string => green(bold(s));
@@ -267,7 +267,7 @@ test({
assertEquals(10, 10);
assertEquals("abc", "abc");
assertEquals({ a: 10, b: { c: "1" } }, { a: 10, b: { c: "1" } });
- }
+ },
});
test({
@@ -278,7 +278,7 @@ test({
AssertionError,
[...createHeader(), removed(`- 1`), added(`+ 2`), ""].join("\n")
);
- }
+ },
});
test({
@@ -289,7 +289,7 @@ test({
AssertionError,
[...createHeader(), removed(`- 1`), added(`+ "1"`)].join("\n")
);
- }
+ },
});
test({
@@ -306,10 +306,10 @@ test({
white(' "2",'),
white(" 3,"),
white(" ]"),
- ""
+ "",
].join("\n")
);
- }
+ },
});
test({
@@ -329,8 +329,8 @@ test({
removed(`- "b": "2",`),
removed(`- "c": 3,`),
white(" }"),
- ""
+ "",
].join("\n")
);
- }
+ },
});
diff --git a/std/testing/bench.ts b/std/testing/bench.ts
index 1c4b01c0b..cd7b89e8c 100644
--- a/std/testing/bench.ts
+++ b/std/testing/bench.ts
@@ -65,7 +65,7 @@ function createBenchmarkTimer(clock: BenchmarkClock): BenchmarkTimer {
},
stop(): void {
clock.stop = performance.now();
- }
+ },
};
}
@@ -84,7 +84,7 @@ export function bench(
candidates.push({
name: benchmark.name,
runs: verifyOr1Run(benchmark.runs),
- func: benchmark.func
+ func: benchmark.func,
});
}
}
@@ -92,7 +92,7 @@ export function bench(
/** Runs all registered and non-skipped benchmarks serially. */
export async function runBenchmarks({
only = /[^\s]/,
- skip = /^\s*$/
+ skip = /^\s*$/,
}: BenchmarkRunOptions = {}): Promise<void> {
// Filtering candidates by the "only" and "skip" constraint
const benchmarks: BenchmarkDefinition[] = candidates.filter(
diff --git a/std/testing/bench_example.ts b/std/testing/bench_example.ts
index d27fb97e8..401516cca 100644
--- a/std/testing/bench_example.ts
+++ b/std/testing/bench_example.ts
@@ -16,7 +16,7 @@ bench({
b.start();
for (let i = 0; i < 1e6; i++);
b.stop();
- }
+ },
});
// Itsabug
diff --git a/std/testing/bench_test.ts b/std/testing/bench_test.ts
index 904ee2a8c..6dfc18b10 100644
--- a/std/testing/bench_test.ts
+++ b/std/testing/bench_test.ts
@@ -6,7 +6,7 @@ import "./bench_example.ts";
test({
name: "benching",
- fn: async function(): Promise<void> {
+ fn: async function (): Promise<void> {
bench(function forIncrementX1e9(b): void {
b.start();
for (let i = 0; i < 1e9; i++);
@@ -49,7 +49,7 @@ test({
b.start();
for (let i = 0; i < 1e6; i++);
b.stop();
- }
+ },
});
bench(function throwing(b): void {
@@ -58,5 +58,5 @@ test({
});
await runBenchmarks({ skip: /throw/ });
- }
+ },
});
diff --git a/std/testing/diff.ts b/std/testing/diff.ts
index 5cedb402a..97baa089f 100644
--- a/std/testing/diff.ts
+++ b/std/testing/diff.ts
@@ -7,7 +7,7 @@ interface FarthestPoint {
export enum DiffType {
removed = "removed",
common = "common",
- added = "added"
+ added = "added",
}
export interface DiffResult<T> {
@@ -60,12 +60,12 @@ export default function diff<T>(A: T[], B: T[]): Array<DiffResult<T>> {
...A.map(
(a): DiffResult<typeof a> => ({
type: swapped ? DiffType.added : DiffType.removed,
- value: a
+ value: a,
})
),
...suffixCommon.map(
(c): DiffResult<typeof c> => ({ type: DiffType.common, value: c })
- )
+ ),
];
}
const offset = N;
@@ -107,13 +107,13 @@ export default function diff<T>(A: T[], B: T[]): Array<DiffResult<T>> {
if (type === REMOVED) {
result.unshift({
type: swapped ? DiffType.removed : DiffType.added,
- value: B[b]
+ value: B[b],
});
b -= 1;
} else if (type === ADDED) {
result.unshift({
type: swapped ? DiffType.added : DiffType.removed,
- value: A[a]
+ value: A[a],
});
a -= 1;
} else {
@@ -133,8 +133,9 @@ export default function diff<T>(A: T[], B: T[]): Array<DiffResult<T>> {
k: number,
M: number
): FarthestPoint {
- if (slide && slide.y === -1 && down && down.y === -1)
+ if (slide && slide.y === -1 && down && down.y === -1) {
return { y: 0, id: 0 };
+ }
if (
(down && down.y === -1) ||
k === M ||
@@ -215,6 +216,6 @@ export default function diff<T>(A: T[], B: T[]): Array<DiffResult<T>> {
...backTrace(A, B, fp[delta + offset], swapped),
...suffixCommon.map(
(c): DiffResult<typeof c> => ({ type: DiffType.common, value: c })
- )
+ ),
];
}
diff --git a/std/testing/diff_test.ts b/std/testing/diff_test.ts
index 0e8416274..317dc0db8 100644
--- a/std/testing/diff_test.ts
+++ b/std/testing/diff_test.ts
@@ -6,7 +6,7 @@ test({
name: "empty",
fn(): void {
assertEquals(diff([], []), []);
- }
+ },
});
test({
@@ -14,30 +14,30 @@ test({
fn(): void {
assertEquals(diff(["a"], ["b"]), [
{ type: "removed", value: "a" },
- { type: "added", value: "b" }
+ { type: "added", value: "b" },
]);
- }
+ },
});
test({
name: '"a" vs "a"',
fn(): void {
assertEquals(diff(["a"], ["a"]), [{ type: "common", value: "a" }]);
- }
+ },
});
test({
name: '"a" vs ""',
fn(): void {
assertEquals(diff(["a"], []), [{ type: "removed", value: "a" }]);
- }
+ },
});
test({
name: '"" vs "a"',
fn(): void {
assertEquals(diff([], ["a"]), [{ type: "added", value: "a" }]);
- }
+ },
});
test({
@@ -45,9 +45,9 @@ test({
fn(): void {
assertEquals(diff(["a"], ["a", "b"]), [
{ type: "common", value: "a" },
- { type: "added", value: "b" }
+ { type: "added", value: "b" },
]);
- }
+ },
});
test({
@@ -62,9 +62,9 @@ test({
{ type: "common", value: "n" },
{ type: "common", value: "g" },
{ type: "removed", value: "t" },
- { type: "removed", value: "h" }
+ { type: "removed", value: "h" },
]);
- }
+ },
});
test({
@@ -78,9 +78,9 @@ test({
{ type: "removed", value: "n" },
{ type: "removed", value: "g" },
{ type: "removed", value: "t" },
- { type: "removed", value: "h" }
+ { type: "removed", value: "h" },
]);
- }
+ },
});
test({
@@ -94,9 +94,9 @@ test({
{ type: "added", value: "n" },
{ type: "added", value: "g" },
{ type: "added", value: "t" },
- { type: "added", value: "h" }
+ { type: "added", value: "h" },
]);
- }
+ },
});
test({
@@ -105,7 +105,7 @@ test({
assertEquals(diff(["abc", "c"], ["abc", "bcd", "c"]), [
{ type: "common", value: "abc" },
{ type: "added", value: "bcd" },
- { type: "common", value: "c" }
+ { type: "common", value: "c" },
]);
- }
+ },
});
diff --git a/std/testing/format.ts b/std/testing/format.ts
index 62fdde5eb..ee291dc23 100644
--- a/std/testing/format.ts
+++ b/std/testing/format.ts
@@ -56,7 +56,7 @@ const DEFAULT_OPTIONS: Options = {
indent: 2,
maxDepth: Infinity,
min: false,
- printFunctionName: true
+ printFunctionName: true,
};
interface BasicValueOptions {
@@ -358,8 +358,8 @@ function printIteratorValues(
return result;
}
-const getKeysOfEnumerableProperties = (object: {}): Array<string | symbol> => {
- const keys: Array<string | symbol> = Object.keys(object).sort();
+function getKeysOfEnumerableProperties<T>(object: T): Array<keyof T | symbol> {
+ const keys = Object.keys(object).sort() as Array<keyof T | symbol>;
if (Object.getOwnPropertySymbols) {
Object.getOwnPropertySymbols(object).forEach((symbol): void => {
@@ -372,7 +372,7 @@ const getKeysOfEnumerableProperties = (object: {}): Array<string | symbol> => {
}
return keys;
-};
+}
/**
* Return properties of an object
@@ -519,7 +519,7 @@ const getConfig = (options: Options): Config => ({
...options,
indent: options.min ? "" : createIndent(options.indent),
spacingInner: options.min ? " " : "\n",
- spacingOuter: options.min ? "" : "\n"
+ spacingOuter: options.min ? "" : "\n",
});
/**
@@ -531,7 +531,7 @@ const getConfig = (options: Options): Config => ({
export function format(val: any, options: Optional<Options> = {}): string {
const opts: Options = {
...DEFAULT_OPTIONS,
- ...options
+ ...options,
};
const basicResult = printBasicValue(val, opts);
if (basicResult !== null) {
diff --git a/std/testing/format_test.ts b/std/testing/format_test.ts
index 14f84f3c2..eac5b7d84 100644
--- a/std/testing/format_test.ts
+++ b/std/testing/format_test.ts
@@ -29,12 +29,12 @@ const createVal = () => [
{
id: "8658c1d0-9eda-4a90-95e1-8001e8eb6036",
text: "Add alternative serialize API for pretty-format plugins",
- type: "ADD_TODO"
+ type: "ADD_TODO",
},
{
id: "8658c1d0-9eda-4a90-95e1-8001e8eb6036",
- type: "TOGGLE_TODO"
- }
+ type: "TOGGLE_TODO",
+ },
];
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
@@ -50,7 +50,7 @@ const createExpected = () =>
' "id": "8658c1d0-9eda-4a90-95e1-8001e8eb6036",',
' "type": "TOGGLE_TODO",',
" },",
- "]"
+ "]",
].join("\n");
test({
@@ -58,7 +58,7 @@ test({
fn(): void {
const val = returnArguments();
assertEquals(format(val), "Arguments []");
- }
+ },
});
test({
@@ -66,7 +66,7 @@ test({
fn(): void {
const val: unknown[] = [];
assertEquals(format(val), "Array []");
- }
+ },
});
test({
@@ -74,7 +74,7 @@ test({
fn(): void {
const val = [1, 2, 3];
assertEquals(format(val), "Array [\n 1,\n 2,\n 3,\n]");
- }
+ },
});
test({
@@ -82,7 +82,7 @@ test({
fn(): void {
const val = new Uint32Array(0);
assertEquals(format(val), "Uint32Array []");
- }
+ },
});
test({
@@ -90,7 +90,7 @@ test({
fn(): void {
const val = new Uint32Array(3);
assertEquals(format(val), "Uint32Array [\n 0,\n 0,\n 0,\n]");
- }
+ },
});
test({
@@ -98,7 +98,7 @@ test({
fn(): void {
const val = new ArrayBuffer(3);
assertEquals(format(val), "ArrayBuffer []");
- }
+ },
});
test({
@@ -109,7 +109,7 @@ test({
format(val),
"Array [\n Array [\n 1,\n 2,\n 3,\n ],\n]"
);
- }
+ },
});
test({
@@ -117,7 +117,7 @@ test({
fn(): void {
const val = true;
assertEquals(format(val), "true");
- }
+ },
});
test({
@@ -125,7 +125,7 @@ test({
fn(): void {
const val = false;
assertEquals(format(val), "false");
- }
+ },
});
test({
@@ -133,7 +133,7 @@ test({
fn(): void {
const val = new Error();
assertEquals(format(val), "[Error]");
- }
+ },
});
test({
@@ -141,7 +141,7 @@ test({
fn(): void {
const val = new TypeError("message");
assertEquals(format(val), "[TypeError: message]");
- }
+ },
});
test({
@@ -150,7 +150,7 @@ test({
// tslint:disable-next-line:function-constructor
const val = new Function();
assertEquals(format(val), "[Function anonymous]");
- }
+ },
});
test({
@@ -163,7 +163,7 @@ test({
// tslint:disable-next-line:no-empty
f((): void => {});
assertEquals(format(val), "[Function anonymous]");
- }
+ },
});
test({
@@ -176,7 +176,7 @@ test({
formatted === "[Function anonymous]" || formatted === "[Function val]",
true
);
- }
+ },
});
test({
@@ -185,7 +185,7 @@ test({
// tslint:disable-next-line:no-empty
const val = function named(): void {};
assertEquals(format(val), "[Function named]");
- }
+ },
});
test({
@@ -197,7 +197,7 @@ test({
yield 3;
};
assertEquals(format(val), "[Function generate]");
- }
+ },
});
test({
@@ -207,11 +207,11 @@ test({
const val = function named(): void {};
assertEquals(
format(val, {
- printFunctionName: false
+ printFunctionName: false,
}),
"[Function]"
);
- }
+ },
});
test({
@@ -219,7 +219,7 @@ test({
fn(): void {
const val = Infinity;
assertEquals(format(val), "Infinity");
- }
+ },
});
test({
@@ -227,7 +227,7 @@ test({
fn(): void {
const val = -Infinity;
assertEquals(format(val), "-Infinity");
- }
+ },
});
test({
@@ -235,7 +235,7 @@ test({
fn(): void {
const val = new Map();
assertEquals(format(val), "Map {}");
- }
+ },
});
test({
@@ -248,7 +248,7 @@ test({
format(val),
'Map {\n "prop1" => "value1",\n "prop2" => "value2",\n}'
);
- }
+ },
});
test({
@@ -267,7 +267,7 @@ test({
[Symbol("description"), "symbol"],
["Symbol(description)", "string"],
[["array", "key"], "array"],
- [{ key: "value" }, "object"]
+ [{ key: "value" }, "object"],
]);
const expected = [
"Map {",
@@ -288,10 +288,10 @@ test({
" Object {",
' "key": "value",',
' } => "object",',
- "}"
+ "}",
].join("\n");
assertEquals(format(val), expected);
- }
+ },
});
test({
@@ -299,7 +299,7 @@ test({
fn(): void {
const val = NaN;
assertEquals(format(val), "NaN");
- }
+ },
});
test({
@@ -307,7 +307,7 @@ test({
fn(): void {
const val = null;
assertEquals(format(val), "null");
- }
+ },
});
test({
@@ -315,7 +315,7 @@ test({
fn(): void {
const val = 123;
assertEquals(format(val), "123");
- }
+ },
});
test({
@@ -323,7 +323,7 @@ test({
fn(): void {
const val = -123;
assertEquals(format(val), "-123");
- }
+ },
});
test({
@@ -331,7 +331,7 @@ test({
fn(): void {
const val = 0;
assertEquals(format(val), "0");
- }
+ },
});
test({
@@ -339,7 +339,7 @@ test({
fn(): void {
const val = -0;
assertEquals(format(val), "-0");
- }
+ },
});
test({
@@ -347,7 +347,7 @@ test({
fn(): void {
const val = new Date(10e11);
assertEquals(format(val), "2001-09-09T01:46:40.000Z");
- }
+ },
});
test({
@@ -355,7 +355,7 @@ test({
fn(): void {
const val = new Date(Infinity);
assertEquals(format(val), "Date { NaN }");
- }
+ },
});
test({
@@ -363,7 +363,7 @@ test({
fn(): void {
const val = {};
assertEquals(format(val), "Object {}");
- }
+ },
});
test({
@@ -374,7 +374,7 @@ test({
format(val),
'Object {\n "prop1": "value1",\n "prop2": "value2",\n}'
);
- }
+ },
});
test({
@@ -390,7 +390,7 @@ test({
'Object {\n "prop": "value1",\n Symbol(symbol1): "value2",\n ' +
'Symbol(symbol2): "value3",\n}'
);
- }
+ },
});
test({
@@ -398,15 +398,15 @@ test({
"prints an object without non-enumerable properties which have string key",
fn(): void {
const val = {
- enumerable: true
+ enumerable: true,
};
const key = "non-enumerable";
Object.defineProperty(val, key, {
enumerable: false,
- value: false
+ value: false,
});
assertEquals(format(val), 'Object {\n "enumerable": true,\n}');
- }
+ },
});
test({
@@ -414,15 +414,15 @@ test({
"prints an object without non-enumerable properties which have symbol key",
fn(): void {
const val = {
- enumerable: true
+ enumerable: true,
};
const key = Symbol("non-enumerable");
Object.defineProperty(val, key, {
enumerable: false,
- value: false
+ value: false,
});
assertEquals(format(val), 'Object {\n "enumerable": true,\n}');
- }
+ },
});
test({
@@ -430,7 +430,7 @@ test({
fn(): void {
const val = { b: 1, a: 2 };
assertEquals(format(val), 'Object {\n "a": 2,\n "b": 1,\n}');
- }
+ },
});
test({
@@ -438,7 +438,7 @@ test({
fn(): void {
const val = new RegExp("regexp");
assertEquals(format(val), "/regexp/");
- }
+ },
});
test({
@@ -446,7 +446,7 @@ test({
fn(): void {
const val = /regexp/gi;
assertEquals(format(val), "/regexp/gi");
- }
+ },
});
test({
@@ -454,7 +454,7 @@ test({
fn(): void {
const val = /regexp\d/gi;
assertEquals(format(val), "/regexp\\d/gi");
- }
+ },
});
test({
@@ -462,7 +462,7 @@ test({
fn(): void {
const val = /regexp\d/gi;
assertEquals(format(val, { escapeRegex: true }), "/regexp\\\\d/gi");
- }
+ },
});
test({
@@ -473,7 +473,7 @@ test({
format(obj, { escapeRegex: true }),
'Object {\n "test": /regexp\\\\d/gi,\n}'
);
- }
+ },
});
test({
@@ -481,7 +481,7 @@ test({
fn(): void {
const val = new Set();
assertEquals(format(val), "Set {}");
- }
+ },
});
test({
@@ -491,7 +491,7 @@ test({
val.add("value1");
val.add("value2");
assertEquals(format(val), 'Set {\n "value1",\n "value2",\n}');
- }
+ },
});
test({
@@ -499,7 +499,7 @@ test({
fn(): void {
const val = "string";
assertEquals(format(val), '"string"');
- }
+ },
});
test({
@@ -507,7 +507,7 @@ test({
fn(): void {
const val = "\"'\\";
assertEquals(format(val), '"\\"\'\\\\"');
- }
+ },
});
test({
@@ -515,7 +515,7 @@ test({
fn(): void {
const val = "\"'\\n";
assertEquals(format(val, { escapeString: false }), '""\'\\n"');
- }
+ },
});
test({
@@ -523,7 +523,7 @@ test({
fn(): void {
assertEquals(format('"-"'), '"\\"-\\""');
assertEquals(format("\\ \\\\"), '"\\\\ \\\\\\\\"');
- }
+ },
});
test({
@@ -531,7 +531,7 @@ test({
fn(): void {
const val = ["line 1", "line 2", "line 3"].join("\n");
assertEquals(format(val), '"' + val + '"');
- }
+ },
});
test({
@@ -540,15 +540,15 @@ test({
const polyline = {
props: {
id: "J",
- points: ["0.5,0.460", "0.5,0.875", "0.25,0.875"].join("\n")
+ points: ["0.5,0.460", "0.5,0.875", "0.25,0.875"].join("\n"),
},
- type: "polyline"
+ type: "polyline",
};
const val = {
props: {
- children: polyline
+ children: polyline,
},
- type: "svg"
+ type: "svg",
};
assertEquals(
format(val),
@@ -566,10 +566,10 @@ test({
" },",
" },",
' "type": "svg",',
- "}"
+ "}",
].join("\n")
);
- }
+ },
});
test({
@@ -577,7 +577,7 @@ test({
fn(): void {
const val = Symbol("symbol");
assertEquals(format(val), "Symbol(symbol)");
- }
+ },
});
test({
@@ -585,7 +585,7 @@ test({
fn(): void {
const val = undefined;
assertEquals(format(val), "undefined");
- }
+ },
});
test({
@@ -593,7 +593,7 @@ test({
fn(): void {
const val = new WeakMap();
assertEquals(format(val), "WeakMap {}");
- }
+ },
});
test({
@@ -601,7 +601,7 @@ test({
fn(): void {
const val = new WeakSet();
assertEquals(format(val), "WeakSet {}");
- }
+ },
});
test({
@@ -613,7 +613,7 @@ test({
'Object {\n "prop": Object {\n "prop": Object {\n "prop": ' +
'"value",\n },\n },\n}'
);
- }
+ },
});
test({
@@ -623,7 +623,7 @@ test({
const val: any = {};
val.prop = val;
assertEquals(format(val), 'Object {\n "prop": [Circular],\n}');
- }
+ },
});
test({
@@ -635,21 +635,21 @@ test({
format(val),
'Object {\n "prop1": Object {},\n "prop2": Object {},\n}'
);
- }
+ },
});
test({
name: "default implicit: 2 spaces",
fn(): void {
assertEquals(format(createVal()), createExpected());
- }
+ },
});
test({
name: "default explicit: 2 spaces",
fn(): void {
assertEquals(format(createVal(), { indent: 2 }), createExpected());
- }
+ },
});
// Tests assume that no strings in val contain multiple adjacent spaces!
@@ -661,7 +661,7 @@ test({
format(createVal(), { indent }),
createExpected().replace(/ {2}/g, " ".repeat(indent))
);
- }
+ },
});
test({
@@ -672,7 +672,7 @@ test({
format(createVal(), { indent }),
createExpected().replace(/ {2}/g, " ".repeat(indent))
);
- }
+ },
});
test({
@@ -693,8 +693,8 @@ test({
"object with constructor": new MyObject("value"),
"object without constructor": Object.create(null),
"set empty": new Set(),
- "set non-empty": new Set(["value"])
- }
+ "set non-empty": new Set(["value"]),
+ },
];
assertEquals(
format(v, { maxDepth: 2 }),
@@ -715,17 +715,17 @@ test({
' "set empty": [Set],',
' "set non-empty": [Set],',
" },",
- "]"
+ "]",
].join("\n")
);
- }
+ },
});
test({
name: "prints objects with no constructor",
fn(): void {
assertEquals(format(Object.create(null)), "Object {}");
- }
+ },
});
test({
@@ -736,10 +736,10 @@ test({
const expected = [
"Object {", // Object instead of undefined
' "constructor": "constructor",',
- "}"
+ "}",
].join("\n");
assertEquals(format(obj), expected);
- }
+ },
});
test({
@@ -748,11 +748,11 @@ test({
assertEquals(
format({
toJSON: (): unknown => ({ value: false }),
- value: true
+ value: true,
}),
'Object {\n "value": false,\n}'
);
- }
+ },
});
test({
@@ -761,11 +761,11 @@ test({
assertEquals(
format({
toJSON: (): string => "[Internal Object]",
- value: true
+ value: true,
}),
'"[Internal Object]"'
);
- }
+ },
});
test({
@@ -774,11 +774,11 @@ test({
assertEquals(
format({
toJSON: false,
- value: true
+ value: true,
}),
'Object {\n "toJSON": false,\n "value": true,\n}'
);
- }
+ },
});
test({
@@ -787,11 +787,11 @@ test({
assertEquals(
format({
toJSON: (): unknown => ({ toJSON: (): unknown => ({ value: true }) }),
- value: false
+ value: false,
}),
'Object {\n "toJSON": [Function toJSON],\n}'
);
- }
+ },
});
test({
@@ -801,5 +801,5 @@ test({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(set as any).toJSON = (): string => "map";
assertEquals(format(set), '"map"');
- }
+ },
});
diff --git a/std/testing/runner.ts b/std/testing/runner.ts
index 9aa31cb4a..0abc6012b 100755
--- a/std/testing/runner.ts
+++ b/std/testing/runner.ts
@@ -75,7 +75,7 @@ export async function* findTestModules(
exclude: excludePaths,
includeDirs: true,
extended: true,
- globstar: true
+ globstar: true,
};
async function* expandDirectory(d: string): AsyncIterableIterator<string> {
@@ -83,7 +83,7 @@ export async function* findTestModules(
for await (const walkInfo of expandGlob(dirGlob, {
...expandGlobOpts,
root: d,
- includeDirs: false
+ includeDirs: false,
})) {
yield filePathToUrl(walkInfo.filename);
}
@@ -170,7 +170,7 @@ export async function runTestModules({
exitOnFail = false,
only = /[^\s]/,
skip = /^\s*$/,
- disableLog = false
+ disableLog = false,
}: RunTestModulesOptions = {}): Promise<void> {
let moduleCount = 0;
const testModules = [];
@@ -235,7 +235,7 @@ export async function runTestModules({
exitOnFail,
only,
skip,
- disableLog
+ disableLog,
});
}
@@ -247,14 +247,14 @@ async function main(): Promise<void> {
exclude: ["e"],
failfast: ["f"],
help: ["h"],
- quiet: ["q"]
+ quiet: ["q"],
},
default: {
"allow-none": false,
failfast: false,
help: false,
- quiet: false
- }
+ quiet: false,
+ },
});
if (parsedArgs.help) {
return showHelp();
@@ -277,7 +277,7 @@ async function main(): Promise<void> {
exclude,
allowNone,
disableLog,
- exitOnFail: true
+ exitOnFail: true,
});
} catch (error) {
if (!disableLog) {
diff --git a/std/textproto/test.ts b/std/textproto/test.ts
index 1dcbfd479..5833935ba 100644
--- a/std/textproto/test.ts
+++ b/std/textproto/test.ts
@@ -10,7 +10,7 @@ import {
assert,
assertEquals,
assertThrows,
- assertNotEOF
+ assertNotEOF,
} from "../testing/asserts.ts";
const { test } = Deno;
@@ -25,7 +25,7 @@ test({
const _input =
"dotlines\r\n.foo\r\n..bar\n...baz\nquux\r\n\r\n.\r\nanot.her\r\n";
return Promise.resolve();
- }
+ },
});
test("[textproto] ReadEmpty", async () => {
@@ -56,7 +56,7 @@ test({
const m = assertNotEOF(await r.readMIMEHeader());
assertEquals(m.get("My-Key"), "Value 1, Value 2");
assertEquals(m.get("Long-key"), "Even Longer Value");
- }
+ },
});
test({
@@ -66,7 +66,7 @@ test({
const r = reader(input);
const m = assertNotEOF(await r.readMIMEHeader());
assertEquals(m.get("Foo"), "bar");
- }
+ },
});
test({
@@ -76,7 +76,7 @@ test({
const r = reader(input);
const m = assertNotEOF(await r.readMIMEHeader());
assertEquals(m.get("Test-1"), "1");
- }
+ },
});
test({
@@ -91,7 +91,7 @@ test({
const r = reader(`Cookie: ${sdata}\r\n\r\n`);
const m = assertNotEOF(await r.readMIMEHeader());
assertEquals(m.get("Cookie"), sdata);
- }
+ },
});
// Test that we read slightly-bogus MIME headers seen in the wild,
@@ -115,7 +115,7 @@ test({
assertThrows((): void => {
assertEquals(m.get("Audio Mode"), "None");
});
- }
+ },
});
test({
@@ -127,7 +127,7 @@ test({
"\tNo colon first line with leading tab\r\nFoo: foo\r\n\r\n",
" First: line with leading space\r\nFoo: foo\r\n\r\n",
"\tFirst: line with leading tab\r\nFoo: foo\r\n\r\n",
- "Foo: foo\r\nNo colon second line\r\n\r\n"
+ "Foo: foo\r\nNo colon second line\r\n\r\n",
];
const r = reader(input.join(""));
@@ -138,7 +138,7 @@ test({
err = e;
}
assert(err instanceof Deno.errors.InvalidData);
- }
+ },
});
test({
@@ -160,7 +160,7 @@ test({
err = e;
}
assert(err instanceof Deno.errors.InvalidData);
- }
+ },
});
test({
@@ -170,11 +170,11 @@ test({
"Accept: */*\r\n",
'Content-Disposition: form-data; name="test"\r\n',
" \r\n",
- "------WebKitFormBoundaryimeZ2Le9LjohiUiG--\r\n\n"
+ "------WebKitFormBoundaryimeZ2Le9LjohiUiG--\r\n\n",
];
const r = reader(input.join(""));
const m = assertNotEOF(await r.readMIMEHeader());
assertEquals(m.get("Accept"), "*/*");
assertEquals(m.get("Content-Disposition"), 'form-data; name="test"');
- }
+ },
});
diff --git a/std/types/react-dom.d.ts b/std/types/react-dom.d.ts
index f135197f2..3be59411f 100644
--- a/std/types/react-dom.d.ts
+++ b/std/types/react-dom.d.ts
@@ -30,7 +30,7 @@ import {
DOMAttributes,
DOMElement,
ReactNode,
- ReactPortal
+ ReactPortal,
} from "./react.d.ts";
export function findDOMNode(
diff --git a/std/types/react.d.ts b/std/types/react.d.ts
index b512a43a2..725503b13 100644
--- a/std/types/react.d.ts
+++ b/std/types/react.d.ts
@@ -3231,9 +3231,7 @@ declare namespace React {
// naked 'any' type in a conditional type will short circuit and union both the then/else branches
// so boolean is only resolved for T = any
-type IsExactlyAny<T> = boolean extends (T extends never
-? true
-: false)
+type IsExactlyAny<T> = boolean extends (T extends never ? true : false)
? true
: false;
diff --git a/std/types/tests/react-dom_mock.js b/std/types/tests/react-dom_mock.js
index 68b4137ba..cbc20958b 100644
--- a/std/types/tests/react-dom_mock.js
+++ b/std/types/tests/react-dom_mock.js
@@ -3,7 +3,7 @@
const ReactDOM = {
render(element) {
return JSON.stringify(element);
- }
+ },
};
export default ReactDOM;
diff --git a/std/types/tests/react_mock.js b/std/types/tests/react_mock.js
index 93faa6c9b..3dec4f422 100644
--- a/std/types/tests/react_mock.js
+++ b/std/types/tests/react_mock.js
@@ -3,7 +3,7 @@
const React = {
createElement(type, props, ...children) {
return JSON.stringify({ type, props, children });
- }
+ },
};
export default React;
diff --git a/std/util/deep_assign_test.ts b/std/util/deep_assign_test.ts
index a69d30b73..e759a33ac 100644
--- a/std/util/deep_assign_test.ts
+++ b/std/util/deep_assign_test.ts
@@ -13,10 +13,10 @@ test(function deepAssignTest(): void {
const expected = {
foo: {
deno: new Date("1979-05-27T07:32:00Z"),
- bar: "deno"
+ bar: "deno",
},
deno: { bar: { deno: ["is", "not", "node"] } },
- reg: RegExp(/DENOWOWO/)
+ reg: RegExp(/DENOWOWO/),
};
assert(date !== expected.foo.deno);
assert(reg !== expected.reg);
diff --git a/std/uuid/mod.ts b/std/uuid/mod.ts
index 26e4b43ff..8e312c558 100644
--- a/std/uuid/mod.ts
+++ b/std/uuid/mod.ts
@@ -14,7 +14,7 @@ const NOT_IMPLEMENTED = {
},
validate(): never {
throw new Error("Not implemented");
- }
+ },
};
// TODO Implement
diff --git a/std/uuid/tests/isNil.ts b/std/uuid/tests/isNil.ts
index 7719f1229..4514576da 100644
--- a/std/uuid/tests/isNil.ts
+++ b/std/uuid/tests/isNil.ts
@@ -11,5 +11,5 @@ test({
const u = "582cbcff-dad6-4f28-888a-e062ae36bafc";
assert(isNil(nil));
assert(!isNil(u));
- }
+ },
});
diff --git a/std/uuid/tests/v4/generate.ts b/std/uuid/tests/v4/generate.ts
index c9946d46c..897a53fde 100644
--- a/std/uuid/tests/v4/generate.ts
+++ b/std/uuid/tests/v4/generate.ts
@@ -9,7 +9,7 @@ test({
const u = generate();
assertEquals(typeof u, "string", "returns a string");
assert(u !== "", "return string is not empty");
- }
+ },
});
test({
@@ -19,5 +19,5 @@ test({
const u = generate() as string;
assert(validate(u), `${u} is not a valid uuid v4`);
}
- }
+ },
});
diff --git a/std/uuid/tests/v4/validate.ts b/std/uuid/tests/v4/validate.ts
index feeecf6b7..3735de51e 100644
--- a/std/uuid/tests/v4/validate.ts
+++ b/std/uuid/tests/v4/validate.ts
@@ -12,5 +12,5 @@ Deno.test({
assert(validate(u), `generated ${u} should be valid`);
assert(validate(t), `${t} should be valid`);
assert(!validate(n), `${n} should not be valid`);
- }
+ },
});
diff --git a/std/uuid/v4.ts b/std/uuid/v4.ts
index 7688a5306..d291b5478 100644
--- a/std/uuid/v4.ts
+++ b/std/uuid/v4.ts
@@ -28,6 +28,6 @@ export function generate(): string {
"-",
...bits.slice(8, 10),
"-",
- ...bits.slice(10)
+ ...bits.slice(10),
].join("");
}
diff --git a/std/ws/README.md b/std/ws/README.md
index a8101f9f0..2379d9f96 100644
--- a/std/ws/README.md
+++ b/std/ws/README.md
@@ -12,7 +12,7 @@ import {
acceptWebSocket,
isWebSocketCloseEvent,
isWebSocketPingEvent,
- WebSocket
+ WebSocket,
} from "https://deno.land/std/ws/mod.ts";
/** websocket echo server */
@@ -24,7 +24,7 @@ for await (const req of serve(`:${port}`)) {
conn,
headers,
bufReader: req.r,
- bufWriter: req.w
+ bufWriter: req.w,
})
.then(
async (sock: WebSocket): Promise<void> => {
@@ -73,7 +73,7 @@ import {
connectWebSocket,
isWebSocketCloseEvent,
isWebSocketPingEvent,
- isWebSocketPongEvent
+ isWebSocketPongEvent,
} from "https://deno.land/std/ws/mod.ts";
import { encode } from "https://deno.land/std/strings/mod.ts";
import { BufReader } from "https://deno.land/std/io/bufio.ts";
@@ -84,7 +84,7 @@ const endpoint = Deno.args[0] || "ws://127.0.0.1:8080";
/** simple websocket cli */
const sock = await connectWebSocket(endpoint);
console.log(green("ws connected! (type 'close' to quit)"));
-(async function(): Promise<void> {
+(async function (): Promise<void> {
for await (const msg of sock.receive()) {
if (typeof msg === "string") {
console.log(yellow("< " + msg));
diff --git a/std/ws/example_client.ts b/std/ws/example_client.ts
index 664073210..e6653362d 100644
--- a/std/ws/example_client.ts
+++ b/std/ws/example_client.ts
@@ -2,7 +2,7 @@ import {
connectWebSocket,
isWebSocketCloseEvent,
isWebSocketPingEvent,
- isWebSocketPongEvent
+ isWebSocketPongEvent,
} from "../ws/mod.ts";
import { encode } from "../strings/mod.ts";
import { BufReader } from "../io/bufio.ts";
@@ -13,7 +13,7 @@ const endpoint = Deno.args[0] || "ws://127.0.0.1:8080";
/** simple websocket cli */
const sock = await connectWebSocket(endpoint);
console.log(green("ws connected! (type 'close' to quit)"));
-(async function(): Promise<void> {
+(async function (): Promise<void> {
for await (const msg of sock.receive()) {
if (typeof msg === "string") {
console.log(yellow("< " + msg));
diff --git a/std/ws/example_server.ts b/std/ws/example_server.ts
index 03adc0a49..048198326 100644
--- a/std/ws/example_server.ts
+++ b/std/ws/example_server.ts
@@ -4,7 +4,7 @@ import {
acceptWebSocket,
isWebSocketCloseEvent,
isWebSocketPingEvent,
- WebSocket
+ WebSocket,
} from "./mod.ts";
/** websocket echo server */
@@ -16,7 +16,7 @@ for await (const req of serve(`:${port}`)) {
conn,
headers,
bufReader: req.r,
- bufWriter: req.w
+ bufWriter: req.w,
})
.then(
async (sock: WebSocket): Promise<void> => {
diff --git a/std/ws/mod.ts b/std/ws/mod.ts
index 6101260e9..a9b8cb675 100644
--- a/std/ws/mod.ts
+++ b/std/ws/mod.ts
@@ -19,7 +19,7 @@ export enum OpCode {
BinaryFrame = 0x2,
Close = 0x8,
Ping = 0x9,
- Pong = 0xa
+ Pong = 0xa,
}
export type WebSocketEvent =
@@ -125,13 +125,13 @@ export async function writeFrame(
0x80 | frame.opcode,
hasMask | 0b01111110,
payloadLength >>> 8,
- payloadLength & 0x00ff
+ payloadLength & 0x00ff,
]);
} else {
header = new Uint8Array([
0x80 | frame.opcode,
hasMask | 0b01111111,
- ...sliceLongToBytes(payloadLength)
+ ...sliceLongToBytes(payloadLength),
]);
}
if (frame.mask) {
@@ -186,7 +186,7 @@ export async function readFrame(buf: BufReader): Promise<WebSocketFrame> {
isLastFrame,
opcode,
mask,
- payload
+ payload,
};
}
@@ -209,7 +209,7 @@ class WebSocketImpl implements WebSocket {
conn,
bufReader,
bufWriter,
- mask
+ mask,
}: {
conn: Conn;
bufReader?: BufReader;
@@ -271,7 +271,7 @@ class WebSocketImpl implements WebSocket {
await this.enqueue({
opcode: OpCode.Pong,
payload: frame.payload,
- isLastFrame: true
+ isLastFrame: true,
});
yield ["ping", frame.payload] as WebSocketPingEvent;
break;
@@ -290,7 +290,7 @@ class WebSocketImpl implements WebSocket {
const { d, frame } = entry;
writeFrame(frame, this.bufWriter)
.then(() => d.resolve())
- .catch(e => d.reject(e))
+ .catch((e) => d.reject(e))
.finally(() => {
this.sendQueue.shift();
this.dequeue();
@@ -318,7 +318,7 @@ class WebSocketImpl implements WebSocket {
isLastFrame,
opcode,
payload,
- mask: this.mask
+ mask: this.mask,
};
return this.enqueue(frame);
}
@@ -329,7 +329,7 @@ class WebSocketImpl implements WebSocket {
isLastFrame: true,
opcode: OpCode.Ping,
mask: this.mask,
- payload
+ payload,
};
return this.enqueue(frame);
}
@@ -355,7 +355,7 @@ class WebSocketImpl implements WebSocket {
isLastFrame: true,
opcode: OpCode.Close,
mask: this.mask,
- payload
+ payload,
});
} catch (e) {
throw e;
@@ -378,7 +378,7 @@ class WebSocketImpl implements WebSocket {
this._isClosed = true;
const rest = this.sendQueue;
this.sendQueue = [];
- rest.forEach(e =>
+ rest.forEach((e) =>
e.d.reject(
new Deno.errors.ConnectionReset("Socket has already been closed")
)
@@ -431,8 +431,8 @@ export async function acceptWebSocket(req: {
headers: new Headers({
Upgrade: "websocket",
Connection: "Upgrade",
- "Sec-WebSocket-Accept": secAccept
- })
+ "Sec-WebSocket-Accept": secAccept,
+ }),
});
return sock;
}
@@ -543,7 +543,7 @@ export async function connectWebSocket(
conn,
bufWriter,
bufReader,
- mask: createMask()
+ mask: createMask(),
});
}
diff --git a/std/ws/sha1.ts b/std/ws/sha1.ts
index dc8ba680c..fc86881f8 100644
--- a/std/ws/sha1.ts
+++ b/std/ws/sha1.ts
@@ -358,7 +358,7 @@ export class Sha1 {
(h4 >> 24) & 0xff,
(h4 >> 16) & 0xff,
(h4 >> 8) & 0xff,
- h4 & 0xff
+ h4 & 0xff,
];
}
diff --git a/std/ws/test.ts b/std/ws/test.ts
index f1efa8e40..583750bb1 100644
--- a/std/ws/test.ts
+++ b/std/ws/test.ts
@@ -14,7 +14,7 @@ import {
readFrame,
unmask,
writeFrame,
- createWebSocket
+ createWebSocket,
} from "./mod.ts";
import { encode, decode } from "../strings/mod.ts";
import Writer = Deno.Writer;
@@ -50,7 +50,7 @@ test("[ws] read masked text frame", async () => {
0x9f,
0x4d,
0x51,
- 0x58
+ 0x58,
])
)
);
@@ -136,8 +136,8 @@ test("[ws] acceptable", () => {
const ret = acceptable({
headers: new Headers({
upgrade: "websocket",
- "sec-websocket-key": "aaa"
- })
+ "sec-websocket-key": "aaa",
+ }),
});
assertEquals(ret, true);
@@ -148,12 +148,12 @@ test("[ws] acceptable", () => {
["host", "127.0.0.1:9229"],
[
"sec-websocket-extensions",
- "permessage-deflate; client_max_window_bits"
+ "permessage-deflate; client_max_window_bits",
],
["sec-websocket-key", "dGhlIHNhbXBsZSBub25jZQ=="],
["sec-websocket-version", "13"],
- ["upgrade", "WebSocket"]
- ])
+ ["upgrade", "WebSocket"],
+ ]),
})
);
});
@@ -161,25 +161,25 @@ test("[ws] acceptable", () => {
test("[ws] acceptable should return false when headers invalid", () => {
assertEquals(
acceptable({
- headers: new Headers({ "sec-websocket-key": "aaa" })
+ headers: new Headers({ "sec-websocket-key": "aaa" }),
}),
false
);
assertEquals(
acceptable({
- headers: new Headers({ upgrade: "websocket" })
+ headers: new Headers({ upgrade: "websocket" }),
}),
false
);
assertEquals(
acceptable({
- headers: new Headers({ upgrade: "invalid", "sec-websocket-key": "aaa" })
+ headers: new Headers({ upgrade: "invalid", "sec-websocket-key": "aaa" }),
}),
false
);
assertEquals(
acceptable({
- headers: new Headers({ upgrade: "websocket", "sec-websocket-ky": "" })
+ headers: new Headers({ upgrade: "websocket", "sec-websocket-ky": "" }),
}),
false
);
@@ -205,7 +205,7 @@ test("[ws] write and read masked frame", async () => {
isLastFrame: true,
mask,
opcode: OpCode.TextFrame,
- payload: encode(msg)
+ payload: encode(msg),
},
buf
);
@@ -282,19 +282,19 @@ function dummyConn(r: Reader, w: Writer): Conn {
write: (x): Promise<number> => w.write(x),
close: (): void => {},
localAddr: { transport: "tcp", hostname: "0.0.0.0", port: 0 },
- remoteAddr: { transport: "tcp", hostname: "0.0.0.0", port: 0 }
+ remoteAddr: { transport: "tcp", hostname: "0.0.0.0", port: 0 },
};
}
function delayedWriter(ms: number, dest: Writer): Writer {
return {
write(p: Uint8Array): Promise<number> {
- return new Promise<number>(resolve => {
+ return new Promise<number>((resolve) => {
setTimeout(async (): Promise<void> => {
resolve(await dest.write(p));
}, ms);
});
- }
+ },
};
}
test({
@@ -308,7 +308,7 @@ test({
sock.send("first"),
sock.send("second"),
sock.ping(),
- sock.send(new Uint8Array([3]))
+ sock.send(new Uint8Array([3])),
]);
const bufr = new BufReader(buf);
const first = await readFrame(bufr);
@@ -322,7 +322,7 @@ test({
assertEquals(ping.opcode, OpCode.Ping);
assertEquals(third.opcode, OpCode.BinaryFrame);
assertEquals(bytes.equal(third.payload, new Uint8Array([3])), true);
- }
+ },
});
test("[ws] createSecKeyHasCorrectLength", () => {
@@ -337,7 +337,7 @@ test("[ws] WebSocket should throw `Deno.errors.ConnectionReset` when peer closed
const eofReader: Deno.Reader = {
read(_: Uint8Array): Promise<number | Deno.EOF> {
return Promise.resolve(Deno.EOF);
- }
+ },
};
const conn = dummyConn(eofReader, buf);
const sock = createWebSocket({ conn });
@@ -355,7 +355,7 @@ test("[ws] WebSocket shouldn't throw `Deno.errors.UnexpectedEof` on recive()", a
const eofReader: Deno.Reader = {
read(_: Uint8Array): Promise<number | Deno.EOF> {
return Promise.resolve(Deno.EOF);
- }
+ },
};
const conn = dummyConn(eofReader, buf);
const sock = createWebSocket({ conn });
@@ -373,10 +373,10 @@ test({
let timer: number | undefined;
const lazyWriter: Deno.Writer = {
write(_: Uint8Array): Promise<number> {
- return new Promise(resolve => {
+ return new Promise((resolve) => {
timer = setTimeout(() => resolve(0), 1000);
});
- }
+ },
};
const conn = dummyConn(buf, lazyWriter);
const sock = createWebSocket({ conn });
@@ -384,7 +384,7 @@ test({
const p = Promise.all([
sock.send("hello").catch(onError),
sock.send(new Uint8Array([1, 2])).catch(onError),
- sock.ping().catch(onError)
+ sock.ping().catch(onError),
]);
sock.closeForce();
assertEquals(sock.isClosed, true);
@@ -396,5 +396,5 @@ test({
// Wait for another event loop turn for `timeout` op promise
// to resolve, otherwise we'll get "op leak".
await delay(10);
- }
+ },
});