[Pkg-javascript-commits] [backbone] 274/281: factor away else branch

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 ef9d40aa82d452459caab3d20ead4bc5967636c5
Author: Brad Dunbar <dunbarb2 at gmail.com>
Date:   Mon Jan 30 13:28:34 2012 -0500

    factor away else branch
---
 backbone.js | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/backbone.js b/backbone.js
index b03b2c5..8ac5162 100644
--- a/backbone.js
+++ b/backbone.js
@@ -395,17 +395,16 @@
     // You can also pass an attributes object to diff against the model,
     // determining if there *would be* a change.
     changedAttributes: function(diff) {
-      var changed = false, old = this._previousAttributes;
       if (diff) {
+        var val, changed = false, old = this._previousAttributes;
         for (var attr in diff) {
-          if (_.isEqual(old[attr], diff[attr])) continue;
-          (changed || (changed = {}))[attr] = diff[attr];
+          if (_.isEqual(old[attr], (val = diff[attr]))) continue;
+          (changed || (changed = {}))[attr] = val;
         }
         return changed;
-      } else {
-        if (!this.hasChanged()) return false;
-        return _.clone(this._changed);
       }
+      if (!this.hasChanged()) return false;
+      return _.clone(this._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