added unit testing, and started implementing unit tests...phew
This commit is contained in:
21
node_modules/@sinonjs/commons/.editorconfig
generated
vendored
Normal file
21
node_modules/@sinonjs/commons/.editorconfig
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
; EditorConfig file: http://EditorConfig.org
|
||||
; Install the "EditorConfig" plugin into your editor to use
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
# Matches the exact files either package.json or .travis.yml
|
||||
[{package.json, .travis.yml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
; Needed if doing `git add --patch` to edit patches
|
||||
[*.diff]
|
||||
trim_trailing_whitespace = false
|
1
node_modules/@sinonjs/commons/.eslintignore
generated
vendored
Normal file
1
node_modules/@sinonjs/commons/.eslintignore
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
coverage/*
|
53
node_modules/@sinonjs/commons/.eslintrc.yaml
generated
vendored
Normal file
53
node_modules/@sinonjs/commons/.eslintrc.yaml
generated
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
extends:
|
||||
- sinon
|
||||
- 'plugin:prettier/recommended'
|
||||
|
||||
env:
|
||||
browser: true
|
||||
node: true
|
||||
|
||||
globals:
|
||||
ArrayBuffer: false
|
||||
Map: false
|
||||
Promise: false
|
||||
Set: false
|
||||
Symbol: false
|
||||
|
||||
plugins:
|
||||
- ie11
|
||||
- local-rules
|
||||
|
||||
rules:
|
||||
strict: [error, 'global']
|
||||
# authors are expected to understand function hoisting
|
||||
no-use-before-define: off
|
||||
|
||||
ie11/no-collection-args: error
|
||||
ie11/no-for-in-const: error
|
||||
ie11/no-loop-func: warn
|
||||
ie11/no-weak-collections: error
|
||||
local-rules/no-prototype-methods: error
|
||||
|
||||
overrides:
|
||||
files: '*.test.*'
|
||||
plugins:
|
||||
- mocha
|
||||
env:
|
||||
mocha: true
|
||||
rules:
|
||||
max-nested-callbacks:
|
||||
- warn
|
||||
- 6
|
||||
mocha/handle-done-callback: error
|
||||
mocha/no-exclusive-tests: error
|
||||
mocha/no-global-tests: error
|
||||
mocha/no-hooks-for-single-case: off
|
||||
mocha/no-identical-title: error
|
||||
mocha/no-mocha-arrows: error
|
||||
mocha/no-nested-tests: error
|
||||
mocha/no-return-and-callback: error
|
||||
mocha/no-sibling-hooks: error
|
||||
mocha/no-skipped-tests: error
|
||||
mocha/no-top-level-hooks: error
|
||||
local-rules/no-prototype-methods: off
|
||||
|
3
node_modules/@sinonjs/commons/.prettierrc
generated
vendored
Normal file
3
node_modules/@sinonjs/commons/.prettierrc
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"tabWidth": 4
|
||||
}
|
33
node_modules/@sinonjs/commons/.travis.yml
generated
vendored
Normal file
33
node_modules/@sinonjs/commons/.travis.yml
generated
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
language: node_js
|
||||
|
||||
sudo: false
|
||||
|
||||
node_js:
|
||||
# https://github.com/nodejs/LTS
|
||||
- "6" # ends April 2019
|
||||
- "8" # ends December 2019
|
||||
- "10" # ends April 2021
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- node_modules
|
||||
|
||||
env:
|
||||
- HUSKY_SKIP_INSTALL=true
|
||||
|
||||
before_script:
|
||||
- npm install coveralls
|
||||
|
||||
# Make npm run work for the script phase:
|
||||
- if [ "x$TRAVIS_NODE_VERSION" = "x6" ]; then npm config set ignore-scripts false; fi
|
||||
# these build targets only need to run once per build, so let's conserve a few resources
|
||||
- if [ "x$TRAVIS_NODE_VERSION" = "x10" ]; then npm run lint; fi
|
||||
|
||||
script:
|
||||
- npm run test-check-coverage
|
||||
|
||||
after_success:
|
||||
- if [ "x$TRAVIS_NODE_VERSION" = "x10" ]; then cat ./coverage/lcov.info | coveralls lib; fi
|
||||
|
||||
git:
|
||||
depth: 3
|
29
node_modules/@sinonjs/commons/LICENSE
generated
vendored
Normal file
29
node_modules/@sinonjs/commons/LICENSE
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2018, Sinon.JS
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
14
node_modules/@sinonjs/commons/README.md
generated
vendored
Normal file
14
node_modules/@sinonjs/commons/README.md
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
# commons
|
||||
|
||||
[](http://travis-ci.org/sinonjs/commons) [](https://coveralls.io/github/sinonjs/commons?branch=master)
|
||||
|
||||
Simple functions shared among the sinon end user libraries
|
||||
|
||||
## Rules
|
||||
|
||||
* Follows the [Sinon.JS compatibility](https://github.com/sinonjs/sinon/blob/master/CONTRIBUTING.md#compatibility)
|
||||
* 100% test coverage
|
||||
* Code formatted using [Prettier](https://prettier.io)
|
||||
* No side effects welcome! (only pure functions)
|
||||
* No platform specific functions
|
||||
* One export per file (any bundler can do tree shaking)
|
79
node_modules/@sinonjs/commons/eslint-local-rules.js
generated
vendored
Normal file
79
node_modules/@sinonjs/commons/eslint-local-rules.js
generated
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
"use strict";
|
||||
|
||||
function getPrototypeMethods(prototype) {
|
||||
/* eslint-disable local-rules/no-prototype-methods */
|
||||
return Object.getOwnPropertyNames(prototype).filter(function(name) {
|
||||
return (
|
||||
typeof prototype[name] === "function" &&
|
||||
prototype.hasOwnProperty(name)
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
var DISALLOWED_ARRAY_PROPS = getPrototypeMethods(Array.prototype);
|
||||
|
||||
var DISALLOWED_OBJECT_PROPS = getPrototypeMethods(Object.prototype);
|
||||
|
||||
module.exports = {
|
||||
// rule to disallow direct use of prototype methods of builtins
|
||||
"no-prototype-methods": {
|
||||
meta: {
|
||||
docs: {
|
||||
description: "disallow calling prototype methods directly",
|
||||
category: "Possible Errors",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/rules/no-prototype-builtins"
|
||||
},
|
||||
|
||||
schema: []
|
||||
},
|
||||
|
||||
create: function(context) {
|
||||
/**
|
||||
* Reports if a disallowed property is used in a CallExpression
|
||||
* @param {ASTNode} node The CallExpression node.
|
||||
* @returns {void}
|
||||
*/
|
||||
function disallowBuiltIns(node) {
|
||||
if (
|
||||
node.callee.type !== "MemberExpression" ||
|
||||
node.callee.computed ||
|
||||
// allow static method calls
|
||||
node.callee.object.name === "Array" ||
|
||||
node.callee.object.name === "Object"
|
||||
) {
|
||||
return;
|
||||
}
|
||||
var propName = node.callee.property.name;
|
||||
|
||||
if (DISALLOWED_OBJECT_PROPS.indexOf(propName) > -1) {
|
||||
context.report({
|
||||
message:
|
||||
"Do not access {{obj}} prototype method '{{prop}}' from target object.",
|
||||
loc: node.callee.property.loc.start,
|
||||
data: {
|
||||
obj: "Object",
|
||||
prop: propName
|
||||
},
|
||||
node: node
|
||||
});
|
||||
} else if (DISALLOWED_ARRAY_PROPS.indexOf(propName) > -1) {
|
||||
context.report({
|
||||
message:
|
||||
"Do not access {{obj}} prototype method '{{prop}}' from target object.",
|
||||
loc: node.callee.property.loc.start,
|
||||
data: {
|
||||
obj: "Array",
|
||||
prop: propName
|
||||
},
|
||||
node: node
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
CallExpression: disallowBuiltIns
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
34
node_modules/@sinonjs/commons/lib/called-in-order.js
generated
vendored
Normal file
34
node_modules/@sinonjs/commons/lib/called-in-order.js
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
|
||||
var every = require("./prototypes/array").every;
|
||||
|
||||
function hasCallsLeft(callMap, spy) {
|
||||
if (callMap[spy.id] === undefined) {
|
||||
callMap[spy.id] = 0;
|
||||
}
|
||||
|
||||
return callMap[spy.id] < spy.callCount;
|
||||
}
|
||||
|
||||
function checkAdjacentCalls(callMap, spy, index, spies) {
|
||||
var calledBeforeNext = true;
|
||||
|
||||
if (index !== spies.length - 1) {
|
||||
calledBeforeNext = spy.calledBefore(spies[index + 1]);
|
||||
}
|
||||
|
||||
if (hasCallsLeft(callMap, spy) && calledBeforeNext) {
|
||||
callMap[spy.id] += 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
module.exports = function calledInOrder(spies) {
|
||||
var callMap = {};
|
||||
// eslint-disable-next-line no-underscore-dangle
|
||||
var _spies = arguments.length > 1 ? arguments : spies;
|
||||
|
||||
return every(_spies, checkAdjacentCalls.bind(null, callMap));
|
||||
};
|
121
node_modules/@sinonjs/commons/lib/called-in-order.test.js
generated
vendored
Normal file
121
node_modules/@sinonjs/commons/lib/called-in-order.test.js
generated
vendored
Normal file
@ -0,0 +1,121 @@
|
||||
"use strict";
|
||||
|
||||
var assert = require("@sinonjs/referee-sinon").assert;
|
||||
var calledInOrder = require("./called-in-order");
|
||||
var sinon = require("@sinonjs/referee-sinon").sinon;
|
||||
|
||||
var testObject1 = {
|
||||
someFunction: function() {
|
||||
return;
|
||||
}
|
||||
};
|
||||
var testObject2 = {
|
||||
otherFunction: function() {
|
||||
return;
|
||||
}
|
||||
};
|
||||
var testObject3 = {
|
||||
thirdFunction: function() {
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
function testMethod() {
|
||||
testObject1.someFunction();
|
||||
testObject2.otherFunction();
|
||||
testObject2.otherFunction();
|
||||
testObject2.otherFunction();
|
||||
testObject3.thirdFunction();
|
||||
}
|
||||
|
||||
describe("calledInOrder", function() {
|
||||
beforeEach(function() {
|
||||
sinon.stub(testObject1, "someFunction");
|
||||
sinon.stub(testObject2, "otherFunction");
|
||||
sinon.stub(testObject3, "thirdFunction");
|
||||
testMethod();
|
||||
});
|
||||
afterEach(function() {
|
||||
testObject1.someFunction.restore();
|
||||
testObject2.otherFunction.restore();
|
||||
testObject3.thirdFunction.restore();
|
||||
});
|
||||
|
||||
describe("given single array argument", function() {
|
||||
describe("when stubs were called in expected order", function() {
|
||||
it("returns true", function() {
|
||||
assert.isTrue(
|
||||
calledInOrder([
|
||||
testObject1.someFunction,
|
||||
testObject2.otherFunction
|
||||
])
|
||||
);
|
||||
assert.isTrue(
|
||||
calledInOrder([
|
||||
testObject1.someFunction,
|
||||
testObject2.otherFunction,
|
||||
testObject2.otherFunction,
|
||||
testObject3.thirdFunction
|
||||
])
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when stubs were called in unexpected order", function() {
|
||||
it("returns false", function() {
|
||||
assert.isFalse(
|
||||
calledInOrder([
|
||||
testObject2.otherFunction,
|
||||
testObject1.someFunction
|
||||
])
|
||||
);
|
||||
assert.isFalse(
|
||||
calledInOrder([
|
||||
testObject2.otherFunction,
|
||||
testObject1.someFunction,
|
||||
testObject1.someFunction,
|
||||
testObject3.thirdFunction
|
||||
])
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("given multiple arguments", function() {
|
||||
describe("when stubs were called in expected order", function() {
|
||||
it("returns true", function() {
|
||||
assert.isTrue(
|
||||
calledInOrder(
|
||||
testObject1.someFunction,
|
||||
testObject2.otherFunction
|
||||
)
|
||||
);
|
||||
assert.isTrue(
|
||||
calledInOrder(
|
||||
testObject1.someFunction,
|
||||
testObject2.otherFunction,
|
||||
testObject3.thirdFunction
|
||||
)
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when stubs were called in unexpected order", function() {
|
||||
it("returns false", function() {
|
||||
assert.isFalse(
|
||||
calledInOrder(
|
||||
testObject2.otherFunction,
|
||||
testObject1.someFunction
|
||||
)
|
||||
);
|
||||
assert.isFalse(
|
||||
calledInOrder(
|
||||
testObject2.otherFunction,
|
||||
testObject1.someFunction,
|
||||
testObject3.thirdFunction
|
||||
)
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
19
node_modules/@sinonjs/commons/lib/class-name.js
generated
vendored
Normal file
19
node_modules/@sinonjs/commons/lib/class-name.js
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
"use strict";
|
||||
|
||||
var functionName = require("./function-name");
|
||||
|
||||
module.exports = function className(value) {
|
||||
return (
|
||||
(value.constructor && value.constructor.name) ||
|
||||
// The next branch is for IE11 support only:
|
||||
// Because the name property is not set on the prototype
|
||||
// of the Function object, we finally try to grab the
|
||||
// name from its definition. This will never be reached
|
||||
// in node, so we are not able to test this properly.
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name
|
||||
(typeof value.constructor === "function" &&
|
||||
/* istanbul ignore next */
|
||||
functionName(value.constructor)) ||
|
||||
null
|
||||
);
|
||||
};
|
37
node_modules/@sinonjs/commons/lib/class-name.test.js
generated
vendored
Normal file
37
node_modules/@sinonjs/commons/lib/class-name.test.js
generated
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
/* eslint-disable no-empty-function */
|
||||
|
||||
var assert = require("@sinonjs/referee").assert;
|
||||
var className = require("./class-name");
|
||||
|
||||
describe("className", function() {
|
||||
it("returns the class name of an instance", function() {
|
||||
// Because eslint-config-sinon disables es6, we can't
|
||||
// use a class definition here
|
||||
// https://github.com/sinonjs/eslint-config-sinon/blob/master/index.js
|
||||
// var instance = new (class TestClass {})();
|
||||
var instance = new function TestClass() {}();
|
||||
var name = className(instance);
|
||||
assert.equals(name, "TestClass");
|
||||
});
|
||||
|
||||
it("returns 'Object' for {}", function() {
|
||||
var name = className({});
|
||||
assert.equals(name, "Object");
|
||||
});
|
||||
|
||||
it("returns null for an object that has no prototype", function() {
|
||||
var obj = Object.create(null);
|
||||
var name = className(obj);
|
||||
assert.equals(name, null);
|
||||
});
|
||||
|
||||
it("returns null for an object whose prototype was mangled", function() {
|
||||
// This is what Node v6 and v7 do for objects returned by querystring.parse()
|
||||
function MangledObject() {}
|
||||
MangledObject.prototype = Object.create(null);
|
||||
var obj = new MangledObject();
|
||||
var name = className(obj);
|
||||
assert.equals(name, null);
|
||||
});
|
||||
});
|
40
node_modules/@sinonjs/commons/lib/deprecated.js
generated
vendored
Normal file
40
node_modules/@sinonjs/commons/lib/deprecated.js
generated
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
/* eslint-disable no-console */
|
||||
"use strict";
|
||||
|
||||
// wrap returns a function that will invoke the supplied function and print a deprecation warning to the console each
|
||||
// time it is called.
|
||||
exports.wrap = function(func, msg) {
|
||||
var wrapped = function() {
|
||||
exports.printWarning(msg);
|
||||
return func.apply(this, arguments);
|
||||
};
|
||||
if (func.prototype) {
|
||||
wrapped.prototype = func.prototype;
|
||||
}
|
||||
return wrapped;
|
||||
};
|
||||
|
||||
// defaultMsg returns a string which can be supplied to `wrap()` to notify the user that a particular part of the
|
||||
// sinon API has been deprecated.
|
||||
exports.defaultMsg = function(packageName, funcName) {
|
||||
return (
|
||||
packageName +
|
||||
"." +
|
||||
funcName +
|
||||
" is deprecated and will be removed from the public API in a future version of " +
|
||||
packageName +
|
||||
"."
|
||||
);
|
||||
};
|
||||
|
||||
exports.printWarning = function(msg) {
|
||||
// Watch out for IE7 and below! :(
|
||||
/* istanbul ignore next */
|
||||
if (typeof console !== "undefined") {
|
||||
if (console.info) {
|
||||
console.info(msg);
|
||||
} else {
|
||||
console.log(msg);
|
||||
}
|
||||
}
|
||||
};
|
86
node_modules/@sinonjs/commons/lib/deprecated.test.js
generated
vendored
Normal file
86
node_modules/@sinonjs/commons/lib/deprecated.test.js
generated
vendored
Normal file
@ -0,0 +1,86 @@
|
||||
/* eslint-disable no-console */
|
||||
"use strict";
|
||||
|
||||
var assert = require("@sinonjs/referee-sinon").assert;
|
||||
var sinon = require("@sinonjs/referee-sinon").sinon;
|
||||
|
||||
var deprecated = require("./deprecated");
|
||||
|
||||
var msg = "test";
|
||||
|
||||
describe("deprecated", function() {
|
||||
describe("defaultMsg", function() {
|
||||
it("should return a string", function() {
|
||||
assert.equals(
|
||||
deprecated.defaultMsg("sinon", "someFunc"),
|
||||
"sinon.someFunc is deprecated and will be removed from the public API in a future version of sinon."
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe("printWarning", function() {
|
||||
describe("when `console` is defined", function() {
|
||||
beforeEach(function() {
|
||||
sinon.replace(console, "info", sinon.fake());
|
||||
sinon.replace(console, "log", sinon.fake());
|
||||
});
|
||||
|
||||
afterEach(sinon.restore);
|
||||
|
||||
describe("when `console.info` is defined", function() {
|
||||
it("shoudl call `console.info` with a message", function() {
|
||||
deprecated.printWarning(msg);
|
||||
assert.calledOnceWith(console.info, msg);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when `console.info` is undefined", function() {
|
||||
it("should call `console.log` with a message", function() {
|
||||
console.info = undefined;
|
||||
deprecated.printWarning(msg);
|
||||
assert.calledOnceWith(console.log, msg);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("wrap", function() {
|
||||
var method = sinon.fake();
|
||||
var wrapped;
|
||||
|
||||
beforeEach(function() {
|
||||
wrapped = deprecated.wrap(method, msg);
|
||||
});
|
||||
|
||||
it("should return a wrapper function", function() {
|
||||
assert.match(wrapped, sinon.match.func);
|
||||
});
|
||||
|
||||
it("should assign the prototype of the passed method", function() {
|
||||
assert.equals(method.prototype, wrapped.prototype);
|
||||
});
|
||||
|
||||
context("when the passed method has falsy prototype", function() {
|
||||
it("should not be assigned to the wrapped method", function() {
|
||||
method.prototype = null;
|
||||
wrapped = deprecated.wrap(method, msg);
|
||||
assert.match(wrapped.prototype, sinon.match.object);
|
||||
});
|
||||
});
|
||||
|
||||
context("when invoking the wrapped function", function() {
|
||||
before(function() {
|
||||
sinon.replace(deprecated, "printWarning", sinon.fake());
|
||||
wrapped({});
|
||||
});
|
||||
|
||||
it("should call `printWarning` before invoking", function() {
|
||||
assert.calledOnceWith(deprecated.printWarning, msg);
|
||||
});
|
||||
|
||||
it("should invoke the passed method with the given arguments", function() {
|
||||
assert.calledOnceWith(method, {});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
20
node_modules/@sinonjs/commons/lib/every.js
generated
vendored
Normal file
20
node_modules/@sinonjs/commons/lib/every.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
|
||||
// This is an `every` implementation that works for all iterables
|
||||
module.exports = function every(obj, fn) {
|
||||
var pass = true;
|
||||
|
||||
try {
|
||||
/* eslint-disable-next-line local-rules/no-prototype-methods */
|
||||
obj.forEach(function() {
|
||||
if (!fn.apply(this, arguments)) {
|
||||
// Throwing an error is the only way to break `forEach`
|
||||
throw new Error();
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
pass = false;
|
||||
}
|
||||
|
||||
return pass;
|
||||
};
|
41
node_modules/@sinonjs/commons/lib/every.test.js
generated
vendored
Normal file
41
node_modules/@sinonjs/commons/lib/every.test.js
generated
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
"use strict";
|
||||
|
||||
var assert = require("@sinonjs/referee-sinon").assert;
|
||||
var sinon = require("@sinonjs/referee-sinon").sinon;
|
||||
var every = require("./every");
|
||||
|
||||
describe("util/core/every", function() {
|
||||
it("returns true when the callback function returns true for every element in an iterable", function() {
|
||||
var obj = [true, true, true, true];
|
||||
var allTrue = every(obj, function(val) {
|
||||
return val;
|
||||
});
|
||||
|
||||
assert(allTrue);
|
||||
});
|
||||
|
||||
it("returns false when the callback function returns false for any element in an iterable", function() {
|
||||
var obj = [true, true, true, false];
|
||||
var result = every(obj, function(val) {
|
||||
return val;
|
||||
});
|
||||
|
||||
assert.isFalse(result);
|
||||
});
|
||||
|
||||
it("calls the given callback once for each item in an iterable until it returns false", function() {
|
||||
var iterableOne = [true, true, true, true];
|
||||
var iterableTwo = [true, true, false, true];
|
||||
var callback = sinon.spy(function(val) {
|
||||
return val;
|
||||
});
|
||||
|
||||
every(iterableOne, callback);
|
||||
assert.equals(callback.callCount, 4);
|
||||
|
||||
callback.resetHistory();
|
||||
|
||||
every(iterableTwo, callback);
|
||||
assert.equals(callback.callCount, 3);
|
||||
});
|
||||
});
|
17
node_modules/@sinonjs/commons/lib/function-name.js
generated
vendored
Normal file
17
node_modules/@sinonjs/commons/lib/function-name.js
generated
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function functionName(func) {
|
||||
if (!func) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return (
|
||||
func.displayName ||
|
||||
func.name ||
|
||||
// Use function decomposition as a last resort to get function
|
||||
// name. Does not rely on function decomposition to work - if it
|
||||
// doesn't debugging will be slightly less informative
|
||||
// (i.e. toString will say 'spy' rather than 'myFunc').
|
||||
(String(func).match(/function ([^\s(]+)/) || [])[1]
|
||||
);
|
||||
};
|
55
node_modules/@sinonjs/commons/lib/function-name.test.js
generated
vendored
Normal file
55
node_modules/@sinonjs/commons/lib/function-name.test.js
generated
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
|
||||
var jsc = require("jsverify");
|
||||
var refute = require("@sinonjs/referee-sinon").refute;
|
||||
|
||||
var functionName = require("./function-name");
|
||||
|
||||
describe("function-name", function() {
|
||||
it("should return empty string if func is falsy", function() {
|
||||
jsc.assertForall("falsy", function(fn) {
|
||||
return functionName(fn) === "";
|
||||
});
|
||||
});
|
||||
|
||||
it("should use displayName by default", function() {
|
||||
jsc.assertForall("nestring", function(displayName) {
|
||||
var fn = { displayName: displayName };
|
||||
|
||||
return functionName(fn) === fn.displayName;
|
||||
});
|
||||
});
|
||||
|
||||
it("should use name if displayName is not available", function() {
|
||||
jsc.assertForall("nestring", function(name) {
|
||||
var fn = { name: name };
|
||||
|
||||
return functionName(fn) === fn.name;
|
||||
});
|
||||
});
|
||||
|
||||
it("should fallback to string parsing", function() {
|
||||
jsc.assertForall("nat", function(naturalNumber) {
|
||||
var name = "fn" + naturalNumber;
|
||||
var fn = {
|
||||
toString: function() {
|
||||
return "\nfunction " + name;
|
||||
}
|
||||
};
|
||||
|
||||
return functionName(fn) === name;
|
||||
});
|
||||
});
|
||||
|
||||
it("should not fail when a name cannot be found", function() {
|
||||
refute.exception(function() {
|
||||
var fn = {
|
||||
toString: function() {
|
||||
return "\nfunction (";
|
||||
}
|
||||
};
|
||||
|
||||
functionName(fn);
|
||||
});
|
||||
});
|
||||
});
|
13
node_modules/@sinonjs/commons/lib/index.js
generated
vendored
Normal file
13
node_modules/@sinonjs/commons/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
calledInOrder: require("./called-in-order"),
|
||||
className: require("./class-name"),
|
||||
deprecated: require("./deprecated"),
|
||||
every: require("./every"),
|
||||
functionName: require("./function-name"),
|
||||
orderByFirstCall: require("./order-by-first-call"),
|
||||
prototypes: require("./prototypes"),
|
||||
typeOf: require("./type-of"),
|
||||
valueToString: require("./value-to-string")
|
||||
};
|
29
node_modules/@sinonjs/commons/lib/index.test.js
generated
vendored
Normal file
29
node_modules/@sinonjs/commons/lib/index.test.js
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
"use strict";
|
||||
|
||||
var assert = require("@sinonjs/referee-sinon").assert;
|
||||
var index = require("./index");
|
||||
|
||||
var expectedMethods = [
|
||||
"calledInOrder",
|
||||
"className",
|
||||
"every",
|
||||
"functionName",
|
||||
"orderByFirstCall",
|
||||
"typeOf",
|
||||
"valueToString"
|
||||
];
|
||||
var expectedObjectProperties = ["deprecated", "prototypes"];
|
||||
|
||||
describe("package", function() {
|
||||
expectedMethods.forEach(function(name) {
|
||||
it("should export a method named " + name, function() {
|
||||
assert.isFunction(index[name]);
|
||||
});
|
||||
});
|
||||
|
||||
expectedObjectProperties.forEach(function(name) {
|
||||
it("should export an object property named " + name, function() {
|
||||
assert.isObject(index[name]);
|
||||
});
|
||||
});
|
||||
});
|
18
node_modules/@sinonjs/commons/lib/order-by-first-call.js
generated
vendored
Normal file
18
node_modules/@sinonjs/commons/lib/order-by-first-call.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
|
||||
var sort = require("./prototypes/array").sort;
|
||||
var slice = require("./prototypes/array").slice;
|
||||
|
||||
function comparator(a, b) {
|
||||
// uuid, won't ever be equal
|
||||
var aCall = a.getCall(0);
|
||||
var bCall = b.getCall(0);
|
||||
var aId = (aCall && aCall.callId) || -1;
|
||||
var bId = (bCall && bCall.callId) || -1;
|
||||
|
||||
return aId < bId ? -1 : 1;
|
||||
}
|
||||
|
||||
module.exports = function orderByFirstCall(spies) {
|
||||
return sort(slice(spies), comparator);
|
||||
};
|
52
node_modules/@sinonjs/commons/lib/order-by-first-call.test.js
generated
vendored
Normal file
52
node_modules/@sinonjs/commons/lib/order-by-first-call.test.js
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
"use strict";
|
||||
|
||||
var assert = require("@sinonjs/referee-sinon").assert;
|
||||
var knuthShuffle = require("knuth-shuffle").knuthShuffle;
|
||||
var sinon = require("@sinonjs/referee-sinon").sinon;
|
||||
var orderByFirstCall = require("./order-by-first-call");
|
||||
|
||||
describe("orderByFirstCall", function() {
|
||||
it("should order an Array of spies by the callId of the first call, ascending", function() {
|
||||
// create an array of spies
|
||||
var spies = [
|
||||
sinon.spy(),
|
||||
sinon.spy(),
|
||||
sinon.spy(),
|
||||
sinon.spy(),
|
||||
sinon.spy(),
|
||||
sinon.spy()
|
||||
];
|
||||
|
||||
// call all the spies
|
||||
spies.forEach(function(spy) {
|
||||
spy();
|
||||
});
|
||||
|
||||
// add a few uncalled spies
|
||||
spies.push(sinon.spy());
|
||||
spies.push(sinon.spy());
|
||||
|
||||
// randomise the order of the spies
|
||||
knuthShuffle(spies);
|
||||
|
||||
var sortedSpies = orderByFirstCall(spies);
|
||||
|
||||
assert.equals(sortedSpies.length, spies.length);
|
||||
|
||||
var orderedByFirstCall = sortedSpies.every(function(spy, index) {
|
||||
if (index + 1 === sortedSpies.length) {
|
||||
return true;
|
||||
}
|
||||
var nextSpy = sortedSpies[index + 1];
|
||||
|
||||
// uncalled spies should be ordered first
|
||||
if (!spy.called) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return spy.calledImmediatelyBefore(nextSpy);
|
||||
});
|
||||
|
||||
assert.isTrue(orderedByFirstCall);
|
||||
});
|
||||
});
|
44
node_modules/@sinonjs/commons/lib/prototypes/README.md
generated
vendored
Normal file
44
node_modules/@sinonjs/commons/lib/prototypes/README.md
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
# Prototypes
|
||||
|
||||
The functions in this folder are to be use for keeping cached references to the built-in prototypes, so that people can't inadvertently break the library by making mistakes in userland.
|
||||
|
||||
See https://github.com/sinonjs/sinon/pull/1523
|
||||
|
||||
## Without cached references
|
||||
|
||||
```js
|
||||
// in userland, the library user needs to replace the filter method on
|
||||
// Array.prototype
|
||||
var array = [1, 2, 3];
|
||||
sinon.replace(array, "filter", sinon.fake.returns(2));
|
||||
|
||||
// in a sinon module, the library author needs to use the filter method
|
||||
var someArray = ["a", "b", 42, "c"];
|
||||
var answer = filter(someArray, function(v) {
|
||||
return v === 42;
|
||||
});
|
||||
|
||||
console.log(answer);
|
||||
// => 2
|
||||
```
|
||||
|
||||
|
||||
## With cached references
|
||||
|
||||
```js
|
||||
// in userland, the library user needs to replace the filter method on
|
||||
// Array.prototype
|
||||
var array = [1, 2, 3];
|
||||
sinon.replace(array, "filter", sinon.fake.returns(2));
|
||||
|
||||
// in a sinon module, the library author needs to use the filter method
|
||||
// get a reference to the original Array.prototype.filter
|
||||
var filter = require("@sinonjs/commons").prototypes.array.filter;
|
||||
var someArray = ["a", "b", 42, "c"];
|
||||
var answer = filter(someArray, function(v) {
|
||||
return v === 42;
|
||||
});
|
||||
|
||||
console.log(answer);
|
||||
// => 42
|
||||
```
|
5
node_modules/@sinonjs/commons/lib/prototypes/array.js
generated
vendored
Normal file
5
node_modules/@sinonjs/commons/lib/prototypes/array.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
var copyPrototype = require("./copy-prototype");
|
||||
|
||||
module.exports = copyPrototype(Array.prototype);
|
21
node_modules/@sinonjs/commons/lib/prototypes/copy-prototype.js
generated
vendored
Normal file
21
node_modules/@sinonjs/commons/lib/prototypes/copy-prototype.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
|
||||
var call = Function.call;
|
||||
|
||||
module.exports = function copyPrototypeMethods(prototype) {
|
||||
/* eslint-disable local-rules/no-prototype-methods */
|
||||
return Object.getOwnPropertyNames(prototype).reduce(function(result, name) {
|
||||
// ignore size because it throws from Map
|
||||
if (
|
||||
name !== "size" &&
|
||||
name !== "caller" &&
|
||||
name !== "callee" &&
|
||||
name !== "arguments" &&
|
||||
typeof prototype[name] === "function"
|
||||
) {
|
||||
result[name] = call.bind(prototype[name]);
|
||||
}
|
||||
|
||||
return result;
|
||||
}, Object.create(null));
|
||||
};
|
5
node_modules/@sinonjs/commons/lib/prototypes/function.js
generated
vendored
Normal file
5
node_modules/@sinonjs/commons/lib/prototypes/function.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
var copyPrototype = require("./copy-prototype");
|
||||
|
||||
module.exports = copyPrototype(Function.prototype);
|
8
node_modules/@sinonjs/commons/lib/prototypes/index.js
generated
vendored
Normal file
8
node_modules/@sinonjs/commons/lib/prototypes/index.js
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
array: require("./array"),
|
||||
function: require("./function"),
|
||||
object: require("./object"),
|
||||
string: require("./string")
|
||||
};
|
43
node_modules/@sinonjs/commons/lib/prototypes/index.test.js
generated
vendored
Normal file
43
node_modules/@sinonjs/commons/lib/prototypes/index.test.js
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
"use strict";
|
||||
|
||||
var assert = require("@sinonjs/referee-sinon").assert;
|
||||
|
||||
var arrayProto = require("./index").array;
|
||||
var functionProto = require("./index").function;
|
||||
var objectProto = require("./index").object;
|
||||
var stringProto = require("./index").string;
|
||||
|
||||
describe("prototypes", function() {
|
||||
describe(".array", function() {
|
||||
verifyProperties(arrayProto, Array);
|
||||
});
|
||||
describe(".function", function() {
|
||||
verifyProperties(functionProto, Function);
|
||||
});
|
||||
describe(".object", function() {
|
||||
verifyProperties(objectProto, Object);
|
||||
});
|
||||
describe(".string", function() {
|
||||
verifyProperties(stringProto, String);
|
||||
});
|
||||
});
|
||||
|
||||
function verifyProperties(p, origin) {
|
||||
it("should have all the methods of the origin prototype", function() {
|
||||
var methodNames = Object.getOwnPropertyNames(origin.prototype).filter(
|
||||
function(name) {
|
||||
return (
|
||||
name !== "size" &&
|
||||
name !== "caller" &&
|
||||
name !== "callee" &&
|
||||
name !== "arguments" &&
|
||||
typeof origin.prototype[name] === "function"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
methodNames.forEach(function(name) {
|
||||
assert.isTrue(Object.prototype.hasOwnProperty.call(p, name), name);
|
||||
});
|
||||
});
|
||||
}
|
5
node_modules/@sinonjs/commons/lib/prototypes/object.js
generated
vendored
Normal file
5
node_modules/@sinonjs/commons/lib/prototypes/object.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
var copyPrototype = require("./copy-prototype");
|
||||
|
||||
module.exports = copyPrototype(Object.prototype);
|
5
node_modules/@sinonjs/commons/lib/prototypes/string.js
generated
vendored
Normal file
5
node_modules/@sinonjs/commons/lib/prototypes/string.js
generated
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
var copyPrototype = require("./copy-prototype");
|
||||
|
||||
module.exports = copyPrototype(String.prototype);
|
7
node_modules/@sinonjs/commons/lib/type-of.js
generated
vendored
Normal file
7
node_modules/@sinonjs/commons/lib/type-of.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
var type = require("type-detect");
|
||||
|
||||
module.exports = function typeOf(value) {
|
||||
return type(value).toLowerCase();
|
||||
};
|
51
node_modules/@sinonjs/commons/lib/type-of.test.js
generated
vendored
Normal file
51
node_modules/@sinonjs/commons/lib/type-of.test.js
generated
vendored
Normal file
@ -0,0 +1,51 @@
|
||||
"use strict";
|
||||
|
||||
var assert = require("@sinonjs/referee-sinon").assert;
|
||||
var typeOf = require("./type-of");
|
||||
|
||||
describe("typeOf", function() {
|
||||
it("returns boolean", function() {
|
||||
assert.equals(typeOf(false), "boolean");
|
||||
});
|
||||
|
||||
it("returns string", function() {
|
||||
assert.equals(typeOf("Sinon.JS"), "string");
|
||||
});
|
||||
|
||||
it("returns number", function() {
|
||||
assert.equals(typeOf(123), "number");
|
||||
});
|
||||
|
||||
it("returns object", function() {
|
||||
assert.equals(typeOf({}), "object");
|
||||
});
|
||||
|
||||
it("returns function", function() {
|
||||
assert.equals(
|
||||
typeOf(function() {
|
||||
return undefined;
|
||||
}),
|
||||
"function"
|
||||
);
|
||||
});
|
||||
|
||||
it("returns undefined", function() {
|
||||
assert.equals(typeOf(undefined), "undefined");
|
||||
});
|
||||
|
||||
it("returns null", function() {
|
||||
assert.equals(typeOf(null), "null");
|
||||
});
|
||||
|
||||
it("returns array", function() {
|
||||
assert.equals(typeOf([]), "array");
|
||||
});
|
||||
|
||||
it("returns regexp", function() {
|
||||
assert.equals(typeOf(/.*/), "regexp");
|
||||
});
|
||||
|
||||
it("returns date", function() {
|
||||
assert.equals(typeOf(new Date()), "date");
|
||||
});
|
||||
});
|
11
node_modules/@sinonjs/commons/lib/value-to-string.js
generated
vendored
Normal file
11
node_modules/@sinonjs/commons/lib/value-to-string.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
function valueToString(value) {
|
||||
if (value && value.toString) {
|
||||
/* eslint-disable-next-line local-rules/no-prototype-methods */
|
||||
return value.toString();
|
||||
}
|
||||
return String(value);
|
||||
}
|
||||
|
||||
module.exports = valueToString;
|
20
node_modules/@sinonjs/commons/lib/value-to-string.test.js
generated
vendored
Normal file
20
node_modules/@sinonjs/commons/lib/value-to-string.test.js
generated
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
|
||||
var assert = require("@sinonjs/referee-sinon").assert;
|
||||
var valueToString = require("./value-to-string");
|
||||
|
||||
describe("util/core/valueToString", function() {
|
||||
it("returns string representation of an object", function() {
|
||||
var obj = {};
|
||||
|
||||
assert.equals(valueToString(obj), obj.toString());
|
||||
});
|
||||
|
||||
it("returns 'null' for literal null'", function() {
|
||||
assert.equals(valueToString(null), "null");
|
||||
});
|
||||
|
||||
it("returns 'undefined' for literal undefined", function() {
|
||||
assert.equals(valueToString(undefined), "undefined");
|
||||
});
|
||||
});
|
74
node_modules/@sinonjs/commons/package.json
generated
vendored
Normal file
74
node_modules/@sinonjs/commons/package.json
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
{
|
||||
"_from": "@sinonjs/commons@^1.3.1",
|
||||
"_id": "@sinonjs/commons@1.4.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-9jHK3YF/8HtJ9wCAbG+j8cD0i0+ATS9A7gXFqS36TblLPNy6rEEc+SB0imo91eCboGaBYGV/MT1/br/J+EE7Tw==",
|
||||
"_location": "/@sinonjs/commons",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@sinonjs/commons@^1.3.1",
|
||||
"name": "@sinonjs/commons",
|
||||
"escapedName": "@sinonjs%2fcommons",
|
||||
"scope": "@sinonjs",
|
||||
"rawSpec": "^1.3.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.3.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@sinonjs/formatio",
|
||||
"/@sinonjs/samsam",
|
||||
"/sinon"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.4.0.tgz",
|
||||
"_shasum": "7b3ec2d96af481d7a0321252e7b1c94724ec5a78",
|
||||
"_spec": "@sinonjs/commons@^1.3.1",
|
||||
"_where": "/Users/josh.burman/Projects/braid/node_modules/sinon",
|
||||
"author": "",
|
||||
"bugs": {
|
||||
"url": "https://github.com/sinonjs/commons/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"type-detect": "4.0.8"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Simple functions shared among the sinon end user libraries",
|
||||
"devDependencies": {
|
||||
"@sinonjs/referee-sinon": "4.1.0",
|
||||
"eslint": "^5.8.0",
|
||||
"eslint-config-prettier": "^3.1.0",
|
||||
"eslint-config-sinon": "^2.0.0",
|
||||
"eslint-plugin-ie11": "^1.0.0",
|
||||
"eslint-plugin-local-rules": "^0.1.0",
|
||||
"eslint-plugin-mocha": "^5.2.0",
|
||||
"eslint-plugin-prettier": "^3.0.0",
|
||||
"husky": "0.14.3",
|
||||
"jsverify": "0.8.3",
|
||||
"knuth-shuffle": "^1.0.8",
|
||||
"lint-staged": "7.2.0",
|
||||
"mocha": "5.2.0",
|
||||
"nyc": "12.0.2",
|
||||
"prettier": "^1.14.3"
|
||||
},
|
||||
"homepage": "https://github.com/sinonjs/commons#readme",
|
||||
"license": "BSD-3-Clause",
|
||||
"lint-staged": {
|
||||
"*.js": "eslint"
|
||||
},
|
||||
"main": "lib/index.js",
|
||||
"name": "@sinonjs/commons",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sinonjs/commons.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "eslint .",
|
||||
"precommit": "lint-staged",
|
||||
"test": "mocha --recursive -R dot \"lib/**/*.test.js\"",
|
||||
"test-check-coverage": "npm run test-coverage && nyc check-coverage --branches 100 --functions 100 --lines 100",
|
||||
"test-coverage": "nyc --reporter text --reporter html --reporter lcovonly npm run test"
|
||||
},
|
||||
"version": "1.4.0"
|
||||
}
|
27
node_modules/@sinonjs/formatio/LICENSE
generated
vendored
Normal file
27
node_modules/@sinonjs/formatio/LICENSE
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
(The BSD License)
|
||||
|
||||
Copyright (c) 2010-2012, Christian Johansen (christian@cjohansen.no) and
|
||||
August Lilleaas (august.lilleaas@gmail.com). All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of Christian Johansen nor the names of his contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
101
node_modules/@sinonjs/formatio/README.md
generated
vendored
Normal file
101
node_modules/@sinonjs/formatio/README.md
generated
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
# formatio
|
||||
|
||||
[](http://travis-ci.org/sinonjs/formatio)
|
||||
[](https://coveralls.io/github/sinonjs/formatio?branch=master)
|
||||
|
||||
> The cheesy object formatter
|
||||
|
||||
Pretty formatting of arbitrary JavaScript values. Currently only supports ascii
|
||||
formatting, suitable for command-line utilities. Like `JSON.stringify`, it
|
||||
formats objects recursively, but unlike `JSON.stringify`, it can handle
|
||||
regular expressions, functions, circular objects and more.
|
||||
|
||||
`formatio` is a general-purpose library. It works in browsers (including old
|
||||
and rowdy ones, like IE6) and Node. It will define itself as an AMD module if
|
||||
you want it to (i.e. if there's a `define` function available).
|
||||
|
||||
## Installation
|
||||
|
||||
```shell
|
||||
npm install @sinonjs/formatio
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
https://sinonjs.github.io/formatio/
|
||||
|
||||
|
||||
## Backers
|
||||
|
||||
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/sinon#backer)]
|
||||
|
||||
<a href="https://opencollective.com/sinon/backer/0/website" target="_blank"><img src="https://opencollective.com/sinon/backer/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/1/website" target="_blank"><img src="https://opencollective.com/sinon/backer/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/2/website" target="_blank"><img src="https://opencollective.com/sinon/backer/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/3/website" target="_blank"><img src="https://opencollective.com/sinon/backer/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/4/website" target="_blank"><img src="https://opencollective.com/sinon/backer/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/5/website" target="_blank"><img src="https://opencollective.com/sinon/backer/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/6/website" target="_blank"><img src="https://opencollective.com/sinon/backer/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/7/website" target="_blank"><img src="https://opencollective.com/sinon/backer/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/8/website" target="_blank"><img src="https://opencollective.com/sinon/backer/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/9/website" target="_blank"><img src="https://opencollective.com/sinon/backer/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/10/website" target="_blank"><img src="https://opencollective.com/sinon/backer/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/11/website" target="_blank"><img src="https://opencollective.com/sinon/backer/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/12/website" target="_blank"><img src="https://opencollective.com/sinon/backer/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/13/website" target="_blank"><img src="https://opencollective.com/sinon/backer/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/14/website" target="_blank"><img src="https://opencollective.com/sinon/backer/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/15/website" target="_blank"><img src="https://opencollective.com/sinon/backer/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/16/website" target="_blank"><img src="https://opencollective.com/sinon/backer/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/17/website" target="_blank"><img src="https://opencollective.com/sinon/backer/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/18/website" target="_blank"><img src="https://opencollective.com/sinon/backer/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/19/website" target="_blank"><img src="https://opencollective.com/sinon/backer/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/20/website" target="_blank"><img src="https://opencollective.com/sinon/backer/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/21/website" target="_blank"><img src="https://opencollective.com/sinon/backer/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/22/website" target="_blank"><img src="https://opencollective.com/sinon/backer/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/23/website" target="_blank"><img src="https://opencollective.com/sinon/backer/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/24/website" target="_blank"><img src="https://opencollective.com/sinon/backer/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/25/website" target="_blank"><img src="https://opencollective.com/sinon/backer/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/26/website" target="_blank"><img src="https://opencollective.com/sinon/backer/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/27/website" target="_blank"><img src="https://opencollective.com/sinon/backer/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/28/website" target="_blank"><img src="https://opencollective.com/sinon/backer/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/29/website" target="_blank"><img src="https://opencollective.com/sinon/backer/29/avatar.svg"></a>
|
||||
|
||||
|
||||
## Sponsors
|
||||
|
||||
Become a sponsor and get your logo on our README on GitHub with a link to your site. [[Become a sponsor](https://opencollective.com/sinon#sponsor)]
|
||||
|
||||
<a href="https://opencollective.com/sinon/sponsor/0/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/1/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/2/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/3/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/4/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/5/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/6/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/7/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/8/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/9/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/10/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/11/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/12/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/13/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/14/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/15/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/16/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/17/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/18/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/19/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/20/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/21/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/22/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/23/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/24/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/25/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/26/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/27/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/28/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/29/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/29/avatar.svg"></a>
|
||||
|
||||
## Licence
|
||||
|
||||
formatio was released under [BSD-3](LICENSE)
|
231
node_modules/@sinonjs/formatio/lib/formatio.js
generated
vendored
Normal file
231
node_modules/@sinonjs/formatio/lib/formatio.js
generated
vendored
Normal file
@ -0,0 +1,231 @@
|
||||
"use strict";
|
||||
|
||||
var samsam = require("@sinonjs/samsam");
|
||||
var functionName = require("@sinonjs/commons").functionName;
|
||||
var typeOf = require("@sinonjs/commons").typeOf;
|
||||
|
||||
var formatio = {
|
||||
excludeConstructors: ["Object", /^.$/],
|
||||
quoteStrings: true,
|
||||
limitChildrenCount: 0
|
||||
};
|
||||
|
||||
var specialObjects = [];
|
||||
if (typeof global !== "undefined") {
|
||||
specialObjects.push({ object: global, value: "[object global]" });
|
||||
}
|
||||
if (typeof document !== "undefined") {
|
||||
specialObjects.push({
|
||||
object: document,
|
||||
value: "[object HTMLDocument]"
|
||||
});
|
||||
}
|
||||
if (typeof window !== "undefined") {
|
||||
specialObjects.push({ object: window, value: "[object Window]" });
|
||||
}
|
||||
|
||||
function constructorName(f, object) {
|
||||
var name = functionName(object && object.constructor);
|
||||
var excludes = f.excludeConstructors ||
|
||||
formatio.excludeConstructors || [];
|
||||
|
||||
var i, l;
|
||||
for (i = 0, l = excludes.length; i < l; ++i) {
|
||||
if (typeof excludes[i] === "string" && excludes[i] === name) {
|
||||
return "";
|
||||
} else if (excludes[i].test && excludes[i].test(name)) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
function isCircular(object, objects) {
|
||||
if (typeof object !== "object") { return false; }
|
||||
var i, l;
|
||||
for (i = 0, l = objects.length; i < l; ++i) {
|
||||
if (objects[i] === object) { return true; }
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function ascii(f, object, processed, indent) {
|
||||
if (typeof object === "string") {
|
||||
if (object.length === 0) { return "(empty string)"; }
|
||||
var qs = f.quoteStrings;
|
||||
var quote = typeof qs !== "boolean" || qs;
|
||||
return processed || quote ? "\"" + object + "\"" : object;
|
||||
}
|
||||
|
||||
if (typeof object === "symbol") {
|
||||
return object.toString();
|
||||
}
|
||||
|
||||
if (typeof object === "function" && !(object instanceof RegExp)) {
|
||||
return ascii.func(object);
|
||||
}
|
||||
|
||||
processed = processed || [];
|
||||
|
||||
if (isCircular(object, processed)) { return "[Circular]"; }
|
||||
|
||||
if (typeOf(object) === "array") {
|
||||
return ascii.array.call(f, object, processed);
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
var i, l;
|
||||
for (i = 0, l = specialObjects.length; i < l; i++) {
|
||||
if (object === specialObjects[i].object) {
|
||||
return specialObjects[i].value;
|
||||
}
|
||||
}
|
||||
|
||||
if (samsam.isSet(object)) {
|
||||
return ascii.set.call(f, object, processed);
|
||||
}
|
||||
|
||||
return ascii.object.call(f, object, processed, indent);
|
||||
}
|
||||
|
||||
ascii.func = function (func) {
|
||||
var funcName = functionName(func) || "";
|
||||
return "function " + funcName + "() {}";
|
||||
};
|
||||
|
||||
function delimit(str, delimiters) {
|
||||
delimiters = delimiters || ["[", "]"];
|
||||
return delimiters[0] + str + delimiters[1];
|
||||
}
|
||||
|
||||
ascii.array = function (array, processed, delimiters) {
|
||||
processed = processed || [];
|
||||
processed.push(array);
|
||||
var pieces = [];
|
||||
var i, l;
|
||||
l = (this.limitChildrenCount > 0) ?
|
||||
Math.min(this.limitChildrenCount, array.length) : array.length;
|
||||
|
||||
for (i = 0; i < l; ++i) {
|
||||
pieces.push(ascii(this, array[i], processed));
|
||||
}
|
||||
|
||||
if (l < array.length) {
|
||||
pieces.push("[... " + (array.length - l) + " more elements]");
|
||||
}
|
||||
|
||||
return delimit(pieces.join(", "), delimiters);
|
||||
};
|
||||
|
||||
ascii.set = function (set, processed) {
|
||||
return ascii.array.call(this, Array.from(set), processed, ["Set {", "}"]);
|
||||
};
|
||||
|
||||
ascii.object = function (object, processed, indent) {
|
||||
processed = processed || [];
|
||||
processed.push(object);
|
||||
indent = indent || 0;
|
||||
var pieces = [];
|
||||
var symbols = typeof Object.getOwnPropertySymbols === "function"
|
||||
? Object.getOwnPropertySymbols(object)
|
||||
: [];
|
||||
var properties = Object.keys(object).sort().concat(symbols);
|
||||
var length = 3;
|
||||
var prop, str, obj, i, k, l;
|
||||
l = (this.limitChildrenCount > 0) ?
|
||||
Math.min(this.limitChildrenCount, properties.length) : properties.length;
|
||||
|
||||
for (i = 0; i < l; ++i) {
|
||||
prop = properties[i];
|
||||
obj = object[prop];
|
||||
|
||||
if (isCircular(obj, processed)) {
|
||||
str = "[Circular]";
|
||||
} else {
|
||||
str = ascii(this, obj, processed, indent + 2);
|
||||
}
|
||||
|
||||
str = (
|
||||
typeof prop === "string" && /\s/.test(prop) ?
|
||||
"\"" + prop + "\"" : prop.toString()
|
||||
) + ": " + str;
|
||||
length += str.length;
|
||||
pieces.push(str);
|
||||
}
|
||||
|
||||
var cons = constructorName(this, object);
|
||||
var prefix = cons ? "[" + cons + "] " : "";
|
||||
var is = "";
|
||||
for (i = 0, k = indent; i < k; ++i) { is += " "; }
|
||||
|
||||
if (l < properties.length)
|
||||
{pieces.push("[... " + (properties.length - l) + " more elements]");}
|
||||
|
||||
if (length + indent > 80) {
|
||||
return prefix + "{\n " + is + pieces.join(",\n " + is) + "\n" +
|
||||
is + "}";
|
||||
}
|
||||
return prefix + "{ " + pieces.join(", ") + " }";
|
||||
};
|
||||
|
||||
ascii.element = function (element) {
|
||||
var tagName = element.tagName.toLowerCase();
|
||||
var attrs = element.attributes;
|
||||
var pairs = [];
|
||||
var attr, attrName, i, l, val;
|
||||
|
||||
for (i = 0, l = attrs.length; i < l; ++i) {
|
||||
attr = attrs.item(i);
|
||||
attrName = attr.nodeName.toLowerCase().replace("html:", "");
|
||||
val = attr.nodeValue;
|
||||
if (attrName !== "contenteditable" || val !== "inherit") {
|
||||
if (val) { pairs.push(attrName + "=\"" + val + "\""); }
|
||||
}
|
||||
}
|
||||
|
||||
var formatted = "<" + tagName + (pairs.length > 0 ? " " : "");
|
||||
// SVG elements have undefined innerHTML
|
||||
var content = element.innerHTML || "";
|
||||
|
||||
if (content.length > 20) {
|
||||
content = content.substr(0, 20) + "[...]";
|
||||
}
|
||||
|
||||
var res = formatted + pairs.join(" ") + ">" + content +
|
||||
"</" + tagName + ">";
|
||||
|
||||
return res.replace(/ contentEditable="inherit"/, "");
|
||||
};
|
||||
|
||||
function Formatio(options) {
|
||||
// eslint-disable-next-line guard-for-in
|
||||
for (var opt in options) {
|
||||
this[opt] = options[opt];
|
||||
}
|
||||
}
|
||||
|
||||
Formatio.prototype = {
|
||||
functionName: functionName,
|
||||
|
||||
configure: function (options) {
|
||||
return new Formatio(options);
|
||||
},
|
||||
|
||||
constructorName: function (object) {
|
||||
return constructorName(this, object);
|
||||
},
|
||||
|
||||
ascii: function (object, processed, indent) {
|
||||
return ascii(this, object, processed, indent);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = Formatio.prototype;
|
72
node_modules/@sinonjs/formatio/package.json
generated
vendored
Normal file
72
node_modules/@sinonjs/formatio/package.json
generated
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
{
|
||||
"_from": "@sinonjs/formatio@^3.2.1",
|
||||
"_id": "@sinonjs/formatio@3.2.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-tsHvOB24rvyvV2+zKMmPkZ7dXX6LSLKZ7aOtXY6Edklp0uRcgGpOsQTTGTcWViFyx4uhWc6GV8QdnALbIbIdeQ==",
|
||||
"_location": "/@sinonjs/formatio",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@sinonjs/formatio@^3.2.1",
|
||||
"name": "@sinonjs/formatio",
|
||||
"escapedName": "@sinonjs%2fformatio",
|
||||
"scope": "@sinonjs",
|
||||
"rawSpec": "^3.2.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.2.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/nise",
|
||||
"/sinon"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-3.2.1.tgz",
|
||||
"_shasum": "52310f2f9bcbc67bdac18c94ad4901b95fde267e",
|
||||
"_spec": "@sinonjs/formatio@^3.2.1",
|
||||
"_where": "/Users/josh.burman/Projects/braid/node_modules/sinon",
|
||||
"author": {
|
||||
"name": "Christian Johansen"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sinonjs/formatio/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@sinonjs/commons": "^1",
|
||||
"@sinonjs/samsam": "^3.1.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Human-readable object formatting",
|
||||
"devDependencies": {
|
||||
"@sinonjs/referee": "^2.6.0",
|
||||
"eslint": "^4.19.1",
|
||||
"eslint-config-sinon": "^1.0.3",
|
||||
"eslint-plugin-ie11": "^1.0.0",
|
||||
"eslint-plugin-mocha": "^4.11.0",
|
||||
"mocha": "^5.0.0",
|
||||
"nyc": "^11.7.3",
|
||||
"rollup": "0.65.2",
|
||||
"rollup-plugin-commonjs": "9.1.6"
|
||||
},
|
||||
"files": [
|
||||
"lib/**/*[^test].js"
|
||||
],
|
||||
"homepage": "https://sinonjs.github.io/formatio/",
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "./lib/formatio",
|
||||
"name": "@sinonjs/formatio",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sinonjs/formatio.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npm run build:dist-folder && npm run build:bundle",
|
||||
"build:bundle": "rollup -c > dist/formatio.js",
|
||||
"build:dist-folder": "mkdirp dist",
|
||||
"lint": "eslint .",
|
||||
"prepublishOnly": "npm run build && mkdocs gh-deploy -r upstream || mkdocs gh-deploy -r origin",
|
||||
"test": "mocha 'lib/**/*.test.js'",
|
||||
"test-coverage": "nyc --reporter text --reporter html --reporter lcovonly npm run test"
|
||||
},
|
||||
"version": "3.2.1"
|
||||
}
|
27
node_modules/@sinonjs/samsam/LICENSE
generated
vendored
Normal file
27
node_modules/@sinonjs/samsam/LICENSE
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
(The BSD License)
|
||||
|
||||
Copyright (c) 2010-2012, Christian Johansen, christian@cjohansen.no and
|
||||
August Lilleaas, august.lilleaas@gmail.com. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of Christian Johansen nor the names of his contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
83
node_modules/@sinonjs/samsam/README.md
generated
vendored
Normal file
83
node_modules/@sinonjs/samsam/README.md
generated
vendored
Normal file
@ -0,0 +1,83 @@
|
||||
# samsam
|
||||
|
||||
[](http://travis-ci.org/sinonjs/samsam)
|
||||
[](https://coveralls.io/github/sinonjs/samsam?branch=master)
|
||||
|
||||
Value identification and comparison functions
|
||||
|
||||
Documentation: http://sinonjs.github.io/samsam/
|
||||
|
||||
## Backers
|
||||
|
||||
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/sinon#backer)]
|
||||
|
||||
<a href="https://opencollective.com/sinon/backer/0/website" target="_blank"><img src="https://opencollective.com/sinon/backer/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/1/website" target="_blank"><img src="https://opencollective.com/sinon/backer/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/2/website" target="_blank"><img src="https://opencollective.com/sinon/backer/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/3/website" target="_blank"><img src="https://opencollective.com/sinon/backer/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/4/website" target="_blank"><img src="https://opencollective.com/sinon/backer/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/5/website" target="_blank"><img src="https://opencollective.com/sinon/backer/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/6/website" target="_blank"><img src="https://opencollective.com/sinon/backer/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/7/website" target="_blank"><img src="https://opencollective.com/sinon/backer/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/8/website" target="_blank"><img src="https://opencollective.com/sinon/backer/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/9/website" target="_blank"><img src="https://opencollective.com/sinon/backer/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/10/website" target="_blank"><img src="https://opencollective.com/sinon/backer/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/11/website" target="_blank"><img src="https://opencollective.com/sinon/backer/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/12/website" target="_blank"><img src="https://opencollective.com/sinon/backer/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/13/website" target="_blank"><img src="https://opencollective.com/sinon/backer/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/14/website" target="_blank"><img src="https://opencollective.com/sinon/backer/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/15/website" target="_blank"><img src="https://opencollective.com/sinon/backer/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/16/website" target="_blank"><img src="https://opencollective.com/sinon/backer/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/17/website" target="_blank"><img src="https://opencollective.com/sinon/backer/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/18/website" target="_blank"><img src="https://opencollective.com/sinon/backer/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/19/website" target="_blank"><img src="https://opencollective.com/sinon/backer/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/20/website" target="_blank"><img src="https://opencollective.com/sinon/backer/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/21/website" target="_blank"><img src="https://opencollective.com/sinon/backer/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/22/website" target="_blank"><img src="https://opencollective.com/sinon/backer/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/23/website" target="_blank"><img src="https://opencollective.com/sinon/backer/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/24/website" target="_blank"><img src="https://opencollective.com/sinon/backer/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/25/website" target="_blank"><img src="https://opencollective.com/sinon/backer/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/26/website" target="_blank"><img src="https://opencollective.com/sinon/backer/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/27/website" target="_blank"><img src="https://opencollective.com/sinon/backer/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/28/website" target="_blank"><img src="https://opencollective.com/sinon/backer/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/backer/29/website" target="_blank"><img src="https://opencollective.com/sinon/backer/29/avatar.svg"></a>
|
||||
|
||||
|
||||
## Sponsors
|
||||
|
||||
Become a sponsor and get your logo on our README on GitHub with a link to your site. [[Become a sponsor](https://opencollective.com/sinon#sponsor)]
|
||||
|
||||
<a href="https://opencollective.com/sinon/sponsor/0/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/1/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/2/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/3/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/4/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/5/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/6/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/7/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/8/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/9/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/10/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/11/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/12/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/13/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/14/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/15/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/16/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/17/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/18/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/19/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/20/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/21/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/22/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/23/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/24/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/25/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/26/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/27/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/28/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/sinon/sponsor/29/website" target="_blank"><img src="https://opencollective.com/sinon/sponsor/29/avatar.svg"></a>
|
||||
|
||||
## Licence
|
||||
|
||||
samsam was released under [BSD-3](LICENSE)
|
1100
node_modules/@sinonjs/samsam/dist/samsam.js
generated
vendored
Normal file
1100
node_modules/@sinonjs/samsam/dist/samsam.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
203
node_modules/@sinonjs/samsam/docs/index.md
generated
vendored
Normal file
203
node_modules/@sinonjs/samsam/docs/index.md
generated
vendored
Normal file
@ -0,0 +1,203 @@
|
||||
# samsam
|
||||
|
||||
> Same same, but different
|
||||
|
||||
`samsam` is a collection of predicate and comparison functions useful for
|
||||
identifiying the type of values and to compare values with varying degrees of
|
||||
strictness.
|
||||
|
||||
`samsam` is a general-purpose library with no dependencies. It works in browsers
|
||||
(including old and rowdy ones, like IE6) and Node. It will define itself as an
|
||||
AMD module if you want it to (i.e. if there's a `define` function available).
|
||||
|
||||
## Predicate functions
|
||||
|
||||
|
||||
### `isArguments(value)`
|
||||
|
||||
Returns `true` if `value` is an `arguments` object, `false` otherwise.
|
||||
|
||||
|
||||
### `isNegZero(value)`
|
||||
|
||||
Returns `true` if `value` is `-0`.
|
||||
|
||||
|
||||
### `isElement(value)`
|
||||
|
||||
Returns `true` if `value` is a DOM element node. Unlike
|
||||
Underscore.js/lodash, this function will return `false` if `value` is an
|
||||
*element-like* object, i.e. a regular object with a `nodeType` property that
|
||||
holds the value `1`.
|
||||
|
||||
### `isSet(value)`
|
||||
|
||||
Returns `true` if `value` is a [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set).
|
||||
|
||||
|
||||
## Comparison functions
|
||||
|
||||
|
||||
### `identical(x, y)`
|
||||
|
||||
Strict equality check according to EcmaScript Harmony's `egal`.
|
||||
|
||||
**From the Harmony wiki:**
|
||||
|
||||
> An egal function simply makes available the internal `SameValue` function
|
||||
from section 9.12 of the ES5 spec. If two values are egal, then they are not
|
||||
observably distinguishable.
|
||||
|
||||
`identical` returns `true` when `===` is `true`, except for `-0` and
|
||||
`+0`, where it returns `false`. Additionally, it returns `true` when
|
||||
`NaN` is compared to itself.
|
||||
|
||||
|
||||
### `deepEqual(actual, expectation)`
|
||||
|
||||
Deep equal comparison. Two values are "deep equal" if:
|
||||
|
||||
* They are identical
|
||||
* They are both date objects representing the same time
|
||||
* They are both arrays containing elements that are all deepEqual
|
||||
* They are objects with the same set of properties, and each property
|
||||
in `actual` is deepEqual to the corresponding property in `expectation`
|
||||
|
||||
* `actual` can have [symbolic properties](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) that are missing from `expectation`
|
||||
|
||||
|
||||
### `match(object, matcher)`
|
||||
|
||||
Partial equality check. Compares `object` with matcher according a wide set of
|
||||
rules:
|
||||
|
||||
#### String matcher
|
||||
|
||||
In its simplest form, `match` performs a case insensitive substring match.
|
||||
When the matcher is a string, `object` is converted to a string, and the
|
||||
function returns `true` if the matcher is a case-insensitive substring of
|
||||
`object` as a string.
|
||||
|
||||
```javascript
|
||||
samsam.match("Give me something", "Give"); //true
|
||||
samsam.match("Give me something", "sumptn"); // false
|
||||
samsam.match({ toString: function () { return "yeah"; } }, "Yeah!"); // true
|
||||
```
|
||||
|
||||
The last example is not symmetric. When the matcher is a string, the `object`
|
||||
is coerced to a string - in this case using `toString`. Changing the order of
|
||||
the arguments would cause the matcher to be an object, in which case different
|
||||
rules apply (see below).
|
||||
|
||||
|
||||
#### Boolean matcher
|
||||
|
||||
Performs a strict (i.e. `===`) match with the object. So, only `true`
|
||||
matches `true`, and only `false` matches `false`.
|
||||
|
||||
|
||||
#### Regular expression matcher
|
||||
|
||||
When the matcher is a regular expression, the function will pass if
|
||||
`object.test(matcher)` is `true`. `match` is written in a generic way, so
|
||||
any object with a `test` method will be used as a matcher this way.
|
||||
|
||||
```javascript
|
||||
samsam.match("Give me something", /^[a-z\s]$/i); // true
|
||||
samsam.match("Give me something", /[0-9]/); // false
|
||||
samsam.match({ toString: function () { return "yeah!"; } }, /yeah/); // true
|
||||
samsam.match(234, /[a-z]/); // false
|
||||
```
|
||||
|
||||
|
||||
#### Number matcher
|
||||
|
||||
When the matcher is a number, the assertion will pass if `object == matcher`.
|
||||
|
||||
```javascript
|
||||
samsam.match("123", 123); // true
|
||||
samsam.match("Give me something", 425); // false
|
||||
samsam.match({ toString: function () { return "42"; } }, 42); // true
|
||||
samsam.match(234, 1234); // false
|
||||
```
|
||||
|
||||
|
||||
#### Function matcher
|
||||
|
||||
When the matcher is a function, it is called with `object` as its only
|
||||
argument. `match` returns `true` if the function returns `true`. A strict
|
||||
match is performed against the return value, so a boolean `true` is required,
|
||||
truthy is not enough.
|
||||
|
||||
```javascript
|
||||
// true
|
||||
samsam.match("123", function (exp) {
|
||||
return exp == "123";
|
||||
});
|
||||
|
||||
// false
|
||||
samsam.match("Give me something", function () {
|
||||
return "ok";
|
||||
});
|
||||
|
||||
// true
|
||||
samsam.match({
|
||||
toString: function () {
|
||||
return "42";
|
||||
}
|
||||
}, function () { return true; });
|
||||
|
||||
// false
|
||||
samsam.match(234, function () {});
|
||||
```
|
||||
|
||||
|
||||
#### Object matcher
|
||||
|
||||
As mentioned above, if an object matcher defines a `test` method, `match`
|
||||
will return `true` if `matcher.test(object)` returns truthy.
|
||||
|
||||
If the matcher does not have a test method, a recursive match is performed. If
|
||||
all properties of `matcher` matches corresponding properties in `object`,
|
||||
`match` returns `true`. Note that the object matcher does not care if the
|
||||
number of properties in the two objects are the same - only if all properties in
|
||||
the matcher recursively matches ones in `object`.
|
||||
|
||||
```javascript
|
||||
// true
|
||||
samsam.match("123", {
|
||||
test: function (arg) {
|
||||
return arg == 123;
|
||||
}
|
||||
});
|
||||
|
||||
// false
|
||||
samsam.match({}, { prop: 42 });
|
||||
|
||||
// true
|
||||
samsam.match({
|
||||
name: "Chris",
|
||||
profession: "Programmer"
|
||||
}, {
|
||||
name: "Chris"
|
||||
});
|
||||
|
||||
// false
|
||||
samsam.match(234, { name: "Chris" });
|
||||
```
|
||||
|
||||
|
||||
#### DOM elements
|
||||
|
||||
`match` can be very helpful when comparing DOM elements, because it allows
|
||||
you to compare several properties with one call:
|
||||
|
||||
```javascript
|
||||
var el = document.getElementById("myEl");
|
||||
|
||||
samsam.match(el, {
|
||||
tagName: "h2",
|
||||
className: "item",
|
||||
innerHTML: "Howdy"
|
||||
});
|
||||
```
|
27
node_modules/@sinonjs/samsam/lib/create-set.js
generated
vendored
Normal file
27
node_modules/@sinonjs/samsam/lib/create-set.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
|
||||
var typeOf = require("@sinonjs/commons").typeOf;
|
||||
|
||||
// This helper makes it convenient to create Set instances from a
|
||||
// collection, an overcomes the shortcoming that IE11 doesn't support
|
||||
// collection arguments
|
||||
//
|
||||
// See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set
|
||||
function createSet(array) {
|
||||
if (arguments.length > 0 && !Array.isArray(array)) {
|
||||
throw new TypeError(
|
||||
"createSet can be called with either no arguments or an Array"
|
||||
);
|
||||
}
|
||||
|
||||
var items = typeOf(array) === "array" ? array : [];
|
||||
var set = new Set();
|
||||
|
||||
items.forEach(function(item) {
|
||||
set.add(item);
|
||||
});
|
||||
|
||||
return set;
|
||||
}
|
||||
|
||||
module.exports = createSet;
|
74
node_modules/@sinonjs/samsam/lib/deep-equal-benchmark.js
generated
vendored
Normal file
74
node_modules/@sinonjs/samsam/lib/deep-equal-benchmark.js
generated
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
"use strict";
|
||||
|
||||
var Benchmark = require("benchmark");
|
||||
var deepEqual = require("./deep-equal");
|
||||
|
||||
var suite = new Benchmark.Suite();
|
||||
var complex1 = {
|
||||
"1e116061-59bf-433a-8ab0-017b67a51d26":
|
||||
"a7fd22ab-e809-414f-ad55-9c97598395d8",
|
||||
"3824e8b7-22f5-489c-9919-43b432e3af6b":
|
||||
"548baefd-f43c-4dc9-9df5-f7c9c96223b0",
|
||||
"123e5750-eb66-45e5-a770-310879203b33":
|
||||
"89ff817d-65a2-4598-b190-21c128096e6a",
|
||||
"1d66be95-8aaa-4167-9a47-e7ee19bb0735":
|
||||
"64349492-56e8-4100-9552-a89fb4a9aef4",
|
||||
"f5538565-dc92-4ee4-a762-1ba5fe0528f6": {
|
||||
"53631f78-2f2a-448f-89c7-ed3585e8e6f0":
|
||||
"2cce00ee-f5ee-43ef-878f-958597b23225",
|
||||
"73e8298b-72fd-4969-afc1-d891b61e744f":
|
||||
"4e57aa30-af51-4d78-887c-019755e5d117",
|
||||
"85439907-5b0e-4a08-8cfa-902a68dc3cc0":
|
||||
"9639add9-6897-4cf0-b3d3-2ebf9c214f01",
|
||||
"d4ae9d87-bd6c-47e0-95a1-6f4eb4211549":
|
||||
"41fd3dd2-43ce-47f2-b92e-462474d07a6f",
|
||||
"f70345a2-0ea3-45a6-bafa-8c7a72379277": {
|
||||
"1bce714b-cd0a-417d-9a0c-bf4b7d35c0c4":
|
||||
"3b8b0dde-e2ed-4b34-ac8d-729ba3c9667e",
|
||||
"13e05c60-97d1-43f0-a6ef-d5247f4dd11f":
|
||||
"60f685a4-6558-4ade-9d4b-28281c3989db",
|
||||
"925b2609-e7b7-42f5-82cf-2d995697cec5":
|
||||
"79115261-8161-4a6c-9487-47847276a717",
|
||||
"52d644ac-7b33-4b79-b5b3-5afe7fd4ec2c": [
|
||||
"3c2ae716-92f1-4a3d-b98f-50ea49f51c45",
|
||||
"de76b822-71b3-4b5a-a041-4140378b70e2",
|
||||
"0302a405-1d58-44fa-a0c6-dd07bb0ca26e",
|
||||
new Date(),
|
||||
new Error(),
|
||||
new RegExp(),
|
||||
// eslint-disable-next-line no-undef
|
||||
new Map(),
|
||||
new Set(),
|
||||
// eslint-disable-next-line no-undef, ie11/no-weak-collections
|
||||
new WeakMap(),
|
||||
// eslint-disable-next-line no-undef, ie11/no-weak-collections
|
||||
new WeakSet()
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
var complex2 = Object.create(complex1);
|
||||
|
||||
var cyclic1 = {
|
||||
"4a092cd1-225e-4739-8331-d6564aafb702":
|
||||
"d0cebbe0-23fb-4cc4-8fa0-ef11ceedf12e"
|
||||
};
|
||||
cyclic1.cyclicRef = cyclic1;
|
||||
|
||||
var cyclic2 = Object.create(cyclic1);
|
||||
|
||||
// add tests
|
||||
suite
|
||||
.add("complex objects", function() {
|
||||
return deepEqual(complex1, complex2);
|
||||
})
|
||||
.add("cyclic references", function() {
|
||||
return deepEqual(cyclic1, cyclic2);
|
||||
})
|
||||
// add listeners
|
||||
.on("cycle", function(event) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(String(event.target));
|
||||
})
|
||||
// run async
|
||||
.run({ async: true });
|
227
node_modules/@sinonjs/samsam/lib/deep-equal.js
generated
vendored
Normal file
227
node_modules/@sinonjs/samsam/lib/deep-equal.js
generated
vendored
Normal file
@ -0,0 +1,227 @@
|
||||
"use strict";
|
||||
|
||||
var valueToString = require("@sinonjs/commons").valueToString;
|
||||
|
||||
var getClass = require("./get-class");
|
||||
var identical = require("./identical");
|
||||
var isArguments = require("./is-arguments");
|
||||
var isDate = require("./is-date");
|
||||
var isElement = require("./is-element");
|
||||
var isNaN = require("./is-nan");
|
||||
var isObject = require("./is-object");
|
||||
var isSet = require("./is-set");
|
||||
var isSubset = require("./is-subset");
|
||||
var getClassName = require("./get-class-name");
|
||||
|
||||
var every = Array.prototype.every;
|
||||
var getTime = Date.prototype.getTime;
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
var indexOf = Array.prototype.indexOf;
|
||||
var keys = Object.keys;
|
||||
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
||||
|
||||
/**
|
||||
* @name samsam.deepEqual
|
||||
* @param Object actual
|
||||
* @param Object expectation
|
||||
*
|
||||
* Deep equal comparison. Two values are "deep equal" if:
|
||||
*
|
||||
* - They are equal, according to samsam.identical
|
||||
* - They are both date objects representing the same time
|
||||
* - They are both arrays containing elements that are all deepEqual
|
||||
* - They are objects with the same set of properties, and each property
|
||||
* in ``actual`` is deepEqual to the corresponding property in ``expectation``
|
||||
*
|
||||
* Supports cyclic objects.
|
||||
*/
|
||||
function deepEqualCyclic(actual, expectation, match) {
|
||||
// used for cyclic comparison
|
||||
// contain already visited objects
|
||||
var actualObjects = [];
|
||||
var expectationObjects = [];
|
||||
// contain pathes (position in the object structure)
|
||||
// of the already visited objects
|
||||
// indexes same as in objects arrays
|
||||
var actualPaths = [];
|
||||
var expectationPaths = [];
|
||||
// contains combinations of already compared objects
|
||||
// in the manner: { "$1['ref']$2['ref']": true }
|
||||
var compared = {};
|
||||
|
||||
// does the recursion for the deep equal check
|
||||
return (function deepEqual(
|
||||
actualObj,
|
||||
expectationObj,
|
||||
actualPath,
|
||||
expectationPath
|
||||
) {
|
||||
// If both are matchers they must be the same instance in order to be
|
||||
// considered equal If we didn't do that we would end up running one
|
||||
// matcher against the other
|
||||
if (match && match.isMatcher(expectationObj)) {
|
||||
if (match.isMatcher(actualObj)) {
|
||||
return actualObj === expectationObj;
|
||||
}
|
||||
return expectationObj.test(actualObj);
|
||||
}
|
||||
|
||||
var actualType = typeof actualObj;
|
||||
var expectationType = typeof expectationObj;
|
||||
|
||||
// == null also matches undefined
|
||||
if (
|
||||
actualObj === expectationObj ||
|
||||
isNaN(actualObj) ||
|
||||
isNaN(expectationObj) ||
|
||||
actualObj == null ||
|
||||
expectationObj == null ||
|
||||
actualType !== "object" ||
|
||||
expectationType !== "object"
|
||||
) {
|
||||
return identical(actualObj, expectationObj);
|
||||
}
|
||||
|
||||
// Elements are only equal if identical(expected, actual)
|
||||
if (isElement(actualObj) || isElement(expectationObj)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var isActualDate = isDate(actualObj);
|
||||
var isExpectationDate = isDate(expectationObj);
|
||||
if (isActualDate || isExpectationDate) {
|
||||
if (
|
||||
!isActualDate ||
|
||||
!isExpectationDate ||
|
||||
getTime.call(actualObj) !== getTime.call(expectationObj)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (actualObj instanceof RegExp && expectationObj instanceof RegExp) {
|
||||
if (valueToString(actualObj) !== valueToString(expectationObj)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (actualObj instanceof Error && expectationObj instanceof Error) {
|
||||
return actualObj === expectationObj;
|
||||
}
|
||||
|
||||
var actualClass = getClass(actualObj);
|
||||
var expectationClass = getClass(expectationObj);
|
||||
var actualKeys = keys(actualObj);
|
||||
var expectationKeys = keys(expectationObj);
|
||||
var actualName = getClassName(actualObj);
|
||||
var expectationName = getClassName(expectationObj);
|
||||
var expectationSymbols =
|
||||
typeof Object.getOwnPropertySymbols === "function"
|
||||
? getOwnPropertySymbols(expectationObj)
|
||||
: [];
|
||||
var expectationKeysAndSymbols = expectationKeys.concat(
|
||||
expectationSymbols
|
||||
);
|
||||
|
||||
if (isArguments(actualObj) || isArguments(expectationObj)) {
|
||||
if (actualObj.length !== expectationObj.length) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (
|
||||
actualType !== expectationType ||
|
||||
actualClass !== expectationClass ||
|
||||
actualKeys.length !== expectationKeys.length ||
|
||||
(actualName &&
|
||||
expectationName &&
|
||||
actualName !== expectationName)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (isSet(actualObj) || isSet(expectationObj)) {
|
||||
if (
|
||||
!isSet(actualObj) ||
|
||||
!isSet(expectationObj) ||
|
||||
actualObj.size !== expectationObj.size
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return isSubset(actualObj, expectationObj, deepEqual);
|
||||
}
|
||||
|
||||
return every.call(expectationKeysAndSymbols, function(key) {
|
||||
if (!hasOwnProperty.call(actualObj, key)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var actualValue = actualObj[key];
|
||||
var expectationValue = expectationObj[key];
|
||||
var actualObject = isObject(actualValue);
|
||||
var expectationObject = isObject(expectationValue);
|
||||
// determines, if the objects were already visited
|
||||
// (it's faster to check for isObject first, than to
|
||||
// get -1 from getIndex for non objects)
|
||||
var actualIndex = actualObject
|
||||
? indexOf.call(actualObjects, actualValue)
|
||||
: -1;
|
||||
var expectationIndex = expectationObject
|
||||
? indexOf.call(expectationObjects, expectationValue)
|
||||
: -1;
|
||||
// determines the new paths of the objects
|
||||
// - for non cyclic objects the current path will be extended
|
||||
// by current property name
|
||||
// - for cyclic objects the stored path is taken
|
||||
var newActualPath =
|
||||
actualIndex !== -1
|
||||
? actualPaths[actualIndex]
|
||||
: actualPath + "[" + JSON.stringify(key) + "]";
|
||||
var newExpectationPath =
|
||||
expectationIndex !== -1
|
||||
? expectationPaths[expectationIndex]
|
||||
: expectationPath + "[" + JSON.stringify(key) + "]";
|
||||
var combinedPath = newActualPath + newExpectationPath;
|
||||
|
||||
// stop recursion if current objects are already compared
|
||||
if (compared[combinedPath]) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// remember the current objects and their paths
|
||||
if (actualIndex === -1 && actualObject) {
|
||||
actualObjects.push(actualValue);
|
||||
actualPaths.push(newActualPath);
|
||||
}
|
||||
if (expectationIndex === -1 && expectationObject) {
|
||||
expectationObjects.push(expectationValue);
|
||||
expectationPaths.push(newExpectationPath);
|
||||
}
|
||||
|
||||
// remember that the current objects are already compared
|
||||
if (actualObject && expectationObject) {
|
||||
compared[combinedPath] = true;
|
||||
}
|
||||
|
||||
// End of cyclic logic
|
||||
|
||||
// neither actualValue nor expectationValue is a cycle
|
||||
// continue with next level
|
||||
return deepEqual(
|
||||
actualValue,
|
||||
expectationValue,
|
||||
newActualPath,
|
||||
newExpectationPath
|
||||
);
|
||||
});
|
||||
})(actual, expectation, "$1", "$2");
|
||||
}
|
||||
|
||||
deepEqualCyclic.use = function(match) {
|
||||
return function(a, b) {
|
||||
return deepEqualCyclic(a, b, match);
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = deepEqualCyclic;
|
22
node_modules/@sinonjs/samsam/lib/get-class-name.js
generated
vendored
Normal file
22
node_modules/@sinonjs/samsam/lib/get-class-name.js
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
|
||||
var valueToString = require("@sinonjs/commons").valueToString;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
module.exports = getClassName;
|
12
node_modules/@sinonjs/samsam/lib/get-class.js
generated
vendored
Normal file
12
node_modules/@sinonjs/samsam/lib/get-class.js
generated
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
|
||||
var o = Object.prototype;
|
||||
|
||||
function getClass(value) {
|
||||
// Returns the internal [[Class]] by calling Object.prototype.toString
|
||||
// with the provided value as this. Return value is a string, naming the
|
||||
// internal class, e.g. "Array"
|
||||
return o.toString.call(value).split(/[ \]]/)[1];
|
||||
}
|
||||
|
||||
module.exports = getClass;
|
25
node_modules/@sinonjs/samsam/lib/identical.js
generated
vendored
Normal file
25
node_modules/@sinonjs/samsam/lib/identical.js
generated
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
|
||||
var isNaN = require("./is-nan");
|
||||
var isNegZero = require("./is-neg-zero");
|
||||
|
||||
/**
|
||||
* @name samsam.equal
|
||||
* @param Object obj1
|
||||
* @param Object obj2
|
||||
*
|
||||
* Returns ``true`` if two objects are strictly equal. Compared to
|
||||
* ``===`` there are two exceptions:
|
||||
*
|
||||
* - NaN is considered equal to NaN
|
||||
* - -0 and +0 are not considered equal
|
||||
*/
|
||||
function identical(obj1, obj2) {
|
||||
if (obj1 === obj2 || (isNaN(obj1) && isNaN(obj2))) {
|
||||
return obj1 !== 0 || isNegZero(obj1) === isNegZero(obj2);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
module.exports = identical;
|
35
node_modules/@sinonjs/samsam/lib/is-arguments.js
generated
vendored
Normal file
35
node_modules/@sinonjs/samsam/lib/is-arguments.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
"use strict";
|
||||
|
||||
var getClass = require("./get-class");
|
||||
|
||||
/**
|
||||
* @name samsam.isArguments
|
||||
* @param Object object
|
||||
*
|
||||
* Returns ``true`` if ``object`` is an ``arguments`` object,
|
||||
* ``false`` otherwise.
|
||||
*/
|
||||
function isArguments(object) {
|
||||
if (getClass(object) === "Arguments") {
|
||||
return true;
|
||||
}
|
||||
if (
|
||||
typeof object !== "object" ||
|
||||
typeof object.length !== "number" ||
|
||||
getClass(object) === "Array"
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (typeof object.callee === "function") {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
object[object.length] = 6;
|
||||
delete object[object.length];
|
||||
} catch (e) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
module.exports = isArguments;
|
7
node_modules/@sinonjs/samsam/lib/is-date.js
generated
vendored
Normal file
7
node_modules/@sinonjs/samsam/lib/is-date.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
function isDate(value) {
|
||||
return value instanceof Date;
|
||||
}
|
||||
|
||||
module.exports = isDate;
|
27
node_modules/@sinonjs/samsam/lib/is-element.js
generated
vendored
Normal file
27
node_modules/@sinonjs/samsam/lib/is-element.js
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
"use strict";
|
||||
|
||||
var div = typeof document !== "undefined" && document.createElement("div");
|
||||
|
||||
/**
|
||||
* @name samsam.isElement
|
||||
* @param Object object
|
||||
*
|
||||
* Returns ``true`` if ``object`` is a DOM element node. Unlike
|
||||
* Underscore.js/lodash, this function will return ``false`` if ``object``
|
||||
* is an *element-like* object, i.e. a regular object with a ``nodeType``
|
||||
* property that holds the value ``1``.
|
||||
*/
|
||||
function isElement(object) {
|
||||
if (!object || object.nodeType !== 1 || !div) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
object.appendChild(div);
|
||||
object.removeChild(div);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
module.exports = isElement;
|
11
node_modules/@sinonjs/samsam/lib/is-nan.js
generated
vendored
Normal file
11
node_modules/@sinonjs/samsam/lib/is-nan.js
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
|
||||
function isNaN(value) {
|
||||
// Unlike global isNaN, this avoids type coercion
|
||||
// typeof check avoids IE host object issues, hat tip to
|
||||
// lodash
|
||||
var val = value; // JsLint thinks value !== value is "weird"
|
||||
return typeof value === "number" && value !== val;
|
||||
}
|
||||
|
||||
module.exports = isNaN;
|
13
node_modules/@sinonjs/samsam/lib/is-neg-zero.js
generated
vendored
Normal file
13
node_modules/@sinonjs/samsam/lib/is-neg-zero.js
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* @name samsam.isNegZero
|
||||
* @param Object value
|
||||
*
|
||||
* Returns ``true`` if ``value`` is ``-0``.
|
||||
*/
|
||||
function isNegZero(value) {
|
||||
return value === 0 && 1 / value === -Infinity;
|
||||
}
|
||||
|
||||
module.exports = isNegZero;
|
24
node_modules/@sinonjs/samsam/lib/is-object.js
generated
vendored
Normal file
24
node_modules/@sinonjs/samsam/lib/is-object.js
generated
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
|
||||
// Returns true when the value is a regular Object and not a specialized Object
|
||||
//
|
||||
// This helps speeding up deepEqual cyclic checks
|
||||
// The premise is that only Objects are stored in the visited array.
|
||||
// So if this function returns false, we don't have to do the
|
||||
// expensive operation of searching for the value in the the array of already
|
||||
// visited objects
|
||||
function isObject(value) {
|
||||
return (
|
||||
typeof value === "object" &&
|
||||
value !== null &&
|
||||
// none of these are collection objects, so we can return false
|
||||
!(value instanceof Boolean) &&
|
||||
!(value instanceof Date) &&
|
||||
!(value instanceof Error) &&
|
||||
!(value instanceof Number) &&
|
||||
!(value instanceof RegExp) &&
|
||||
!(value instanceof String)
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = isObject;
|
7
node_modules/@sinonjs/samsam/lib/is-set.js
generated
vendored
Normal file
7
node_modules/@sinonjs/samsam/lib/is-set.js
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
"use strict";
|
||||
|
||||
function isSet(val) {
|
||||
return (typeof Set !== "undefined" && val instanceof Set) || false;
|
||||
}
|
||||
|
||||
module.exports = isSet;
|
18
node_modules/@sinonjs/samsam/lib/is-subset.js
generated
vendored
Normal file
18
node_modules/@sinonjs/samsam/lib/is-subset.js
generated
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
|
||||
function isSubset(s1, s2, compare) {
|
||||
var allContained = true;
|
||||
s1.forEach(function(v1) {
|
||||
var includes = false;
|
||||
s2.forEach(function(v2) {
|
||||
if (compare(v2, v1)) {
|
||||
includes = true;
|
||||
}
|
||||
});
|
||||
allContained = allContained && includes;
|
||||
});
|
||||
|
||||
return allContained;
|
||||
}
|
||||
|
||||
module.exports = isSubset;
|
42
node_modules/@sinonjs/samsam/lib/iterable-to-string.js
generated
vendored
Normal file
42
node_modules/@sinonjs/samsam/lib/iterable-to-string.js
generated
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
|
||||
var slice = require("@sinonjs/commons").prototypes.string.slice;
|
||||
var typeOf = require("@sinonjs/commons").typeOf;
|
||||
var valueToString = require("@sinonjs/commons").valueToString;
|
||||
|
||||
module.exports = function iterableToString(obj) {
|
||||
var representation = "";
|
||||
|
||||
function stringify(item) {
|
||||
return typeof item === "string"
|
||||
? "'" + item + "'"
|
||||
: valueToString(item);
|
||||
}
|
||||
|
||||
function mapToString(map) {
|
||||
/* eslint-disable-next-line local-rules/no-prototype-methods */
|
||||
map.forEach(function(value, key) {
|
||||
representation +=
|
||||
"[" + stringify(key) + "," + stringify(value) + "],";
|
||||
});
|
||||
|
||||
representation = slice(representation, 0, -1);
|
||||
return representation;
|
||||
}
|
||||
|
||||
function genericIterableToString(iterable) {
|
||||
/* eslint-disable-next-line local-rules/no-prototype-methods */
|
||||
iterable.forEach(function(value) {
|
||||
representation += stringify(value) + ",";
|
||||
});
|
||||
|
||||
representation = slice(representation, 0, -1);
|
||||
return representation;
|
||||
}
|
||||
|
||||
if (typeOf(obj) === "map") {
|
||||
return mapToString(obj);
|
||||
}
|
||||
|
||||
return genericIterableToString(obj);
|
||||
};
|
136
node_modules/@sinonjs/samsam/lib/match.js
generated
vendored
Normal file
136
node_modules/@sinonjs/samsam/lib/match.js
generated
vendored
Normal file
@ -0,0 +1,136 @@
|
||||
"use strict";
|
||||
|
||||
var valueToString = require("@sinonjs/commons").valueToString;
|
||||
|
||||
var deepEqual = require("./deep-equal").use(match); // eslint-disable-line no-use-before-define
|
||||
var getClass = require("./get-class");
|
||||
var isDate = require("./is-date");
|
||||
var isSet = require("./is-set");
|
||||
var isSubset = require("./is-subset");
|
||||
var createMatcher = require("./matcher");
|
||||
|
||||
function arrayContains(array, subset, compare) {
|
||||
if (subset.length === 0) {
|
||||
return true;
|
||||
}
|
||||
var i, l, j, k;
|
||||
for (i = 0, l = array.length; i < l; ++i) {
|
||||
if (compare(array[i], subset[0])) {
|
||||
for (j = 0, k = subset.length; j < k; ++j) {
|
||||
if (i + j >= l) {
|
||||
return false;
|
||||
}
|
||||
if (!compare(array[i + j], subset[j])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name samsam.match
|
||||
* @param Object object
|
||||
* @param Object matcher
|
||||
*
|
||||
* Compare arbitrary value ``object`` with matcher.
|
||||
*/
|
||||
function match(object, matcher) {
|
||||
if (matcher && typeof matcher.test === "function") {
|
||||
return matcher.test(object);
|
||||
}
|
||||
|
||||
if (typeof matcher === "function") {
|
||||
return matcher(object) === true;
|
||||
}
|
||||
|
||||
if (typeof matcher === "string") {
|
||||
matcher = matcher.toLowerCase();
|
||||
var notNull = typeof object === "string" || !!object;
|
||||
return (
|
||||
notNull &&
|
||||
valueToString(object)
|
||||
.toLowerCase()
|
||||
.indexOf(matcher) >= 0
|
||||
);
|
||||
}
|
||||
|
||||
if (typeof matcher === "number") {
|
||||
return matcher === object;
|
||||
}
|
||||
|
||||
if (typeof matcher === "boolean") {
|
||||
return matcher === object;
|
||||
}
|
||||
|
||||
if (typeof matcher === "undefined") {
|
||||
return typeof object === "undefined";
|
||||
}
|
||||
|
||||
if (matcher === null) {
|
||||
return object === null;
|
||||
}
|
||||
|
||||
if (object === null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isSet(object)) {
|
||||
return isSubset(matcher, object, match);
|
||||
}
|
||||
|
||||
if (getClass(object) === "Array" && getClass(matcher) === "Array") {
|
||||
return arrayContains(object, matcher, match);
|
||||
}
|
||||
|
||||
if (isDate(matcher)) {
|
||||
return isDate(object) && object.getTime() === matcher.getTime();
|
||||
}
|
||||
|
||||
if (matcher && typeof matcher === "object") {
|
||||
if (matcher === object) {
|
||||
return true;
|
||||
}
|
||||
if (typeof object !== "object") {
|
||||
return false;
|
||||
}
|
||||
var prop;
|
||||
// eslint-disable-next-line guard-for-in
|
||||
for (prop in matcher) {
|
||||
var value = object[prop];
|
||||
if (
|
||||
typeof value === "undefined" &&
|
||||
typeof object.getAttribute === "function"
|
||||
) {
|
||||
value = object.getAttribute(prop);
|
||||
}
|
||||
if (
|
||||
matcher[prop] === null ||
|
||||
typeof matcher[prop] === "undefined"
|
||||
) {
|
||||
if (value !== matcher[prop]) {
|
||||
return false;
|
||||
}
|
||||
} else if (
|
||||
typeof value === "undefined" ||
|
||||
!deepEqual(value, matcher[prop])
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
throw new Error(
|
||||
"Matcher was not a string, a number, a " +
|
||||
"function, a boolean or an object"
|
||||
);
|
||||
}
|
||||
|
||||
Object.keys(createMatcher).forEach(function(key) {
|
||||
match[key] = createMatcher[key];
|
||||
});
|
||||
|
||||
module.exports = match;
|
470
node_modules/@sinonjs/samsam/lib/matcher.js
generated
vendored
Normal file
470
node_modules/@sinonjs/samsam/lib/matcher.js
generated
vendored
Normal file
@ -0,0 +1,470 @@
|
||||
"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 stringIndexOf = stringProto.indexOf;
|
||||
|
||||
function assertType(value, type, name) {
|
||||
var actual = typeOf(value);
|
||||
if (actual !== type) {
|
||||
throw new TypeError(
|
||||
"Expected type of " +
|
||||
name +
|
||||
" to be " +
|
||||
type +
|
||||
", but was " +
|
||||
actual
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function assertMethodExists(value, method, name, methodPath) {
|
||||
if (value[method] == null) {
|
||||
throw new TypeError(
|
||||
"Expected " + name + " to have method " + methodPath
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
var matcher = {
|
||||
toString: function() {
|
||||
return this.message;
|
||||
}
|
||||
};
|
||||
|
||||
function isMatcher(object) {
|
||||
return isPrototypeOf(matcher, object);
|
||||
}
|
||||
|
||||
function matchObject(actual, expectation) {
|
||||
if (actual === null || actual === undefined) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return arrayEvery(Object.keys(expectation), function(key) {
|
||||
var exp = expectation[key];
|
||||
var act = actual[key];
|
||||
|
||||
if (isMatcher(exp)) {
|
||||
if (!exp.test(act)) {
|
||||
return false;
|
||||
}
|
||||
} else if (typeOf(exp) === "object") {
|
||||
if (!matchObject(act, exp)) {
|
||||
return false;
|
||||
}
|
||||
} else if (!deepEqual(act, exp)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
var TYPE_MAP = {
|
||||
function: function(m, expectation, message) {
|
||||
m.test = expectation;
|
||||
m.message = message || "match(" + functionName(expectation) + ")";
|
||||
},
|
||||
number: function(m, expectation) {
|
||||
m.test = function(actual) {
|
||||
// we need type coercion here
|
||||
return expectation == actual; // eslint-disable-line eqeqeq
|
||||
};
|
||||
},
|
||||
object: function(m, expectation) {
|
||||
var array = [];
|
||||
|
||||
if (typeof expectation.test === "function") {
|
||||
m.test = function(actual) {
|
||||
return expectation.test(actual) === true;
|
||||
};
|
||||
m.message = "match(" + functionName(expectation.test) + ")";
|
||||
return m;
|
||||
}
|
||||
|
||||
array = map(Object.keys(expectation), function(key) {
|
||||
return key + ": " + valueToString(expectation[key]);
|
||||
});
|
||||
|
||||
m.test = function(actual) {
|
||||
return matchObject(actual, expectation);
|
||||
};
|
||||
m.message = "match(" + join(array, ", ") + ")";
|
||||
|
||||
return m;
|
||||
},
|
||||
regexp: function(m, expectation) {
|
||||
m.test = function(actual) {
|
||||
return typeof actual === "string" && expectation.test(actual);
|
||||
};
|
||||
},
|
||||
string: function(m, expectation) {
|
||||
m.test = function(actual) {
|
||||
return (
|
||||
typeof actual === "string" &&
|
||||
stringIndexOf(actual, expectation) !== -1
|
||||
);
|
||||
};
|
||||
m.message = 'match("' + expectation + '")';
|
||||
}
|
||||
};
|
||||
|
||||
function match(expectation, message) {
|
||||
var m = Object.create(matcher);
|
||||
var type = typeOf(expectation);
|
||||
|
||||
if (message !== undefined && typeof message !== "string") {
|
||||
throw new TypeError("Message should be a string");
|
||||
}
|
||||
|
||||
if (arguments.length > 2) {
|
||||
throw new TypeError(
|
||||
"Expected 1 or 2 arguments, received " + arguments.length
|
||||
);
|
||||
}
|
||||
|
||||
if (type in TYPE_MAP) {
|
||||
TYPE_MAP[type](m, expectation, message);
|
||||
} else {
|
||||
m.test = function(actual) {
|
||||
return deepEqual(actual, expectation);
|
||||
};
|
||||
}
|
||||
|
||||
if (!m.message) {
|
||||
m.message = "match(" + valueToString(expectation) + ")";
|
||||
}
|
||||
|
||||
return m;
|
||||
}
|
||||
|
||||
matcher.or = function(m2) {
|
||||
if (!arguments.length) {
|
||||
throw new TypeError("Matcher expected");
|
||||
} else if (!isMatcher(m2)) {
|
||||
m2 = match(m2);
|
||||
}
|
||||
var m1 = this;
|
||||
var or = Object.create(matcher);
|
||||
or.test = function(actual) {
|
||||
return m1.test(actual) || m2.test(actual);
|
||||
};
|
||||
or.message = m1.message + ".or(" + m2.message + ")";
|
||||
return or;
|
||||
};
|
||||
|
||||
matcher.and = function(m2) {
|
||||
if (!arguments.length) {
|
||||
throw new TypeError("Matcher expected");
|
||||
} else if (!isMatcher(m2)) {
|
||||
m2 = match(m2);
|
||||
}
|
||||
var m1 = this;
|
||||
var and = Object.create(matcher);
|
||||
and.test = function(actual) {
|
||||
return m1.test(actual) && m2.test(actual);
|
||||
};
|
||||
and.message = m1.message + ".and(" + m2.message + ")";
|
||||
return and;
|
||||
};
|
||||
|
||||
match.isMatcher = isMatcher;
|
||||
|
||||
match.any = match(function() {
|
||||
return true;
|
||||
}, "any");
|
||||
|
||||
match.defined = match(function(actual) {
|
||||
return actual !== null && actual !== undefined;
|
||||
}, "defined");
|
||||
|
||||
match.truthy = match(function(actual) {
|
||||
return !!actual;
|
||||
}, "truthy");
|
||||
|
||||
match.falsy = match(function(actual) {
|
||||
return !actual;
|
||||
}, "falsy");
|
||||
|
||||
match.same = function(expectation) {
|
||||
return match(function(actual) {
|
||||
return expectation === actual;
|
||||
}, "same(" + valueToString(expectation) + ")");
|
||||
};
|
||||
|
||||
match.in = function(arrayOfExpectations) {
|
||||
if (typeOf(arrayOfExpectations) !== "array") {
|
||||
throw new TypeError("array expected");
|
||||
}
|
||||
|
||||
return match(function(actual) {
|
||||
return some(arrayOfExpectations, function(expectation) {
|
||||
return expectation === actual;
|
||||
});
|
||||
}, "in(" + valueToString(arrayOfExpectations) + ")");
|
||||
};
|
||||
|
||||
match.typeOf = function(type) {
|
||||
assertType(type, "string", "type");
|
||||
return match(function(actual) {
|
||||
return typeOf(actual) === type;
|
||||
}, 'typeOf("' + type + '")');
|
||||
};
|
||||
|
||||
match.instanceOf = function(type) {
|
||||
if (
|
||||
typeof Symbol === "undefined" ||
|
||||
typeof Symbol.hasInstance === "undefined"
|
||||
) {
|
||||
assertType(type, "function", "type");
|
||||
} else {
|
||||
assertMethodExists(
|
||||
type,
|
||||
Symbol.hasInstance,
|
||||
"type",
|
||||
"[Symbol.hasInstance]"
|
||||
);
|
||||
}
|
||||
return match(function(actual) {
|
||||
return actual instanceof type;
|
||||
}, "instanceOf(" +
|
||||
(functionName(type) || Object.prototype.toString.call(type)) +
|
||||
")");
|
||||
};
|
||||
|
||||
function createPropertyMatcher(propertyTest, messagePrefix) {
|
||||
return function(property, value) {
|
||||
assertType(property, "string", "property");
|
||||
var onlyProperty = arguments.length === 1;
|
||||
var message = messagePrefix + '("' + property + '"';
|
||||
if (!onlyProperty) {
|
||||
message += ", " + valueToString(value);
|
||||
}
|
||||
message += ")";
|
||||
return match(function(actual) {
|
||||
if (
|
||||
actual === undefined ||
|
||||
actual === null ||
|
||||
!propertyTest(actual, property)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return onlyProperty || deepEqual(actual[property], value);
|
||||
}, message);
|
||||
};
|
||||
}
|
||||
|
||||
match.has = createPropertyMatcher(function(actual, property) {
|
||||
if (typeof actual === "object") {
|
||||
return property in actual;
|
||||
}
|
||||
return actual[property] !== undefined;
|
||||
}, "has");
|
||||
|
||||
match.hasOwn = createPropertyMatcher(function(actual, property) {
|
||||
return hasOwnProperty(actual, property);
|
||||
}, "hasOwn");
|
||||
|
||||
match.hasNested = function(property, value) {
|
||||
assertType(property, "string", "property");
|
||||
var onlyProperty = arguments.length === 1;
|
||||
var message = 'hasNested("' + property + '"';
|
||||
if (!onlyProperty) {
|
||||
message += ", " + valueToString(value);
|
||||
}
|
||||
message += ")";
|
||||
return match(function(actual) {
|
||||
if (
|
||||
actual === undefined ||
|
||||
actual === null ||
|
||||
get(actual, property) === undefined
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return onlyProperty || deepEqual(get(actual, property), value);
|
||||
}, message);
|
||||
};
|
||||
|
||||
match.every = function(predicate) {
|
||||
if (!isMatcher(predicate)) {
|
||||
throw new TypeError("Matcher expected");
|
||||
}
|
||||
|
||||
return match(function(actual) {
|
||||
if (typeOf(actual) === "object") {
|
||||
return every(Object.keys(actual), function(key) {
|
||||
return predicate.test(actual[key]);
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
!!actual &&
|
||||
typeOf(actual.forEach) === "function" &&
|
||||
every(actual, function(element) {
|
||||
return predicate.test(element);
|
||||
})
|
||||
);
|
||||
}, "every(" + predicate.message + ")");
|
||||
};
|
||||
|
||||
match.some = function(predicate) {
|
||||
if (!isMatcher(predicate)) {
|
||||
throw new TypeError("Matcher expected");
|
||||
}
|
||||
|
||||
return match(function(actual) {
|
||||
if (typeOf(actual) === "object") {
|
||||
return !every(Object.keys(actual), function(key) {
|
||||
return !predicate.test(actual[key]);
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
!!actual &&
|
||||
typeOf(actual.forEach) === "function" &&
|
||||
!every(actual, function(element) {
|
||||
return !predicate.test(element);
|
||||
})
|
||||
);
|
||||
}, "some(" + predicate.message + ")");
|
||||
};
|
||||
|
||||
match.array = match.typeOf("array");
|
||||
|
||||
match.array.deepEquals = function(expectation) {
|
||||
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) + "])");
|
||||
};
|
||||
|
||||
match.array.startsWith = function(expectation) {
|
||||
return match(function(actual) {
|
||||
return (
|
||||
typeOf(actual) === "array" &&
|
||||
every(expectation, function(expectedElement, index) {
|
||||
return actual[index] === expectedElement;
|
||||
})
|
||||
);
|
||||
}, "startsWith([" + iterableToString(expectation) + "])");
|
||||
};
|
||||
|
||||
match.array.endsWith = function(expectation) {
|
||||
return match(function(actual) {
|
||||
// This indicates the index in which we should start matching
|
||||
var offset = actual.length - expectation.length;
|
||||
|
||||
return (
|
||||
typeOf(actual) === "array" &&
|
||||
every(expectation, function(expectedElement, index) {
|
||||
return actual[offset + index] === expectedElement;
|
||||
})
|
||||
);
|
||||
}, "endsWith([" + iterableToString(expectation) + "])");
|
||||
};
|
||||
|
||||
match.array.contains = function(expectation) {
|
||||
return match(function(actual) {
|
||||
return (
|
||||
typeOf(actual) === "array" &&
|
||||
every(expectation, function(expectedElement) {
|
||||
return arrayIndexOf(actual, expectedElement) !== -1;
|
||||
})
|
||||
);
|
||||
}, "contains([" + iterableToString(expectation) + "])");
|
||||
};
|
||||
|
||||
match.map = match.typeOf("map");
|
||||
|
||||
match.map.deepEquals = function mapDeepEquals(expectation) {
|
||||
return match(function(actual) {
|
||||
// Comparing lengths is the fastest way to spot a difference before iterating through every item
|
||||
var sameLength = actual.size === expectation.size;
|
||||
return (
|
||||
typeOf(actual) === "map" &&
|
||||
sameLength &&
|
||||
every(actual, function(element, key) {
|
||||
return expectation.has(key) && expectation.get(key) === element;
|
||||
})
|
||||
);
|
||||
}, "deepEquals(Map[" + iterableToString(expectation) + "])");
|
||||
};
|
||||
|
||||
match.map.contains = function mapContains(expectation) {
|
||||
return match(function(actual) {
|
||||
return (
|
||||
typeOf(actual) === "map" &&
|
||||
every(expectation, function(element, key) {
|
||||
return actual.has(key) && actual.get(key) === element;
|
||||
})
|
||||
);
|
||||
}, "contains(Map[" + iterableToString(expectation) + "])");
|
||||
};
|
||||
|
||||
match.set = match.typeOf("set");
|
||||
|
||||
match.set.deepEquals = function setDeepEquals(expectation) {
|
||||
return match(function(actual) {
|
||||
// Comparing lengths is the fastest way to spot a difference before iterating through every item
|
||||
var sameLength = actual.size === expectation.size;
|
||||
return (
|
||||
typeOf(actual) === "set" &&
|
||||
sameLength &&
|
||||
every(actual, function(element) {
|
||||
return expectation.has(element);
|
||||
})
|
||||
);
|
||||
}, "deepEquals(Set[" + iterableToString(expectation) + "])");
|
||||
};
|
||||
|
||||
match.set.contains = function setContains(expectation) {
|
||||
return match(function(actual) {
|
||||
return (
|
||||
typeOf(actual) === "set" &&
|
||||
every(expectation, function(element) {
|
||||
return actual.has(element);
|
||||
})
|
||||
);
|
||||
}, "contains(Set[" + iterableToString(expectation) + "])");
|
||||
};
|
||||
|
||||
match.bool = match.typeOf("boolean");
|
||||
match.number = match.typeOf("number");
|
||||
match.string = match.typeOf("string");
|
||||
match.object = match.typeOf("object");
|
||||
match.func = match.typeOf("function");
|
||||
match.regexp = match.typeOf("regexp");
|
||||
match.date = match.typeOf("date");
|
||||
match.symbol = match.typeOf("symbol");
|
||||
|
||||
module.exports = match;
|
21
node_modules/@sinonjs/samsam/lib/samsam.js
generated
vendored
Normal file
21
node_modules/@sinonjs/samsam/lib/samsam.js
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
"use strict";
|
||||
|
||||
var identical = require("./identical");
|
||||
var isArguments = require("./is-arguments");
|
||||
var isElement = require("./is-element");
|
||||
var isNegZero = require("./is-neg-zero");
|
||||
var isSet = require("./is-set");
|
||||
var match = require("./match");
|
||||
var deepEqualCyclic = require("./deep-equal").use(match);
|
||||
var createMatcher = require("./matcher");
|
||||
|
||||
module.exports = {
|
||||
createMatcher: createMatcher,
|
||||
deepEqual: deepEqualCyclic,
|
||||
identical: identical,
|
||||
isArguments: isArguments,
|
||||
isElement: isElement,
|
||||
isNegZero: isNegZero,
|
||||
isSet: isSet,
|
||||
match: match
|
||||
};
|
94
node_modules/@sinonjs/samsam/package.json
generated
vendored
Normal file
94
node_modules/@sinonjs/samsam/package.json
generated
vendored
Normal file
@ -0,0 +1,94 @@
|
||||
{
|
||||
"_from": "@sinonjs/samsam@^3.2.0",
|
||||
"_id": "@sinonjs/samsam@3.3.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-beHeJM/RRAaLLsMJhsCvHK31rIqZuobfPLa/80yGH5hnD8PV1hyh9xJBJNFfNmO7yWqm+zomijHsXpI6iTQJfQ==",
|
||||
"_location": "/@sinonjs/samsam",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@sinonjs/samsam@^3.2.0",
|
||||
"name": "@sinonjs/samsam",
|
||||
"escapedName": "@sinonjs%2fsamsam",
|
||||
"scope": "@sinonjs",
|
||||
"rawSpec": "^3.2.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^3.2.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@sinonjs/formatio",
|
||||
"/sinon"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-3.3.0.tgz",
|
||||
"_shasum": "9557ea89cd39dbc94ffbd093c8085281cac87416",
|
||||
"_spec": "@sinonjs/samsam@^3.2.0",
|
||||
"_where": "/Users/josh.burman/Projects/braid/node_modules/sinon",
|
||||
"author": {
|
||||
"name": "Christian Johansen"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sinonjs/samsam/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@sinonjs/commons": "^1.0.2",
|
||||
"array-from": "^2.1.1",
|
||||
"lodash": "^4.17.11"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Value identification and comparison functions",
|
||||
"devDependencies": {
|
||||
"@sinonjs/referee": "^2.0.0",
|
||||
"benchmark": "2.1.4",
|
||||
"eslint": "^4.19.1",
|
||||
"eslint-config-prettier": "2.9.0",
|
||||
"eslint-config-sinon": "^1.0.3",
|
||||
"eslint-plugin-ie11": "^1.0.0",
|
||||
"eslint-plugin-mocha": "^4.11.0",
|
||||
"eslint-plugin-prettier": "2.6.2",
|
||||
"husky": "^0.14.3",
|
||||
"jsdom": "^13.0.0",
|
||||
"jsdom-global": "^3.0.2",
|
||||
"lint-staged": "^6.1.0",
|
||||
"microtime": "2.1.8",
|
||||
"mkdirp": "^0.5.1",
|
||||
"mocha": "^5.0.0",
|
||||
"mochify": "^5.8.1",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"nyc": "^13.2.0",
|
||||
"prettier": "1.13.7",
|
||||
"rollup": "^0.57.1",
|
||||
"rollup-plugin-commonjs": "^9.1.0"
|
||||
},
|
||||
"files": [
|
||||
"dist/",
|
||||
"docs/",
|
||||
"lib/",
|
||||
"!lib/**/*.test.js"
|
||||
],
|
||||
"homepage": "http://sinonjs.github.io/samsam/",
|
||||
"license": "BSD-3-Clause",
|
||||
"lint-staged": {
|
||||
"*.js": "eslint"
|
||||
},
|
||||
"main": "./lib/samsam",
|
||||
"name": "@sinonjs/samsam",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sinonjs/samsam.git"
|
||||
},
|
||||
"scripts": {
|
||||
"benchmark": "node lib/deep-equal-benchmark.js",
|
||||
"build": "run-s build:dist-folder build:bundle",
|
||||
"build:bundle": "rollup -c > dist/samsam.js",
|
||||
"build:dist-folder": "mkdirp dist",
|
||||
"lint": "eslint .",
|
||||
"prepublishOnly": "npm run build && mkdocs gh-deploy -r upstream || mkdocs gh-deploy -r origin",
|
||||
"test": "mocha ./lib/*.test.js",
|
||||
"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"
|
||||
},
|
||||
"version": "3.3.0"
|
||||
}
|
237
node_modules/@sinonjs/text-encoding/LICENSE.md
generated
vendored
Normal file
237
node_modules/@sinonjs/text-encoding/LICENSE.md
generated
vendored
Normal file
@ -0,0 +1,237 @@
|
||||
The encoding indexes, algorithms, and many comments in the code
|
||||
derive from the Encoding Standard https://encoding.spec.whatwg.org/
|
||||
|
||||
Otherwise, the code of this repository is released under the Unlicense
|
||||
license and is also dual-licensed under an Apache 2.0 license. Both
|
||||
are included below.
|
||||
|
||||
# Unlicense
|
||||
|
||||
This is free and unencumbered software released into the public domain.
|
||||
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
distribute this software, either in source code form or as a compiled
|
||||
binary, for any purpose, commercial or non-commercial, and by any
|
||||
means.
|
||||
|
||||
In jurisdictions that recognize copyright laws, the author or authors
|
||||
of this software dedicate any and all copyright interest in the
|
||||
software to the public domain. We make this dedication for the benefit
|
||||
of the public at large and to the detriment of our heirs and
|
||||
successors. We intend this dedication to be an overt act of
|
||||
relinquishment in perpetuity of all present and future rights to this
|
||||
software under copyright law.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more information, please refer to <http://unlicense.org/>
|
||||
|
||||
# Apache 2.0 License
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
111
node_modules/@sinonjs/text-encoding/README.md
generated
vendored
Normal file
111
node_modules/@sinonjs/text-encoding/README.md
generated
vendored
Normal file
@ -0,0 +1,111 @@
|
||||
text-encoding
|
||||
==============
|
||||
|
||||
This is a polyfill for the [Encoding Living
|
||||
Standard](https://encoding.spec.whatwg.org/) API for the Web, allowing
|
||||
encoding and decoding of textual data to and from Typed Array buffers
|
||||
for binary data in JavaScript.
|
||||
|
||||
By default it adheres to the spec and does not support *encoding* to
|
||||
legacy encodings, only *decoding*. It is also implemented to match the
|
||||
specification's algorithms, rather than for performance. The intended
|
||||
use is within Web pages, so it has no dependency on server frameworks
|
||||
or particular module schemes.
|
||||
|
||||
Basic examples and tests are included.
|
||||
|
||||
### Install ###
|
||||
|
||||
There are a few ways you can get and use the `text-encoding` library.
|
||||
|
||||
### HTML Page Usage ###
|
||||
|
||||
Clone the repo and include the files directly:
|
||||
|
||||
```html
|
||||
<!-- Required for non-UTF encodings -->
|
||||
<script src="encoding-indexes.js"></script>
|
||||
<script src="encoding.js"></script>
|
||||
```
|
||||
|
||||
This is the only use case the developer cares about. If you want those
|
||||
fancy module and/or package manager things that are popular these days
|
||||
you should probably use a different library.
|
||||
|
||||
#### Package Managers ####
|
||||
|
||||
The package is published to **npm** and **bower** as `@sinonjs/text-encoding`.
|
||||
Use through these is not really supported, since they aren't used by
|
||||
the developer of the library. Using `require()` in interesting ways
|
||||
probably breaks. Patches welcome, as long as they don't break the
|
||||
basic use of the files via `<script>`.
|
||||
|
||||
### API Overview ###
|
||||
|
||||
Basic Usage
|
||||
|
||||
```js
|
||||
var uint8array = new TextEncoder().encode(string);
|
||||
var string = new TextDecoder(encoding).decode(uint8array);
|
||||
```
|
||||
|
||||
Streaming Decode
|
||||
|
||||
```js
|
||||
var string = "", decoder = new TextDecoder(encoding), buffer;
|
||||
while (buffer = next_chunk()) {
|
||||
string += decoder.decode(buffer, {stream:true});
|
||||
}
|
||||
string += decoder.decode(); // finish the stream
|
||||
```
|
||||
|
||||
### Encodings ###
|
||||
|
||||
All encodings from the Encoding specification are supported:
|
||||
|
||||
utf-8 ibm866 iso-8859-2 iso-8859-3 iso-8859-4 iso-8859-5 iso-8859-6
|
||||
iso-8859-7 iso-8859-8 iso-8859-8-i iso-8859-10 iso-8859-13 iso-8859-14
|
||||
iso-8859-15 iso-8859-16 koi8-r koi8-u macintosh windows-874
|
||||
windows-1250 windows-1251 windows-1252 windows-1253 windows-1254
|
||||
windows-1255 windows-1256 windows-1257 windows-1258 x-mac-cyrillic
|
||||
gb18030 hz-gb-2312 big5 euc-jp iso-2022-jp shift_jis euc-kr
|
||||
replacement utf-16be utf-16le x-user-defined
|
||||
|
||||
(Some encodings may be supported under other names, e.g. ascii,
|
||||
iso-8859-1, etc. See [Encoding](https://encoding.spec.whatwg.org/) for
|
||||
additional labels for each encoding.)
|
||||
|
||||
Encodings other than **utf-8**, **utf-16le** and **utf-16be** require
|
||||
an additional `encoding-indexes.js` file to be included. It is rather
|
||||
large (596kB uncompressed, 188kB gzipped); portions may be deleted if
|
||||
support for some encodings is not required.
|
||||
|
||||
### Non-Standard Behavior ###
|
||||
|
||||
As required by the specification, only encoding to **utf-8** is
|
||||
supported. If you want to try it out, you can force a non-standard
|
||||
behavior by passing the `NONSTANDARD_allowLegacyEncoding` option to
|
||||
TextEncoder and a label. For example:
|
||||
|
||||
```js
|
||||
var uint8array = new TextEncoder(
|
||||
'windows-1252', { NONSTANDARD_allowLegacyEncoding: true }).encode(text);
|
||||
```
|
||||
|
||||
But note that the above won't work if you're using the polyfill in a
|
||||
browser that natively supports the TextEncoder API natively, since the
|
||||
polyfill won't be used!
|
||||
|
||||
You can force the polyfill to be used by using this before the polyfill:
|
||||
|
||||
```html
|
||||
<script>
|
||||
window.TextEncoder = window.TextDecoder = null;
|
||||
</script>
|
||||
```
|
||||
|
||||
To support the legacy encodings (which may be stateful), the
|
||||
TextEncoder `encode()` method accepts an optional dictionary and
|
||||
`stream` option, e.g. `encoder.encode(string, {stream: true});` This
|
||||
is not needed for standard encoding since the input is always in
|
||||
complete code points.
|
9
node_modules/@sinonjs/text-encoding/index.js
generated
vendored
Normal file
9
node_modules/@sinonjs/text-encoding/index.js
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
// This is free and unencumbered software released into the public domain.
|
||||
// See LICENSE.md for more information.
|
||||
|
||||
var encoding = require("./lib/encoding.js");
|
||||
|
||||
module.exports = {
|
||||
TextEncoder: encoding.TextEncoder,
|
||||
TextDecoder: encoding.TextDecoder,
|
||||
};
|
47
node_modules/@sinonjs/text-encoding/lib/encoding-indexes.js
generated
vendored
Normal file
47
node_modules/@sinonjs/text-encoding/lib/encoding-indexes.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
3313
node_modules/@sinonjs/text-encoding/lib/encoding.js
generated
vendored
Normal file
3313
node_modules/@sinonjs/text-encoding/lib/encoding.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
93
node_modules/@sinonjs/text-encoding/package.json
generated
vendored
Normal file
93
node_modules/@sinonjs/text-encoding/package.json
generated
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
{
|
||||
"_from": "@sinonjs/text-encoding@^0.7.1",
|
||||
"_id": "@sinonjs/text-encoding@0.7.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==",
|
||||
"_location": "/@sinonjs/text-encoding",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@sinonjs/text-encoding@^0.7.1",
|
||||
"name": "@sinonjs/text-encoding",
|
||||
"escapedName": "@sinonjs%2ftext-encoding",
|
||||
"scope": "@sinonjs",
|
||||
"rawSpec": "^0.7.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.7.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/nise"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.1.tgz",
|
||||
"_shasum": "8da5c6530915653f3a1f38fd5f101d8c3f8079c5",
|
||||
"_spec": "@sinonjs/text-encoding@^0.7.1",
|
||||
"_where": "/Users/josh.burman/Projects/braid/node_modules/nise",
|
||||
"author": {
|
||||
"name": "Joshua Bell",
|
||||
"email": "inexorabletash@gmail.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/inexorabletash/text-encoding/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Joshua Bell",
|
||||
"email": "inexorabletash@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Rick Eyre",
|
||||
"email": "rick.eyre@outlook.com"
|
||||
},
|
||||
{
|
||||
"name": "Eugen Podaru",
|
||||
"email": "eugen.podaru@live.com"
|
||||
},
|
||||
{
|
||||
"name": "Filip Dupanović",
|
||||
"email": "filip.dupanovic@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Anne van Kesteren",
|
||||
"email": "annevk@annevk.nl"
|
||||
},
|
||||
{
|
||||
"name": "Author: Francis Avila",
|
||||
"email": "francisga@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Michael J. Ryan",
|
||||
"email": "tracker1@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Pierre Queinnec",
|
||||
"email": "pierre@queinnec.org"
|
||||
},
|
||||
{
|
||||
"name": "Zack Weinberg",
|
||||
"email": "zackw@panix.com"
|
||||
}
|
||||
],
|
||||
"deprecated": false,
|
||||
"description": "Polyfill for the Encoding Living Standard's API.",
|
||||
"files": [
|
||||
"index.js",
|
||||
"lib/encoding.js",
|
||||
"lib/encoding-indexes.js"
|
||||
],
|
||||
"homepage": "https://github.com/inexorabletash/text-encoding",
|
||||
"keywords": [
|
||||
"encoding",
|
||||
"decoding",
|
||||
"living standard"
|
||||
],
|
||||
"license": "(Unlicense OR Apache-2.0)",
|
||||
"main": "index.js",
|
||||
"name": "@sinonjs/text-encoding",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/inexorabletash/text-encoding.git"
|
||||
},
|
||||
"version": "0.7.1"
|
||||
}
|
Reference in New Issue
Block a user