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