mirror of
https://github.com/jashkenas/backbone.git
synced 2026-04-30 03:00:06 -04:00
Enhancing Model with isEmpty function
This commit is contained in:
@@ -578,6 +578,11 @@
|
||||
return this._validate({}, _.extend(options || {}, { validate: true }));
|
||||
},
|
||||
|
||||
// Check if the model is empty.
|
||||
isEmpty: function() {
|
||||
return _.isEmpty(this.attributes);
|
||||
},
|
||||
|
||||
// Run validation against the next complete set of model attributes,
|
||||
// returning `true` if all is well. Otherwise, fire an `"invalid"` event.
|
||||
_validate: function(attrs, options) {
|
||||
|
||||
Reference in New Issue
Block a user