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

Method setConfigOption

tools/mcmanifest.js:179–200  ·  view source on GitHub ↗
(sdkconfig, option)

Source from the content-addressed store, hash-verified

177 this.line("");
178 }
179 setConfigOption(sdkconfig, option) {
180 let name = option.name;
181 let value = option.value;
182 let index = sdkconfig.indexOf(name);
183 let changed = false;
184 if (-1 != index) {
185 ++index;
186 if ("n" == value) {
187 if ("y" == sdkconfig.charAt(index + name.length)) {
188 sdkconfig = sdkconfig.replace(new RegExp(name + ".*"), name + "=");
189 changed = true;
190 }
191 }
192 else {
193 if (value != sdkconfig.charAt(index + name.length)) {
194 sdkconfig = sdkconfig.replace(new RegExp(name + ".*"), name + "=" + value);
195 changed = true;
196 }
197 }
198 }
199 return { sdkconfig, changed };
200 }
201 generateConfigurationRules(tool) {
202 if ("esp32" !== tool.platform)
203 return;

Callers 1

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected