MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / applyEnv

Method applyEnv

tools/nodered2mcu.js:1870–1895  ·  view source on GitHub ↗
(config, name, node, flows)

Source from the content-addressed store, hash-verified

1868 return parts;
1869 }
1870 applyEnv(config, name, node, flows) {
1871 const value = config[name];
1872
1873 if (value instanceof Uint8Array)
1874 return;
1875
1876 if (Array.isArray(value)) {
1877 for (let i=0, length = value.length ; i < length; i++)
1878 this.applyEnv(value, i, node, flows);
1879 return;
1880 }
1881
1882 if ("string" == typeof value) {
1883 if (("$" === value[0]) && (EnvVarPropertyRE_old.test(value) || EnvVarPropertyRE.test(value)) ) {
1884 const v = this.getSetting(value.substring(2, value.length - 1), node, flows);
1885 if (v)
1886 config[name] = v;
1887 }
1888 return;
1889 }
1890
1891 for (let name in value) {
1892 if (Object.hasOwn(value, name))
1893 this.applyEnv(value, name, node, flows);
1894 }
1895 }
1896 getSetting(name, node, flows) { //@@ subflows
1897 const type = node.type;
1898

Callers 1

transformFlowsMethod · 0.80

Calls 2

testMethod · 0.80
getSettingMethod · 0.80

Tested by

no test coverage detected