MCPcopy Create free account
hub / github.com/Effect-TS/effect / filter

Function filter

packages/ai/ai/src/Tool.ts:1479–1507  ·  view source on GitHub ↗
(obj: any)

Source from the content-addressed store, hash-verified

1477}
1478
1479function filter(obj: any) {
1480 let next = [obj]
1481
1482 while (next.length) {
1483 const nodes = next
1484 next = []
1485
1486 for (const node of nodes) {
1487 if (Object.prototype.hasOwnProperty.call(node, "__proto__")) {
1488 throw new SyntaxError("Object contains forbidden prototype property")
1489 }
1490
1491 if (
1492 Object.prototype.hasOwnProperty.call(node, "constructor") &&
1493 Object.prototype.hasOwnProperty.call(node.constructor, "prototype")
1494 ) {
1495 throw new SyntaxError("Object contains forbidden prototype property")
1496 }
1497
1498 for (const key in node) {
1499 const value = node[key]
1500 if (value && typeof value === "object") {
1501 next.push(value)
1502 }
1503 }
1504 }
1505 }
1506 return obj
1507}
1508
1509/**
1510 * **Unsafe**: This function will throw an error if an insecure property is

Callers 1

_parseFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…