(source, options)
| 394 | } |
| 395 | |
| 396 | function buildJSONLikeCandidates(source, options) { |
| 397 | options = options || {}; |
| 398 | const candidates = []; |
| 399 | const seen = new Set(); |
| 400 | const addCandidate = (value) => { |
| 401 | value = String(value || '').trim(); |
| 402 | if (!value || seen.has(value)) return; |
| 403 | seen.add(value); |
| 404 | candidates.push(value); |
| 405 | }; |
| 406 | |
| 407 | const normalized = String(source || '').trim(); |
| 408 | const stripped = stripJSONGuards(normalized); |
| 409 | |
| 410 | addCandidate(normalized); |
| 411 | addCandidate(stripped); |
| 412 | |
| 413 | if (options.allowExtractJSONFragment !== false && !/^[\{\[]/.test(stripped) && !(options.nestedEscapeParse && /^["']/.test(stripped))) { |
| 414 | addCandidate(extractBalancedJSONContainer(stripped)); |
| 415 | addCandidate(extractBalancedJSONContainer(normalized)); |
| 416 | } |
| 417 | |
| 418 | return candidates; |
| 419 | } |
| 420 | |
| 421 | function parseJSONLike(source, options) { |
| 422 | options = options || {}; |
no test coverage detected