MCPcopy Index your code
hub / github.com/pythongosssss/ComfyUI-Custom-Scripts / getNodeDefaults

Function getNodeDefaults

web/js/widgetDefaults.js:19–38  ·  view source on GitHub ↗
(node, defaults)

Source from the content-addressed store, hash-verified

17 let setting;
18
19 const getNodeDefaults = (node, defaults) => {
20 const nodeDefaults = defaults[node.type] ?? {};
21 const propSetBy = {};
22
23 Object.keys(regexDefaults)
24 .filter((r) => new RegExp(r).test(node.type))
25 .reduce((p, n) => {
26 const props = regexDefaults[n];
27 for (const k in props) {
28 // Use the longest matching key as its probably the most specific
29 if (!(k in nodeDefaults) || (k in propSetBy && n.length > propSetBy[k].length)) {
30 propSetBy[k] = n;
31 nodeDefaults[k] = props[k];
32 }
33 }
34 return p;
35 }, nodeDefaults);
36
37 return nodeDefaults;
38 };
39
40 const applyDefaults = (defaults) => {
41 for (const node of Object.values(LiteGraph.registered_node_types)) {

Callers 2

applyDefaultsFunction · 0.85
setupFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected