unexpected
Advanced tools
Comparing version 3.1.4 to 3.1.5
@@ -166,3 +166,4 @@ /*global namespace*/ | ||
if (this.flags.only) { | ||
expect(hasKeys && getKeys(subject).length === keys.length, '[not] to be truthy'); | ||
expect(hasKeys, 'to be truthy'); | ||
expect(getKeys(subject).length === keys.length, '[not] to be truthy'); | ||
} else { | ||
@@ -169,0 +170,0 @@ expect(hasKeys, '[not] to be truthy'); |
@@ -17,2 +17,3 @@ /*global namespace*/ | ||
var isArguments = utils.isArguments; | ||
var getKeyOfDefinedProperties = utils.getKeyOfDefinedProperties; | ||
var extend = utils.extend; | ||
@@ -110,9 +111,7 @@ var levenshteinDistance = utils.levenshteinDistance; | ||
} | ||
var actualKeys, expectedKeys, key, i; | ||
try { | ||
actualKeys = getKeys(actual); | ||
expectedKeys = getKeys(expected); | ||
} catch (e) {//happens when one is a string literal and the other isn't | ||
return false; | ||
} | ||
var actualKeys = getKeyOfDefinedProperties(actual), | ||
expectedKeys = getKeyOfDefinedProperties(expected), | ||
key, | ||
i; | ||
// having the same number of owned properties (keys incorporates hasOwnProperty) | ||
@@ -119,0 +118,0 @@ if (actualKeys.length !== expectedKeys.length) { |
@@ -5,2 +5,3 @@ /*global namespace*/ | ||
var forEach = shim.forEach; | ||
var filter = shim.filter; | ||
var getKeys = shim.getKeys; | ||
@@ -39,3 +40,2 @@ | ||
isArray: function (ar) { | ||
@@ -82,10 +82,16 @@ return Object.prototype.toString.call(ar) === '[object Array]'; | ||
isUndefinedOrNull: function (value) { | ||
isUndefinedOrNull: function (value) { | ||
return value === null || value === undefined; | ||
}, | ||
isArguments: function (object) { | ||
isArguments: function (object) { | ||
return Object.prototype.toString.call(object) === '[object Arguments]'; | ||
}, | ||
getKeyOfDefinedProperties: function (object) { | ||
return filter(getKeys(object), function (key) { | ||
return typeof object[key] !== 'undefined'; | ||
}); | ||
}, | ||
/** | ||
@@ -92,0 +98,0 @@ * Levenshtein distance algorithm from wikipedia |
{ | ||
"name": "unexpected", | ||
"version": "3.1.4", | ||
"version": "3.1.5", | ||
"author": "Sune Sloth Simonsen <sune@we-knowhow.dk>", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
302036
5923