(input: string)
| 74 | } |
| 75 | |
| 76 | const mappingSeparator = (input: string): number => { |
| 77 | let quote: "'" | "\"" | undefined |
| 78 | let escaped = false |
| 79 | let depth = 0 |
| 80 | for (let index = 0; index < input.length; index++) { |
| 81 | const character = input[index] |
| 82 | if (quote === "\"") { |
| 83 | if (escaped) escaped = false |
| 84 | else if (character === "\\") escaped = true |
| 85 | else if (character === quote) quote = undefined |
| 86 | } else if (quote === "'") { |
| 87 | if (character === quote && input[index + 1] === quote) index++ |
| 88 | else if (character === quote) quote = undefined |
| 89 | } else if (character === "'" || character === "\"") { |
| 90 | quote = character |
| 91 | } else if (character === "[" || character === "{") { |
| 92 | depth++ |
| 93 | } else if (character === "]" || character === "}") { |
| 94 | depth-- |
| 95 | } else if (character === ":" && depth === 0 && (input[index + 1] === undefined || /\s/.test(input[index + 1]))) { |
| 96 | return index |
| 97 | } |
| 98 | } |
| 99 | return -1 |
| 100 | } |
| 101 | |
| 102 | const parseDoubleQuoted = (input: string): string => { |
| 103 | if (!input.endsWith("\"") || input.length < 2) { |
no outgoing calls
no test coverage detected