[Pkg-javascript-commits] [backbone] 275/281: one more refactor...

Jonas Smedegaard js at moszumanska.debian.org
Sat May 3 17:02:22 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag 0.9.0
in repository backbone.

commit fb97ef1e86593f374fdf32b03064c2f364d23228
Author: Brad Dunbar <dunbarb2 at gmail.com>
Date:   Mon Jan 30 13:57:00 2012 -0500

    one more refactor...
---
 backbone.js | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/backbone.js b/backbone.js
index 8ac5162..f652cff 100644
--- a/backbone.js
+++ b/backbone.js
@@ -395,16 +395,13 @@
     // You can also pass an attributes object to diff against the model,
     // determining if there *would be* a change.
     changedAttributes: function(diff) {
-      if (diff) {
-        var val, changed = false, old = this._previousAttributes;
-        for (var attr in diff) {
-          if (_.isEqual(old[attr], (val = diff[attr]))) continue;
-          (changed || (changed = {}))[attr] = val;
-        }
-        return changed;
+      if (!diff) return this.hasChanged() ? _.clone(this._changed) : false;
+      var val, changed = false, old = this._previousAttributes;
+      for (var attr in diff) {
+        if (_.isEqual(old[attr], (val = diff[attr]))) continue;
+        (changed || (changed = {}))[attr] = val;
       }
-      if (!this.hasChanged()) return false;
-      return _.clone(this._changed);
+      return changed;
     },
 
     // Get the previous value of an attribute, recorded at the time the last

-- 
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