(text: string)
| 1457 | const suspectConstructorRx = /"constructor"\s*:/ |
| 1458 | |
| 1459 | function _parse(text: string) { |
| 1460 | // Parse normally |
| 1461 | const obj = JSON.parse(text) |
| 1462 | |
| 1463 | // Ignore null and non-objects |
| 1464 | if (obj === null || typeof obj !== "object") { |
| 1465 | return obj |
| 1466 | } |
| 1467 | |
| 1468 | if ( |
| 1469 | suspectProtoRx.test(text) === false && |
| 1470 | suspectConstructorRx.test(text) === false |
| 1471 | ) { |
| 1472 | return obj |
| 1473 | } |
| 1474 | |
| 1475 | // Scan result for proto keys |
| 1476 | return filter(obj) |
| 1477 | } |
| 1478 | |
| 1479 | function filter(obj: any) { |
| 1480 | let next = [obj] |
no test coverage detected
searching dependent graphs…