From 678313b17677e012ba9a07aeca58af1aafbf4e8c Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Tue, 28 Apr 2020 17:40:43 +0100 Subject: BREAKING: Remove Deno.EOF, use null instead (#4953) --- std/encoding/csv.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'std/encoding/csv.ts') 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 { +): Promise { 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 { - return (await tp.r.peek(0)) === Deno.EOF; + return (await tp.r.peek(0)) === null; } -async function readLine(tp: TextProtoReader): Promise { +async function readLine(tp: TextProtoReader): Promise { 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 -- cgit v1.2.3