@sinonjs/samsam
Advanced tools
Comparing version 2.1.1 to 2.1.2
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('array-from')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'array-from'], factory) : | ||
(factory((global.samsam = {}),global.arrayFrom)); | ||
}(this, (function (exports,arrayFrom) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(factory((global.samsam = {}))); | ||
}(this, (function (exports) { 'use strict'; | ||
arrayFrom = arrayFrom && arrayFrom.hasOwnProperty('default') ? arrayFrom['default'] : arrayFrom; | ||
var o = Object.prototype; | ||
@@ -157,25 +155,14 @@ | ||
function isSubset(s1, s2, compare) { | ||
// FIXME: IE11 doesn't support Array.from | ||
// Potential solutions: | ||
// - contribute a patch to https://github.com/Volox/eslint-plugin-ie11#readme | ||
// - https://github.com/mathiasbynens/Array.from (doesn't work with matchers) | ||
var values1 = arrayFrom(s1); | ||
var values2 = arrayFrom(s2); | ||
for (var i = 0; i < values1.length; i++) { | ||
var allContained = true; | ||
s1.forEach(function(v1) { | ||
var includes = false; | ||
for (var j = 0; j < values2.length; j++) { | ||
if (compare(values2[j], values1[i])) { | ||
s2.forEach(function(v2) { | ||
if (compare(v2, v1)) { | ||
includes = true; | ||
break; | ||
} | ||
} | ||
}); | ||
allContained = allContained && includes; | ||
}); | ||
if (!includes) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
return allContained; | ||
} | ||
@@ -185,4 +172,17 @@ | ||
var re = /function (\w+)\s*\(/; | ||
function getClassName(value) { | ||
return value.constructor ? value.constructor.name : null; | ||
if (value.constructor && "name" in value.constructor) { | ||
return value.constructor.name; | ||
} | ||
if (typeof value.constructor === "function") { | ||
var match = value.constructor.toString().match(re); | ||
if (match.length > 1) { | ||
return match[1]; | ||
} | ||
} | ||
return null; | ||
} | ||
@@ -269,3 +269,7 @@ | ||
if (obj1 instanceof Error && obj2 instanceof Error) { | ||
if (obj1.stack !== obj2.stack) { | ||
if ( | ||
obj1.constructor !== obj2.constructor || | ||
obj1.message !== obj2.message || | ||
obj1.stack !== obj2.stack | ||
) { | ||
return false; | ||
@@ -272,0 +276,0 @@ } |
@@ -91,3 +91,7 @@ "use strict"; | ||
if (obj1 instanceof Error && obj2 instanceof Error) { | ||
if (obj1.stack !== obj2.stack) { | ||
if ( | ||
obj1.constructor !== obj2.constructor || | ||
obj1.message !== obj2.message || | ||
obj1.stack !== obj2.stack | ||
) { | ||
return false; | ||
@@ -94,0 +98,0 @@ } |
"use strict"; | ||
var re = /function (\w+)\s*\(/; | ||
function getClassName(value) { | ||
return value.constructor ? value.constructor.name : null; | ||
if (value.constructor && "name" in value.constructor) { | ||
return value.constructor.name; | ||
} | ||
if (typeof value.constructor === "function") { | ||
var match = value.constructor.toString().match(re); | ||
if (match.length > 1) { | ||
return match[1]; | ||
} | ||
} | ||
return null; | ||
} | ||
module.exports = getClassName; |
"use strict"; | ||
var from = require("array-from"); | ||
function isSubset(s1, s2, compare) { | ||
// FIXME: IE11 doesn't support Array.from | ||
// Potential solutions: | ||
// - contribute a patch to https://github.com/Volox/eslint-plugin-ie11#readme | ||
// - https://github.com/mathiasbynens/Array.from (doesn't work with matchers) | ||
var values1 = from(s1); | ||
var values2 = from(s2); | ||
for (var i = 0; i < values1.length; i++) { | ||
var allContained = true; | ||
s1.forEach(function(v1) { | ||
var includes = false; | ||
for (var j = 0; j < values2.length; j++) { | ||
if (compare(values2[j], values1[i])) { | ||
s2.forEach(function(v2) { | ||
if (compare(v2, v1)) { | ||
includes = true; | ||
break; | ||
} | ||
} | ||
}); | ||
allContained = allContained && includes; | ||
}); | ||
if (!includes) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
return allContained; | ||
} | ||
module.exports = isSubset; |
{ | ||
"name": "@sinonjs/samsam", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "Value identification and comparison functions", | ||
@@ -24,3 +24,5 @@ "homepage": "http://sinonjs.github.io/samsam/", | ||
"test": "mocha ./lib/*.test.js", | ||
"test-coverage": "nyc --reporter text --reporter html --reporter lcovonly npm run test" | ||
"test-cloud": "npm run test-headless -- --wd", | ||
"test-coverage": "nyc --reporter text --reporter html --reporter lcovonly npm run test", | ||
"test-headless": "mochify lib/*.test.js" | ||
}, | ||
@@ -33,5 +35,3 @@ "files": [ | ||
], | ||
"dependencies": { | ||
"array-from": "^2.1.1" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
@@ -53,2 +53,3 @@ "@sinonjs/referee": "^2.0.0", | ||
"mocha": "^5.0.0", | ||
"mochify": "^5.8.1", | ||
"npm-run-all": "^4.1.2", | ||
@@ -55,0 +56,0 @@ "nyc": "^11.7.3", |
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
0
982
0
51466
21
21
- Removedarray-from@^2.1.1
- Removedarray-from@2.1.1(transitive)