Skip to content

Commit

Permalink
Use Object.is() where available.
Browse files Browse the repository at this point in the history
  • Loading branch information
asudoh committed Jun 3, 2014
1 parent 1f50cbd commit e9f16bc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Observable.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@
* @returns The value set.
*/
value: (function () {
function areSameValues(lhs, rhs) {
var areSameValues = Object.is || function (lhs, rhs) {
return lhs === rhs && (lhs !== 0 || 1 / lhs === 1 / rhs) || lhs !== lhs && rhs !== rhs;
}
};
return function (name, value) {
var type = name in this ? Observable.CHANGETYPE_UPDATE : Observable.CHANGETYPE_ADD,
oldValue = this[name],
Expand Down
9 changes: 4 additions & 5 deletions ObservablePath.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@
})(this, function (Observable, BindingSource) {
"use strict";

var EMPTY_OBJECT = {};
var EMPTY_OBJECT = {},
areSameValues = Object.is || function (lhs, rhs) {
return lhs === rhs && (lhs !== 0 || 1 / lhs === 1 / rhs) || lhs !== lhs && rhs !== rhs;
};

function getPathComps(path, create) {
return path === "" ? [] : typeof path.splice !== "function" ? path.split(".") : create ? path.slice() : path;
}

function areSameValues(lhs, rhs) {
return lhs === rhs && (lhs !== 0 || 1 / lhs === 1 / rhs) || lhs !== lhs && rhs !== rhs;
}

/**
* @method module:liaison/ObservablePath.getObjectPath
* @param {object} o An object.
Expand Down

0 comments on commit e9f16bc

Please sign in to comment.