(text: string, i: number)
| 416 | |
| 417 | // A scalar ends at the first delimiter, which `JSON.parse` then validates. |
| 418 | scanScalar(text: string, i: number): number { |
| 419 | for (; i < text.length; i++) { |
| 420 | const c = text.charCodeAt(i) |
| 421 | if (isWhitespace(c) || c === COMMA || c === RBRACKET || c === RBRACE) return i |
| 422 | } |
| 423 | return -1 |
| 424 | } |
| 425 | |
| 426 | // Tracks only string, escape and nesting state; `JSON.parse` validates the |
| 427 | // rest. Returns the index after the value, or -1. |