diff options
Diffstat (limited to 'io')
-rw-r--r-- | io/bufio.ts | 2 | ||||
-rw-r--r-- | io/bufio_test.ts | 26 | ||||
-rw-r--r-- | io/readers_test.ts | 6 | ||||
-rw-r--r-- | io/util_test.ts | 2 | ||||
-rw-r--r-- | io/writers.ts | 2 |
5 files changed, 19 insertions, 19 deletions
diff --git a/io/bufio.ts b/io/bufio.ts index 3291c8a07..213870c3c 100644 --- a/io/bufio.ts +++ b/io/bufio.ts @@ -407,7 +407,7 @@ export class BufReader implements Reader { */ export class BufWriter implements Writer { buf: Uint8Array; - n: number = 0; + n = 0; err: Error | null = null; /** return new BufWriter unless w is BufWriter */ diff --git a/io/bufio_test.ts b/io/bufio_test.ts index 9d1ffc307..75664694a 100644 --- a/io/bufio_test.ts +++ b/io/bufio_test.ts @@ -32,7 +32,7 @@ async function readBytes(buf: BufReader): Promise<string> { const b = new Uint8Array(1000); let nb = 0; while (true) { - let c = await buf.readByte(); + const c = await buf.readByte(); if (c === Deno.EOF) { break; // EOF } @@ -122,10 +122,10 @@ test(async function bufioBufReader(): Promise<void> { } texts[texts.length - 1] = all; - for (let text of texts) { - for (let readmaker of readMakers) { - for (let bufreader of bufreaders) { - for (let bufsize of bufsizes) { + for (const text of texts) { + for (const readmaker of readMakers) { + for (const bufreader of bufreaders) { + for (const bufsize of bufsizes) { const read = readmaker.fn(stringsReader(text)); const buf = new BufReader(read, bufsize); const s = await bufreader.fn(buf); @@ -210,8 +210,8 @@ class TestReader implements Reader { async function testReadLine(input: Uint8Array): Promise<void> { for (let stride = 1; stride < 2; stride++) { let done = 0; - let reader = new TestReader(input, stride); - let l = new BufReader(reader, input.byteLength + 1); + const reader = new TestReader(input, stride); + const l = new BufReader(reader, input.byteLength + 1); while (true) { const r = await l.readLine(); if (r === Deno.EOF) { @@ -220,7 +220,7 @@ async function testReadLine(input: Uint8Array): Promise<void> { const { line, more } = r; assertEquals(more, false); // eslint-disable-next-line @typescript-eslint/restrict-plus-operands - let want = testOutput.subarray(done, done + line.byteLength); + const want = testOutput.subarray(done, done + line.byteLength); assertEquals( line, want, @@ -244,9 +244,9 @@ test(async function bufioReadLine(): Promise<void> { test(async function bufioPeek(): Promise<void> { const decoder = new TextDecoder(); - let p = new Uint8Array(10); + const p = new Uint8Array(10); // string is 16 (minReadBufferSize) long. - let buf = new BufReader( + const buf = new BufReader( stringsReader("abcdefghijklmnop"), MIN_READ_BUFFER_SIZE ); @@ -281,7 +281,7 @@ test(async function bufioPeek(): Promise<void> { actual = assertNotEOF(await buf.peek(2)); assertEquals(decoder.decode(actual), "de"); - let res = await buf.read(p.subarray(0, 3)); + const res = await buf.read(p.subarray(0, 3)); assertEquals(decoder.decode(p.subarray(0, 3)), "def"); assert(res !== Deno.EOF); @@ -327,8 +327,8 @@ test(async function bufioWriter(): Promise<void> { } const w = new Buffer(); - for (let nwrite of bufsizes) { - for (let bs of bufsizes) { + for (const nwrite of bufsizes) { + for (const bs of bufsizes) { // Write nwrite bytes using buffer size bs. // Check that the right amount makes it out // and that the data is correct. diff --git a/io/readers_test.ts b/io/readers_test.ts index f80bfd55f..474407427 100644 --- a/io/readers_test.ts +++ b/io/readers_test.ts @@ -17,13 +17,13 @@ test(async function ioStringReader(): Promise<void> { test(async function ioStringReader(): Promise<void> { const r = new StringReader("abcdef"); const buf = new Uint8Array(3); - let res1 = await r.read(buf); + const res1 = await r.read(buf); assertEquals(res1, 3); assertEquals(decode(buf), "abc"); - let res2 = await r.read(buf); + const res2 = await r.read(buf); assertEquals(res2, 3); assertEquals(decode(buf), "def"); - let res3 = await r.read(buf); + const res3 = await r.read(buf); assertEquals(res3, Deno.EOF); assertEquals(decode(buf), "def"); }); diff --git a/io/util_test.ts b/io/util_test.ts index 3302fe9e3..c616a4bba 100644 --- a/io/util_test.ts +++ b/io/util_test.ts @@ -6,7 +6,7 @@ import { copyBytes, tempFile } from "./util.ts"; import * as path from "../fs/path.ts"; test(function testCopyBytes(): void { - let dst = new Uint8Array(4); + const dst = new Uint8Array(4); dst.fill(0); let src = Uint8Array.of(1, 2); diff --git a/io/writers.ts b/io/writers.ts index de070d48a..91d19a9d7 100644 --- a/io/writers.ts +++ b/io/writers.ts @@ -5,7 +5,7 @@ import { decode, encode } from "../strings/mod.ts"; /** Writer utility for buffering string chunks */ export class StringWriter implements Writer { private chunks: Uint8Array[] = []; - private byteLength: number = 0; + private byteLength = 0; private cache: string | undefined; constructor(private base: string = "") { |