[Pkg-javascript-commits] [backbone] 34/37: DRY-ing up _validate
Jonas Smedegaard
js at moszumanska.debian.org
Sat May 3 17:02:49 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to tag 0.9.1
in repository backbone.
commit 8a427f30180eab5eeda0decd4478f8eafbb1f349
Author: Jeremy Ashkenas <jashkenas at gmail.com>
Date: Thu Feb 2 16:22:10 2012 -0500
DRY-ing up _validate
---
backbone.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/backbone.js b/backbone.js
index 242458f..2eed82d 100644
--- a/backbone.js
+++ b/backbone.js
@@ -226,7 +226,7 @@
if (options.unset) for (attr in attrs) attrs[attr] = void 0;
// Run validation.
- if (!options.silent && !this._validate(attrs, options)) return false;
+ if (!this._validate(attrs, options)) return false;
// Check for changes of `id`.
if (this.idAttribute in attrs) this.id = attrs[this.idAttribute];
@@ -446,7 +446,7 @@
// if all is well. If a specific `error` callback has been passed,
// call that instead of firing the general `"error"` event.
_validate: function(attrs, options) {
- if (!_.isFunction(this.validate)) return true;
+ if (options.silent || !this.validate) return true;
attrs = _.extend({}, this.attributes, attrs);
var error = this.validate(attrs, options);
if (!error) return true;
@@ -674,7 +674,7 @@
var attrs = model;
options.collection = this;
model = new this.model(attrs, options);
- if (!options.silent && !model._validate(model.attributes, options)) model = false;
+ if (!model._validate(model.attributes, options)) model = false;
} else if (!model.collection) {
model.collection = this;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/backbone.git
More information about the Pkg-javascript-commits
mailing list