Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * compactObject
- * =============
- * Simple port of Underscore Array's compact function. You need to replace _.trim function if underscore.string it's not included.
- */
- _.mixin({
- compactObject: function(to_clean) {
- _.map(to_clean, function(value, key, to_clean) {
- if ( !!!value || (_.isString(value) && _.trim(value).length === 0)) {
- delete to_clean[key];
- }
- });
- return to_clean;
- }
- });
Add Comment
Please, Sign In to add comment