Merge pull request #366 from lvzhenbang/patch-3

update cleanObj
This commit is contained in:
Angelos Chalaris
2017-12-27 10:33:49 +02:00
committed by GitHub

View File

@ -13,11 +13,11 @@ const cleanObj = (obj, keysToKeep = [], childIndicator) => {
} else if (!keysToKeep.includes(key)) { } else if (!keysToKeep.includes(key)) {
delete obj[key]; delete obj[key];
} }
})  });
return obj;
} }
/* /*
const testObj = {a: 1, b: 2, children: {a: 1, b: 2}} const testObj = {a: 1, b: 2, children: {a: 1, b: 2}}
cleanObj(testObj, ["a"],"children") cleanObj(testObj, ["a"],"children") // { a: 1, children : { a: 1}}
console.log(testObj)// { a: 1, children : { a: 1}}
*/ */
``` ```