MCPcopy Create free account
hub / github.com/json-editor/json-editor / optimizeNames

Method optimizeNames

docs/scripts/ajv-validator.js:874–886  ·  view source on GitHub ↗
(names, constants)

Source from the content-addressed store, hash-verified

872 return nodes.length > 0 ? this : undefined;
873 }
874 optimizeNames(names, constants) {
875 const { nodes } = this;
876 let i = nodes.length;
877 while (i--) {
878 // iterating backwards improves 1-pass optimization
879 const n = nodes[i];
880 if (n.optimizeNames(names, constants))
881 continue;
882 subtractNames(names, n.names);
883 nodes.splice(i, 1);
884 }
885 return nodes.length > 0 ? this : undefined;
886 }
887 get names() {
888 return this.nodes.reduce((names, n) => addNames(names, n.names), {});
889 }

Callers

nothing calls this directly

Calls 2

subtractNamesFunction · 0.85
optimizeNamesMethod · 0.45

Tested by

no test coverage detected