Created
December 26, 2012 01:36
-
-
Save alxarch/4377045 to your computer and use it in GitHub Desktop.
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
// Improved unset for multiple values. | |
unset: function(attr, options){ | |
var unset = {}, i, max; | |
if(typeof attr === 'string'){ | |
return Backbone.Model.prototype.unset.call(this, arguments); | |
} | |
if(attr instanceof Array){ | |
for(i = 0, max = attr.length; i < max; i++){ | |
unset[attr[i]] = null; | |
} | |
return this.set(unset, _.extend({}, options, { unset: true })); | |
} | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment