MCPcopy Index your code
hub / github.com/prettydiff/prettydiff / stringAsLines

Function stringAsLines

api/diffview.ts:18–31  ·  view source on GitHub ↗
(str : string)

Source from the content-addressed store, hash-verified

16 }()),
17 // translates source code from a string to an array by splitting on line breaks
18 stringAsLines = function diffview_stringAsLines(str : string): string[]{
19 const lines = (options.diff_format === "text")
20 ? str
21 : str
22 .replace(/&/g, "&")
23 .replace(/&#lt;/g, "$#lt;")
24 .replace(/&#gt;/g, "$#gt;")
25 .replace(/</g, "$#lt;")
26 .replace(/>/g, "$#gt;");
27 if (options.crlf === true) {
28 return lines.split("\r\n");
29 }
30 return lines.split("\n");
31 },
32 // array representation of base source
33 baseTextArray: string[] = (typeof options.source === "string")
34 ? stringAsLines(options.source)

Callers 1

diffviewFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected