MCPcopy
hub / github.com/jestjs/jest / hasUnmatchedDoubleQuoteMarks

Function hasUnmatchedDoubleQuoteMarks

packages/jest-snapshot/src/dedentLines.ts:19–32  ·  view source on GitHub ↗
(string: string)

Source from the content-addressed store, hash-verified

17// "key": "value has multiple lines\n…
18// "key has multiple lines\n…
19const hasUnmatchedDoubleQuoteMarks = (string: string): boolean => {
20 let n = 0;
21
22 let i = string.indexOf('"', 0);
23 while (i !== -1) {
24 if (i === 0 || string[i - 1] !== '\\') {
25 n += 1;
26 }
27
28 i = string.indexOf('"', i + 1);
29 }
30
31 return n % 2 !== 0;
32};
33
34const isFirstLineOfTag = (line: string) => /^( {2})*</.test(line);
35

Callers 2

dedentStartTagFunction · 0.85
dedentLinesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected