MCPcopy
hub / github.com/Effect-TS/effect / _parse

Function _parse

packages/ai/ai/src/Tool.ts:1459–1477  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

1457const suspectConstructorRx = /"constructor"\s*:/
1458
1459function _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
1479function filter(obj: any) {
1480 let next = [obj]

Callers 1

unsafeSecureJsonParseFunction · 0.85

Calls 2

parseMethod · 0.80
filterFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…