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

Function getDefaults

web/js/widgetDefaults.js:65–92  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

63 };
64
65 const getDefaults = () => {
66 let items;
67 regexDefaults = {};
68 try {
69 items = JSON.parse(setting.value);
70 items = items.reduce((p, n) => {
71 if (n.node.startsWith("/") && n.node.endsWith("/")) {
72 const name = n.node.substring(1, n.node.length - 1);
73 try {
74 // Validate regex
75 new RegExp(name);
76
77 if (!regexDefaults[name]) regexDefaults[name] = {};
78 regexDefaults[name][n.widget] = n.value;
79 } catch (error) {}
80 }
81
82 if (!p[n.node]) p[n.node] = {};
83 p[n.node][n.widget] = n.value;
84 return p;
85 }, {});
86 } catch (error) {}
87 if (!items) {
88 items = {};
89 }
90 applyDefaults(items);
91 return items;
92 };
93
94 const onNodeAdded = app.graph.onNodeAdded;
95 app.graph.onNodeAdded = function (node) {

Callers 2

saveMethod · 0.85
setupFunction · 0.85

Calls 1

applyDefaultsFunction · 0.85

Tested by

no test coverage detected