Skip to content
Permalink
Browse files
refactor(ConfigChanges): use for-of loop for iterating over array (#159)
  • Loading branch information
raphinesse committed Mar 2, 2021
1 parent 7e615a5 commit 5ad1bdbec90e3ad740eec8538a2a6e653c30b0d0
Showing 1 changed file with 2 additions and 2 deletions.
@@ -67,13 +67,13 @@ class PlatformMunger {
// The remove parameter tells whether to add the change or remove it.
apply_file_munge (file, munge, remove) {
for (const selector in munge.parents) {
for (const xml_child in munge.parents[selector]) {
for (const mungeElem of munge.parents[selector]) {
// this xml child is new, graft it (only if config file exists)
const config_file = this.config_keeper.get(this.project_dir, this.platform, file);

if (config_file.exists) {
const operation = remove ? 'prune_child' : 'graft_child';
config_file[operation](selector, munge.parents[selector][xml_child]);
config_file[operation](selector, mungeElem);
} else {
events.emit('warn', `config file ${file} requested for changes not found at ${config_file.filepath}, ignoring`);
}

0 comments on commit 5ad1bdb

Please sign in to comment.