Skip to content

Instantly share code, notes, and snippets.

@kalinchernev
Created April 2, 2017 15:26
Show Gist options
  • Save kalinchernev/cb229d17be25e8d09b7a86e9a023c6ff to your computer and use it in GitHub Desktop.
Save kalinchernev/cb229d17be25e8d09b7a86e9a023c6ff to your computer and use it in GitHub Desktop.
Clean object having useless values - old school
1 function cleanObject(obj) {
2 for (var propName in obj) {
3 if (obj[propName] === null || obj[propName] === undefined || obj[propName] === 0) {
4 delete obj[propName];
5 }
6 }
7 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment