Skip to content

Commit

Permalink
[Deps] use has instead of relying on Function#call.
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Dec 10, 2015
1 parent a33c88f commit 0eeda8f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
14 changes: 7 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var ObjectPrototype = Object.prototype;
var toStr = ObjectPrototype.toString;
var booleanValue = Boolean.prototype.valueOf;
var has = ObjectPrototype.hasOwnProperty;
var has = require('has');
var isArrowFunction = require('is-arrow-function');
var isBoolean = require('is-boolean-object');
var isDate = require('is-date-object');
Expand Down Expand Up @@ -40,7 +40,7 @@ if (!getPrototypeOf) {
getPrototypeOf = function (obj) {
var constructor = obj.constructor,
oldConstructor;
if (has.call(obj, 'constructor')) {
if (has(obj, 'constructor')) {
oldConstructor = constructor;
if (!(delete obj.constructor)) { // reset constructor
return null; // can't delete obj.constructor, return null
Expand Down Expand Up @@ -127,7 +127,7 @@ module.exports = function isEqual(value, other) {
var index = value.length;
do {
index -= 1;
} while (index > 0 && has.call(value, index) && has.call(other, index) && isEqual(value[index], other[index]));
} while (index > 0 && has(value, index) && has(other, index) && isEqual(value[index], other[index]));
return index <= 0;
}

Expand Down Expand Up @@ -199,14 +199,14 @@ module.exports = function isEqual(value, other) {

var key;
for (key in value) {
if (has.call(value, key)) {
if (!has.call(other, key)) { return false; }
if (has(value, key)) {
if (!has(other, key)) { return false; }
if (!isEqual(value[key], other[key])) { return false; }
}
}
for (key in other) {
if (has.call(other, key)) {
if (!has.call(value, key)) { return false; }
if (has(other, key)) {
if (!has(value, key)) { return false; }
if (!isEqual(other[key], value[key])) { return false; }
}
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"equality"
],
"dependencies": {
"has": "^1.0.1",
"is-arrow-function": "^2.0.3",
"is-boolean-object": "^1.0.0",
"is-callable": "^1.1.1",
Expand Down

0 comments on commit 0eeda8f

Please sign in to comment.