@sinonjs/samsam
Advanced tools
Comparing version 3.3.2 to 3.3.3
@@ -53,3 +53,3 @@ (function (global, factory) { | ||
var o = Object.prototype; | ||
var toString = require$$0.prototypes.object.toString; | ||
@@ -60,3 +60,3 @@ function getClass(value) { | ||
// internal class, e.g. "Array" | ||
return o.toString.call(value).split(/[ \]]/)[1]; | ||
return toString(value).split(/[ \]]/)[1]; | ||
} | ||
@@ -183,23 +183,11 @@ | ||
var valueToString = require$$0.valueToString; | ||
var className = require$$0.className; | ||
var arrayProto = require$$0.prototypes.array; | ||
var objectProto = require$$0.prototypes.object; | ||
var re = /function (\w+)\s*\(/; | ||
function getClassName(value) { | ||
if (value.constructor && "name" in value.constructor) { | ||
return value.constructor.name; | ||
} | ||
if (typeof value.constructor === "function") { | ||
var match = valueToString(value.constructor).match(re); | ||
if (match.length > 1) { | ||
return match[1]; | ||
} | ||
} | ||
return null; | ||
} | ||
var getClassName_1 = getClassName; | ||
var valueToString$1 = require$$0.valueToString; | ||
@@ -211,13 +199,6 @@ | ||
var every = Array.prototype.every; | ||
var every = arrayProto.every; | ||
var getTime = Date.prototype.getTime; | ||
var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
var indexOf = Array.prototype.indexOf; | ||
var hasOwnProperty = objectProto.hasOwnProperty; | ||
var indexOf = arrayProto.indexOf; | ||
var keys = Object.keys; | ||
@@ -306,3 +287,3 @@ var getOwnPropertySymbols = Object.getOwnPropertySymbols; | ||
if (actualObj instanceof RegExp && expectationObj instanceof RegExp) { | ||
if (valueToString$1(actualObj) !== valueToString$1(expectationObj)) { | ||
if (valueToString(actualObj) !== valueToString(expectationObj)) { | ||
return false; | ||
@@ -320,4 +301,4 @@ } | ||
var expectationKeys = keys(expectationObj); | ||
var actualName = getClassName_1(actualObj); | ||
var expectationName = getClassName_1(expectationObj); | ||
var actualName = className(actualObj); | ||
var expectationName = className(expectationObj); | ||
var expectationSymbols = | ||
@@ -379,4 +360,4 @@ typeof getOwnPropertySymbols === "function" | ||
return every.call(expectationKeysAndSymbols, function(key) { | ||
if (!hasOwnProperty.call(actualObj, key)) { | ||
return every(expectationKeysAndSymbols, function(key) { | ||
if (!hasOwnProperty(actualObj, key)) { | ||
return false; | ||
@@ -393,6 +374,6 @@ } | ||
var actualIndex = actualObject | ||
? indexOf.call(actualObjects, actualValue) | ||
? indexOf(actualObjects, actualValue) | ||
: -1; | ||
var expectationIndex = expectationObject | ||
? indexOf.call(expectationObjects, expectationValue) | ||
? indexOf(expectationObjects, expectationValue) | ||
: -1; | ||
@@ -457,3 +438,3 @@ // determines the new paths of the objects | ||
var typeOf = require$$0.typeOf; | ||
var valueToString$2 = require$$0.valueToString; | ||
var valueToString$1 = require$$0.valueToString; | ||
@@ -466,3 +447,3 @@ var iterableToString = function iterableToString(obj) { | ||
? "'" + item + "'" | ||
: valueToString$2(item); | ||
: valueToString$1(item); | ||
} | ||
@@ -498,3 +479,3 @@ | ||
var arrayProto = require$$0.prototypes.array; | ||
var arrayProto$1 = require$$0.prototypes.array; | ||
var deepEqual$1 = deepEqual.use(match); // eslint-disable-line no-use-before-define | ||
@@ -505,18 +486,29 @@ var every$1 = require$$0.every; | ||
var objectProto = require$$0.prototypes.object; | ||
var objectProto$1 = require$$0.prototypes.object; | ||
var stringProto = require$$0.prototypes.string; | ||
var typeOf$1 = require$$0.typeOf; | ||
var valueToString$3 = require$$0.valueToString; | ||
var valueToString$2 = require$$0.valueToString; | ||
var arrayIndexOf = arrayProto.indexOf; | ||
var arrayEvery = arrayProto.every; | ||
var join = arrayProto.join; | ||
var map = arrayProto.map; | ||
var some = arrayProto.some; | ||
var arrayIndexOf = arrayProto$1.indexOf; | ||
var arrayEvery = arrayProto$1.every; | ||
var join = arrayProto$1.join; | ||
var map = arrayProto$1.map; | ||
var some = arrayProto$1.some; | ||
var hasOwnProperty$1 = objectProto.hasOwnProperty; | ||
var isPrototypeOf = objectProto.isPrototypeOf; | ||
var hasOwnProperty$1 = objectProto$1.hasOwnProperty; | ||
var isPrototypeOf = objectProto$1.isPrototypeOf; | ||
var objectToString = objectProto$1.toString; | ||
var stringIndexOf = stringProto.indexOf; | ||
var matcher = { | ||
toString: function() { | ||
return this.message; | ||
} | ||
}; | ||
function isMatcher(object) { | ||
return isPrototypeOf(matcher, object); | ||
} | ||
function assertType(value, type, name) { | ||
@@ -544,10 +536,10 @@ var actual = typeOf$1(value); | ||
var matcher = { | ||
toString: function() { | ||
return this.message; | ||
function assertMatcher(value) { | ||
if (!isMatcher(value)) { | ||
throw new TypeError("Matcher expected"); | ||
} | ||
}; | ||
} | ||
function isMatcher(object) { | ||
return isPrototypeOf(matcher, object); | ||
function isIterable(value) { | ||
return !!value && typeOf$1(value.forEach) === "function"; | ||
} | ||
@@ -603,3 +595,3 @@ | ||
array = map(Object.keys(expectation), function(key) { | ||
return key + ": " + valueToString$3(expectation[key]); | ||
return key + ": " + valueToString$2(expectation[key]); | ||
}); | ||
@@ -653,3 +645,3 @@ | ||
if (!m.message) { | ||
m.message = "match(" + valueToString$3(expectation) + ")"; | ||
m.message = "match(" + valueToString$2(expectation) + ")"; | ||
} | ||
@@ -711,3 +703,3 @@ | ||
return expectation === actual; | ||
}, "same(" + valueToString$3(expectation) + ")"); | ||
}, "same(" + valueToString$2(expectation) + ")"); | ||
}; | ||
@@ -724,3 +716,3 @@ | ||
}); | ||
}, "in(" + valueToString$3(arrayOfExpectations) + ")"); | ||
}, "in(" + valueToString$2(arrayOfExpectations) + ")"); | ||
}; | ||
@@ -751,5 +743,3 @@ | ||
return actual instanceof type; | ||
}, "instanceOf(" + | ||
(functionName(type) || Object.prototype.toString.call(type)) + | ||
")"); | ||
}, "instanceOf(" + (functionName(type) || objectToString(type)) + ")"); | ||
}; | ||
@@ -763,3 +753,3 @@ | ||
if (!onlyProperty) { | ||
message += ", " + valueToString$3(value); | ||
message += ", " + valueToString$2(value); | ||
} | ||
@@ -796,3 +786,3 @@ message += ")"; | ||
if (!onlyProperty) { | ||
message += ", " + valueToString$3(value); | ||
message += ", " + valueToString$2(value); | ||
} | ||
@@ -813,5 +803,3 @@ message += ")"; | ||
match.every = function(predicate) { | ||
if (!isMatcher(predicate)) { | ||
throw new TypeError("Matcher expected"); | ||
} | ||
assertMatcher(predicate); | ||
@@ -826,4 +814,3 @@ return match(function(actual) { | ||
return ( | ||
!!actual && | ||
typeOf$1(actual.forEach) === "function" && | ||
isIterable(actual) && | ||
every$1(actual, function(element) { | ||
@@ -837,5 +824,3 @@ return predicate.test(element); | ||
match.some = function(predicate) { | ||
if (!isMatcher(predicate)) { | ||
throw new TypeError("Matcher expected"); | ||
} | ||
assertMatcher(predicate); | ||
@@ -850,4 +835,3 @@ return match(function(actual) { | ||
return ( | ||
!!actual && | ||
typeOf$1(actual.forEach) === "function" && | ||
isIterable(actual) && | ||
!every$1(actual, function(element) { | ||
@@ -981,3 +965,3 @@ return !predicate.test(element); | ||
var valueToString$4 = require$$0.valueToString; | ||
var valueToString$3 = require$$0.valueToString; | ||
@@ -1033,3 +1017,3 @@ var deepEqual$2 = deepEqual.use(match$1); // eslint-disable-line no-use-before-define | ||
notNull && | ||
valueToString$4(object) | ||
valueToString$3(object) | ||
.toLowerCase() | ||
@@ -1036,0 +1020,0 @@ .indexOf(matcher) >= 0 |
"use strict"; | ||
var valueToString = require("@sinonjs/commons").valueToString; | ||
var className = require("@sinonjs/commons").className; | ||
var arrayProto = require("@sinonjs/commons").prototypes.array; | ||
var objectProto = require("@sinonjs/commons").prototypes.object; | ||
@@ -15,8 +18,7 @@ var getClass = require("./get-class"); | ||
var isSubset = require("./is-subset"); | ||
var getClassName = require("./get-class-name"); | ||
var every = Array.prototype.every; | ||
var every = arrayProto.every; | ||
var getTime = Date.prototype.getTime; | ||
var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
var indexOf = Array.prototype.indexOf; | ||
var hasOwnProperty = objectProto.hasOwnProperty; | ||
var indexOf = arrayProto.indexOf; | ||
var keys = Object.keys; | ||
@@ -118,4 +120,4 @@ var getOwnPropertySymbols = Object.getOwnPropertySymbols; | ||
var expectationKeys = keys(expectationObj); | ||
var actualName = getClassName(actualObj); | ||
var expectationName = getClassName(expectationObj); | ||
var actualName = className(actualObj); | ||
var expectationName = className(expectationObj); | ||
var expectationSymbols = | ||
@@ -177,4 +179,4 @@ typeof getOwnPropertySymbols === "function" | ||
return every.call(expectationKeysAndSymbols, function(key) { | ||
if (!hasOwnProperty.call(actualObj, key)) { | ||
return every(expectationKeysAndSymbols, function(key) { | ||
if (!hasOwnProperty(actualObj, key)) { | ||
return false; | ||
@@ -191,6 +193,6 @@ } | ||
var actualIndex = actualObject | ||
? indexOf.call(actualObjects, actualValue) | ||
? indexOf(actualObjects, actualValue) | ||
: -1; | ||
var expectationIndex = expectationObject | ||
? indexOf.call(expectationObjects, expectationValue) | ||
? indexOf(expectationObjects, expectationValue) | ||
: -1; | ||
@@ -197,0 +199,0 @@ // determines the new paths of the objects |
"use strict"; | ||
var o = Object.prototype; | ||
var toString = require("@sinonjs/commons").prototypes.object.toString; | ||
@@ -9,5 +9,5 @@ function getClass(value) { | ||
// internal class, e.g. "Array" | ||
return o.toString.call(value).split(/[ \]]/)[1]; | ||
return toString(value).split(/[ \]]/)[1]; | ||
} | ||
module.exports = getClass; |
@@ -22,5 +22,16 @@ "use strict"; | ||
var isPrototypeOf = objectProto.isPrototypeOf; | ||
var objectToString = objectProto.toString; | ||
var stringIndexOf = stringProto.indexOf; | ||
var matcher = { | ||
toString: function() { | ||
return this.message; | ||
} | ||
}; | ||
function isMatcher(object) { | ||
return isPrototypeOf(matcher, object); | ||
} | ||
function assertType(value, type, name) { | ||
@@ -48,10 +59,10 @@ var actual = typeOf(value); | ||
var matcher = { | ||
toString: function() { | ||
return this.message; | ||
function assertMatcher(value) { | ||
if (!isMatcher(value)) { | ||
throw new TypeError("Matcher expected"); | ||
} | ||
}; | ||
} | ||
function isMatcher(object) { | ||
return isPrototypeOf(matcher, object); | ||
function isIterable(value) { | ||
return !!value && typeOf(value.forEach) === "function"; | ||
} | ||
@@ -251,5 +262,3 @@ | ||
return actual instanceof type; | ||
}, "instanceOf(" + | ||
(functionName(type) || Object.prototype.toString.call(type)) + | ||
")"); | ||
}, "instanceOf(" + (functionName(type) || objectToString(type)) + ")"); | ||
}; | ||
@@ -311,5 +320,3 @@ | ||
match.every = function(predicate) { | ||
if (!isMatcher(predicate)) { | ||
throw new TypeError("Matcher expected"); | ||
} | ||
assertMatcher(predicate); | ||
@@ -324,4 +331,3 @@ return match(function(actual) { | ||
return ( | ||
!!actual && | ||
typeOf(actual.forEach) === "function" && | ||
isIterable(actual) && | ||
every(actual, function(element) { | ||
@@ -335,5 +341,3 @@ return predicate.test(element); | ||
match.some = function(predicate) { | ||
if (!isMatcher(predicate)) { | ||
throw new TypeError("Matcher expected"); | ||
} | ||
assertMatcher(predicate); | ||
@@ -348,4 +352,3 @@ return match(function(actual) { | ||
return ( | ||
!!actual && | ||
typeOf(actual.forEach) === "function" && | ||
isIterable(actual) && | ||
!every(actual, function(element) { | ||
@@ -352,0 +355,0 @@ return !predicate.test(element); |
{ | ||
"name": "@sinonjs/samsam", | ||
"version": "3.3.2", | ||
"version": "3.3.3", | ||
"description": "Value identification and comparison functions", | ||
@@ -35,5 +35,5 @@ "homepage": "http://sinonjs.github.io/samsam/", | ||
"dependencies": { | ||
"@sinonjs/commons": "^1.0.2", | ||
"@sinonjs/commons": "^1.3.0", | ||
"array-from": "^2.1.1", | ||
"lodash": "^4.17.11" | ||
"lodash": "^4.17.15" | ||
}, | ||
@@ -55,6 +55,6 @@ "devDependencies": { | ||
"mkdirp": "^0.5.1", | ||
"mocha": "^5.0.0", | ||
"mochify": "^5.8.1", | ||
"mocha": "^6.2.0", | ||
"mochify": "^6.4.1", | ||
"npm-run-all": "^4.1.2", | ||
"nyc": "^13.2.0", | ||
"nyc": "^14.1.1", | ||
"prettier": "1.13.7", | ||
@@ -61,0 +61,0 @@ "rollup": "^0.57.1", |
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
90380
23
1998
Updated@sinonjs/commons@^1.3.0
Updatedlodash@^4.17.15