(text: string)
| 1919 | const suspectConstructorRx = /"constructor"\s*:/ |
| 1920 | |
| 1921 | function _parse(text: string) { |
| 1922 | // Parse normally |
| 1923 | const obj = JSON.parse(text) |
| 1924 | |
| 1925 | // Ignore null and non-objects |
| 1926 | if (obj === null || typeof obj !== "object") { |
| 1927 | return obj |
| 1928 | } |
| 1929 | |
| 1930 | if ( |
| 1931 | suspectProtoRx.test(text) === false && |
| 1932 | suspectConstructorRx.test(text) === false |
| 1933 | ) { |
| 1934 | return obj |
| 1935 | } |
| 1936 | |
| 1937 | // Scan result for proto keys |
| 1938 | return filter(obj) |
| 1939 | } |
| 1940 | |
| 1941 | function filter(obj: any) { |
| 1942 | let next = [obj] |
no test coverage detected