summaryrefslogtreecommitdiff
path: root/std/encoding/csv.ts
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2020-04-28 17:40:43 +0100
committerGitHub <noreply@github.com>2020-04-28 12:40:43 -0400
commit678313b17677e012ba9a07aeca58af1aafbf4e8c (patch)
treee48e25b165a7d6d566095442448f2e36fa09c561 /std/encoding/csv.ts
parent47c2f034e95696a47770d60aec1362501e7f330d (diff)
BREAKING: Remove Deno.EOF, use null instead (#4953)
Diffstat (limited to 'std/encoding/csv.ts')
-rw-r--r--std/encoding/csv.ts14
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