MCPcopy Index your code
hub / github.com/anomalyco/opencode / walk

Function walk

packages/opencode/test/provider/transform.test.ts:1040–1050  ·  view source on GitHub ↗
(node: any, cb: (node: any, path: (string | number)[]) => void, path: (string | number)[] = [])

Source from the content-addressed store, hash-verified

1038 } as any
1039
1040 const walk = (node: any, cb: (node: any, path: (string | number)[]) => void, path: (string | number)[] = []) => {
1041 if (node === null || typeof node !== "object") {
1042 return
1043 }
1044 if (Array.isArray(node)) {
1045 node.forEach((item, i) => walk(item, cb, [...path, i]))
1046 return
1047 }
1048 cb(node, path)
1049 Object.entries(node).forEach(([key, value]) => walk(value, cb, [...path, key]))
1050 }
1051
1052 test("keeps edits.items.anyOf without adding type", () => {
1053 const schema = {

Callers 1

transform.test.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected