diff options
Diffstat (limited to 'deps/v8/tools/csvparser.mjs')
-rw-r--r-- | deps/v8/tools/csvparser.mjs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/deps/v8/tools/csvparser.mjs b/deps/v8/tools/csvparser.mjs index c43ee4c4fc..273bf89776 100644 --- a/deps/v8/tools/csvparser.mjs +++ b/deps/v8/tools/csvparser.mjs @@ -38,13 +38,11 @@ export class CsvParser { escapeField(string) { let nextPos = string.indexOf("\\"); if (nextPos === -1) return string; - let result = string.substring(0, nextPos); // Escape sequences of the form \x00 and \u0000; - let endPos = string.length; let pos = 0; while (nextPos !== -1) { - let escapeIdentifier = string.charAt(nextPos + 1); + const escapeIdentifier = string.charAt(nextPos + 1); pos = nextPos + 2; if (escapeIdentifier === 'n') { result += '\n'; @@ -61,7 +59,7 @@ export class CsvParser { nextPos = pos + 4; } // Convert the selected escape sequence to a single character. - let escapeChars = string.substring(pos, nextPos); + const escapeChars = string.substring(pos, nextPos); if (escapeChars === '2C') { result += ','; } else { @@ -75,6 +73,7 @@ export class CsvParser { // If there are no more escape sequences consume the rest of the string. if (nextPos === -1) { result += string.substr(pos); + break; } else if (pos !== nextPos) { result += string.substring(pos, nextPos); } |