Skip to content

Instantly share code, notes, and snippets.

@krasnobaev
Last active August 12, 2016 08:57
Show Gist options
  • Save krasnobaev/95edaba20ed36e9104da7646da829ac3 to your computer and use it in GitHub Desktop.
Save krasnobaev/95edaba20ed36e9104da7646da829ac3 to your computer and use it in GitHub Desktop.
result = [{a:null,b:2}, {b:4,c:null}];
result.forEach(function (el) {
var keys = Object.prototype.keys(el);
keys.forEach(function (el2) {
if (el[el2] === null) {
delete el[el2];
}
});
});
var result = Object.freeze([{a:null,b:2}, {b:4,c:null}]);
resclone = [];
result.forEach(function (el) {
var kels = Object.keys(el);
var arr = {};
kels.forEach(function (kel) {
if (el[kel] !== null) {
arr[kel] = el[kel];
}
});
resclone.push(arr);
});
resclone;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment