Skip to content

Instantly share code, notes, and snippets.

@apellizzn
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apellizzn/fd08706e080c1f4e30ce to your computer and use it in GitHub Desktop.
Save apellizzn/fd08706e080c1f4e30ce to your computer and use it in GitHub Desktop.
Javascript function that takes in input an object and return it without each attributes with value undefined, null, ""
function normalizeObject(object){
for(var index in object) {
console.log(!object[index]);
if(!object[index] && object[index]!== false && object[index]!==0){
delete object[index]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment