MCPcopy Create free account
hub / github.com/denoland/std / readTextLines

Function readTextLines

ini/parse.ts:36–56  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

34}
35
36function* readTextLines(text: string): Generator<string> {
37 let line = "";
38 for (let i = 0; i < text.length; i += 1) {
39 const char = text[i];
40 switch (char) {
41 case "\n":
42 yield line;
43 line = "";
44 break;
45 case "\r":
46 yield line;
47 line = "";
48 if (text[i + 1] === "\n") i += 1;
49 break;
50 default:
51 line += char;
52 break;
53 }
54 }
55 yield line;
56}
57
58/** Options for {@linkcode parse}. */
59export interface ParseOptions {

Callers 1

parseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected