diff options
Diffstat (limited to 'std/encoding/csv.ts')
-rw-r--r-- | std/encoding/csv.ts | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/std/encoding/csv.ts b/std/encoding/csv.ts index 711e27772..ae86e25bb 100644 --- a/std/encoding/csv.ts +++ b/std/encoding/csv.ts @@ -64,12 +64,12 @@ async function readRecord( Startline: number, reader: BufReader, opt: ReadOptions = { comma: ",", trimLeadingSpace: false } -): Promise<string[] | Deno.EOF> { +): Promise<string[] | null> { const tp = new TextProtoReader(reader); const lineIndex = Startline; let line = await readLine(tp); - if (line === Deno.EOF) return Deno.EOF; + if (line === null) return null; if (line.length === 0) { return []; } @@ -147,7 +147,7 @@ async function readRecord( // Hit end of line (copy all data so far). recordBuffer += line; const r = await readLine(tp); - if (r === Deno.EOF) { + if (r === null) { if (!opt.lazyQuotes) { quoteError = ERR_QUOTE; break parseField; @@ -182,13 +182,13 @@ async function readRecord( } async function isEOF(tp: TextProtoReader): Promise<boolean> { - return (await tp.r.peek(0)) === Deno.EOF; + return (await tp.r.peek(0)) === null; } -async function readLine(tp: TextProtoReader): Promise<string | Deno.EOF> { +async function readLine(tp: TextProtoReader): Promise<string | null> { let line: string; const r = await tp.readLine(); - if (r === Deno.EOF) return Deno.EOF; + if (r === null) return null; line = r; // For backwards compatibility, drop trailing \r before EOF. @@ -226,7 +226,7 @@ export async function readMatrix( for (;;) { const r = await readRecord(lineIndex, reader, opt); - if (r === Deno.EOF) break; + if (r === null) break; lineResult = r; lineIndex++; // If fieldsPerRecord is 0, Read sets it to |