Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return match(function(actual) {
// Comparing lengths is the fastest way to spot a difference before iterating through every item
var sameLength = actual.length === expectation.length;
return (
typeOf(actual) === "array" &&
sameLength &&
every(actual, function(element, index) {
var expected = expectation[index];
return typeOf(expected) === "array" &&
typeOf(element) === "array"
? match.array.deepEquals(expected).test(element)
: deepEqual(expected, element);
})
);
}, "deepEquals([" + iterableToString(expectation) + "])");
};
"use strict";
var arrayProto = require("@sinonjs/commons").prototypes.array;
var deepEqual = require("./deep-equal").use(match); // eslint-disable-line no-use-before-define
var every = require("@sinonjs/commons").every;
var functionName = require("@sinonjs/commons").functionName;
var get = require("lodash").get;
var iterableToString = require("./iterable-to-string");
var objectProto = require("@sinonjs/commons").prototypes.object;
var stringProto = require("@sinonjs/commons").prototypes.string;
var typeOf = require("@sinonjs/commons").typeOf;
var valueToString = require("@sinonjs/commons").valueToString;
var arrayIndexOf = arrayProto.indexOf;
var arrayEvery = arrayProto.every;
var join = arrayProto.join;
var map = arrayProto.map;
var some = arrayProto.some;
"use strict";
var arrayProto = require("@sinonjs/commons").prototypes.array;
var deepEqual = require("./util/core/deep-equal").use(match); // eslint-disable-line no-use-before-define
var every = require("./util/core/every");
var functionName = require("@sinonjs/commons").functionName;
var get = require("lodash.get");
var iterableToString = require("./util/core/iterable-to-string");
var objectProto = require("@sinonjs/commons").prototypes.object;
var stringProto = require("@sinonjs/commons").prototypes.string;
var typeOf = require("./util/core/typeOf");
var valueToString = require("@sinonjs/commons").valueToString;
var arrayIndexOf = arrayProto.indexOf;
var arrayEvery = arrayProto.every;
var join = arrayProto.join;
var map = arrayProto.map;
var some = arrayProto.some;
var hasOwnProperty = objectProto.hasOwnProperty;
var isPrototypeOf = objectProto.isPrototypeOf;
var stringIndexOf = stringProto.indexOf;
function assertType(value, type, name) {
var actual = typeOf(value);
"use strict";
var arrayProto = require("@sinonjs/commons").prototypes.array;
var deepEqual = require("./deep-equal").use(match); // eslint-disable-line no-use-before-define
var every = require("@sinonjs/commons").every;
var functionName = require("@sinonjs/commons").functionName;
var get = require("lodash").get;
var iterableToString = require("./iterable-to-string");
var objectProto = require("@sinonjs/commons").prototypes.object;
var stringProto = require("@sinonjs/commons").prototypes.string;
var typeOf = require("@sinonjs/commons").typeOf;
var valueToString = require("@sinonjs/commons").valueToString;
var arrayIndexOf = arrayProto.indexOf;
var arrayEvery = arrayProto.every;
var join = arrayProto.join;
var map = arrayProto.map;
var some = arrayProto.some;
var hasOwnProperty = objectProto.hasOwnProperty;
var isPrototypeOf = objectProto.isPrototypeOf;
var objectToString = objectProto.toString;
var stringIndexOf = stringProto.indexOf;
var matcher = {
"use strict";
var arrayProto = require("@sinonjs/commons").prototypes.array;
var hasOwnProperty = require("@sinonjs/commons").prototypes.object.hasOwnProperty;
var join = arrayProto.join;
var push = arrayProto.push;
var slice = arrayProto.slice;
// Adapted from https://developer.mozilla.org/en/docs/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug
var hasDontEnumBug = (function() {
var obj = {
constructor: function() {
return "0";
},
toString: function() {
return "1";
},
valueOf: function() {
function createSpy(func) {
var name;
var funk = func;
if (typeof funk !== "function") {
funk = function() {
return;
};
} else {
name = functionName(funk);
}
var proxy = createProxy(funk, funk);
// Inherit spy API:
extend.nonEnum(proxy, spyApi);
extend.nonEnum(proxy, {
displayName: name || "spy",
fakes: [],
instantiateFake: createSpy,
id: "spy#" + uuid++
});
return proxy;
}
var fnStub =
pop(
sort(matchings, function(a, b) {
return a.matchingArguments.length - b.matchingArguments.length;
})
) || proxy;
return getCurrentBehavior(fnStub).invoke(this, arguments);
}
proxy = createProxy(functionStub, originalFunc || functionStub);
// Inherit spy API:
extend.nonEnum(proxy, spy);
// Inherit stub API:
extend.nonEnum(proxy, stub);
var name = originalFunc ? functionName(originalFunc) : null;
extend.nonEnum(proxy, {
fakes: [],
instantiateFake: createStub,
displayName: name || "stub",
defaultBehavior: null,
behaviors: [],
id: "stub#" + uuid++
});
return proxy;
}
var fnStub =
pop(
sort(matchings, function(a, b) {
return a.matchingArguments.length - b.matchingArguments.length;
})
) || proxy;
return getCurrentBehavior(fnStub).invoke(this, arguments);
}
proxy = createProxy(functionStub, originalFunc || functionStub);
// Inherit spy API:
extend.nonEnum(proxy, spy);
// Inherit stub API:
extend.nonEnum(proxy, stub);
var name = originalFunc ? functionName(originalFunc) : null;
extend.nonEnum(proxy, {
fakes: [],
instantiateFake: createStub,
displayName: name || "stub",
defaultBehavior: null,
behaviors: [],
id: "stub#" + uuid++
});
return proxy;
}
}
// eslint supports bigint as of version 6.0.0
// https://github.com/eslint/eslint/commit/e4ab0531c4e44c23494c6a802aa2329d15ac90e5
// eslint-disable-next-line
if (typeOf(object) === "bigint") {
return object.toString();
}
var internalProcessed = processed || [];
if (isCircular(object, internalProcessed)) {
return "[Circular]";
}
if (typeOf(object) === "array") {
return ascii.array.call(f, object, internalProcessed);
}
if (!object) {
return String(1 / object === -Infinity ? "-0" : object);
}
if (samsam.isElement(object)) {
return ascii.element(object);
}
if (
typeof object.toString === "function" &&
object.toString !== Object.prototype.toString
) {
return object.toString();
}
},{}],20:[function(require,module,exports){
"use strict";
var globalObject = require("@sinonjs/commons").global;
// eslint-disable-next-line complexity
function withGlobal(_global) {
var userAgent = _global.navigator && _global.navigator.userAgent;
var isRunningInIE = userAgent && userAgent.indexOf("MSIE ") > -1;
var maxTimeout = Math.pow(2, 31) - 1; //see https://heycam.github.io/webidl/#abstract-opdef-converttoint
var NOOP = function() {
return undefined;
};
var NOOP_ARRAY = function() {
return [];
};
var timeoutResult = _global.setTimeout(NOOP, 0);
var addTimerReturnsObject = typeof timeoutResult === "object";
var hrtimePresent =
_global.process && typeof _global.process.hrtime === "function";