Created
August 31, 2012 23:44
-
-
Save lstebner/3561250 to your computer and use it in GitHub Desktop.
Underscore mixin to delete an object property
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// remove key from object | |
_.mixin({ | |
remove: function(obj, key){ | |
delete obj[key]; | |
return obj; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cool! Would be nice if you could also pass in an array of property names or any number of arguments to be deleted.