@sinonjs/samsam
Advanced tools
Comparing version 3.0.2 to 3.1.0
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@sinonjs/commons'), require('lodash.get')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@sinonjs/commons', 'lodash.get'], factory) : | ||
(factory((global.samsam = {}),global.commons,global.lodash)); | ||
}(this, (function (exports,commons,lodash) { 'use strict'; | ||
(factory((global.samsam = {}),global.require$$0,global.lodash)); | ||
}(this, (function (exports,require$$0,lodash) { 'use strict'; | ||
commons = commons && commons.hasOwnProperty('default') ? commons['default'] : commons; | ||
require$$0 = require$$0 && require$$0.hasOwnProperty('default') ? require$$0['default'] : require$$0; | ||
lodash = lodash && lodash.hasOwnProperty('default') ? lodash['default'] : lodash; | ||
@@ -122,2 +122,8 @@ | ||
function isSet(val) { | ||
return (typeof Set !== "undefined" && val instanceof Set) || false; | ||
} | ||
var isSet_1 = isSet; | ||
function isDate(value) { | ||
@@ -152,8 +158,2 @@ return value instanceof Date; | ||
function isSet(val) { | ||
return (typeof Set !== "undefined" && val instanceof Set) || false; | ||
} | ||
var isSet_1 = isSet; | ||
function isSubset(s1, s2, compare) { | ||
@@ -176,2 +176,4 @@ var allContained = true; | ||
var valueToString = require$$0.valueToString; | ||
var re = /function (\w+)\s*\(/; | ||
@@ -185,3 +187,3 @@ | ||
if (typeof value.constructor === "function") { | ||
var match = value.constructor.toString().match(re); | ||
var match = valueToString(value.constructor).match(re); | ||
if (match.length > 1) { | ||
@@ -197,2 +199,15 @@ return match[1]; | ||
var valueToString$1 = require$$0.valueToString; | ||
var every = Array.prototype.every; | ||
@@ -279,3 +294,3 @@ var getTime = Date.prototype.getTime; | ||
if (obj1 instanceof RegExp && obj2 instanceof RegExp) { | ||
if (obj1.toString() !== obj2.toString()) { | ||
if (valueToString$1(obj1) !== valueToString$1(obj2)) { | ||
return false; | ||
@@ -384,4 +399,5 @@ } | ||
var slice = commons.prototypes.string.slice; | ||
var typeOf = commons.typeOf; | ||
var slice = require$$0.prototypes.string.slice; | ||
var typeOf = require$$0.typeOf; | ||
var valueToString$2 = require$$0.valueToString; | ||
@@ -392,3 +408,5 @@ var iterableToString = function iterableToString(obj) { | ||
function stringify(item) { | ||
return typeof item === "string" ? "'" + item + "'" : String(item); | ||
return typeof item === "string" | ||
? "'" + item + "'" | ||
: valueToString$2(item); | ||
} | ||
@@ -424,12 +442,12 @@ | ||
var arrayProto = commons.prototypes.array; | ||
var arrayProto = require$$0.prototypes.array; | ||
var deepEqual$1 = deepEqual.use(match); // eslint-disable-line no-use-before-define | ||
var every$1 = commons.every; | ||
var functionName = commons.functionName; | ||
var every$1 = require$$0.every; | ||
var functionName = require$$0.functionName; | ||
var objectProto = commons.prototypes.object; | ||
var stringProto = commons.prototypes.string; | ||
var typeOf$1 = commons.typeOf; | ||
var valueToString = commons.valueToString; | ||
var objectProto = require$$0.prototypes.object; | ||
var stringProto = require$$0.prototypes.string; | ||
var typeOf$1 = require$$0.typeOf; | ||
var valueToString$3 = require$$0.valueToString; | ||
@@ -527,3 +545,3 @@ var arrayIndexOf = arrayProto.indexOf; | ||
array = map(Object.keys(expectation), function(key) { | ||
return key + ": " + valueToString(expectation[key]); | ||
return key + ": " + valueToString$3(expectation[key]); | ||
}); | ||
@@ -567,3 +585,3 @@ | ||
if (!m.message) { | ||
m.message = "match(" + valueToString(expectation) + ")"; | ||
m.message = "match(" + valueToString$3(expectation) + ")"; | ||
} | ||
@@ -625,7 +643,7 @@ | ||
return expectation === actual; | ||
}, "same(" + valueToString(expectation) + ")"); | ||
}, "same(" + valueToString$3(expectation) + ")"); | ||
}; | ||
match.in = function(arrayOfExpectations) { | ||
if (!Array.isArray(arrayOfExpectations)) { | ||
if (typeOf$1(arrayOfExpectations) !== "array") { | ||
throw new TypeError("array expected"); | ||
@@ -638,3 +656,3 @@ } | ||
}); | ||
}, "in(" + valueToString(arrayOfExpectations) + ")"); | ||
}, "in(" + valueToString$3(arrayOfExpectations) + ")"); | ||
}; | ||
@@ -676,3 +694,3 @@ | ||
if (!onlyProperty) { | ||
message += ", " + valueToString(value); | ||
message += ", " + valueToString$3(value); | ||
} | ||
@@ -709,3 +727,3 @@ message += ")"; | ||
if (!onlyProperty) { | ||
message += ", " + valueToString(value); | ||
message += ", " + valueToString$3(value); | ||
} | ||
@@ -779,3 +797,7 @@ message += ")"; | ||
every$1(actual, function(element, index) { | ||
return expectation[index] === element; | ||
var expected = expectation[index]; | ||
return typeOf$1(expected) === "array" && | ||
typeOf$1(element) === "array" | ||
? match.array.deepEquals(expected).test(element) | ||
: deepEqual$1(expected, element); | ||
}) | ||
@@ -887,2 +909,4 @@ ); | ||
var valueToString$4 = require$$0.valueToString; | ||
var deepEqual$2 = deepEqual.use(match$1); // eslint-disable-line no-use-before-define | ||
@@ -937,3 +961,3 @@ | ||
notNull && | ||
String(object) | ||
valueToString$4(object) | ||
.toLowerCase() | ||
@@ -1028,6 +1052,7 @@ .indexOf(matcher) >= 0 | ||
deepEqual: deepEqualCyclic$1, | ||
identical: identical_1, | ||
isArguments: isArguments_1, | ||
isElement: isElement_1, | ||
isNegZero: isNegZero_1, | ||
identical: identical_1, | ||
isSet: isSet_1, | ||
match: match_1 | ||
@@ -1037,7 +1062,8 @@ }; | ||
var samsam_2 = samsam.deepEqual; | ||
var samsam_3 = samsam.isArguments; | ||
var samsam_4 = samsam.isElement; | ||
var samsam_5 = samsam.isNegZero; | ||
var samsam_6 = samsam.identical; | ||
var samsam_7 = samsam.match; | ||
var samsam_3 = samsam.identical; | ||
var samsam_4 = samsam.isArguments; | ||
var samsam_5 = samsam.isElement; | ||
var samsam_6 = samsam.isNegZero; | ||
var samsam_7 = samsam.isSet; | ||
var samsam_8 = samsam.match; | ||
@@ -1047,7 +1073,8 @@ exports.default = samsam; | ||
exports.deepEqual = samsam_2; | ||
exports.isArguments = samsam_3; | ||
exports.isElement = samsam_4; | ||
exports.isNegZero = samsam_5; | ||
exports.identical = samsam_6; | ||
exports.match = samsam_7; | ||
exports.identical = samsam_3; | ||
exports.isArguments = samsam_4; | ||
exports.isElement = samsam_5; | ||
exports.isNegZero = samsam_6; | ||
exports.isSet = samsam_7; | ||
exports.match = samsam_8; | ||
@@ -1054,0 +1081,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
"use strict"; | ||
var typeOf = require("@sinonjs/commons").typeOf; | ||
// This helper makes it convenient to create Set instances from a | ||
@@ -15,3 +17,3 @@ // collection, an overcomes the shortcoming that IE11 doesn't support | ||
var items = Array.isArray(array) ? array : []; | ||
var items = typeOf(array) === "array" ? array : []; | ||
var set = new Set(); | ||
@@ -18,0 +20,0 @@ |
"use strict"; | ||
var valueToString = require("@sinonjs/commons").valueToString; | ||
var getClass = require("./get-class"); | ||
@@ -95,3 +97,3 @@ var identical = require("./identical"); | ||
if (obj1 instanceof RegExp && obj2 instanceof RegExp) { | ||
if (obj1.toString() !== obj2.toString()) { | ||
if (valueToString(obj1) !== valueToString(obj2)) { | ||
return false; | ||
@@ -98,0 +100,0 @@ } |
"use strict"; | ||
var valueToString = require("@sinonjs/commons").valueToString; | ||
var re = /function (\w+)\s*\(/; | ||
@@ -11,3 +13,3 @@ | ||
if (typeof value.constructor === "function") { | ||
var match = value.constructor.toString().match(re); | ||
var match = valueToString(value.constructor).match(re); | ||
if (match.length > 1) { | ||
@@ -14,0 +16,0 @@ return match[1]; |
@@ -5,2 +5,3 @@ "use strict"; | ||
var typeOf = require("@sinonjs/commons").typeOf; | ||
var valueToString = require("@sinonjs/commons").valueToString; | ||
@@ -11,3 +12,5 @@ module.exports = function iterableToString(obj) { | ||
function stringify(item) { | ||
return typeof item === "string" ? "'" + item + "'" : String(item); | ||
return typeof item === "string" | ||
? "'" + item + "'" | ||
: valueToString(item); | ||
} | ||
@@ -14,0 +17,0 @@ |
"use strict"; | ||
var valueToString = require("@sinonjs/commons").valueToString; | ||
var deepEqual = require("./deep-equal").use(match); // eslint-disable-line no-use-before-define | ||
@@ -52,3 +54,3 @@ var getClass = require("./get-class"); | ||
notNull && | ||
String(object) | ||
valueToString(object) | ||
.toLowerCase() | ||
@@ -55,0 +57,0 @@ .indexOf(matcher) >= 0 |
@@ -205,3 +205,3 @@ "use strict"; | ||
match.in = function(arrayOfExpectations) { | ||
if (!Array.isArray(arrayOfExpectations)) { | ||
if (typeOf(arrayOfExpectations) !== "array") { | ||
throw new TypeError("array expected"); | ||
@@ -352,3 +352,7 @@ } | ||
every(actual, function(element, index) { | ||
return expectation[index] === element; | ||
var expected = expectation[index]; | ||
return typeOf(expected) === "array" && | ||
typeOf(element) === "array" | ||
? match.array.deepEquals(expected).test(element) | ||
: deepEqual(expected, element); | ||
}) | ||
@@ -355,0 +359,0 @@ ); |
@@ -7,2 +7,3 @@ "use strict"; | ||
var isNegZero = require("./is-neg-zero"); | ||
var isSet = require("./is-set"); | ||
var match = require("./match"); | ||
@@ -15,7 +16,8 @@ var deepEqualCyclic = require("./deep-equal").use(match); | ||
deepEqual: deepEqualCyclic, | ||
identical: identical, | ||
isArguments: isArguments, | ||
isElement: isElement, | ||
isNegZero: isNegZero, | ||
identical: identical, | ||
isSet: isSet, | ||
match: match | ||
}; |
{ | ||
"name": "@sinonjs/samsam", | ||
"version": "3.0.2", | ||
"version": "3.1.0", | ||
"description": "Value identification and comparison functions", | ||
@@ -5,0 +5,0 @@ "homepage": "http://sinonjs.github.io/samsam/", |
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
85312
1907