Add sinon package for mocking
This commit is contained in:
parent
43c1bea680
commit
b0af5695e6
191 changed files with 85298 additions and 0 deletions
97
node_modules/@sinonjs/commons/.circleci/config.yml
generated
vendored
Normal file
97
node_modules/@sinonjs/commons/.circleci/config.yml
generated
vendored
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
version: 2.1
|
||||
|
||||
references:
|
||||
x-workdir: &work-dir
|
||||
working_directory: ~/source
|
||||
|
||||
x-save-workspace: &persist-step
|
||||
persist_to_workspace:
|
||||
root: ~/source
|
||||
paths:
|
||||
- .
|
||||
|
||||
x-attach: &attach-step
|
||||
attach_workspace:
|
||||
at: .
|
||||
|
||||
jobs:
|
||||
install-dependencies:
|
||||
<<: *work-dir
|
||||
docker:
|
||||
- image: circleci/node:10
|
||||
environment:
|
||||
HUSKY_SKIP_INSTALL: 1
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- v1-npm-{{ checksum "package-lock.json" }}
|
||||
- run:
|
||||
name: Install dependencies
|
||||
command: |
|
||||
if [ ! -d node_modules ]; then
|
||||
npm ci
|
||||
fi
|
||||
- save_cache:
|
||||
key: v1-npm-{{ checksum "package-lock.json" }}
|
||||
paths:
|
||||
- node_modules
|
||||
- *persist-step
|
||||
|
||||
lint:
|
||||
<<: *work-dir
|
||||
docker:
|
||||
- image: node
|
||||
steps:
|
||||
- *attach-step
|
||||
- run:
|
||||
name: lint
|
||||
command: npm run lint
|
||||
|
||||
node-8:
|
||||
docker:
|
||||
- image: circleci/node:8
|
||||
steps:
|
||||
- *attach-step
|
||||
- run:
|
||||
name: Test
|
||||
command: npm test
|
||||
|
||||
node-10:
|
||||
docker:
|
||||
- image: circleci/node:10
|
||||
steps:
|
||||
- *attach-step
|
||||
- run:
|
||||
name: Test
|
||||
command: npm test
|
||||
|
||||
node-12:
|
||||
docker:
|
||||
- image: circleci/node:12
|
||||
steps:
|
||||
- *attach-step
|
||||
- run:
|
||||
name: Test with coverage
|
||||
command: npm run test-check-coverage
|
||||
- run:
|
||||
name: Upload coverage report
|
||||
command: bash <(curl -s https://codecov.io/bash) -F unit -s coverage/lcov.info
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
commons-circle-ci:
|
||||
jobs:
|
||||
- install-dependencies
|
||||
- lint:
|
||||
requires:
|
||||
- install-dependencies
|
||||
- node-8:
|
||||
requires:
|
||||
- install-dependencies
|
||||
- node-10:
|
||||
requires:
|
||||
- install-dependencies
|
||||
- node-12:
|
||||
requires:
|
||||
- install-dependencies
|
||||
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/*
|
||||
52
node_modules/@sinonjs/commons/.eslintrc.yaml
generated
vendored
Normal file
52
node_modules/@sinonjs/commons/.eslintrc.yaml
generated
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
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
|
||||
}
|
||||
25
node_modules/@sinonjs/commons/CHANGES.md
generated
vendored
Normal file
25
node_modules/@sinonjs/commons/CHANGES.md
generated
vendored
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Changes
|
||||
|
||||
## 1.8.0
|
||||
|
||||
- [`4282205`](https://github.com/sinonjs/commons/commit/4282205343a4dcde2a35ccf2a8c2094300dad369)
|
||||
Emit deprecationg warnings in node, and keep console info in browsers (mshaaban0)
|
||||
|
||||
_Released on 2020-05-20._
|
||||
|
||||
## 1.7.2
|
||||
|
||||
- [`76ad9c1`](https://github.com/sinonjs/commons/commit/76ad9c16bad29f72420ed55bdf45b65d076108c8)
|
||||
Fix generators causing exceptions in function-name (Sebastian Mayr)
|
||||
|
||||
_Released on 2020-04-08._
|
||||
|
||||
## 1.7.1
|
||||
|
||||
- [`0486d25`](https://github.com/sinonjs/commons/commit/0486d250ecec9b5f9aa2210357767e413f4162d3)
|
||||
Upgrade eslint-config-sinon, add eslint-plugin-jsdoc (Morgan Roderick)
|
||||
>
|
||||
> This adds linting of jsdoc
|
||||
>
|
||||
|
||||
_Released on 2020-02-19._
|
||||
84
node_modules/@sinonjs/commons/CODE_OF_CONDUCT.md
generated
vendored
Normal file
84
node_modules/@sinonjs/commons/CODE_OF_CONDUCT.md
generated
vendored
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the overall community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or
|
||||
advances of any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or email
|
||||
address, without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement by e-mailing any or all of [Morgan Roderick](mailto:morgan@roderick.dk), [Max Antoni](mailto:mail@maxantoni.de), [Carl-Erik Kopseng](mailto:carlerik@gmail.com). All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series of actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
||||
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
||||
|
||||
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
||||
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.
|
||||
16
node_modules/@sinonjs/commons/README.md
generated
vendored
Normal file
16
node_modules/@sinonjs/commons/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# commons
|
||||
|
||||
[](https://circleci.com/gh/sinonjs/commons)
|
||||
[](https://codecov.io/gh/sinonjs/commons)
|
||||
<a href="CODE_OF_CONDUCT.md"><img src="https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg" alt="Contributor Covenant" /></a>
|
||||
|
||||
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)
|
||||
81
node_modules/@sinonjs/commons/eslint-local-rules.js
generated
vendored
Normal file
81
node_modules/@sinonjs/commons/eslint-local-rules.js
generated
vendored
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
/* eslint-disable jsdoc/require-jsdoc, jsdoc/no-undefined-types */
|
||||
"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
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
57
node_modules/@sinonjs/commons/lib/called-in-order.js
generated
vendored
Normal file
57
node_modules/@sinonjs/commons/lib/called-in-order.js
generated
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
"use strict";
|
||||
|
||||
var every = require("./prototypes/array").every;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
function hasCallsLeft(callMap, spy) {
|
||||
if (callMap[spy.id] === undefined) {
|
||||
callMap[spy.id] = 0;
|
||||
}
|
||||
|
||||
return callMap[spy.id] < spy.callCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* A Sinon proxy object (fake, spy, stub)
|
||||
*
|
||||
* @typedef {object} SinonProxy
|
||||
* @property {Function} calledBefore - A method that determines if this proxy was called before another one
|
||||
* @property {string} id - Some id
|
||||
* @property {number} callCount - Number of times this proxy has been called
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns true when the spies have been called in the order they were supplied in
|
||||
*
|
||||
* @param {SinonProxy[] | SinonProxy} spies An array of proxies, or several proxies as arguments
|
||||
* @returns {boolean} true when spies are called in order, false otherwise
|
||||
*/
|
||||
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));
|
||||
}
|
||||
|
||||
module.exports = calledInOrder;
|
||||
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
|
||||
)
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
27
node_modules/@sinonjs/commons/lib/class-name.js
generated
vendored
Normal file
27
node_modules/@sinonjs/commons/lib/class-name.js
generated
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
"use strict";
|
||||
|
||||
var functionName = require("./function-name");
|
||||
|
||||
/**
|
||||
* Returns a display name for a value from a constructor
|
||||
*
|
||||
* @param {object} value A value to examine
|
||||
* @returns {(string|null)} A string or null
|
||||
*/
|
||||
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
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = className;
|
||||
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);
|
||||
});
|
||||
});
|
||||
58
node_modules/@sinonjs/commons/lib/deprecated.js
generated
vendored
Normal file
58
node_modules/@sinonjs/commons/lib/deprecated.js
generated
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/* eslint-disable no-console */
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Returns a function that will invoke the supplied function and print a
|
||||
* deprecation warning to the console each time it is called.
|
||||
*
|
||||
* @param {Function} func
|
||||
* @param {string} msg
|
||||
* @returns {Function}
|
||||
*/
|
||||
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;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns a string which can be supplied to `wrap()` to notify the user that a
|
||||
* particular part of the sinon API has been deprecated.
|
||||
*
|
||||
* @param {string} packageName
|
||||
* @param {string} funcName
|
||||
* @returns {string}
|
||||
*/
|
||||
exports.defaultMsg = function(packageName, funcName) {
|
||||
return (
|
||||
packageName +
|
||||
"." +
|
||||
funcName +
|
||||
" is deprecated and will be removed from the public API in a future version of " +
|
||||
packageName +
|
||||
"."
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Prints a warning on the console, when it exists
|
||||
*
|
||||
* @param {string} msg
|
||||
* @returns {undefined}
|
||||
*/
|
||||
exports.printWarning = function(msg) {
|
||||
/* istanbul ignore next */
|
||||
if (typeof process === "object" && process.emitWarning) {
|
||||
// Emit Warnings in Node
|
||||
process.emitWarning(msg);
|
||||
} else if (console.info) {
|
||||
console.info(msg);
|
||||
} else {
|
||||
console.log(msg);
|
||||
}
|
||||
};
|
||||
100
node_modules/@sinonjs/commons/lib/deprecated.test.js
generated
vendored
Normal file
100
node_modules/@sinonjs/commons/lib/deprecated.test.js
generated
vendored
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
/* 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() {
|
||||
beforeEach(function() {
|
||||
sinon.replace(process, "emitWarning", sinon.fake());
|
||||
});
|
||||
|
||||
afterEach(sinon.restore);
|
||||
|
||||
describe("when `process.emitWarning` is defined", function() {
|
||||
it("should call process.emitWarning with a msg", function() {
|
||||
deprecated.printWarning(msg);
|
||||
assert.calledOnceWith(process.emitWarning, msg);
|
||||
});
|
||||
});
|
||||
|
||||
describe("when `process.emitWarning` is undefined", function() {
|
||||
beforeEach(function() {
|
||||
sinon.replace(console, "info", sinon.fake());
|
||||
sinon.replace(console, "log", sinon.fake());
|
||||
process.emitWarning = undefined;
|
||||
});
|
||||
|
||||
afterEach(sinon.restore);
|
||||
|
||||
describe("when `console.info` is defined", function() {
|
||||
it("should 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, {});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
27
node_modules/@sinonjs/commons/lib/every.js
generated
vendored
Normal file
27
node_modules/@sinonjs/commons/lib/every.js
generated
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
"use strict";
|
||||
|
||||
/**
|
||||
* Returns true when fn returns true for all members of obj.
|
||||
* This is an every implementation that works for all iterables
|
||||
*
|
||||
* @param {object} obj
|
||||
* @param {Function} fn
|
||||
* @returns {boolean}
|
||||
*/
|
||||
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);
|
||||
});
|
||||
});
|
||||
29
node_modules/@sinonjs/commons/lib/function-name.js
generated
vendored
Normal file
29
node_modules/@sinonjs/commons/lib/function-name.js
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
"use strict";
|
||||
|
||||
/**
|
||||
* Returns a display name for a function
|
||||
*
|
||||
* @param {Function} func
|
||||
* @returns {string}
|
||||
*/
|
||||
module.exports = function functionName(func) {
|
||||
if (!func) {
|
||||
return "";
|
||||
}
|
||||
|
||||
try {
|
||||
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]
|
||||
);
|
||||
} catch (e) {
|
||||
// Stringify may fail and we might get an exception, as a last-last
|
||||
// resort fall back to empty string.
|
||||
return "";
|
||||
}
|
||||
};
|
||||
76
node_modules/@sinonjs/commons/lib/function-name.test.js
generated
vendored
Normal file
76
node_modules/@sinonjs/commons/lib/function-name.test.js
generated
vendored
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
"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);
|
||||
});
|
||||
});
|
||||
|
||||
it("should not fail when toString is undefined", function() {
|
||||
refute.exception(function() {
|
||||
functionName(Object.create(null));
|
||||
});
|
||||
});
|
||||
|
||||
it("should not fail when toString throws", function() {
|
||||
refute.exception(function() {
|
||||
var fn;
|
||||
try {
|
||||
// eslint-disable-next-line no-eval
|
||||
fn = eval("(function*() {})")().constructor;
|
||||
} catch (e) {
|
||||
// env doesn't support generators
|
||||
return;
|
||||
}
|
||||
|
||||
functionName(fn);
|
||||
});
|
||||
});
|
||||
});
|
||||
22
node_modules/@sinonjs/commons/lib/global.js
generated
vendored
Normal file
22
node_modules/@sinonjs/commons/lib/global.js
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
"use strict";
|
||||
|
||||
/**
|
||||
* A reference to the global object
|
||||
*
|
||||
* @type {object} globalObject
|
||||
*/
|
||||
var globalObject;
|
||||
|
||||
/* istanbul ignore else */
|
||||
if (typeof global !== "undefined") {
|
||||
// Node
|
||||
globalObject = global;
|
||||
} else if (typeof window !== "undefined") {
|
||||
// Browser
|
||||
globalObject = window;
|
||||
} else {
|
||||
// WebWorker
|
||||
globalObject = self;
|
||||
}
|
||||
|
||||
module.exports = globalObject;
|
||||
16
node_modules/@sinonjs/commons/lib/global.test.js
generated
vendored
Normal file
16
node_modules/@sinonjs/commons/lib/global.test.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
"use strict";
|
||||
|
||||
var assert = require("@sinonjs/referee-sinon").assert;
|
||||
var globalObject = require("./global");
|
||||
|
||||
describe("global", function() {
|
||||
before(function() {
|
||||
if (typeof global === "undefined") {
|
||||
this.skip();
|
||||
}
|
||||
});
|
||||
|
||||
it("is same as global", function() {
|
||||
assert.same(globalObject, global);
|
||||
});
|
||||
});
|
||||
14
node_modules/@sinonjs/commons/lib/index.js
generated
vendored
Normal file
14
node_modules/@sinonjs/commons/lib/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
global: require("./global"),
|
||||
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]);
|
||||
});
|
||||
});
|
||||
});
|
||||
36
node_modules/@sinonjs/commons/lib/order-by-first-call.js
generated
vendored
Normal file
36
node_modules/@sinonjs/commons/lib/order-by-first-call.js
generated
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
"use strict";
|
||||
|
||||
var sort = require("./prototypes/array").sort;
|
||||
var slice = require("./prototypes/array").slice;
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* A Sinon proxy object (fake, spy, stub)
|
||||
*
|
||||
* @typedef {object} SinonProxy
|
||||
* @property {Function} getCall - A method that can return the first call
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sorts an array of SinonProxy instances (fake, spy, stub) by their first call
|
||||
*
|
||||
* @param {SinonProxy[] | SinonProxy} spies
|
||||
* @returns {SinonProxy[]}
|
||||
*/
|
||||
function orderByFirstCall(spies) {
|
||||
return sort(slice(spies), comparator);
|
||||
}
|
||||
|
||||
module.exports = orderByFirstCall;
|
||||
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);
|
||||
10
node_modules/@sinonjs/commons/lib/prototypes/index.js
generated
vendored
Normal file
10
node_modules/@sinonjs/commons/lib/prototypes/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
array: require("./array"),
|
||||
function: require("./function"),
|
||||
map: require("./map"),
|
||||
object: require("./object"),
|
||||
set: require("./set"),
|
||||
string: require("./string")
|
||||
};
|
||||
51
node_modules/@sinonjs/commons/lib/prototypes/index.test.js
generated
vendored
Normal file
51
node_modules/@sinonjs/commons/lib/prototypes/index.test.js
generated
vendored
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
"use strict";
|
||||
|
||||
var assert = require("@sinonjs/referee-sinon").assert;
|
||||
|
||||
var arrayProto = require("./index").array;
|
||||
var functionProto = require("./index").function;
|
||||
var mapProto = require("./index").map;
|
||||
var objectProto = require("./index").object;
|
||||
var setProto = require("./index").set;
|
||||
var stringProto = require("./index").string;
|
||||
|
||||
describe("prototypes", function() {
|
||||
describe(".array", function() {
|
||||
verifyProperties(arrayProto, Array);
|
||||
});
|
||||
describe(".function", function() {
|
||||
verifyProperties(functionProto, Function);
|
||||
});
|
||||
describe(".map", function() {
|
||||
verifyProperties(mapProto, Map);
|
||||
});
|
||||
describe(".object", function() {
|
||||
verifyProperties(objectProto, Object);
|
||||
});
|
||||
describe(".set", function() {
|
||||
verifyProperties(setProto, Set);
|
||||
});
|
||||
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/map.js
generated
vendored
Normal file
5
node_modules/@sinonjs/commons/lib/prototypes/map.js
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
var copyPrototype = require("./copy-prototype");
|
||||
|
||||
module.exports = copyPrototype(Map.prototype);
|
||||
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/set.js
generated
vendored
Normal file
5
node_modules/@sinonjs/commons/lib/prototypes/set.js
generated
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
var copyPrototype = require("./copy-prototype");
|
||||
|
||||
module.exports = copyPrototype(Set.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);
|
||||
13
node_modules/@sinonjs/commons/lib/type-of.js
generated
vendored
Normal file
13
node_modules/@sinonjs/commons/lib/type-of.js
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
"use strict";
|
||||
|
||||
var type = require("type-detect");
|
||||
|
||||
/**
|
||||
* Returns the lower-case result of running type from type-detect on the value
|
||||
*
|
||||
* @param {*} value
|
||||
* @returns {string}
|
||||
*/
|
||||
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");
|
||||
});
|
||||
});
|
||||
17
node_modules/@sinonjs/commons/lib/value-to-string.js
generated
vendored
Normal file
17
node_modules/@sinonjs/commons/lib/value-to-string.js
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
"use strict";
|
||||
|
||||
/**
|
||||
* Returns a string representation of the value
|
||||
*
|
||||
* @param {*} value
|
||||
* @returns {string}
|
||||
*/
|
||||
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");
|
||||
});
|
||||
});
|
||||
83
node_modules/@sinonjs/commons/package.json
generated
vendored
Normal file
83
node_modules/@sinonjs/commons/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
{
|
||||
"_from": "@sinonjs/commons@^1.7.2",
|
||||
"_id": "@sinonjs/commons@1.8.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-wEj54PfsZ5jGSwMX68G8ZXFawcSglQSXqCftWX3ec8MDUzQdHgcKvw97awHbY0efQEL5iKUOAmmVtoYgmrSG4Q==",
|
||||
"_location": "/@sinonjs/commons",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@sinonjs/commons@^1.7.2",
|
||||
"name": "@sinonjs/commons",
|
||||
"escapedName": "@sinonjs%2fcommons",
|
||||
"scope": "@sinonjs",
|
||||
"rawSpec": "^1.7.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.7.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@sinonjs/fake-timers",
|
||||
"/@sinonjs/formatio",
|
||||
"/@sinonjs/samsam",
|
||||
"/nise",
|
||||
"/sinon"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.0.tgz",
|
||||
"_shasum": "c8d68821a854c555bba172f3b06959a0039b236d",
|
||||
"_spec": "@sinonjs/commons@^1.7.2",
|
||||
"_where": "/Users/sam/code/codeql-action/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": "7.0.2",
|
||||
"@studio/changes": "^2.0.0",
|
||||
"eslint": "^6.1.0",
|
||||
"eslint-config-prettier": "^6.3.0",
|
||||
"eslint-config-sinon": "^4.0.0",
|
||||
"eslint-plugin-ie11": "^1.0.0",
|
||||
"eslint-plugin-jsdoc": "^22.1.0",
|
||||
"eslint-plugin-local-rules": "^0.1.0",
|
||||
"eslint-plugin-mocha": "^6.1.1",
|
||||
"eslint-plugin-prettier": "^3.0.0",
|
||||
"husky": "4.2.3",
|
||||
"jsverify": "0.8.4",
|
||||
"knuth-shuffle": "^1.0.8",
|
||||
"lint-staged": "10.1.1",
|
||||
"mocha": "7.1.0",
|
||||
"nyc": "15.0.0",
|
||||
"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 .",
|
||||
"postversion": "git push --follow-tags && npm publish",
|
||||
"precommit": "lint-staged",
|
||||
"preversion": "npm run test-check-coverage",
|
||||
"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": "changes --commits --footer"
|
||||
},
|
||||
"version": "1.8.0"
|
||||
}
|
||||
347
node_modules/@sinonjs/fake-timers/CHANGELOG.md
generated
vendored
Normal file
347
node_modules/@sinonjs/fake-timers/CHANGELOG.md
generated
vendored
Normal file
|
|
@ -0,0 +1,347 @@
|
|||
|
||||
6.0.1 / 2020-03-24
|
||||
==================
|
||||
|
||||
* Support util.promisify in Node (#223)
|
||||
|
||||
6.0.0 / 2020-02-04
|
||||
==================
|
||||
|
||||
* Rename project to `@sinonjs/fake-timers`
|
||||
|
||||
5.1.2 / 2019-12-19
|
||||
==================
|
||||
|
||||
* Use global from `@sinonjs/commons`
|
||||
* Fix setSystemTime affects hrtime if its called multiple times.
|
||||
* Test coverage: use nyc
|
||||
|
||||
5.1.1 / 2019-10-21
|
||||
==================
|
||||
|
||||
* Fix global ReferenceError (#273)
|
||||
|
||||
5.1.0 / 2019-10-14
|
||||
==================
|
||||
|
||||
* Upgrade lolex with async versions of most calls
|
||||
|
||||
5.0.1 / 2019-10-10
|
||||
==================
|
||||
|
||||
* Upgrade eslint, add prettier
|
||||
* Use `--no-detect-globals` to bundle and test lolex (#270)
|
||||
|
||||
5.0.0 / 2019-10-07
|
||||
==================
|
||||
|
||||
* Avoid installing setImmediate in unsupported environments
|
||||
* fix #246: non-constructor Date() should return a string
|
||||
|
||||
4.2.0 / 2019-08-04
|
||||
==================
|
||||
|
||||
* Fix support for replacing the JSDOM performance field
|
||||
|
||||
4.1.0 / 2019-06-04
|
||||
==================
|
||||
|
||||
* Fix crash on Bash version 3 (macOS)
|
||||
* Support hrtime.bigint()
|
||||
* fix: count microtasks in countTimers
|
||||
* Return empty arrays for performance.getEntries, other relevant methods
|
||||
|
||||
4.0.1 / 2019-04-17
|
||||
==================
|
||||
|
||||
* Remove sinon: added by mistake
|
||||
|
||||
4.0.0 / 2019-04-17
|
||||
==================
|
||||
|
||||
* Drop support for IE9 and IE10: link to supported browsers in README
|
||||
* No more ExperimentalWarnings in Node environment for queueMicrotask() if it's not used in user's code
|
||||
|
||||
3.1.0 / 2019-02-11
|
||||
==================
|
||||
|
||||
* default timeout set to 50ms
|
||||
* first implementation of requestIdleCallback and cancelIdleCallback
|
||||
* fixed accidentally performance.now() -> x.now() replacement
|
||||
* added queueMicrotask
|
||||
|
||||
3.0.0 / 2018-10-08
|
||||
==================
|
||||
|
||||
* Add countTimers method
|
||||
* Disallow negative ticks (breaking API change!)
|
||||
* Avoid exposing hrNow
|
||||
* Fix #207 - round-off errors in `hrtime`
|
||||
* Truncate sub-nanosecond values for `hrtime`
|
||||
* Truncate sub-millisceond values for `Date.now()`
|
||||
|
||||
v2.7.5 / 2018-09-19
|
||||
==================
|
||||
|
||||
* fix: handle floating point in hrtime (#210)
|
||||
* fix: reset high resolution timer on clock.reset (#209)
|
||||
* Add an error when creating a clock with no Date object (#205)
|
||||
|
||||
v2.7.4 / 2018-09-05
|
||||
==================
|
||||
|
||||
* performance.mark related fixes for failing Safari, IE 10 and IE 11 tests
|
||||
|
||||
v2.7.3 / 2018-09-05
|
||||
==================
|
||||
|
||||
* Fix for #200: TypeError on performance.mark
|
||||
|
||||
v2.7.2 / 2018-09-04
|
||||
==================
|
||||
|
||||
* fix(setInterval): parse `timeout` arg to integer (#202)
|
||||
* Upgrade insecure dependencies with npm audit fix
|
||||
|
||||
v2.7.1 / 2018-07-06
|
||||
==================
|
||||
* Fix performance replacement on iOS 9.3
|
||||
|
||||
v2.7.0 / 2018-05-25
|
||||
==================
|
||||
|
||||
* reset clock to start
|
||||
* check Performance exists before touching it
|
||||
|
||||
v2.6.0 / 2018-05-16
|
||||
==================
|
||||
|
||||
* Fix `reset` and document it publicly Clear microtick jobs and set now to 0 in reset (#179)
|
||||
* Access Date on `_global` (#178)
|
||||
|
||||
v2.5.0 / 2018-05-13
|
||||
==================
|
||||
|
||||
* feat: respect loopLimit in runMicrotasks (#172)
|
||||
* assign performance as a property, not as a function
|
||||
|
||||
v2.4.2 / 2018-05-11
|
||||
===================
|
||||
* Upgrade Mochify to v5.6 (#162) fixed #170
|
||||
* Access `Performance` via `_global` (#168)
|
||||
|
||||
v2.4.1 / 2018-05-08
|
||||
==================
|
||||
|
||||
* fix: handle negative infinity timeout (#165)
|
||||
|
||||
v2.4.0 / 2018-05-08
|
||||
==================
|
||||
|
||||
* Add `withGlobal` export
|
||||
* expose runMicrotasks
|
||||
* Fix that performance.mark is undefined after timer install
|
||||
|
||||
v2.3.2 / 2018-01-29
|
||||
==================
|
||||
|
||||
* Add files section to package.json to avoid unnecessary package bloat #154
|
||||
* Add missing functions in default `toFake` #150
|
||||
|
||||
v2.3.1 / 2017-11-22
|
||||
==================
|
||||
|
||||
* bugfix for a setTimeout() or setSystemTime() within a nextTick() call. (#145)
|
||||
|
||||
v2.3.0 / 2017-11-08
|
||||
==================
|
||||
|
||||
* Stops leak of (request|cancel)AnimationFrame into global scope. (#143)
|
||||
* return timers on uninstall
|
||||
|
||||
v2.2.0 / 2017-11-07
|
||||
==================
|
||||
|
||||
* Add support for requestAnimationFrame
|
||||
* fix negative timeout bug
|
||||
|
||||
v2.1.3 / 2017-10-03
|
||||
==================
|
||||
|
||||
* add module entry point (#133)
|
||||
|
||||
v2.1.2 / 2017-07-25
|
||||
==================
|
||||
|
||||
* - does not fake process.nextTick by default - added .idea folder to .gitignore - fixed documentation - added clock teardowns in tests
|
||||
* overflowing the timer correctly (issue #67)
|
||||
|
||||
v2.1.1 / 2017-07-19
|
||||
==================
|
||||
|
||||
* support passing parameters in nextTick (fixes #122)
|
||||
|
||||
v2.1.0 / 2017-07-18
|
||||
==================
|
||||
|
||||
* Throw error on incorrect install use (#112)
|
||||
* Add support for process.nextTick
|
||||
* lolex can now attach itself to the system timers and automatically ad… (#102)
|
||||
* update hrtime when an interval ticks
|
||||
|
||||
v2.0.0 / 2017-07-13
|
||||
==================
|
||||
|
||||
* New install() signature
|
||||
* Add support for performance.now (#106)
|
||||
* Fix issue with tick(): setSystemClock then throw
|
||||
* Update old dependencies
|
||||
* Added support to automatically increment time (#85)
|
||||
* Changed internal uninstall method signature
|
||||
|
||||
v1.6.0 / 2017-02-25
|
||||
===================
|
||||
|
||||
* Use common Sinon.JS eslint config
|
||||
* Allow install to be called with date object
|
||||
* Remove wrapper function
|
||||
* Fixed typo in clock.runAll error
|
||||
|
||||
v1.5.2 / 2016-11-10
|
||||
===================
|
||||
|
||||
* Upgrade mocha to latest
|
||||
* Only overwrite globals when running in IE
|
||||
|
||||
1.5.1 / 2016-07-26
|
||||
==================
|
||||
|
||||
* Fix setInterval() behavior with string times
|
||||
* Incorporate test from PR #65
|
||||
* Fix issue #59: context object required 'process'
|
||||
* fixed a case where runAll was called and there are no timers (#70)
|
||||
* Correct the clear{Interval|Timeout|Immediate} error message when calling `set*` for a different type of timer.
|
||||
* Lots of minor changes to tooling and the build process
|
||||
|
||||
v1.5.0 / 2016-05-18
|
||||
===================
|
||||
|
||||
* 1.5.0
|
||||
* Check for existence of `process` before using it
|
||||
* Run to last existing timer
|
||||
* Add runAll method to run timers until empty
|
||||
* Turn off Sauce Labs tests for pull requests
|
||||
* Add tests demonstrating that a fake Date could be created with one argument as a String since this string is in a format recognized by the Date.parse() method.
|
||||
* Run test-cloud on Travis
|
||||
* Add process.hrtime()
|
||||
* Add bithound badge to Readme.md
|
||||
* Make Travis also run tests in node 4.2
|
||||
* Update jslint, referee, sinon, browserify, mocha, mochify
|
||||
* Rename src/lolex.js to src/lolex-src.js to avoid bithound ignoring it
|
||||
* Add .bithoundrc
|
||||
|
||||
v1.4.0 / 2015-12-11
|
||||
===================
|
||||
|
||||
* 1.4.0
|
||||
* Remove BASH syntax in lint script
|
||||
* correct test descriptions to match the tests
|
||||
* correct parseTime() error message so it matches behavior
|
||||
* don't run test-cloud as part of npm test
|
||||
* doc: full API reference
|
||||
* doc: update 'Running tests' section
|
||||
* doc: update 'Faking the native timers' section
|
||||
* doc: remove requestAnimationFrame
|
||||
* Implement clock.next()
|
||||
* Run lint in CI
|
||||
* Fix jslint errors
|
||||
|
||||
v1.3.2 / 2015-09-22
|
||||
===================
|
||||
|
||||
* 1.3.2
|
||||
* Fix for breaking shimmed setImmediate
|
||||
|
||||
v1.3.1 / 2015-08-20
|
||||
===================
|
||||
|
||||
* Remove error whos reason is no longer accurate
|
||||
|
||||
v1.3.0 / 2015-08-19
|
||||
===================
|
||||
|
||||
* 1.3.0
|
||||
* Throw exception on wrong use of clearXYZ()
|
||||
* Fix for Sinon.JS issue #808 :add setSystemTime() function
|
||||
* Fix for Sinon.JS issue #766: clearTimeout() no longer clears Immediate/Interval and vice versa
|
||||
* Update Readme.md to point to LICENSE file
|
||||
* Fix error in readme about running tests
|
||||
* Fix for warning about SPDX license format on npm install
|
||||
|
||||
v1.2.2 / 2015-07-22
|
||||
===================
|
||||
|
||||
* 1.2.2
|
||||
* Fixing lint mistake
|
||||
* Update travis to use node@0.12
|
||||
* Fix complaint about missing fake setImmediate
|
||||
* Use license in package.json
|
||||
|
||||
v1.2.1 / 2015-01-06
|
||||
===================
|
||||
|
||||
* New build
|
||||
* Dodge JSLint...
|
||||
* Up version
|
||||
* Proper fix for writable globals in IE
|
||||
* Make timers writable in old IEs
|
||||
|
||||
v1.2.0 / 2014-12-12
|
||||
===================
|
||||
|
||||
* 1.2.0
|
||||
* Fix Sinon.JS issue 624
|
||||
* Lint the test files also
|
||||
* Add .jslintrc
|
||||
* Delay setImmediate if it is during tick call
|
||||
* Add test case
|
||||
* Test behaviour of hasOwnProperty beforehand
|
||||
* Compare now() with delta
|
||||
* Use undefined for defined predicate
|
||||
* Put setImmediate in toFake list
|
||||
* Capture clock instance for uninstall
|
||||
* Restore commented out tests
|
||||
* Add JSLint verification to test
|
||||
* Configure Travis to run tests in node 0.10.x
|
||||
* Add .editorconfig
|
||||
* Fail when faking Date but not setTimeout/setInterval
|
||||
|
||||
v1.1.10 / 2014-11-14
|
||||
====================
|
||||
|
||||
* 1.1.0 Fixes setImmediate problems
|
||||
* Rely on `timer` initialization to null
|
||||
* Timer assembly occurs at addTimer callsites
|
||||
* Sort immediate timers before non-immediate
|
||||
* Add createdAt to timers
|
||||
* Sort timers by multiple criteria, not just callAt
|
||||
* Refactor firstTimerInRange
|
||||
* Rename `timeouts` property to `timers`
|
||||
* addTimer is options-driven
|
||||
|
||||
v1.0.0 / 2014-11-12
|
||||
===================
|
||||
|
||||
* Add built file for browsers
|
||||
* Fix URL
|
||||
* Don't run tests that require global.__proto__ on IE 9 and IE 10
|
||||
* Add "bundle" script to create standalone UMD bundle with browserify
|
||||
* Float with new test framework versions
|
||||
* Remove redundant module prefix
|
||||
* Let Browserify set "global" for us
|
||||
* Change test framework from Buster to Mocha and Mochify
|
||||
* Make timer functions independent on `this`
|
||||
* Change APIs according to Readme
|
||||
* Change clock-creating interface
|
||||
* Change Github paths
|
||||
* Basically working extraction from Sinon.JS
|
||||
11
node_modules/@sinonjs/fake-timers/LICENSE
generated
vendored
Normal file
11
node_modules/@sinonjs/fake-timers/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
Copyright (c) 2010-2014, Christian Johansen, christian@cjohansen.no. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. 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.
|
||||
|
||||
3. 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.
|
||||
341
node_modules/@sinonjs/fake-timers/README.md
generated
vendored
Normal file
341
node_modules/@sinonjs/fake-timers/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,341 @@
|
|||
# `@sinonjs/fake-timers`
|
||||
|
||||
[](https://circleci.com/gh/sinonjs/fake-timers)
|
||||
[](https://codecov.io/gh/sinonjs/fake-timers)
|
||||
<a href="CODE_OF_CONDUCT.md"><img src="https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg" alt="Contributor Covenant" /></a>
|
||||
|
||||
JavaScript implementation of the timer APIs; `setTimeout`, `clearTimeout`, `setImmediate`, `clearImmediate`, `setInterval`, `clearInterval`, `requestAnimationFrame`, `cancelAnimationFrame`, `requestIdleCallback`, and `cancelIdleCallback`, along with a clock instance that controls the flow of time. FakeTimers also provides a `Date` implementation that gets its time from the clock.
|
||||
|
||||
In addition in browser environment `@sinonjs/fake-timers` provides a `performance` implementation that gets its time from the clock. In Node environments FakeTimers provides a `nextTick` implementation that is synchronized with the clock - and a `process.hrtime` shim that works with the clock.
|
||||
|
||||
`@sinonjs/fake-timers` can be used to simulate passing time in automated tests and other
|
||||
situations where you want the scheduling semantics, but don't want to actually
|
||||
wait.
|
||||
|
||||
`@sinonjs/fake-timers` is extracted from [Sinon.JS](https://github.com/sinonjs/sinon.js) and targets the [same runtimes](https://sinonjs.org/releases/latest/#supported-runtimes).
|
||||
|
||||
## Installation
|
||||
|
||||
`@sinonjs/fake-timers` can be used in both Node and browser environments. Installation is as easy as
|
||||
|
||||
```sh
|
||||
npm install @sinonjs/fake-timers
|
||||
```
|
||||
|
||||
If you want to use `@sinonjs/fake-timers` in a browser you can use [the pre-built
|
||||
version](https://github.com/sinonjs/fake-timers/blob/master/fake-timers.js) available in the repo
|
||||
and the npm package. Using npm you only need to reference `./node_modules/@sinonjs/fake-timers/fake-timers.js` in your `<script>` tags.
|
||||
|
||||
You are always free to [build it yourself](https://github.com/sinonjs/fake-timers/blob/53ea4d9b9e5bcff53cc7c9755dc9aa340368cf1c/package.json#L22), of course.
|
||||
|
||||
## Usage
|
||||
|
||||
To use `@sinonjs/fake-timers`, create a new clock, schedule events on it using the timer
|
||||
functions and pass time using the `tick` method.
|
||||
|
||||
```js
|
||||
// In the browser distribution, a global `FakeTimers` is already available
|
||||
var FakeTimers = require("@sinonjs/fake-timers");
|
||||
var clock = FakeTimers.createClock();
|
||||
|
||||
clock.setTimeout(function () {
|
||||
console.log("The poblano is a mild chili pepper originating in the state of Puebla, Mexico.");
|
||||
}, 15);
|
||||
|
||||
// ...
|
||||
|
||||
clock.tick(15);
|
||||
```
|
||||
|
||||
Upon executing the last line, an interesting fact about the
|
||||
[Poblano](http://en.wikipedia.org/wiki/Poblano) will be printed synchronously to
|
||||
the screen. If you want to simulate asynchronous behavior, you have to use your
|
||||
imagination when calling the various functions.
|
||||
|
||||
The `next`, `runAll`, `runToFrame`, and `runToLast` methods are available to advance the clock. See the
|
||||
API Reference for more details.
|
||||
|
||||
### Faking the native timers
|
||||
|
||||
When using `@sinonjs/fake-timers` to test timers, you will most likely want to replace the native
|
||||
timers such that calling `setTimeout` actually schedules a callback with your
|
||||
clock instance, not the browser's internals.
|
||||
|
||||
Calling `install` with no arguments achieves this. You can call `uninstall`
|
||||
later to restore things as they were again.
|
||||
|
||||
```js
|
||||
// In the browser distribution, a global `FakeTimers` is already available
|
||||
var FakeTimers = require("@sinonjs/fake-timers");
|
||||
|
||||
var clock = FakeTimers.install();
|
||||
// Equivalent to
|
||||
// var clock = FakeTimers.install(typeof global !== "undefined" ? global : window);
|
||||
|
||||
setTimeout(fn, 15); // Schedules with clock.setTimeout
|
||||
|
||||
clock.uninstall();
|
||||
// setTimeout is restored to the native implementation
|
||||
```
|
||||
|
||||
To hijack timers in another context pass it to the `install` method.
|
||||
|
||||
```js
|
||||
var FakeTimers = require("@sinonjs/fake-timers");
|
||||
var context = {
|
||||
setTimeout: setTimeout // By default context.setTimeout uses the global setTimeout
|
||||
}
|
||||
var clock = FakeTimers.install({target: context});
|
||||
|
||||
context.setTimeout(fn, 15); // Schedules with clock.setTimeout
|
||||
|
||||
clock.uninstall();
|
||||
// context.setTimeout is restored to the original implementation
|
||||
```
|
||||
|
||||
Usually you want to install the timers onto the global object, so call `install`
|
||||
without arguments.
|
||||
|
||||
#### Automatically incrementing mocked time
|
||||
Since version 2.0 FakeTimers supports the possibility to attach the faked timers
|
||||
to any change in the real system time. This basically means you no longer need
|
||||
to `tick()` the clock in a situation where you won't know **when** to call `tick()`.
|
||||
|
||||
Please note that this is achieved using the original setImmediate() API at a certain
|
||||
configurable interval `config.advanceTimeDelta` (default: 20ms). Meaning time would
|
||||
be incremented every 20ms, not in real time.
|
||||
|
||||
An example would be:
|
||||
|
||||
```js
|
||||
var FakeTimers = require("@sinonjs/fake-timers");
|
||||
var clock = FakeTimers.install({shouldAdvanceTime: true, advanceTimeDelta: 40});
|
||||
|
||||
setTimeout(() => {
|
||||
console.log('this just timed out'); //executed after 40ms
|
||||
}, 30);
|
||||
|
||||
setImmediate(() => {
|
||||
console.log('not so immediate'); //executed after 40ms
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
console.log('this timed out after'); //executed after 80ms
|
||||
clock.uninstall();
|
||||
}, 50);
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
### `var clock = FakeTimers.createClock([now[, loopLimit]])`
|
||||
|
||||
Creates a clock. The default
|
||||
[epoch](https://en.wikipedia.org/wiki/Epoch_%28reference_date%29) is `0`.
|
||||
|
||||
The `now` argument may be a number (in milliseconds) or a Date object.
|
||||
|
||||
The `loopLimit` argument sets the maximum number of timers that will be run when calling `runAll()` before assuming that we have an infinite loop and throwing an error. The default is `1000`.
|
||||
|
||||
### `var clock = FakeTimers.install([config])`
|
||||
Installs FakeTimers using the specified config (otherwise with epoch `0` on the global scope). The following configuration options are available
|
||||
|
||||
Parameter | Type | Default | Description
|
||||
--------- | ---- | ------- | ------------
|
||||
`config.target`| Object | global | installs FakeTimers onto the specified target context
|
||||
`config.now` | Number/Date | 0 | installs FakeTimers with the specified unix epoch
|
||||
`config.toFake` | String[] | ["setTimeout", "clearTimeout", "setImmediate", "clearImmediate","setInterval", "clearInterval", "Date", "requestAnimationFrame", "cancelAnimationFrame", "requestIdleCallback", "cancelIdleCallback", "hrtime"] | an array with explicit function names to hijack. *When not set, FakeTimers will automatically fake all methods **except** `nextTick`* e.g., `FakeTimers.install({ toFake: ["setTimeout","nextTick"]})` will fake only `setTimeout` and `nextTick`
|
||||
`config.loopLimit` | Number | 1000 | the maximum number of timers that will be run when calling runAll()
|
||||
`config.shouldAdvanceTime` | Boolean | false | tells FakeTimers to increment mocked time automatically based on the real system time shift (e.g. the mocked time will be incremented by 20ms for every 20ms change in the real system time)
|
||||
`config.advanceTimeDelta` | Number | 20 | relevant only when using with `shouldAdvanceTime: true`. increment mocked time by `advanceTimeDelta` ms every `advanceTimeDelta` ms change in the real system time.
|
||||
|
||||
### `var id = clock.setTimeout(callback, timeout)`
|
||||
|
||||
Schedules the callback to be fired once `timeout` milliseconds have ticked by.
|
||||
|
||||
In Node.js `setTimeout` returns a timer object. FakeTimers will do the same, however
|
||||
its `ref()` and `unref()` methods have no effect.
|
||||
|
||||
In browsers a timer ID is returned.
|
||||
|
||||
### `clock.clearTimeout(id)`
|
||||
|
||||
Clears the timer given the ID or timer object, as long as it was created using
|
||||
`setTimeout`.
|
||||
|
||||
### `var id = clock.setInterval(callback, timeout)`
|
||||
|
||||
Schedules the callback to be fired every time `timeout` milliseconds have ticked
|
||||
by.
|
||||
|
||||
In Node.js `setInterval` returns a timer object. FakeTimers will do the same, however
|
||||
its `ref()` and `unref()` methods have no effect.
|
||||
|
||||
In browsers a timer ID is returned.
|
||||
|
||||
### `clock.clearInterval(id)`
|
||||
|
||||
Clears the timer given the ID or timer object, as long as it was created using
|
||||
`setInterval`.
|
||||
|
||||
### `var id = clock.setImmediate(callback)`
|
||||
|
||||
Schedules the callback to be fired once `0` milliseconds have ticked by. Note
|
||||
that you'll still have to call `clock.tick()` for the callback to fire. If
|
||||
called during a tick the callback won't fire until `1` millisecond has ticked
|
||||
by.
|
||||
|
||||
In Node.js `setImmediate` returns a timer object. FakeTimers will do the same,
|
||||
however its `ref()` and `unref()` methods have no effect.
|
||||
|
||||
In browsers a timer ID is returned.
|
||||
|
||||
### `clock.clearImmediate(id)`
|
||||
|
||||
Clears the timer given the ID or timer object, as long as it was created using
|
||||
`setImmediate`.
|
||||
|
||||
### `clock.requestAnimationFrame(callback)`
|
||||
|
||||
Schedules the callback to be fired on the next animation frame, which runs every
|
||||
16 ticks. Returns an `id` which can be used to cancel the callback. This is
|
||||
available in both browser & node environments.
|
||||
|
||||
### `clock.cancelAnimationFrame(id)`
|
||||
|
||||
Cancels the callback scheduled by the provided id.
|
||||
|
||||
### `clock.requestIdleCallback(callback[, timeout])`
|
||||
|
||||
Queued the callback to be fired during idle periods to perform background and low priority work on the main event loop. Callbacks which have a timeout option will be fired no later than time in milliseconds. Returns an `id` which can be used to cancel the callback.
|
||||
|
||||
### `clock.cancelIdleCallback(id)`
|
||||
|
||||
Cancels the callback scheduled by the provided id.
|
||||
|
||||
### `clock.countTimers()`
|
||||
|
||||
Returns the number of waiting timers. This can be used to assert that a test
|
||||
finishes without leaking any timers.
|
||||
|
||||
### `clock.hrtime(prevTime?)`
|
||||
Only available in Node.js, mimicks process.hrtime().
|
||||
|
||||
### `clock.nextTick(callback)`
|
||||
|
||||
Only available in Node.js, mimics `process.nextTick` to enable completely synchronous testing flows.
|
||||
|
||||
### `clock.performance.now()`
|
||||
Only available in browser environments, mimicks performance.now().
|
||||
|
||||
|
||||
### `clock.tick(time)` / `await clock.tickAsync(time)`
|
||||
|
||||
Advance the clock, firing callbacks if necessary. `time` may be the number of
|
||||
milliseconds to advance the clock by or a human-readable string. Valid string
|
||||
formats are `"08"` for eight seconds, `"01:00"` for one minute and `"02:34:10"`
|
||||
for two hours, 34 minutes and ten seconds.
|
||||
|
||||
The `tickAsync()` will also break the event loop, allowing any scheduled promise
|
||||
callbacks to execute _before_ running the timers.
|
||||
|
||||
### `clock.next()` / `await clock.nextAsync()`
|
||||
|
||||
Advances the clock to the the moment of the first scheduled timer, firing it.
|
||||
|
||||
The `nextAsync()` will also break the event loop, allowing any scheduled promise
|
||||
callbacks to execute _before_ running the timers.
|
||||
|
||||
### `clock.reset()`
|
||||
|
||||
Removes all timers and ticks without firing them, and sets `now` to `config.now`
|
||||
that was provided to `FakeTimers.install` or to `0` if `config.now` was not provided.
|
||||
Useful to reset the state of the clock without having to `uninstall` and `install` it.
|
||||
|
||||
### `clock.runAll()` / `await clock.runAllAsync()`
|
||||
|
||||
This runs all pending timers until there are none remaining. If new timers are added while it is executing they will be run as well.
|
||||
|
||||
This makes it easier to run asynchronous tests to completion without worrying about the number of timers they use, or the delays in those timers.
|
||||
|
||||
It runs a maximum of `loopLimit` times after which it assumes there is an infinite loop of timers and throws an error.
|
||||
|
||||
The `runAllAsync()` will also break the event loop, allowing any scheduled promise
|
||||
callbacks to execute _before_ running the timers.
|
||||
|
||||
### `clock.runMicrotasks()`
|
||||
|
||||
This runs all pending microtasks scheduled with `nextTick` but none of the timers and is mostly useful for libraries using FakeTimers underneath and for running `nextTick` items without any timers.
|
||||
|
||||
### `clock.runToFrame()`
|
||||
|
||||
Advances the clock to the next frame, firing all scheduled animation frame callbacks,
|
||||
if any, for that frame as well as any other timers scheduled along the way.
|
||||
|
||||
### `clock.runToLast()` / `await clock.runToLastAsync()`
|
||||
|
||||
This takes note of the last scheduled timer when it is run, and advances the
|
||||
clock to that time firing callbacks as necessary.
|
||||
|
||||
If new timers are added while it is executing they will be run only if they
|
||||
would occur before this time.
|
||||
|
||||
This is useful when you want to run a test to completion, but the test recursively
|
||||
sets timers that would cause `runAll` to trigger an infinite loop warning.
|
||||
|
||||
The `runToLastAsync()` will also break the event loop, allowing any scheduled promise
|
||||
callbacks to execute _before_ running the timers.
|
||||
|
||||
### `clock.setSystemTime([now])`
|
||||
|
||||
This simulates a user changing the system clock while your program is running.
|
||||
It affects the current time but it does not in itself cause e.g. timers to fire;
|
||||
they will fire exactly as they would have done without the call to
|
||||
setSystemTime().
|
||||
|
||||
### `clock.uninstall()`
|
||||
|
||||
Restores the original methods on the `target` that was passed to
|
||||
`FakeTimers.install`, or the native timers if no `target` was given.
|
||||
|
||||
### `Date`
|
||||
|
||||
Implements the `Date` object but using the clock to provide the correct time.
|
||||
|
||||
### `Performance`
|
||||
|
||||
Implements the `now` method of the [`Performance`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/now) object but using the clock to provide the correct time. Only available in environments that support the Performance object (browsers mostly).
|
||||
|
||||
### `FakeTimers.withGlobal`
|
||||
|
||||
In order to support creating clocks based on separate or sandboxed environments (such as JSDOM), FakeTimers exports a factory method which takes single argument `global`, which it inspects to figure out what to mock and what features to support. When invoking this function with a global, you will get back an object with `timers`, `createClock` and `install` - same as the regular FakeTimers exports only based on the passed in global instead of the global environment.
|
||||
|
||||
## Running tests
|
||||
|
||||
FakeTimers has a comprehensive test suite. If you're thinking of contributing bug
|
||||
fixes or suggesting new features, you need to make sure you have not broken any
|
||||
tests. You are also expected to add tests for any new behavior.
|
||||
|
||||
### On node:
|
||||
|
||||
```sh
|
||||
npm test
|
||||
```
|
||||
|
||||
Or, if you prefer more verbose output:
|
||||
|
||||
```
|
||||
$(npm bin)/mocha ./test/fake-timers-test.js
|
||||
```
|
||||
|
||||
### In the browser
|
||||
|
||||
[Mochify](https://github.com/mantoni/mochify.js) is used to run the tests in
|
||||
PhantomJS. Make sure you have `phantomjs` installed. Then:
|
||||
|
||||
```sh
|
||||
npm test-headless
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
BSD 3-clause "New" or "Revised" License (see LICENSE file)
|
||||
2625
node_modules/@sinonjs/fake-timers/fake-timers.js
generated
vendored
Normal file
2625
node_modules/@sinonjs/fake-timers/fake-timers.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
124
node_modules/@sinonjs/fake-timers/package.json
generated
vendored
Normal file
124
node_modules/@sinonjs/fake-timers/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,124 @@
|
|||
{
|
||||
"_from": "@sinonjs/fake-timers@^6.0.1",
|
||||
"_id": "@sinonjs/fake-timers@6.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-MZPUxrmFubI36XS1DI3qmI0YdN1gks62JtFZvxR67ljjSNCeK6U08Zx4msEWOXuofgqUt6zPHSi1H9fbjR/NRA==",
|
||||
"_location": "/@sinonjs/fake-timers",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@sinonjs/fake-timers@^6.0.1",
|
||||
"name": "@sinonjs/fake-timers",
|
||||
"escapedName": "@sinonjs%2ffake-timers",
|
||||
"scope": "@sinonjs",
|
||||
"rawSpec": "^6.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^6.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/nise",
|
||||
"/sinon"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-6.0.1.tgz",
|
||||
"_shasum": "293674fccb3262ac782c7aadfdeca86b10c75c40",
|
||||
"_spec": "@sinonjs/fake-timers@^6.0.1",
|
||||
"_where": "/Users/sam/code/codeql-action/node_modules/sinon",
|
||||
"author": {
|
||||
"name": "Christian Johansen"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "http://github.com/sinonjs/fake-timers/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@sinonjs/commons": "^1.7.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Fake JavaScript timers",
|
||||
"devDependencies": {
|
||||
"@sinonjs/referee-sinon": "6.0.1",
|
||||
"browserify": "16.5.0",
|
||||
"eslint": "6.8.0",
|
||||
"eslint-config-prettier": "6.10.0",
|
||||
"eslint-config-sinon": "3.0.1",
|
||||
"eslint-plugin-ie11": "1.0.0",
|
||||
"eslint-plugin-mocha": "6.2.2",
|
||||
"eslint-plugin-prettier": "3.1.1",
|
||||
"husky": "4.2.1",
|
||||
"jsdom": "15.1.1",
|
||||
"lint-staged": "10.0.7",
|
||||
"mocha": "7.0.1",
|
||||
"mochify": "6.6.0",
|
||||
"npm-run-all": "4.1.5",
|
||||
"nyc": "14.1.1",
|
||||
"prettier": "1.19.1"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "eslint-config-sinon",
|
||||
"plugins": [
|
||||
"ie11"
|
||||
],
|
||||
"rules": {
|
||||
"ie11/no-collection-args": [
|
||||
"error"
|
||||
],
|
||||
"ie11/no-for-in-const": [
|
||||
"error"
|
||||
],
|
||||
"ie11/no-loop-func": [
|
||||
"warn"
|
||||
],
|
||||
"ie11/no-weak-collections": [
|
||||
"error"
|
||||
]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"src/",
|
||||
"fake-timers.js"
|
||||
],
|
||||
"homepage": "http://github.com/sinonjs/fake-timers",
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "run-p lint test-node"
|
||||
}
|
||||
},
|
||||
"license": "BSD-3-Clause",
|
||||
"lint-staged": {
|
||||
"*.js": "eslint"
|
||||
},
|
||||
"main": "./src/fake-timers-src.js",
|
||||
"module": "./fake-timers.js",
|
||||
"name": "@sinonjs/fake-timers",
|
||||
"nyc": {
|
||||
"branches": 85,
|
||||
"lines": 92,
|
||||
"functions": 92,
|
||||
"statements": 92,
|
||||
"exclude": [
|
||||
"**/*-test.js",
|
||||
"coverage/**",
|
||||
"fake-timers.js"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/sinonjs/fake-timers.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bundle": "browserify --no-detect-globals -s FakeTimers -o fake-timers.js src/fake-timers-src.js",
|
||||
"lint": "eslint .",
|
||||
"postversion": "./scripts/postversion.sh",
|
||||
"prepublishOnly": "npm run bundle",
|
||||
"preversion": "./scripts/preversion.sh",
|
||||
"test": "npm run lint && npm run test-node && npm run test-headless",
|
||||
"test-check-coverage": "npm run test-coverage && nyc check-coverage",
|
||||
"test-cloud": "mochify --wd --no-detect-globals --timeout=10000",
|
||||
"test-coverage": "nyc --all --reporter text --reporter html --reporter lcovonly npm run test-node",
|
||||
"test-headless": "mochify --no-detect-globals --timeout=10000",
|
||||
"test-node": "mocha test/ integration-test/ -R dot --check-leaks",
|
||||
"version": "./scripts/version.sh"
|
||||
},
|
||||
"version": "6.0.1"
|
||||
}
|
||||
1318
node_modules/@sinonjs/fake-timers/src/fake-timers-src.js
generated
vendored
Normal file
1318
node_modules/@sinonjs/fake-timers/src/fake-timers-src.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
43
node_modules/@sinonjs/formatio/CHANGES.md
generated
vendored
Normal file
43
node_modules/@sinonjs/formatio/CHANGES.md
generated
vendored
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
# Changes
|
||||
|
||||
## 5.0.1
|
||||
|
||||
- [`47a360d`](https://github.com/sinonjs/formatio/commit/47a360d5c5db72ba8ced2d598421bfe105facc69)
|
||||
Bump @sinonjs/samsam to latest (Morgan Roderick)
|
||||
>
|
||||
> This helps dedupe dependencies in Sinon. See https://github.com/sinonjs/sinon/issues/2224
|
||||
>
|
||||
|
||||
_Released on 2020-02-20._
|
||||
|
||||
## 5.0.0
|
||||
|
||||
- [`116aedb`](https://github.com/sinonjs/formatio/commit/116aedb20ca89f5f022633457366afe17b070772)
|
||||
Drop support for Node 8 (Morgan Roderick)
|
||||
>
|
||||
> As can be seen at https://github.com/nodejs/Release, Node 8 reached
|
||||
> "end" of life on 2019-12-31, and is no longer actively supported.
|
||||
>
|
||||
> We will stop testing in Node 8 and start testing in Node 13, which will
|
||||
> become the next LTS release from April 2020.
|
||||
>
|
||||
|
||||
_Released on 2020-02-19._
|
||||
|
||||
## 4.0.1
|
||||
|
||||
- [`8dae99e`](https://github.com/sinonjs/formatio/commit/8dae99e19fb1f63707669aa18375aac377de92be)
|
||||
Fix changes.md (Morgan Roderick)
|
||||
- [`8dde8cb`](https://github.com/sinonjs/formatio/commit/8dde8cb370a2ea54f8d46ff43d1bf69a6ce661c5)
|
||||
Use '--access public' for the publish command (Morgan Roderick)
|
||||
|
||||
_Released on 2019-12-19._
|
||||
|
||||
## 4.0.0
|
||||
|
||||
- [`8693846`](https://github.com/sinonjs/formatio/commit/869384686588e4c71612ce99e4b840842a0e5a46)
|
||||
add support for formatting maps (#51) (Marc Redemske)
|
||||
> * add support for formatting maps
|
||||
> * Update @sinonjs/samsam to version that has isMap method
|
||||
|
||||
_Released on 2019-12-19._
|
||||
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.
|
||||
102
node_modules/@sinonjs/formatio/README.md
generated
vendored
Normal file
102
node_modules/@sinonjs/formatio/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
# formatio
|
||||
|
||||
[](http://travis-ci.org/sinonjs/formatio)
|
||||
[](https://codecov.io/gh/sinonjs/formatio)
|
||||
<a href="CODE_OF_CONDUCT.md"><img src="https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg" alt="Contributor Covenant" /></a>
|
||||
|
||||
> 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)
|
||||
289
node_modules/@sinonjs/formatio/lib/formatio.js
generated
vendored
Normal file
289
node_modules/@sinonjs/formatio/lib/formatio.js
generated
vendored
Normal file
|
|
@ -0,0 +1,289 @@
|
|||
"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 = [];
|
||||
/* istanbul ignore else */
|
||||
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;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
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;
|
||||
// eslint-disable-next-line quotes
|
||||
return processed || quote ? '"' + object + '"' : object;
|
||||
}
|
||||
|
||||
if (typeof object === "symbol") {
|
||||
return object.toString();
|
||||
}
|
||||
|
||||
if (typeof object === "function" && !(object instanceof RegExp)) {
|
||||
return ascii.func(object);
|
||||
}
|
||||
|
||||
// eslint supports bigint as of version 6.0.0
|
||||
// https://github.com/eslint/eslint/commit/e4ab0531c4e44c23494c6a802aa2329d15ac90e5
|
||||
// eslint-disable-next-line
|
||||
if (typeOf(object) === "bigint") {
|
||||
return object.toString();
|
||||
}
|
||||
|
||||
var internalProcessed = processed || [];
|
||||
|
||||
if (isCircular(object, internalProcessed)) {
|
||||
return "[Circular]";
|
||||
}
|
||||
|
||||
if (typeOf(object) === "array") {
|
||||
return ascii.array.call(f, object, internalProcessed);
|
||||
}
|
||||
|
||||
if (!object) {
|
||||
return String(1 / object === -Infinity ? "-0" : object);
|
||||
}
|
||||
if (samsam.isElement(object)) {
|
||||
return ascii.element(object);
|
||||
}
|
||||
|
||||
if (
|
||||
typeof object.toString === "function" &&
|
||||
object.toString !== Object.prototype.toString
|
||||
) {
|
||||
return object.toString();
|
||||
}
|
||||
|
||||
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, internalProcessed);
|
||||
}
|
||||
|
||||
if (object instanceof Map) {
|
||||
return ascii.map.call(f, object, internalProcessed);
|
||||
}
|
||||
|
||||
return ascii.object.call(f, object, internalProcessed, indent);
|
||||
}
|
||||
|
||||
ascii.func = function(func) {
|
||||
var funcName = functionName(func) || "";
|
||||
return "function " + funcName + "() {}";
|
||||
};
|
||||
|
||||
function delimit(str, delimiters) {
|
||||
var delims = delimiters || ["[", "]"];
|
||||
return delims[0] + str + delims[1];
|
||||
}
|
||||
|
||||
ascii.array = function(array, processed, delimiters) {
|
||||
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.map = function(map, processed) {
|
||||
return ascii.array.call(this, Array.from(map), processed, ["Map [", "]"]);
|
||||
};
|
||||
|
||||
function getSymbols(object) {
|
||||
if (samsam.isArguments(object)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
/* istanbul ignore else */
|
||||
if (typeof Object.getOwnPropertySymbols === "function") {
|
||||
return Object.getOwnPropertySymbols(object);
|
||||
}
|
||||
|
||||
/* istanbul ignore next: This is only for IE, since getOwnPropertySymbols
|
||||
* does not exist on Object there
|
||||
*/
|
||||
return [];
|
||||
}
|
||||
|
||||
ascii.object = function(object, processed, indent) {
|
||||
processed.push(object);
|
||||
var internalIndent = indent || 0;
|
||||
var pieces = [];
|
||||
var properties = Object.keys(object)
|
||||
.sort()
|
||||
.concat(getSymbols(object));
|
||||
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, internalIndent + 2);
|
||||
}
|
||||
|
||||
str =
|
||||
(typeof prop === "string" && /\s/.test(prop)
|
||||
? // eslint-disable-next-line quotes
|
||||
'"' + 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 = internalIndent; i < k; ++i) {
|
||||
is += " ";
|
||||
}
|
||||
|
||||
if (l < properties.length) {
|
||||
pieces.push("[... " + (properties.length - l) + " more elements]");
|
||||
}
|
||||
|
||||
if (length + internalIndent > 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) {
|
||||
// eslint-disable-next-line quotes
|
||||
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;
|
||||
81
node_modules/@sinonjs/formatio/package.json
generated
vendored
Normal file
81
node_modules/@sinonjs/formatio/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
{
|
||||
"_from": "@sinonjs/formatio@^5.0.1",
|
||||
"_id": "@sinonjs/formatio@5.0.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-KaiQ5pBf1MpS09MuA0kp6KBQt2JUOQycqVG1NZXvzeaXe5LGFqAKueIS0bw4w0P9r7KuBSVdUk5QjXsUdu2CxQ==",
|
||||
"_location": "/@sinonjs/formatio",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@sinonjs/formatio@^5.0.1",
|
||||
"name": "@sinonjs/formatio",
|
||||
"escapedName": "@sinonjs%2fformatio",
|
||||
"scope": "@sinonjs",
|
||||
"rawSpec": "^5.0.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^5.0.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/sinon"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-5.0.1.tgz",
|
||||
"_shasum": "f13e713cb3313b1ab965901b01b0828ea6b77089",
|
||||
"_spec": "@sinonjs/formatio@^5.0.1",
|
||||
"_where": "/Users/sam/code/codeql-action/node_modules/sinon",
|
||||
"author": {
|
||||
"name": "Christian Johansen"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sinonjs/formatio/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@sinonjs/commons": "^1",
|
||||
"@sinonjs/samsam": "^5.0.2"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Human-readable object formatting",
|
||||
"devDependencies": {
|
||||
"@sinonjs/referee": "^4.0.0",
|
||||
"@studio/changes": "^2.0.0",
|
||||
"eslint": "^6.5.1",
|
||||
"eslint-config-prettier": "^6.4.0",
|
||||
"eslint-config-sinon": "^3.0.1",
|
||||
"eslint-plugin-ie11": "^1.0.0",
|
||||
"eslint-plugin-mocha": "^6.1.1",
|
||||
"eslint-plugin-prettier": "^3.1.1",
|
||||
"jsdom": "^16.1.0",
|
||||
"jsdom-global": "^3.0.2",
|
||||
"mocha": "^7.0.1",
|
||||
"nyc": "^15.0.0",
|
||||
"prettier": "^1.18.2",
|
||||
"rollup": "1.31.0",
|
||||
"rollup-plugin-commonjs": "10.1.0"
|
||||
},
|
||||
"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 .",
|
||||
"postversion": "git push --follow-tags && npm publish --access public",
|
||||
"prepublishOnly": "npm run build && mkdocs gh-deploy -r upstream || mkdocs gh-deploy -r origin",
|
||||
"preversion": "npm run test-check-coverage",
|
||||
"test": "mocha '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": "changes --commits --footer"
|
||||
},
|
||||
"version": "5.0.1"
|
||||
}
|
||||
149
node_modules/@sinonjs/samsam/CHANGES.md
generated
vendored
Normal file
149
node_modules/@sinonjs/samsam/CHANGES.md
generated
vendored
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
# Changes
|
||||
|
||||
## 5.0.3
|
||||
|
||||
- [`9d2add0`](https://github.com/sinonjs/samsam/commit/9d2add01eba85eb17ddb91ac22404fb6c23e8d39)
|
||||
Remove unused @sinonjs/formatio (Morgan Roderick)
|
||||
>
|
||||
> As can be seen with searching the codebase, @sinonjs/formatio is never
|
||||
> imported, and is thus not a direct dependency of @sinonjs/samsam.
|
||||
>
|
||||
|
||||
_Released on 2020-02-28._
|
||||
|
||||
## 5.0.2
|
||||
|
||||
- [`f9e845a`](https://github.com/sinonjs/samsam/commit/f9e845a52ba50916df91335d2003a81a808a4ade)
|
||||
Bump formatio to latest major (Morgan Roderick)
|
||||
>
|
||||
> This will remove some duplication in Sinon, see https://github.com/sinonjs/sinon/issues/2224
|
||||
>
|
||||
|
||||
_Released on 2020-02-20._
|
||||
|
||||
## 5.0.1
|
||||
|
||||
- [`fe5d035`](https://github.com/sinonjs/samsam/commit/fe5d03532ea6cdbec857c49d18392d668cca8ef2)
|
||||
Bump jsdom from 15.2.1 to 16.2.0 (dependabot-preview[bot])
|
||||
>
|
||||
> Bumps [jsdom](https://github.com/jsdom/jsdom) from 15.2.1 to 16.2.0.
|
||||
> - [Release notes](https://github.com/jsdom/jsdom/releases)
|
||||
> - [Changelog](https://github.com/jsdom/jsdom/blob/master/Changelog.md)
|
||||
> - [Commits](https://github.com/jsdom/jsdom/compare/15.2.1...16.2.0)
|
||||
>
|
||||
> Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
|
||||
- [`910af18`](https://github.com/sinonjs/samsam/commit/910af18be1bd57c6237399ca04cbef91d994a38a)
|
||||
Remove maintenance junk from CHANGES.md (Morgan Roderick)
|
||||
|
||||
_Released on 2020-02-18._
|
||||
|
||||
## 5.0.0
|
||||
|
||||
- [`f288430`](https://github.com/sinonjs/samsam/commit/f2884309c9bf68b02ecfda3bd1df8d7a7a31686b)
|
||||
Drop support for Node 8 (Morgan Roderick)
|
||||
>
|
||||
> As can be seen at https://github.com/nodejs/Release, Node 8 reached
|
||||
> "end" of life on 2019-12-31, and is no longer actively supported.
|
||||
>
|
||||
> We will stop testing in Node 8 and start testing in Node 13, which will
|
||||
> become the next LTS release from April 2020.
|
||||
>
|
||||
|
||||
_Released on 2020-02-18._
|
||||
|
||||
## 4.2.2
|
||||
|
||||
- [`c600d6c`](https://github.com/sinonjs/samsam/commit/c600d6cb6c1bec8d65bc718bd9268311204597bc)
|
||||
Fix issue with nested array matching (Jay Merrifield)
|
||||
- [`8b37566`](https://github.com/sinonjs/samsam/commit/8b37566ea73bee512fbc4203c07678288f906bda)
|
||||
Bump eslint from 6.7.2 to 6.8.0 (dependabot-preview[bot])
|
||||
>
|
||||
> Bumps [eslint](https://github.com/eslint/eslint) from 6.7.2 to 6.8.0.
|
||||
> - [Release notes](https://github.com/eslint/eslint/releases)
|
||||
> - [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
|
||||
> - [Commits](https://github.com/eslint/eslint/compare/v6.7.2...v6.8.0)
|
||||
>
|
||||
> Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
|
||||
- [`b7c5db9`](https://github.com/sinonjs/samsam/commit/b7c5db9e7847204188c112843bb193248d0b5156)
|
||||
Bump eslint-plugin-prettier from 3.1.1 to 3.1.2 (dependabot-preview[bot])
|
||||
>
|
||||
> Bumps [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) from 3.1.1 to 3.1.2.
|
||||
> - [Release notes](https://github.com/prettier/eslint-plugin-prettier/releases)
|
||||
> - [Changelog](https://github.com/prettier/eslint-plugin-prettier/blob/master/CHANGELOG.md)
|
||||
> - [Commits](https://github.com/prettier/eslint-plugin-prettier/compare/v3.1.1...v3.1.2)
|
||||
>
|
||||
> Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
|
||||
- [`8965384`](https://github.com/sinonjs/samsam/commit/8965384818697b7b36537619922b3c378bfd0b42)
|
||||
Bump eslint-plugin-mocha from 6.1.1 to 6.2.2 (dependabot-preview[bot])
|
||||
>
|
||||
> Bumps [eslint-plugin-mocha](https://github.com/lo1tuma/eslint-plugin-mocha) from 6.1.1 to 6.2.2.
|
||||
> - [Release notes](https://github.com/lo1tuma/eslint-plugin-mocha/releases)
|
||||
> - [Changelog](https://github.com/lo1tuma/eslint-plugin-mocha/blob/master/CHANGELOG.md)
|
||||
> - [Commits](https://github.com/lo1tuma/eslint-plugin-mocha/compare/6.1.1...6.2.2)
|
||||
>
|
||||
> Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
|
||||
- [`8661610`](https://github.com/sinonjs/samsam/commit/866161044e212b4df56a207e55ab3e449346abf5)
|
||||
Bump eslint-config-prettier from 6.7.0 to 6.9.0 (dependabot-preview[bot])
|
||||
>
|
||||
> Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 6.7.0 to 6.9.0.
|
||||
> - [Release notes](https://github.com/prettier/eslint-config-prettier/releases)
|
||||
> - [Changelog](https://github.com/prettier/eslint-config-prettier/blob/master/CHANGELOG.md)
|
||||
> - [Commits](https://github.com/prettier/eslint-config-prettier/commits/v6.9.0)
|
||||
>
|
||||
> Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
|
||||
- [`7d91124`](https://github.com/sinonjs/samsam/commit/7d91124a9fa95c462c1e714d86405d6cb99e3363)
|
||||
Bump rollup from 1.23.0 to 1.27.14 (dependabot-preview[bot])
|
||||
>
|
||||
> Bumps [rollup](https://github.com/rollup/rollup) from 1.23.0 to 1.27.14.
|
||||
> - [Release notes](https://github.com/rollup/rollup/releases)
|
||||
> - [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
|
||||
> - [Commits](https://github.com/rollup/rollup/compare/v1.23.0...v1.27.14)
|
||||
>
|
||||
> Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
|
||||
- [`31c616a`](https://github.com/sinonjs/samsam/commit/31c616ab278e05071138e18d6e5aea8f2c250c2a)
|
||||
Bump nyc from 14.1.1 to 15.0.0 (dependabot-preview[bot])
|
||||
>
|
||||
> Bumps [nyc](https://github.com/istanbuljs/nyc) from 14.1.1 to 15.0.0.
|
||||
> - [Release notes](https://github.com/istanbuljs/nyc/releases)
|
||||
> - [Changelog](https://github.com/istanbuljs/nyc/blob/master/CHANGELOG.md)
|
||||
> - [Commits](https://github.com/istanbuljs/nyc/compare/v14.1.1...v15.0.0)
|
||||
>
|
||||
> Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
|
||||
- [`e82dbcf`](https://github.com/sinonjs/samsam/commit/e82dbcf9af6a052b1d466e476a7315e047324256)
|
||||
Bump @sinonjs/referee from 3.2.0 to 4.0.0 (dependabot-preview[bot])
|
||||
>
|
||||
> Bumps [@sinonjs/referee](https://github.com/sinonjs/referee) from 3.2.0 to 4.0.0.
|
||||
> - [Release notes](https://github.com/sinonjs/referee/releases)
|
||||
> - [Changelog](https://github.com/sinonjs/referee/blob/master/CHANGES.md)
|
||||
> - [Commits](https://github.com/sinonjs/referee/compare/v3.2.0...v4.0.0)
|
||||
>
|
||||
> Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
|
||||
- [`b089354`](https://github.com/sinonjs/samsam/commit/b089354118a6f64139ca64906d8b8a9f282bc376)
|
||||
Bump eslint-plugin-jsdoc from 18.4.3 to 19.2.0 (dependabot-preview[bot])
|
||||
>
|
||||
> Bumps [eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from 18.4.3 to 19.2.0.
|
||||
> - [Release notes](https://github.com/gajus/eslint-plugin-jsdoc/releases)
|
||||
> - [Commits](https://github.com/gajus/eslint-plugin-jsdoc/compare/v18.4.3...v19.2.0)
|
||||
>
|
||||
> Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
|
||||
- [`bba8c44`](https://github.com/sinonjs/samsam/commit/bba8c441914cd3b07b505b4d917a042d16412c9e)
|
||||
Bump @sinonjs/commons from 1.6.0 to 1.7.0 (dependabot-preview[bot])
|
||||
>
|
||||
> Bumps [@sinonjs/commons](https://github.com/sinonjs/commons) from 1.6.0 to 1.7.0.
|
||||
> - [Release notes](https://github.com/sinonjs/commons/releases)
|
||||
> - [Commits](https://github.com/sinonjs/commons/compare/v1.6.0...v1.7.0)
|
||||
>
|
||||
> Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
|
||||
- [`5915960`](https://github.com/sinonjs/samsam/commit/5915960fab257e27564c544da45b419c360bc8fb)
|
||||
Publish using public access (Morgan Roderick)
|
||||
- [`28ffc83`](https://github.com/sinonjs/samsam/commit/28ffc83556274b025d1fc62b52d2ff8ea25743a4)
|
||||
4.2.1 (Morgan Roderick)
|
||||
|
||||
_Released by [Maximilian Antoni](https://github.com/mantoni) on 2020-01-09._
|
||||
|
||||
## 4.2.1
|
||||
|
||||
- [`8987966`](https://github.com/sinonjs/samsam/commit/898796645000b88f1a4045213355bed29085f46c)
|
||||
re-introduce bound deepEqual (#160) (James Garbutt)
|
||||
|
||||
_Released on 2019-12-30._
|
||||
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.
|
||||
84
node_modules/@sinonjs/samsam/README.md
generated
vendored
Normal file
84
node_modules/@sinonjs/samsam/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
# samsam
|
||||
|
||||
[](https://circleci.com/gh/sinonjs/samsam)
|
||||
[](https://codecov.io/gh/sinonjs/samsam)
|
||||
<a href="CODE_OF_CONDUCT.md"><img src="https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg" alt="Contributor Covenant" /></a>
|
||||
|
||||
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)
|
||||
1396
node_modules/@sinonjs/samsam/dist/samsam.js
generated
vendored
Normal file
1396
node_modules/@sinonjs/samsam/dist/samsam.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
396
node_modules/@sinonjs/samsam/docs/index.md
generated
vendored
Normal file
396
node_modules/@sinonjs/samsam/docs/index.md
generated
vendored
Normal file
|
|
@ -0,0 +1,396 @@
|
|||
# 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. It works in browsers 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`
|
||||
|
||||
|
||||
### Matcher
|
||||
|
||||
Match values and objects by type or or other fuzzy criteria. `samsam` ships
|
||||
with these built in matchers:
|
||||
|
||||
#### `sinon.match.any`
|
||||
|
||||
Matches anything.
|
||||
|
||||
|
||||
#### `sinon.match.defined`
|
||||
|
||||
Requires the value to be defined.
|
||||
|
||||
|
||||
#### `sinon.match.truthy`
|
||||
|
||||
Requires the value to be truthy.
|
||||
|
||||
|
||||
#### `sinon.match.falsy`
|
||||
|
||||
Requires the value to be falsy.
|
||||
|
||||
|
||||
#### `sinon.match.bool`
|
||||
|
||||
Requires the value to be a `Boolean`
|
||||
|
||||
|
||||
#### `sinon.match.number`
|
||||
|
||||
Requires the value to be a `Number`.
|
||||
|
||||
|
||||
#### `sinon.match.string`
|
||||
|
||||
Requires the value to be a `String`.
|
||||
|
||||
|
||||
#### `sinon.match.object`
|
||||
|
||||
Requires the value to be an `Object`.
|
||||
|
||||
|
||||
#### `sinon.match.func`
|
||||
|
||||
Requires the value to be a `Function`.
|
||||
|
||||
|
||||
#### `sinon.match.array`
|
||||
|
||||
Requires the value to be an `Array`.
|
||||
|
||||
|
||||
#### `sinon.match.array.deepEquals(arr)`
|
||||
|
||||
Requires an `Array` to be deep equal another one.
|
||||
|
||||
|
||||
#### `sinon.match.array.startsWith(arr)`
|
||||
|
||||
Requires an `Array` to start with the same values as another one.
|
||||
|
||||
|
||||
#### `sinon.match.array.endsWith(arr)`
|
||||
|
||||
Requires an `Array` to end with the same values as another one.
|
||||
|
||||
|
||||
#### `sinon.match.array.contains(arr)`
|
||||
|
||||
Requires an `Array` to contain each one of the values the given array has.
|
||||
|
||||
|
||||
#### `sinon.match.map`
|
||||
|
||||
Requires the value to be a `Map`.
|
||||
|
||||
|
||||
#### `sinon.match.map.deepEquals(map)`
|
||||
|
||||
Requires a `Map` to be deep equal another one.
|
||||
|
||||
#### `sinon.match.map.contains(map)`
|
||||
|
||||
Requires a `Map` to contain each one of the items the given map has.
|
||||
|
||||
|
||||
#### `sinon.match.set`
|
||||
|
||||
Requires the value to be a `Set`.
|
||||
|
||||
|
||||
#### `sinon.match.set.deepEquals(set)`
|
||||
|
||||
Requires a `Set` to be deep equal another one.
|
||||
|
||||
|
||||
#### `sinon.match.set.contains(set)`
|
||||
|
||||
Requires a `Set` to contain each one of the items the given set has.
|
||||
|
||||
|
||||
#### `sinon.match.regexp`
|
||||
|
||||
Requires the value to be a regular expression.
|
||||
|
||||
|
||||
#### `sinon.match.date`
|
||||
|
||||
Requires the value to be a `Date` object.
|
||||
|
||||
|
||||
#### `sinon.match.symbol`
|
||||
|
||||
Requires the value to be a `Symbol`.
|
||||
|
||||
#### `sinon.match.in(array)`
|
||||
|
||||
Requires the value to be in the `array`.
|
||||
|
||||
#### `sinon.match.same(ref)`
|
||||
|
||||
Requires the value to strictly equal `ref`.
|
||||
|
||||
#### `sinon.match.typeOf(type)`
|
||||
|
||||
Requires the value to be of the given type, where `type` can be one of
|
||||
`"undefined"`,
|
||||
`"null"`,
|
||||
`"boolean"`,
|
||||
`"number"`,
|
||||
`"string"`,
|
||||
`"object"`,
|
||||
`"function"`,
|
||||
`"array"`,
|
||||
`"regexp"`,
|
||||
`"date"` or
|
||||
`"symbol"`.
|
||||
|
||||
|
||||
#### `sinon.match.instanceOf(type)`
|
||||
|
||||
Requires the value to be an instance of the given `type`.
|
||||
|
||||
#### `sinon.match.has(property[, expectation])`
|
||||
|
||||
Requires the value to define the given `property`.
|
||||
|
||||
The property might be inherited via the prototype chain. If the optional expectation is given, the value of the property is deeply compared with the expectation. The expectation can be another matcher.
|
||||
|
||||
#### `sinon.match.hasOwn(property[, expectation])`
|
||||
|
||||
Same as `sinon.match.has` but the property must be defined by the value itself. Inherited properties are ignored.
|
||||
|
||||
|
||||
#### `sinon.match.hasNested(propertyPath[, expectation])`
|
||||
|
||||
Requires the value to define the given `propertyPath`. Dot (`prop.prop`) and bracket (`prop[0]`) notations are supported as in [Lodash.get](https://lodash.com/docs/4.4.2#get).
|
||||
|
||||
The propertyPath might be inherited via the prototype chain. If the optional expectation is given, the value at the propertyPath is deeply compared with the expectation. The expectation can be another matcher.
|
||||
|
||||
|
||||
```javascript
|
||||
sinon.match.hasNested("a[0].b.c");
|
||||
|
||||
// Where actual is something like
|
||||
var actual = { "a": [{ "b": { "c": 3 } }] };
|
||||
|
||||
sinon.match.hasNested("a.b.c");
|
||||
|
||||
// Where actual is something like
|
||||
var actual = { "a": { "b": { "c": 3 } } };
|
||||
```
|
||||
|
||||
#### `sinon.match.every(matcher)`
|
||||
|
||||
Requires **every** element of an `Array`, `Set` or `Map`, or alternatively **every** value of an `Object` to match the given `matcher`.
|
||||
|
||||
#### `sinon.match.some(matcher)`
|
||||
|
||||
Requires **any** element of an `Array`, `Set` or `Map`, or alternatively **any** value of an `Object` to match the given `matcher`.
|
||||
|
||||
## Combining matchers
|
||||
|
||||
All matchers implement `and` and `or`. This allows to logically combine mutliple matchers. The result is a new matchers that requires both (and) or one of the matchers (or) to return `true`.
|
||||
|
||||
```javascript
|
||||
var stringOrNumber = sinon.match.string.or(sinon.match.number);
|
||||
var bookWithPages = sinon.match.instanceOf(Book).and(sinon.match.has("pages"));
|
||||
```
|
||||
|
||||
### `match(object, matcher)`
|
||||
|
||||
Creates a custom matcher to perform 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"
|
||||
});
|
||||
```
|
||||
16
node_modules/@sinonjs/samsam/lib/array-types.js
generated
vendored
Normal file
16
node_modules/@sinonjs/samsam/lib/array-types.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
"use strict";
|
||||
|
||||
var ARRAY_TYPES = [
|
||||
Array,
|
||||
Int8Array,
|
||||
Uint8Array,
|
||||
Uint8ClampedArray,
|
||||
Int16Array,
|
||||
Uint16Array,
|
||||
Int32Array,
|
||||
Uint32Array,
|
||||
Float32Array,
|
||||
Float64Array
|
||||
];
|
||||
|
||||
module.exports = ARRAY_TYPES;
|
||||
347
node_modules/@sinonjs/samsam/lib/create-matcher.js
generated
vendored
Normal file
347
node_modules/@sinonjs/samsam/lib/create-matcher.js
generated
vendored
Normal file
|
|
@ -0,0 +1,347 @@
|
|||
"use strict";
|
||||
|
||||
var arrayProto = require("@sinonjs/commons").prototypes.array;
|
||||
var deepEqual = require("./deep-equal").use(createMatcher); // 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 typeOf = require("@sinonjs/commons").typeOf;
|
||||
var valueToString = require("@sinonjs/commons").valueToString;
|
||||
|
||||
var assertMatcher = require("./create-matcher/assert-matcher");
|
||||
var assertMethodExists = require("./create-matcher/assert-method-exists");
|
||||
var assertType = require("./create-matcher/assert-type");
|
||||
var isIterable = require("./create-matcher/is-iterable");
|
||||
var isMatcher = require("./create-matcher/is-matcher");
|
||||
|
||||
var matcherPrototype = require("./create-matcher/matcher-prototype");
|
||||
|
||||
var arrayIndexOf = arrayProto.indexOf;
|
||||
var some = arrayProto.some;
|
||||
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
var TYPE_MAP = require("./create-matcher/type-map")(createMatcher); // eslint-disable-line no-use-before-define
|
||||
|
||||
/**
|
||||
* Creates a matcher object for the passed expectation
|
||||
*
|
||||
* @alias module:samsam.createMatcher
|
||||
* @param {*} expectation An expecttation
|
||||
* @param {string} message A message for the expectation
|
||||
* @returns {object} A matcher object
|
||||
*/
|
||||
function createMatcher(expectation, message) {
|
||||
var m = Object.create(matcherPrototype);
|
||||
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;
|
||||
}
|
||||
|
||||
createMatcher.isMatcher = isMatcher;
|
||||
|
||||
createMatcher.any = createMatcher(function() {
|
||||
return true;
|
||||
}, "any");
|
||||
|
||||
createMatcher.defined = createMatcher(function(actual) {
|
||||
return actual !== null && actual !== undefined;
|
||||
}, "defined");
|
||||
|
||||
createMatcher.truthy = createMatcher(function(actual) {
|
||||
return Boolean(actual);
|
||||
}, "truthy");
|
||||
|
||||
createMatcher.falsy = createMatcher(function(actual) {
|
||||
return !actual;
|
||||
}, "falsy");
|
||||
|
||||
createMatcher.same = function(expectation) {
|
||||
return createMatcher(function(actual) {
|
||||
return expectation === actual;
|
||||
}, "same(" + valueToString(expectation) + ")");
|
||||
};
|
||||
|
||||
createMatcher.in = function(arrayOfExpectations) {
|
||||
if (typeOf(arrayOfExpectations) !== "array") {
|
||||
throw new TypeError("array expected");
|
||||
}
|
||||
|
||||
return createMatcher(function(actual) {
|
||||
return some(arrayOfExpectations, function(expectation) {
|
||||
return expectation === actual;
|
||||
});
|
||||
}, "in(" + valueToString(arrayOfExpectations) + ")");
|
||||
};
|
||||
|
||||
createMatcher.typeOf = function(type) {
|
||||
assertType(type, "string", "type");
|
||||
return createMatcher(function(actual) {
|
||||
return typeOf(actual) === type;
|
||||
}, 'typeOf("' + type + '")');
|
||||
};
|
||||
|
||||
createMatcher.instanceOf = function(type) {
|
||||
/* istanbul ignore if */
|
||||
if (
|
||||
typeof Symbol === "undefined" ||
|
||||
typeof Symbol.hasInstance === "undefined"
|
||||
) {
|
||||
assertType(type, "function", "type");
|
||||
} else {
|
||||
assertMethodExists(
|
||||
type,
|
||||
Symbol.hasInstance,
|
||||
"type",
|
||||
"[Symbol.hasInstance]"
|
||||
);
|
||||
}
|
||||
return createMatcher(function(actual) {
|
||||
return actual instanceof type;
|
||||
}, "instanceOf(" + (functionName(type) || objectToString(type)) + ")");
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a property matcher
|
||||
*
|
||||
* @private
|
||||
* @param {Function} propertyTest A function to test the property against a value
|
||||
* @param {string} messagePrefix A prefix to use for messages generated by the matcher
|
||||
* @returns {object} A matcher
|
||||
*/
|
||||
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 createMatcher(function(actual) {
|
||||
if (
|
||||
actual === undefined ||
|
||||
actual === null ||
|
||||
!propertyTest(actual, property)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return onlyProperty || deepEqual(actual[property], value);
|
||||
}, message);
|
||||
};
|
||||
}
|
||||
|
||||
createMatcher.has = createPropertyMatcher(function(actual, property) {
|
||||
if (typeof actual === "object") {
|
||||
return property in actual;
|
||||
}
|
||||
return actual[property] !== undefined;
|
||||
}, "has");
|
||||
|
||||
createMatcher.hasOwn = createPropertyMatcher(function(actual, property) {
|
||||
return hasOwnProperty(actual, property);
|
||||
}, "hasOwn");
|
||||
|
||||
createMatcher.hasNested = function(property, value) {
|
||||
assertType(property, "string", "property");
|
||||
var onlyProperty = arguments.length === 1;
|
||||
var message = 'hasNested("' + property + '"';
|
||||
if (!onlyProperty) {
|
||||
message += ", " + valueToString(value);
|
||||
}
|
||||
message += ")";
|
||||
return createMatcher(function(actual) {
|
||||
if (
|
||||
actual === undefined ||
|
||||
actual === null ||
|
||||
get(actual, property) === undefined
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
return onlyProperty || deepEqual(get(actual, property), value);
|
||||
}, message);
|
||||
};
|
||||
|
||||
createMatcher.every = function(predicate) {
|
||||
assertMatcher(predicate);
|
||||
|
||||
return createMatcher(function(actual) {
|
||||
if (typeOf(actual) === "object") {
|
||||
return every(Object.keys(actual), function(key) {
|
||||
return predicate.test(actual[key]);
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
isIterable(actual) &&
|
||||
every(actual, function(element) {
|
||||
return predicate.test(element);
|
||||
})
|
||||
);
|
||||
}, "every(" + predicate.message + ")");
|
||||
};
|
||||
|
||||
createMatcher.some = function(predicate) {
|
||||
assertMatcher(predicate);
|
||||
|
||||
return createMatcher(function(actual) {
|
||||
if (typeOf(actual) === "object") {
|
||||
return !every(Object.keys(actual), function(key) {
|
||||
return !predicate.test(actual[key]);
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
isIterable(actual) &&
|
||||
!every(actual, function(element) {
|
||||
return !predicate.test(element);
|
||||
})
|
||||
);
|
||||
}, "some(" + predicate.message + ")");
|
||||
};
|
||||
|
||||
createMatcher.array = createMatcher.typeOf("array");
|
||||
|
||||
createMatcher.array.deepEquals = function(expectation) {
|
||||
return createMatcher(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"
|
||||
? createMatcher.array.deepEquals(expected).test(element)
|
||||
: deepEqual(expected, element);
|
||||
})
|
||||
);
|
||||
}, "deepEquals([" + iterableToString(expectation) + "])");
|
||||
};
|
||||
|
||||
createMatcher.array.startsWith = function(expectation) {
|
||||
return createMatcher(function(actual) {
|
||||
return (
|
||||
typeOf(actual) === "array" &&
|
||||
every(expectation, function(expectedElement, index) {
|
||||
return actual[index] === expectedElement;
|
||||
})
|
||||
);
|
||||
}, "startsWith([" + iterableToString(expectation) + "])");
|
||||
};
|
||||
|
||||
createMatcher.array.endsWith = function(expectation) {
|
||||
return createMatcher(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) + "])");
|
||||
};
|
||||
|
||||
createMatcher.array.contains = function(expectation) {
|
||||
return createMatcher(function(actual) {
|
||||
return (
|
||||
typeOf(actual) === "array" &&
|
||||
every(expectation, function(expectedElement) {
|
||||
return arrayIndexOf(actual, expectedElement) !== -1;
|
||||
})
|
||||
);
|
||||
}, "contains([" + iterableToString(expectation) + "])");
|
||||
};
|
||||
|
||||
createMatcher.map = createMatcher.typeOf("map");
|
||||
|
||||
createMatcher.map.deepEquals = function mapDeepEquals(expectation) {
|
||||
return createMatcher(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) + "])");
|
||||
};
|
||||
|
||||
createMatcher.map.contains = function mapContains(expectation) {
|
||||
return createMatcher(function(actual) {
|
||||
return (
|
||||
typeOf(actual) === "map" &&
|
||||
every(expectation, function(element, key) {
|
||||
return actual.has(key) && actual.get(key) === element;
|
||||
})
|
||||
);
|
||||
}, "contains(Map[" + iterableToString(expectation) + "])");
|
||||
};
|
||||
|
||||
createMatcher.set = createMatcher.typeOf("set");
|
||||
|
||||
createMatcher.set.deepEquals = function setDeepEquals(expectation) {
|
||||
return createMatcher(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) + "])");
|
||||
};
|
||||
|
||||
createMatcher.set.contains = function setContains(expectation) {
|
||||
return createMatcher(function(actual) {
|
||||
return (
|
||||
typeOf(actual) === "set" &&
|
||||
every(expectation, function(element) {
|
||||
return actual.has(element);
|
||||
})
|
||||
);
|
||||
}, "contains(Set[" + iterableToString(expectation) + "])");
|
||||
};
|
||||
|
||||
createMatcher.bool = createMatcher.typeOf("boolean");
|
||||
createMatcher.number = createMatcher.typeOf("number");
|
||||
createMatcher.string = createMatcher.typeOf("string");
|
||||
createMatcher.object = createMatcher.typeOf("object");
|
||||
createMatcher.func = createMatcher.typeOf("function");
|
||||
createMatcher.regexp = createMatcher.typeOf("regexp");
|
||||
createMatcher.date = createMatcher.typeOf("date");
|
||||
createMatcher.symbol = createMatcher.typeOf("symbol");
|
||||
|
||||
module.exports = createMatcher;
|
||||
17
node_modules/@sinonjs/samsam/lib/create-matcher/assert-matcher.js
generated
vendored
Normal file
17
node_modules/@sinonjs/samsam/lib/create-matcher/assert-matcher.js
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
"use strict";
|
||||
|
||||
var isMatcher = require("./is-matcher");
|
||||
|
||||
/**
|
||||
* Throws a TypeError when `value` is not a matcher
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to examine
|
||||
*/
|
||||
function assertMatcher(value) {
|
||||
if (!isMatcher(value)) {
|
||||
throw new TypeError("Matcher expected");
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = assertMatcher;
|
||||
21
node_modules/@sinonjs/samsam/lib/create-matcher/assert-method-exists.js
generated
vendored
Normal file
21
node_modules/@sinonjs/samsam/lib/create-matcher/assert-method-exists.js
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
"use strict";
|
||||
|
||||
/**
|
||||
* Throws a TypeError when expected method doesn't exist
|
||||
*
|
||||
* @private
|
||||
* @param {*} value A value to examine
|
||||
* @param {string} method The name of the method to look for
|
||||
* @param {name} name A name to use for the error message
|
||||
* @param {string} methodPath The name of the method to use for error messages
|
||||
* @throws {TypeError} When the method doesn't exist
|
||||
*/
|
||||
function assertMethodExists(value, method, name, methodPath) {
|
||||
if (value[method] === null || value[method] === undefined) {
|
||||
throw new TypeError(
|
||||
"Expected " + name + " to have method " + methodPath
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = assertMethodExists;
|
||||
29
node_modules/@sinonjs/samsam/lib/create-matcher/assert-type.js
generated
vendored
Normal file
29
node_modules/@sinonjs/samsam/lib/create-matcher/assert-type.js
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
"use strict";
|
||||
|
||||
var typeOf = require("@sinonjs/commons").typeOf;
|
||||
|
||||
/**
|
||||
* Ensures that value is of type
|
||||
*
|
||||
* @private
|
||||
* @param {*} value A value to examine
|
||||
* @param {string} type A basic JavaScript type to compare to, e.g. "object", "string"
|
||||
* @param {string} name A string to use for the error message
|
||||
* @throws {TypeError} If value is not of the expected type
|
||||
* @returns {undefined}
|
||||
*/
|
||||
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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = assertType;
|
||||
16
node_modules/@sinonjs/samsam/lib/create-matcher/is-iterable.js
generated
vendored
Normal file
16
node_modules/@sinonjs/samsam/lib/create-matcher/is-iterable.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
"use strict";
|
||||
|
||||
var typeOf = require("@sinonjs/commons").typeOf;
|
||||
|
||||
/**
|
||||
* Returns `true` for iterables
|
||||
*
|
||||
* @private
|
||||
* @param {*} value A value to examine
|
||||
* @returns {boolean} Returns `true` when `value` looks like an iterable
|
||||
*/
|
||||
function isIterable(value) {
|
||||
return Boolean(value) && typeOf(value.forEach) === "function";
|
||||
}
|
||||
|
||||
module.exports = isIterable;
|
||||
18
node_modules/@sinonjs/samsam/lib/create-matcher/is-matcher.js
generated
vendored
Normal file
18
node_modules/@sinonjs/samsam/lib/create-matcher/is-matcher.js
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
"use strict";
|
||||
|
||||
var isPrototypeOf = require("@sinonjs/commons").prototypes.object.isPrototypeOf;
|
||||
|
||||
var matcherPrototype = require("./matcher-prototype");
|
||||
|
||||
/**
|
||||
* Returns `true` when `object` is a matcher
|
||||
*
|
||||
* @private
|
||||
* @param {*} object A value to examine
|
||||
* @returns {boolean} Returns `true` when `object` is a matcher
|
||||
*/
|
||||
function isMatcher(object) {
|
||||
return isPrototypeOf(matcherPrototype, object);
|
||||
}
|
||||
|
||||
module.exports = isMatcher;
|
||||
44
node_modules/@sinonjs/samsam/lib/create-matcher/match-object.js
generated
vendored
Normal file
44
node_modules/@sinonjs/samsam/lib/create-matcher/match-object.js
generated
vendored
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
"use strict";
|
||||
|
||||
var every = require("@sinonjs/commons").prototypes.array.every;
|
||||
var typeOf = require("@sinonjs/commons").typeOf;
|
||||
|
||||
var deepEqualFactory = require("../deep-equal").use;
|
||||
|
||||
var isMatcher = require("./is-matcher");
|
||||
/**
|
||||
* Matches `actual` with `expectation`
|
||||
*
|
||||
* @private
|
||||
* @param {*} actual A value to examine
|
||||
* @param {object} expectation An object with properties to match on
|
||||
* @param {object} matcher A matcher to use for comparison
|
||||
* @returns {boolean} Returns true when `actual` matches all properties in `expectation`
|
||||
*/
|
||||
function matchObject(actual, expectation, matcher) {
|
||||
var deepEqual = deepEqualFactory(matcher);
|
||||
if (actual === null || actual === undefined) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return every(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, matcher)) {
|
||||
return false;
|
||||
}
|
||||
} else if (!deepEqual(act, exp)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = matchObject;
|
||||
49
node_modules/@sinonjs/samsam/lib/create-matcher/matcher-prototype.js
generated
vendored
Normal file
49
node_modules/@sinonjs/samsam/lib/create-matcher/matcher-prototype.js
generated
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
"use strict";
|
||||
|
||||
var matcherPrototype = {
|
||||
toString: function() {
|
||||
return this.message;
|
||||
}
|
||||
};
|
||||
|
||||
matcherPrototype.or = function(valueOrMatcher) {
|
||||
var createMatcher = require("../create-matcher");
|
||||
var isMatcher = createMatcher.isMatcher;
|
||||
|
||||
if (!arguments.length) {
|
||||
throw new TypeError("Matcher expected");
|
||||
}
|
||||
|
||||
var m2 = isMatcher(valueOrMatcher)
|
||||
? valueOrMatcher
|
||||
: createMatcher(valueOrMatcher);
|
||||
var m1 = this;
|
||||
var or = Object.create(matcherPrototype);
|
||||
or.test = function(actual) {
|
||||
return m1.test(actual) || m2.test(actual);
|
||||
};
|
||||
or.message = m1.message + ".or(" + m2.message + ")";
|
||||
return or;
|
||||
};
|
||||
|
||||
matcherPrototype.and = function(valueOrMatcher) {
|
||||
var createMatcher = require("../create-matcher");
|
||||
var isMatcher = createMatcher.isMatcher;
|
||||
|
||||
if (!arguments.length) {
|
||||
throw new TypeError("Matcher expected");
|
||||
}
|
||||
|
||||
var m2 = isMatcher(valueOrMatcher)
|
||||
? valueOrMatcher
|
||||
: createMatcher(valueOrMatcher);
|
||||
var m1 = this;
|
||||
var and = Object.create(matcherPrototype);
|
||||
and.test = function(actual) {
|
||||
return m1.test(actual) && m2.test(actual);
|
||||
};
|
||||
and.message = m1.message + ".and(" + m2.message + ")";
|
||||
return and;
|
||||
};
|
||||
|
||||
module.exports = matcherPrototype;
|
||||
62
node_modules/@sinonjs/samsam/lib/create-matcher/type-map.js
generated
vendored
Normal file
62
node_modules/@sinonjs/samsam/lib/create-matcher/type-map.js
generated
vendored
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
"use strict";
|
||||
|
||||
var functionName = require("@sinonjs/commons").functionName;
|
||||
var join = require("@sinonjs/commons").prototypes.array.join;
|
||||
var map = require("@sinonjs/commons").prototypes.array.map;
|
||||
var stringIndexOf = require("@sinonjs/commons").prototypes.string.indexOf;
|
||||
var valueToString = require("@sinonjs/commons").valueToString;
|
||||
|
||||
var matchObject = require("./match-object");
|
||||
|
||||
var createTypeMap = function(match) {
|
||||
return {
|
||||
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, match);
|
||||
};
|
||||
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 + '")';
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = createTypeMap;
|
||||
34
node_modules/@sinonjs/samsam/lib/create-set.js
generated
vendored
Normal file
34
node_modules/@sinonjs/samsam/lib/create-set.js
generated
vendored
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
"use strict";
|
||||
|
||||
var typeOf = require("@sinonjs/commons").typeOf;
|
||||
var forEach = require("@sinonjs/commons").prototypes.array.forEach;
|
||||
|
||||
/**
|
||||
* This helper makes it convenient to create Set instances from a
|
||||
* collection, an overcomes the shortcoming that IE11 doesn't support
|
||||
* collection arguments
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array An array to create a set from
|
||||
* @returns {Set} A set (unique) containing the members from array
|
||||
*
|
||||
* @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();
|
||||
|
||||
forEach(items, 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 });
|
||||
260
node_modules/@sinonjs/samsam/lib/deep-equal.js
generated
vendored
Normal file
260
node_modules/@sinonjs/samsam/lib/deep-equal.js
generated
vendored
Normal file
|
|
@ -0,0 +1,260 @@
|
|||
"use strict";
|
||||
|
||||
var valueToString = require("@sinonjs/commons").valueToString;
|
||||
var className = require("@sinonjs/commons").className;
|
||||
var typeOf = require("@sinonjs/commons").typeOf;
|
||||
var arrayProto = require("@sinonjs/commons").prototypes.array;
|
||||
var objectProto = require("@sinonjs/commons").prototypes.object;
|
||||
var mapForEach = require("@sinonjs/commons").prototypes.map.forEach;
|
||||
|
||||
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 isMap = require("./is-map");
|
||||
var isNaN = require("./is-nan");
|
||||
var isObject = require("./is-object");
|
||||
var isSet = require("./is-set");
|
||||
var isSubset = require("./is-subset");
|
||||
|
||||
var concat = arrayProto.concat;
|
||||
var every = arrayProto.every;
|
||||
var push = arrayProto.push;
|
||||
|
||||
var getTime = Date.prototype.getTime;
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
var indexOf = arrayProto.indexOf;
|
||||
var keys = Object.keys;
|
||||
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
||||
|
||||
/**
|
||||
* Deep equal comparison. Two values are "deep equal" when:
|
||||
*
|
||||
* - 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.
|
||||
*
|
||||
* @alias module:samsam.deepEqual
|
||||
* @param {*} actual The object to examine
|
||||
* @param {*} expectation The object actual is expected to be equal to
|
||||
* @param {object} match A value to match on
|
||||
* @returns {boolean} Returns true when actual and expectation are considered equal
|
||||
*/
|
||||
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
|
||||
// eslint-disable-next-line complexity
|
||||
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;
|
||||
|
||||
if (
|
||||
actualObj === expectationObj ||
|
||||
isNaN(actualObj) ||
|
||||
isNaN(expectationObj) ||
|
||||
actualObj === null ||
|
||||
expectationObj === null ||
|
||||
actualObj === undefined ||
|
||||
expectationObj === undefined ||
|
||||
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 = className(actualObj);
|
||||
var expectationName = className(expectationObj);
|
||||
var expectationSymbols =
|
||||
typeOf(getOwnPropertySymbols) === "function"
|
||||
? getOwnPropertySymbols(expectationObj)
|
||||
: /* istanbul ignore next: cannot collect coverage for engine that doesn't support Symbol */
|
||||
[];
|
||||
var expectationKeysAndSymbols = concat(
|
||||
expectationKeys,
|
||||
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);
|
||||
}
|
||||
|
||||
if (isMap(actualObj) || isMap(expectationObj)) {
|
||||
if (
|
||||
!isMap(actualObj) ||
|
||||
!isMap(expectationObj) ||
|
||||
actualObj.size !== expectationObj.size
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var mapsDeeplyEqual = true;
|
||||
mapForEach(actualObj, function(value, key) {
|
||||
mapsDeeplyEqual =
|
||||
mapsDeeplyEqual &&
|
||||
deepEqualCyclic(value, expectationObj.get(key));
|
||||
});
|
||||
|
||||
return mapsDeeplyEqual;
|
||||
}
|
||||
|
||||
return every(expectationKeysAndSymbols, function(key) {
|
||||
if (!hasOwnProperty(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(actualObjects, actualValue)
|
||||
: -1;
|
||||
var expectationIndex = expectationObject
|
||||
? indexOf(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) {
|
||||
push(actualObjects, actualValue);
|
||||
push(actualPaths, newActualPath);
|
||||
}
|
||||
if (expectationIndex === -1 && expectationObject) {
|
||||
push(expectationObjects, expectationValue);
|
||||
push(expectationPaths, 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 deepEqual(a, b) {
|
||||
return deepEqualCyclic(a, b, match);
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = deepEqualCyclic;
|
||||
18
node_modules/@sinonjs/samsam/lib/get-class.js
generated
vendored
Normal file
18
node_modules/@sinonjs/samsam/lib/get-class.js
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
"use strict";
|
||||
|
||||
var toString = require("@sinonjs/commons").prototypes.object.toString;
|
||||
|
||||
/**
|
||||
* 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"
|
||||
*
|
||||
* @private
|
||||
* @param {*} value - Any value
|
||||
* @returns {string} - A string representation of the `Class` of `value`
|
||||
*/
|
||||
function getClass(value) {
|
||||
return toString(value).split(/[ \]]/)[1];
|
||||
}
|
||||
|
||||
module.exports = getClass;
|
||||
31
node_modules/@sinonjs/samsam/lib/identical.js
generated
vendored
Normal file
31
node_modules/@sinonjs/samsam/lib/identical.js
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
"use strict";
|
||||
|
||||
var isNaN = require("./is-nan");
|
||||
var isNegZero = require("./is-neg-zero");
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @alias module:samsam.identical
|
||||
* @param {*} obj1 The first value to compare
|
||||
* @param {*} obj2 The second value to compare
|
||||
* @returns {boolean} Returns `true` when the objects are *egal*, `false` otherwise
|
||||
*/
|
||||
function identical(obj1, obj2) {
|
||||
if (obj1 === obj2 || (isNaN(obj1) && isNaN(obj2))) {
|
||||
return obj1 !== 0 || isNegZero(obj1) === isNegZero(obj2);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
module.exports = identical;
|
||||
16
node_modules/@sinonjs/samsam/lib/is-arguments.js
generated
vendored
Normal file
16
node_modules/@sinonjs/samsam/lib/is-arguments.js
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
"use strict";
|
||||
|
||||
var getClass = require("./get-class");
|
||||
|
||||
/**
|
||||
* Returns `true` when `object` is an `arguments` object, `false` otherwise
|
||||
*
|
||||
* @alias module:samsam.isArguments
|
||||
* @param {*} object - The object to examine
|
||||
* @returns {boolean} `true` when `object` is an `arguments` object
|
||||
*/
|
||||
function isArguments(object) {
|
||||
return getClass(object) === "Arguments";
|
||||
}
|
||||
|
||||
module.exports = isArguments;
|
||||
20
node_modules/@sinonjs/samsam/lib/is-array-type.js
generated
vendored
Normal file
20
node_modules/@sinonjs/samsam/lib/is-array-type.js
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
"use strict";
|
||||
|
||||
var functionName = require("@sinonjs/commons").functionName;
|
||||
var indexOf = require("@sinonjs/commons").prototypes.array.indexOf;
|
||||
var map = require("@sinonjs/commons").prototypes.array.map;
|
||||
var ARRAY_TYPES = require("./array-types");
|
||||
var type = require("type-detect");
|
||||
|
||||
/**
|
||||
* Returns `true` when `object` is an array type, `false` otherwise
|
||||
*
|
||||
* @param {*} object - The object to examine
|
||||
* @returns {boolean} `true` when `object` is an array type
|
||||
* @private
|
||||
*/
|
||||
function isArrayType(object) {
|
||||
return indexOf(map(ARRAY_TYPES, functionName), type(object)) !== -1;
|
||||
}
|
||||
|
||||
module.exports = isArrayType;
|
||||
14
node_modules/@sinonjs/samsam/lib/is-date.js
generated
vendored
Normal file
14
node_modules/@sinonjs/samsam/lib/is-date.js
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
"use strict";
|
||||
|
||||
/**
|
||||
* Returns `true` when `value` is an instance of Date
|
||||
*
|
||||
* @private
|
||||
* @param {Date} value The value to examine
|
||||
* @returns {boolean} `true` when `value` is an instance of Date
|
||||
*/
|
||||
function isDate(value) {
|
||||
return value instanceof Date;
|
||||
}
|
||||
|
||||
module.exports = isDate;
|
||||
29
node_modules/@sinonjs/samsam/lib/is-element.js
generated
vendored
Normal file
29
node_modules/@sinonjs/samsam/lib/is-element.js
generated
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
"use strict";
|
||||
|
||||
var div = typeof document !== "undefined" && document.createElement("div");
|
||||
|
||||
/**
|
||||
* Returns `true` when `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`.
|
||||
*
|
||||
* @alias module:samsam.isElement
|
||||
* @param {object} object The object to examine
|
||||
* @returns {boolean} Returns `true` for DOM element nodes
|
||||
*/
|
||||
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;
|
||||
14
node_modules/@sinonjs/samsam/lib/is-map.js
generated
vendored
Normal file
14
node_modules/@sinonjs/samsam/lib/is-map.js
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
"use strict";
|
||||
|
||||
/**
|
||||
* Returns `true` when `value` is a Map
|
||||
*
|
||||
* @param {*} value A value to examine
|
||||
* @returns {boolean} `true` when `value` is an instance of `Map`, `false` otherwise
|
||||
* @private
|
||||
*/
|
||||
function isMap(value) {
|
||||
return typeof Map !== "undefined" && value instanceof Map;
|
||||
}
|
||||
|
||||
module.exports = isMap;
|
||||
19
node_modules/@sinonjs/samsam/lib/is-nan.js
generated
vendored
Normal file
19
node_modules/@sinonjs/samsam/lib/is-nan.js
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
"use strict";
|
||||
|
||||
/**
|
||||
* Compares a `value` to `NaN`
|
||||
*
|
||||
* @private
|
||||
* @param {*} value A value to examine
|
||||
* @returns {boolean} Returns `true` when `value` is `NaN`
|
||||
*/
|
||||
function isNaN(value) {
|
||||
// Unlike global `isNaN`, this function avoids type coercion
|
||||
// `typeof` check avoids IE host object issues, hat tip to
|
||||
// lodash
|
||||
|
||||
// eslint-disable-next-line no-self-compare
|
||||
return typeof value === "number" && value !== value;
|
||||
}
|
||||
|
||||
module.exports = isNaN;
|
||||
14
node_modules/@sinonjs/samsam/lib/is-neg-zero.js
generated
vendored
Normal file
14
node_modules/@sinonjs/samsam/lib/is-neg-zero.js
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
"use strict";
|
||||
|
||||
/**
|
||||
* Returns `true` when `value` is `-0`
|
||||
*
|
||||
* @alias module:samsam.isNegZero
|
||||
* @param {*} value A value to examine
|
||||
* @returns {boolean} Returns `true` when `value` is `-0`
|
||||
*/
|
||||
function isNegZero(value) {
|
||||
return value === 0 && 1 / value === -Infinity;
|
||||
}
|
||||
|
||||
module.exports = isNegZero;
|
||||
31
node_modules/@sinonjs/samsam/lib/is-object.js
generated
vendored
Normal file
31
node_modules/@sinonjs/samsam/lib/is-object.js
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
"use strict";
|
||||
|
||||
/**
|
||||
* Returns `true` when the value is a regular Object and not a specialized Object
|
||||
*
|
||||
* This helps speed 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
|
||||
*
|
||||
* @private
|
||||
* @param {object} value The object to examine
|
||||
* @returns {boolean} `true` when the object is a non-specialised object
|
||||
*/
|
||||
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;
|
||||
14
node_modules/@sinonjs/samsam/lib/is-set.js
generated
vendored
Normal file
14
node_modules/@sinonjs/samsam/lib/is-set.js
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
"use strict";
|
||||
|
||||
/**
|
||||
* Returns `true` when the argument is an instance of Set, `false` otherwise
|
||||
*
|
||||
* @alias module:samsam.isSet
|
||||
* @param {*} val - A value to examine
|
||||
* @returns {boolean} Returns `true` when the argument is an instance of Set, `false` otherwise
|
||||
*/
|
||||
function isSet(val) {
|
||||
return (typeof Set !== "undefined" && val instanceof Set) || false;
|
||||
}
|
||||
|
||||
module.exports = isSet;
|
||||
30
node_modules/@sinonjs/samsam/lib/is-subset.js
generated
vendored
Normal file
30
node_modules/@sinonjs/samsam/lib/is-subset.js
generated
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
"use strict";
|
||||
|
||||
var forEach = require("@sinonjs/commons").prototypes.set.forEach;
|
||||
|
||||
/**
|
||||
* Returns `true` when `s1` is a subset of `s2`, `false` otherwise
|
||||
*
|
||||
* @private
|
||||
* @param {Array|Set} s1 The target value
|
||||
* @param {Array|Set} s2 The containing value
|
||||
* @param {Function} compare A comparison function, should return `true` when
|
||||
* values are considered equal
|
||||
* @returns {boolean} Returns `true` when `s1` is a subset of `s2`, `false`` otherwise
|
||||
*/
|
||||
function isSubset(s1, s2, compare) {
|
||||
var allContained = true;
|
||||
forEach(s1, function(v1) {
|
||||
var includes = false;
|
||||
forEach(s2, function(v2) {
|
||||
if (compare(v2, v1)) {
|
||||
includes = true;
|
||||
}
|
||||
});
|
||||
allContained = allContained && includes;
|
||||
});
|
||||
|
||||
return allContained;
|
||||
}
|
||||
|
||||
module.exports = isSubset;
|
||||
71
node_modules/@sinonjs/samsam/lib/iterable-to-string.js
generated
vendored
Normal file
71
node_modules/@sinonjs/samsam/lib/iterable-to-string.js
generated
vendored
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
"use strict";
|
||||
|
||||
var slice = require("@sinonjs/commons").prototypes.string.slice;
|
||||
var typeOf = require("@sinonjs/commons").typeOf;
|
||||
var valueToString = require("@sinonjs/commons").valueToString;
|
||||
|
||||
/**
|
||||
* Creates a string represenation of an iterable object
|
||||
*
|
||||
* @private
|
||||
* @param {object} obj The iterable object to stringify
|
||||
* @returns {string} A string representation
|
||||
*/
|
||||
function iterableToString(obj) {
|
||||
if (typeOf(obj) === "map") {
|
||||
return mapToString(obj);
|
||||
}
|
||||
|
||||
return genericIterableToString(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a string representation of a Map
|
||||
*
|
||||
* @private
|
||||
* @param {Map} map The map to stringify
|
||||
* @returns {string} A string representation
|
||||
*/
|
||||
function mapToString(map) {
|
||||
var representation = "";
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a string represenation for an iterable
|
||||
*
|
||||
* @private
|
||||
* @param {object} iterable The iterable to stringify
|
||||
* @returns {string} A string representation
|
||||
*/
|
||||
function genericIterableToString(iterable) {
|
||||
var representation = "";
|
||||
|
||||
/* eslint-disable-next-line local-rules/no-prototype-methods */
|
||||
iterable.forEach(function(value) {
|
||||
representation += stringify(value) + ",";
|
||||
});
|
||||
|
||||
representation = slice(representation, 0, -1);
|
||||
return representation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a string representation of the passed `item`
|
||||
*
|
||||
* @private
|
||||
* @param {object} item The item to stringify
|
||||
* @returns {string} A string representation of `item`
|
||||
*/
|
||||
function stringify(item) {
|
||||
return typeof item === "string" ? "'" + item + "'" : valueToString(item);
|
||||
}
|
||||
|
||||
module.exports = iterableToString;
|
||||
174
node_modules/@sinonjs/samsam/lib/match.js
generated
vendored
Normal file
174
node_modules/@sinonjs/samsam/lib/match.js
generated
vendored
Normal file
|
|
@ -0,0 +1,174 @@
|
|||
"use strict";
|
||||
|
||||
var valueToString = require("@sinonjs/commons").valueToString;
|
||||
var indexOf = require("@sinonjs/commons").prototypes.string.indexOf;
|
||||
var forEach = require("@sinonjs/commons").prototypes.array.forEach;
|
||||
var type = require("type-detect");
|
||||
|
||||
var engineCanCompareMaps = typeof Array.from === "function";
|
||||
var deepEqual = require("./deep-equal").use(match); // eslint-disable-line no-use-before-define
|
||||
var isArrayType = require("./is-array-type");
|
||||
var isSubset = require("./is-subset");
|
||||
var createMatcher = require("./create-matcher");
|
||||
|
||||
/**
|
||||
* Returns true when `array` contains all of `subset` as defined by the `compare`
|
||||
* argument
|
||||
*
|
||||
* @param {Array} array An array to search for a subset
|
||||
* @param {Array} subset The subset to find in the array
|
||||
* @param {Function} compare A comparison function
|
||||
* @returns {boolean} [description]
|
||||
* @private
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/* eslint-disable complexity */
|
||||
/**
|
||||
* Matches an object with a matcher (or value)
|
||||
*
|
||||
* @alias module:samsam.match
|
||||
* @param {object} object The object candidate to match
|
||||
* @param {object} matcherOrValue A matcher or value to match against
|
||||
* @returns {boolean} true when `object` matches `matcherOrValue`
|
||||
*/
|
||||
function match(object, matcherOrValue) {
|
||||
if (matcherOrValue && typeof matcherOrValue.test === "function") {
|
||||
return matcherOrValue.test(object);
|
||||
}
|
||||
|
||||
switch (type(matcherOrValue)) {
|
||||
case "bigint":
|
||||
case "boolean":
|
||||
case "number":
|
||||
case "symbol":
|
||||
return matcherOrValue === object;
|
||||
case "function":
|
||||
return matcherOrValue(object) === true;
|
||||
case "string":
|
||||
var notNull = typeof object === "string" || Boolean(object);
|
||||
return (
|
||||
notNull &&
|
||||
indexOf(
|
||||
valueToString(object).toLowerCase(),
|
||||
matcherOrValue.toLowerCase()
|
||||
) >= 0
|
||||
);
|
||||
case "null":
|
||||
return object === null;
|
||||
case "undefined":
|
||||
return typeof object === "undefined";
|
||||
case "Date":
|
||||
/* istanbul ignore else */
|
||||
if (type(object) === "Date") {
|
||||
return object.getTime() === matcherOrValue.getTime();
|
||||
}
|
||||
/* istanbul ignore next: this is basically the rest of the function, which is covered */
|
||||
break;
|
||||
case "Array":
|
||||
case "Int8Array":
|
||||
case "Uint8Array":
|
||||
case "Uint8ClampedArray":
|
||||
case "Int16Array":
|
||||
case "Uint16Array":
|
||||
case "Int32Array":
|
||||
case "Uint32Array":
|
||||
case "Float32Array":
|
||||
case "Float64Array":
|
||||
return (
|
||||
isArrayType(matcherOrValue) &&
|
||||
arrayContains(object, matcherOrValue, match)
|
||||
);
|
||||
case "Map":
|
||||
/* istanbul ignore next: this is covered by a test, that is only run in IE, but we collect coverage information in node*/
|
||||
if (!engineCanCompareMaps) {
|
||||
throw new Error(
|
||||
"The JavaScript engine does not support Array.from and cannot reliably do value comparison of Map instances"
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
type(object) === "Map" &&
|
||||
arrayContains(
|
||||
Array.from(object),
|
||||
Array.from(matcherOrValue),
|
||||
match
|
||||
)
|
||||
);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (type(object)) {
|
||||
case "null":
|
||||
return false;
|
||||
case "Set":
|
||||
return isSubset(matcherOrValue, object, match);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* istanbul ignore else */
|
||||
if (matcherOrValue && typeof matcherOrValue === "object") {
|
||||
if (matcherOrValue === object) {
|
||||
return true;
|
||||
}
|
||||
if (typeof object !== "object") {
|
||||
return false;
|
||||
}
|
||||
var prop;
|
||||
// eslint-disable-next-line guard-for-in
|
||||
for (prop in matcherOrValue) {
|
||||
var value = object[prop];
|
||||
if (
|
||||
typeof value === "undefined" &&
|
||||
typeof object.getAttribute === "function"
|
||||
) {
|
||||
value = object.getAttribute(prop);
|
||||
}
|
||||
if (
|
||||
matcherOrValue[prop] === null ||
|
||||
typeof matcherOrValue[prop] === "undefined"
|
||||
) {
|
||||
if (value !== matcherOrValue[prop]) {
|
||||
return false;
|
||||
}
|
||||
} else if (
|
||||
typeof value === "undefined" ||
|
||||
!deepEqual(value, matcherOrValue[prop])
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* istanbul ignore next */
|
||||
throw new Error("Matcher was an unknown or unsupported type");
|
||||
}
|
||||
/* eslint-enable complexity */
|
||||
|
||||
forEach(Object.keys(createMatcher), function(key) {
|
||||
match[key] = createMatcher[key];
|
||||
});
|
||||
|
||||
module.exports = match;
|
||||
26
node_modules/@sinonjs/samsam/lib/samsam.js
generated
vendored
Normal file
26
node_modules/@sinonjs/samsam/lib/samsam.js
generated
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
"use strict";
|
||||
|
||||
/**
|
||||
* @module samsam
|
||||
*/
|
||||
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 isMap = require("./is-map");
|
||||
var match = require("./match");
|
||||
var deepEqualCyclic = require("./deep-equal").use(match);
|
||||
var createMatcher = require("./create-matcher");
|
||||
|
||||
module.exports = {
|
||||
createMatcher: createMatcher,
|
||||
deepEqual: deepEqualCyclic,
|
||||
identical: identical,
|
||||
isArguments: isArguments,
|
||||
isElement: isElement,
|
||||
isMap: isMap,
|
||||
isNegZero: isNegZero,
|
||||
isSet: isSet,
|
||||
match: match
|
||||
};
|
||||
123
node_modules/@sinonjs/samsam/package.json
generated
vendored
Normal file
123
node_modules/@sinonjs/samsam/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
{
|
||||
"_from": "@sinonjs/samsam@^5.0.3",
|
||||
"_id": "@sinonjs/samsam@5.0.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-QucHkc2uMJ0pFGjJUDP3F9dq5dx8QIaqISl9QgwLOh6P9yv877uONPGXh/OH/0zmM3tW1JjuJltAZV2l7zU+uQ==",
|
||||
"_location": "/@sinonjs/samsam",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@sinonjs/samsam@^5.0.3",
|
||||
"name": "@sinonjs/samsam",
|
||||
"escapedName": "@sinonjs%2fsamsam",
|
||||
"scope": "@sinonjs",
|
||||
"rawSpec": "^5.0.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^5.0.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@sinonjs/formatio",
|
||||
"/sinon"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-5.0.3.tgz",
|
||||
"_shasum": "86f21bdb3d52480faf0892a480c9906aa5a52938",
|
||||
"_spec": "@sinonjs/samsam@^5.0.3",
|
||||
"_where": "/Users/sam/code/codeql-action/node_modules/sinon",
|
||||
"author": {
|
||||
"name": "Christian Johansen"
|
||||
},
|
||||
"browser": {
|
||||
"jsdom": false,
|
||||
"jsdom-global": false
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sinonjs/samsam/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@sinonjs/commons": "^1.6.0",
|
||||
"lodash.get": "^4.4.2",
|
||||
"type-detect": "^4.0.8"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Value identification and comparison functions",
|
||||
"devDependencies": {
|
||||
"@sinonjs/referee": "^4.0.0",
|
||||
"@studio/changes": "^2.0.0",
|
||||
"benchmark": "2.1.4",
|
||||
"eslint": "^6.2.0",
|
||||
"eslint-config-prettier": "^6.1.0",
|
||||
"eslint-config-sinon": "^3.0.1",
|
||||
"eslint-plugin-ie11": "^1.0.0",
|
||||
"eslint-plugin-jsdoc": "^21.0.0",
|
||||
"eslint-plugin-local-rules": "^0.1.1",
|
||||
"eslint-plugin-mocha": "^6.0.0",
|
||||
"eslint-plugin-prettier": "^3.1.0",
|
||||
"husky": "^4.2.1",
|
||||
"jquery": "^3.4.1",
|
||||
"jsdoc": "^3.6.3",
|
||||
"jsdom": "^16.2.0",
|
||||
"jsdom-global": "^3.0.2",
|
||||
"lint-staged": "^10.0.7",
|
||||
"microtime": "3.0.0",
|
||||
"mkdirp": "^1.0.3",
|
||||
"mocha": "^7.0.1",
|
||||
"mochify": "^6.6.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"nyc": "^15.0.0",
|
||||
"prettier": "^1.18.2",
|
||||
"proxyquire": "^2.1.3",
|
||||
"proxyquire-universal": "^2.1.0",
|
||||
"proxyquireify": "^3.2.1",
|
||||
"rollup": "^1.23.0",
|
||||
"rollup-plugin-commonjs": "^10.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",
|
||||
"nyc": {
|
||||
"exclude": [
|
||||
"**/*.test.js",
|
||||
"coverage/**",
|
||||
"dist/**",
|
||||
"out/**",
|
||||
"site/**",
|
||||
"eslint-local-rules.js",
|
||||
"rollup.config.js",
|
||||
"lib/deep-equal-benchmark.js"
|
||||
]
|
||||
},
|
||||
"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",
|
||||
"build:dist-folder": "mkdirp dist",
|
||||
"jsdoc": "jsdoc -c jsdoc.conf.json",
|
||||
"lint": "eslint .",
|
||||
"postversion": "git push --follow-tags && npm publish --access public",
|
||||
"prepublishOnly": "npm run build && mkdocs gh-deploy -r upstream || mkdocs gh-deploy -r origin",
|
||||
"preversion": "npm run test-check-coverage",
|
||||
"test": "mocha ./lib/*.test.js",
|
||||
"test-check-coverage": "npm run test-coverage && nyc check-coverage --branches 100 --functions 100 --lines 100",
|
||||
"test-cloud": "npm run test-headless -- --wd",
|
||||
"test-coverage": "nyc --all --reporter text --reporter html --reporter lcovonly npm run test",
|
||||
"test-headless": "mochify --no-detect-globals --recursive -R dot --plugin [ proxyquire-universal ] \"./lib/*.test.js\"",
|
||||
"version": "changes --commits --footer"
|
||||
},
|
||||
"version": "5.0.3"
|
||||
}
|
||||
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/sam/code/codeql-action/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"
|
||||
}
|
||||
21
node_modules/just-extend/LICENSE
generated
vendored
Normal file
21
node_modules/just-extend/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 angus croll
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
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 OR COPYRIGHT HOLDERS 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.
|
||||
36
node_modules/just-extend/README.md
generated
vendored
Normal file
36
node_modules/just-extend/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
## just-extend
|
||||
|
||||
Part of a [library](../../../../) of zero-dependency npm modules that do just do one thing.
|
||||
Guilt-free utilities for every occasion.
|
||||
|
||||
[Try it now](http://anguscroll.com/just/just-extend)
|
||||
|
||||
```js
|
||||
import extend from 'just-extend';
|
||||
|
||||
var obj = {a: 3, b: 5};
|
||||
extend(obj, {a: 4, c: 8}); // {a: 4, b: 5, c: 8}
|
||||
obj; // {a: 4, b: 5, c: 8}
|
||||
|
||||
var obj = {a: 3, b: 5};
|
||||
extend({}, obj, {a: 4, c: 8}); // {a: 4, b: 5, c: 8}
|
||||
obj; // {a: 3, b: 5}
|
||||
|
||||
var arr = [1, 2, 3];
|
||||
var obj = {a: 3, b: 5};
|
||||
extend(obj, {c: arr}); // {a: 3, b: 5, c: [1, 2, 3]}
|
||||
arr.push(4);
|
||||
obj; // {a: 3, b: 5, c: [1, 2, 3, 4]}
|
||||
|
||||
var arr = [1, 2, 3];
|
||||
var obj = {a: 3, b: 5};
|
||||
extend(true, obj, {c: arr}); // {a: 3, b: 5, c: [1, 2, 3]}
|
||||
arr.push(4);
|
||||
obj; // {a: 3, b: 5, c: [1, 2, 3]}
|
||||
|
||||
extend({a: 4, b: 5}); // {a: 4, b: 5}
|
||||
extend({a: 4, b: 5}, 3); {a: 4, b: 5}
|
||||
extend({a: 4, b: 5}, true); {a: 4, b: 5}
|
||||
extend('hello', {a: 4, b: 5}); // throws
|
||||
extend(3, {a: 4, b: 5}); // throws
|
||||
```
|
||||
72
node_modules/just-extend/index.js
generated
vendored
Normal file
72
node_modules/just-extend/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
module.exports = extend;
|
||||
|
||||
/*
|
||||
var obj = {a: 3, b: 5};
|
||||
extend(obj, {a: 4, c: 8}); // {a: 4, b: 5, c: 8}
|
||||
obj; // {a: 4, b: 5, c: 8}
|
||||
|
||||
var obj = {a: 3, b: 5};
|
||||
extend({}, obj, {a: 4, c: 8}); // {a: 4, b: 5, c: 8}
|
||||
obj; // {a: 3, b: 5}
|
||||
|
||||
var arr = [1, 2, 3];
|
||||
var obj = {a: 3, b: 5};
|
||||
extend(obj, {c: arr}); // {a: 3, b: 5, c: [1, 2, 3]}
|
||||
arr.push(4);
|
||||
obj; // {a: 3, b: 5, c: [1, 2, 3, 4]}
|
||||
|
||||
var arr = [1, 2, 3];
|
||||
var obj = {a: 3, b: 5};
|
||||
extend(true, obj, {c: arr}); // {a: 3, b: 5, c: [1, 2, 3]}
|
||||
arr.push(4);
|
||||
obj; // {a: 3, b: 5, c: [1, 2, 3]}
|
||||
|
||||
extend({a: 4, b: 5}); // {a: 4, b: 5}
|
||||
extend({a: 4, b: 5}, 3); {a: 4, b: 5}
|
||||
extend({a: 4, b: 5}, true); {a: 4, b: 5}
|
||||
extend('hello', {a: 4, b: 5}); // throws
|
||||
extend(3, {a: 4, b: 5}); // throws
|
||||
*/
|
||||
|
||||
function extend(/* [deep], obj1, obj2, [objn] */) {
|
||||
var args = [].slice.call(arguments);
|
||||
var deep = false;
|
||||
if (typeof args[0] == 'boolean') {
|
||||
deep = args.shift();
|
||||
}
|
||||
var result = args[0];
|
||||
if (isUnextendable(result)) {
|
||||
throw new Error('extendee must be an object');
|
||||
}
|
||||
var extenders = args.slice(1);
|
||||
var len = extenders.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var extender = extenders[i];
|
||||
for (var key in extender) {
|
||||
if (extender.hasOwnProperty(key)) {
|
||||
var value = extender[key];
|
||||
if (deep && isCloneable(value)) {
|
||||
var base = Array.isArray(value) ? [] : {};
|
||||
result[key] = extend(
|
||||
true,
|
||||
result.hasOwnProperty(key) && !isUnextendable(result[key])
|
||||
? result[key]
|
||||
: base,
|
||||
value
|
||||
);
|
||||
} else {
|
||||
result[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function isCloneable(obj) {
|
||||
return Array.isArray(obj) || {}.toString.call(obj) == '[object Object]';
|
||||
}
|
||||
|
||||
function isUnextendable(val) {
|
||||
return !val || (typeof val != 'object' && typeof val != 'function');
|
||||
}
|
||||
57
node_modules/just-extend/package.json
generated
vendored
Normal file
57
node_modules/just-extend/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
"_from": "just-extend@^4.0.2",
|
||||
"_id": "just-extend@4.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-ApcjaOdVTJ7y4r08xI5wIqpvwS48Q0PBG4DJROcEkH1f8MdAiNFyFxz3xoL0LWAVwjrwPYZdVHHxhRHcx/uGLA==",
|
||||
"_location": "/just-extend",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "just-extend@^4.0.2",
|
||||
"name": "just-extend",
|
||||
"escapedName": "just-extend",
|
||||
"rawSpec": "^4.0.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^4.0.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/nise"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.1.0.tgz",
|
||||
"_shasum": "7278a4027d889601640ee0ce0e5a00b992467da4",
|
||||
"_spec": "just-extend@^4.0.2",
|
||||
"_where": "/Users/sam/code/codeql-action/node_modules/nise",
|
||||
"author": {
|
||||
"name": "Angus Croll"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/angus-c/just/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "extend an object",
|
||||
"homepage": "https://github.com/angus-c/just#readme",
|
||||
"keywords": [
|
||||
"object",
|
||||
"assign",
|
||||
"clone",
|
||||
"copy",
|
||||
"merge",
|
||||
"deep-copy",
|
||||
"extend",
|
||||
"no-dependencies",
|
||||
"just"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "just-extend",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/angus-c/just.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"version": "4.1.0"
|
||||
}
|
||||
47
node_modules/lodash.get/LICENSE
generated
vendored
Normal file
47
node_modules/lodash.get/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
||||
|
||||
Based on Underscore.js, copyright Jeremy Ashkenas,
|
||||
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
||||
|
||||
This software consists of voluntary contributions made by many
|
||||
individuals. For exact contribution history, see the revision history
|
||||
available at https://github.com/lodash/lodash
|
||||
|
||||
The following license applies to all parts of this software except as
|
||||
documented below:
|
||||
|
||||
====
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
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 OR COPYRIGHT HOLDERS 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.
|
||||
|
||||
====
|
||||
|
||||
Copyright and related rights for sample code are waived via CC0. Sample
|
||||
code is defined as all source code displayed within the prose of the
|
||||
documentation.
|
||||
|
||||
CC0: http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
====
|
||||
|
||||
Files located in the node_modules and vendor directories are externally
|
||||
maintained libraries used by this software which have their own
|
||||
licenses; we recommend you read them, as their terms may differ from the
|
||||
terms above.
|
||||
18
node_modules/lodash.get/README.md
generated
vendored
Normal file
18
node_modules/lodash.get/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# lodash.get v4.4.2
|
||||
|
||||
The [lodash](https://lodash.com/) method `_.get` exported as a [Node.js](https://nodejs.org/) module.
|
||||
|
||||
## Installation
|
||||
|
||||
Using npm:
|
||||
```bash
|
||||
$ {sudo -H} npm i -g npm
|
||||
$ npm i --save lodash.get
|
||||
```
|
||||
|
||||
In Node.js:
|
||||
```js
|
||||
var get = require('lodash.get');
|
||||
```
|
||||
|
||||
See the [documentation](https://lodash.com/docs#get) or [package source](https://github.com/lodash/lodash/blob/4.4.2-npm-packages/lodash.get) for more details.
|
||||
931
node_modules/lodash.get/index.js
generated
vendored
Normal file
931
node_modules/lodash.get/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,931 @@
|
|||
/**
|
||||
* lodash (Custom Build) <https://lodash.com/>
|
||||
* Build: `lodash modularize exports="npm" -o ./`
|
||||
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
||||
* Released under MIT license <https://lodash.com/license>
|
||||
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
||||
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
||||
*/
|
||||
|
||||
/** Used as the `TypeError` message for "Functions" methods. */
|
||||
var FUNC_ERROR_TEXT = 'Expected a function';
|
||||
|
||||
/** Used to stand-in for `undefined` hash values. */
|
||||
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
||||
|
||||
/** Used as references for various `Number` constants. */
|
||||
var INFINITY = 1 / 0;
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var funcTag = '[object Function]',
|
||||
genTag = '[object GeneratorFunction]',
|
||||
symbolTag = '[object Symbol]';
|
||||
|
||||
/** Used to match property names within property paths. */
|
||||
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
||||
reIsPlainProp = /^\w*$/,
|
||||
reLeadingDot = /^\./,
|
||||
rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
||||
|
||||
/**
|
||||
* Used to match `RegExp`
|
||||
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
||||
*/
|
||||
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
||||
|
||||
/** Used to match backslashes in property paths. */
|
||||
var reEscapeChar = /\\(\\)?/g;
|
||||
|
||||
/** Used to detect host constructors (Safari). */
|
||||
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
||||
|
||||
/** Detect free variable `global` from Node.js. */
|
||||
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
||||
|
||||
/** Detect free variable `self`. */
|
||||
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
||||
|
||||
/** Used as a reference to the global object. */
|
||||
var root = freeGlobal || freeSelf || Function('return this')();
|
||||
|
||||
/**
|
||||
* Gets the value at `key` of `object`.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} [object] The object to query.
|
||||
* @param {string} key The key of the property to get.
|
||||
* @returns {*} Returns the property value.
|
||||
*/
|
||||
function getValue(object, key) {
|
||||
return object == null ? undefined : object[key];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is a host object in IE < 9.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
|
||||
*/
|
||||
function isHostObject(value) {
|
||||
// Many host objects are `Object` objects that can coerce to strings
|
||||
// despite having improperly defined `toString` methods.
|
||||
var result = false;
|
||||
if (value != null && typeof value.toString != 'function') {
|
||||
try {
|
||||
result = !!(value + '');
|
||||
} catch (e) {}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var arrayProto = Array.prototype,
|
||||
funcProto = Function.prototype,
|
||||
objectProto = Object.prototype;
|
||||
|
||||
/** Used to detect overreaching core-js shims. */
|
||||
var coreJsData = root['__core-js_shared__'];
|
||||
|
||||
/** Used to detect methods masquerading as native. */
|
||||
var maskSrcKey = (function() {
|
||||
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
||||
return uid ? ('Symbol(src)_1.' + uid) : '';
|
||||
}());
|
||||
|
||||
/** Used to resolve the decompiled source of functions. */
|
||||
var funcToString = funcProto.toString;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var objectToString = objectProto.toString;
|
||||
|
||||
/** Used to detect if a method is native. */
|
||||
var reIsNative = RegExp('^' +
|
||||
funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
|
||||
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
||||
);
|
||||
|
||||
/** Built-in value references. */
|
||||
var Symbol = root.Symbol,
|
||||
splice = arrayProto.splice;
|
||||
|
||||
/* Built-in method references that are verified to be native. */
|
||||
var Map = getNative(root, 'Map'),
|
||||
nativeCreate = getNative(Object, 'create');
|
||||
|
||||
/** Used to convert symbols to primitives and strings. */
|
||||
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
||||
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
||||
|
||||
/**
|
||||
* Creates a hash object.
|
||||
*
|
||||
* @private
|
||||
* @constructor
|
||||
* @param {Array} [entries] The key-value pairs to cache.
|
||||
*/
|
||||
function Hash(entries) {
|
||||
var index = -1,
|
||||
length = entries ? entries.length : 0;
|
||||
|
||||
this.clear();
|
||||
while (++index < length) {
|
||||
var entry = entries[index];
|
||||
this.set(entry[0], entry[1]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all key-value entries from the hash.
|
||||
*
|
||||
* @private
|
||||
* @name clear
|
||||
* @memberOf Hash
|
||||
*/
|
||||
function hashClear() {
|
||||
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes `key` and its value from the hash.
|
||||
*
|
||||
* @private
|
||||
* @name delete
|
||||
* @memberOf Hash
|
||||
* @param {Object} hash The hash to modify.
|
||||
* @param {string} key The key of the value to remove.
|
||||
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
||||
*/
|
||||
function hashDelete(key) {
|
||||
return this.has(key) && delete this.__data__[key];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the hash value for `key`.
|
||||
*
|
||||
* @private
|
||||
* @name get
|
||||
* @memberOf Hash
|
||||
* @param {string} key The key of the value to get.
|
||||
* @returns {*} Returns the entry value.
|
||||
*/
|
||||
function hashGet(key) {
|
||||
var data = this.__data__;
|
||||
if (nativeCreate) {
|
||||
var result = data[key];
|
||||
return result === HASH_UNDEFINED ? undefined : result;
|
||||
}
|
||||
return hasOwnProperty.call(data, key) ? data[key] : undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a hash value for `key` exists.
|
||||
*
|
||||
* @private
|
||||
* @name has
|
||||
* @memberOf Hash
|
||||
* @param {string} key The key of the entry to check.
|
||||
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
||||
*/
|
||||
function hashHas(key) {
|
||||
var data = this.__data__;
|
||||
return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the hash `key` to `value`.
|
||||
*
|
||||
* @private
|
||||
* @name set
|
||||
* @memberOf Hash
|
||||
* @param {string} key The key of the value to set.
|
||||
* @param {*} value The value to set.
|
||||
* @returns {Object} Returns the hash instance.
|
||||
*/
|
||||
function hashSet(key, value) {
|
||||
var data = this.__data__;
|
||||
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
|
||||
return this;
|
||||
}
|
||||
|
||||
// Add methods to `Hash`.
|
||||
Hash.prototype.clear = hashClear;
|
||||
Hash.prototype['delete'] = hashDelete;
|
||||
Hash.prototype.get = hashGet;
|
||||
Hash.prototype.has = hashHas;
|
||||
Hash.prototype.set = hashSet;
|
||||
|
||||
/**
|
||||
* Creates an list cache object.
|
||||
*
|
||||
* @private
|
||||
* @constructor
|
||||
* @param {Array} [entries] The key-value pairs to cache.
|
||||
*/
|
||||
function ListCache(entries) {
|
||||
var index = -1,
|
||||
length = entries ? entries.length : 0;
|
||||
|
||||
this.clear();
|
||||
while (++index < length) {
|
||||
var entry = entries[index];
|
||||
this.set(entry[0], entry[1]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all key-value entries from the list cache.
|
||||
*
|
||||
* @private
|
||||
* @name clear
|
||||
* @memberOf ListCache
|
||||
*/
|
||||
function listCacheClear() {
|
||||
this.__data__ = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes `key` and its value from the list cache.
|
||||
*
|
||||
* @private
|
||||
* @name delete
|
||||
* @memberOf ListCache
|
||||
* @param {string} key The key of the value to remove.
|
||||
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
||||
*/
|
||||
function listCacheDelete(key) {
|
||||
var data = this.__data__,
|
||||
index = assocIndexOf(data, key);
|
||||
|
||||
if (index < 0) {
|
||||
return false;
|
||||
}
|
||||
var lastIndex = data.length - 1;
|
||||
if (index == lastIndex) {
|
||||
data.pop();
|
||||
} else {
|
||||
splice.call(data, index, 1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list cache value for `key`.
|
||||
*
|
||||
* @private
|
||||
* @name get
|
||||
* @memberOf ListCache
|
||||
* @param {string} key The key of the value to get.
|
||||
* @returns {*} Returns the entry value.
|
||||
*/
|
||||
function listCacheGet(key) {
|
||||
var data = this.__data__,
|
||||
index = assocIndexOf(data, key);
|
||||
|
||||
return index < 0 ? undefined : data[index][1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a list cache value for `key` exists.
|
||||
*
|
||||
* @private
|
||||
* @name has
|
||||
* @memberOf ListCache
|
||||
* @param {string} key The key of the entry to check.
|
||||
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
||||
*/
|
||||
function listCacheHas(key) {
|
||||
return assocIndexOf(this.__data__, key) > -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the list cache `key` to `value`.
|
||||
*
|
||||
* @private
|
||||
* @name set
|
||||
* @memberOf ListCache
|
||||
* @param {string} key The key of the value to set.
|
||||
* @param {*} value The value to set.
|
||||
* @returns {Object} Returns the list cache instance.
|
||||
*/
|
||||
function listCacheSet(key, value) {
|
||||
var data = this.__data__,
|
||||
index = assocIndexOf(data, key);
|
||||
|
||||
if (index < 0) {
|
||||
data.push([key, value]);
|
||||
} else {
|
||||
data[index][1] = value;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
// Add methods to `ListCache`.
|
||||
ListCache.prototype.clear = listCacheClear;
|
||||
ListCache.prototype['delete'] = listCacheDelete;
|
||||
ListCache.prototype.get = listCacheGet;
|
||||
ListCache.prototype.has = listCacheHas;
|
||||
ListCache.prototype.set = listCacheSet;
|
||||
|
||||
/**
|
||||
* Creates a map cache object to store key-value pairs.
|
||||
*
|
||||
* @private
|
||||
* @constructor
|
||||
* @param {Array} [entries] The key-value pairs to cache.
|
||||
*/
|
||||
function MapCache(entries) {
|
||||
var index = -1,
|
||||
length = entries ? entries.length : 0;
|
||||
|
||||
this.clear();
|
||||
while (++index < length) {
|
||||
var entry = entries[index];
|
||||
this.set(entry[0], entry[1]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all key-value entries from the map.
|
||||
*
|
||||
* @private
|
||||
* @name clear
|
||||
* @memberOf MapCache
|
||||
*/
|
||||
function mapCacheClear() {
|
||||
this.__data__ = {
|
||||
'hash': new Hash,
|
||||
'map': new (Map || ListCache),
|
||||
'string': new Hash
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes `key` and its value from the map.
|
||||
*
|
||||
* @private
|
||||
* @name delete
|
||||
* @memberOf MapCache
|
||||
* @param {string} key The key of the value to remove.
|
||||
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
||||
*/
|
||||
function mapCacheDelete(key) {
|
||||
return getMapData(this, key)['delete'](key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the map value for `key`.
|
||||
*
|
||||
* @private
|
||||
* @name get
|
||||
* @memberOf MapCache
|
||||
* @param {string} key The key of the value to get.
|
||||
* @returns {*} Returns the entry value.
|
||||
*/
|
||||
function mapCacheGet(key) {
|
||||
return getMapData(this, key).get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a map value for `key` exists.
|
||||
*
|
||||
* @private
|
||||
* @name has
|
||||
* @memberOf MapCache
|
||||
* @param {string} key The key of the entry to check.
|
||||
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
||||
*/
|
||||
function mapCacheHas(key) {
|
||||
return getMapData(this, key).has(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the map `key` to `value`.
|
||||
*
|
||||
* @private
|
||||
* @name set
|
||||
* @memberOf MapCache
|
||||
* @param {string} key The key of the value to set.
|
||||
* @param {*} value The value to set.
|
||||
* @returns {Object} Returns the map cache instance.
|
||||
*/
|
||||
function mapCacheSet(key, value) {
|
||||
getMapData(this, key).set(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
// Add methods to `MapCache`.
|
||||
MapCache.prototype.clear = mapCacheClear;
|
||||
MapCache.prototype['delete'] = mapCacheDelete;
|
||||
MapCache.prototype.get = mapCacheGet;
|
||||
MapCache.prototype.has = mapCacheHas;
|
||||
MapCache.prototype.set = mapCacheSet;
|
||||
|
||||
/**
|
||||
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to inspect.
|
||||
* @param {*} key The key to search for.
|
||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||
*/
|
||||
function assocIndexOf(array, key) {
|
||||
var length = array.length;
|
||||
while (length--) {
|
||||
if (eq(array[length][0], key)) {
|
||||
return length;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* The base implementation of `_.get` without support for default values.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to query.
|
||||
* @param {Array|string} path The path of the property to get.
|
||||
* @returns {*} Returns the resolved value.
|
||||
*/
|
||||
function baseGet(object, path) {
|
||||
path = isKey(path, object) ? [path] : castPath(path);
|
||||
|
||||
var index = 0,
|
||||
length = path.length;
|
||||
|
||||
while (object != null && index < length) {
|
||||
object = object[toKey(path[index++])];
|
||||
}
|
||||
return (index && index == length) ? object : undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* The base implementation of `_.isNative` without bad shim checks.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a native function,
|
||||
* else `false`.
|
||||
*/
|
||||
function baseIsNative(value) {
|
||||
if (!isObject(value) || isMasked(value)) {
|
||||
return false;
|
||||
}
|
||||
var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
|
||||
return pattern.test(toSource(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* The base implementation of `_.toString` which doesn't convert nullish
|
||||
* values to empty strings.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to process.
|
||||
* @returns {string} Returns the string.
|
||||
*/
|
||||
function baseToString(value) {
|
||||
// Exit early for strings to avoid a performance hit in some environments.
|
||||
if (typeof value == 'string') {
|
||||
return value;
|
||||
}
|
||||
if (isSymbol(value)) {
|
||||
return symbolToString ? symbolToString.call(value) : '';
|
||||
}
|
||||
var result = (value + '');
|
||||
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Casts `value` to a path array if it's not one.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to inspect.
|
||||
* @returns {Array} Returns the cast property path array.
|
||||
*/
|
||||
function castPath(value) {
|
||||
return isArray(value) ? value : stringToPath(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the data for `map`.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} map The map to query.
|
||||
* @param {string} key The reference key.
|
||||
* @returns {*} Returns the map data.
|
||||
*/
|
||||
function getMapData(map, key) {
|
||||
var data = map.__data__;
|
||||
return isKeyable(key)
|
||||
? data[typeof key == 'string' ? 'string' : 'hash']
|
||||
: data.map;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the native function at `key` of `object`.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} object The object to query.
|
||||
* @param {string} key The key of the method to get.
|
||||
* @returns {*} Returns the function if it's native, else `undefined`.
|
||||
*/
|
||||
function getNative(object, key) {
|
||||
var value = getValue(object, key);
|
||||
return baseIsNative(value) ? value : undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is a property name and not a property path.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
* @param {Object} [object] The object to query keys on.
|
||||
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
|
||||
*/
|
||||
function isKey(value, object) {
|
||||
if (isArray(value)) {
|
||||
return false;
|
||||
}
|
||||
var type = typeof value;
|
||||
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
||||
value == null || isSymbol(value)) {
|
||||
return true;
|
||||
}
|
||||
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
|
||||
(object != null && value in Object(object));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is suitable for use as unique object key.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
||||
*/
|
||||
function isKeyable(value) {
|
||||
var type = typeof value;
|
||||
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
||||
? (value !== '__proto__')
|
||||
: (value === null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `func` has its source masked.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} func The function to check.
|
||||
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
||||
*/
|
||||
function isMasked(func) {
|
||||
return !!maskSrcKey && (maskSrcKey in func);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts `string` to a property path array.
|
||||
*
|
||||
* @private
|
||||
* @param {string} string The string to convert.
|
||||
* @returns {Array} Returns the property path array.
|
||||
*/
|
||||
var stringToPath = memoize(function(string) {
|
||||
string = toString(string);
|
||||
|
||||
var result = [];
|
||||
if (reLeadingDot.test(string)) {
|
||||
result.push('');
|
||||
}
|
||||
string.replace(rePropName, function(match, number, quote, string) {
|
||||
result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
|
||||
});
|
||||
return result;
|
||||
});
|
||||
|
||||
/**
|
||||
* Converts `value` to a string key if it's not a string or symbol.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to inspect.
|
||||
* @returns {string|symbol} Returns the key.
|
||||
*/
|
||||
function toKey(value) {
|
||||
if (typeof value == 'string' || isSymbol(value)) {
|
||||
return value;
|
||||
}
|
||||
var result = (value + '');
|
||||
return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts `func` to its source code.
|
||||
*
|
||||
* @private
|
||||
* @param {Function} func The function to process.
|
||||
* @returns {string} Returns the source code.
|
||||
*/
|
||||
function toSource(func) {
|
||||
if (func != null) {
|
||||
try {
|
||||
return funcToString.call(func);
|
||||
} catch (e) {}
|
||||
try {
|
||||
return (func + '');
|
||||
} catch (e) {}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a function that memoizes the result of `func`. If `resolver` is
|
||||
* provided, it determines the cache key for storing the result based on the
|
||||
* arguments provided to the memoized function. By default, the first argument
|
||||
* provided to the memoized function is used as the map cache key. The `func`
|
||||
* is invoked with the `this` binding of the memoized function.
|
||||
*
|
||||
* **Note:** The cache is exposed as the `cache` property on the memoized
|
||||
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
||||
* constructor with one whose instances implement the
|
||||
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
||||
* method interface of `delete`, `get`, `has`, and `set`.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Function
|
||||
* @param {Function} func The function to have its output memoized.
|
||||
* @param {Function} [resolver] The function to resolve the cache key.
|
||||
* @returns {Function} Returns the new memoized function.
|
||||
* @example
|
||||
*
|
||||
* var object = { 'a': 1, 'b': 2 };
|
||||
* var other = { 'c': 3, 'd': 4 };
|
||||
*
|
||||
* var values = _.memoize(_.values);
|
||||
* values(object);
|
||||
* // => [1, 2]
|
||||
*
|
||||
* values(other);
|
||||
* // => [3, 4]
|
||||
*
|
||||
* object.a = 2;
|
||||
* values(object);
|
||||
* // => [1, 2]
|
||||
*
|
||||
* // Modify the result cache.
|
||||
* values.cache.set(object, ['a', 'b']);
|
||||
* values(object);
|
||||
* // => ['a', 'b']
|
||||
*
|
||||
* // Replace `_.memoize.Cache`.
|
||||
* _.memoize.Cache = WeakMap;
|
||||
*/
|
||||
function memoize(func, resolver) {
|
||||
if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
|
||||
throw new TypeError(FUNC_ERROR_TEXT);
|
||||
}
|
||||
var memoized = function() {
|
||||
var args = arguments,
|
||||
key = resolver ? resolver.apply(this, args) : args[0],
|
||||
cache = memoized.cache;
|
||||
|
||||
if (cache.has(key)) {
|
||||
return cache.get(key);
|
||||
}
|
||||
var result = func.apply(this, args);
|
||||
memoized.cache = cache.set(key, result);
|
||||
return result;
|
||||
};
|
||||
memoized.cache = new (memoize.Cache || MapCache);
|
||||
return memoized;
|
||||
}
|
||||
|
||||
// Assign cache to `_.memoize`.
|
||||
memoize.Cache = MapCache;
|
||||
|
||||
/**
|
||||
* Performs a
|
||||
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
||||
* comparison between two values to determine if they are equivalent.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to compare.
|
||||
* @param {*} other The other value to compare.
|
||||
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
||||
* @example
|
||||
*
|
||||
* var object = { 'a': 1 };
|
||||
* var other = { 'a': 1 };
|
||||
*
|
||||
* _.eq(object, object);
|
||||
* // => true
|
||||
*
|
||||
* _.eq(object, other);
|
||||
* // => false
|
||||
*
|
||||
* _.eq('a', 'a');
|
||||
* // => true
|
||||
*
|
||||
* _.eq('a', Object('a'));
|
||||
* // => false
|
||||
*
|
||||
* _.eq(NaN, NaN);
|
||||
* // => true
|
||||
*/
|
||||
function eq(value, other) {
|
||||
return value === other || (value !== value && other !== other);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as an `Array` object.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isArray([1, 2, 3]);
|
||||
* // => true
|
||||
*
|
||||
* _.isArray(document.body.children);
|
||||
* // => false
|
||||
*
|
||||
* _.isArray('abc');
|
||||
* // => false
|
||||
*
|
||||
* _.isArray(_.noop);
|
||||
* // => false
|
||||
*/
|
||||
var isArray = Array.isArray;
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as a `Function` object.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isFunction(_);
|
||||
* // => true
|
||||
*
|
||||
* _.isFunction(/abc/);
|
||||
* // => false
|
||||
*/
|
||||
function isFunction(value) {
|
||||
// The use of `Object#toString` avoids issues with the `typeof` operator
|
||||
// in Safari 8-9 which returns 'object' for typed array and other constructors.
|
||||
var tag = isObject(value) ? objectToString.call(value) : '';
|
||||
return tag == funcTag || tag == genTag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is the
|
||||
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
||||
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isObject({});
|
||||
* // => true
|
||||
*
|
||||
* _.isObject([1, 2, 3]);
|
||||
* // => true
|
||||
*
|
||||
* _.isObject(_.noop);
|
||||
* // => true
|
||||
*
|
||||
* _.isObject(null);
|
||||
* // => false
|
||||
*/
|
||||
function isObject(value) {
|
||||
var type = typeof value;
|
||||
return !!value && (type == 'object' || type == 'function');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
||||
* and has a `typeof` result of "object".
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isObjectLike({});
|
||||
* // => true
|
||||
*
|
||||
* _.isObjectLike([1, 2, 3]);
|
||||
* // => true
|
||||
*
|
||||
* _.isObjectLike(_.noop);
|
||||
* // => false
|
||||
*
|
||||
* _.isObjectLike(null);
|
||||
* // => false
|
||||
*/
|
||||
function isObjectLike(value) {
|
||||
return !!value && typeof value == 'object';
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as a `Symbol` primitive or object.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isSymbol(Symbol.iterator);
|
||||
* // => true
|
||||
*
|
||||
* _.isSymbol('abc');
|
||||
* // => false
|
||||
*/
|
||||
function isSymbol(value) {
|
||||
return typeof value == 'symbol' ||
|
||||
(isObjectLike(value) && objectToString.call(value) == symbolTag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts `value` to a string. An empty string is returned for `null`
|
||||
* and `undefined` values. The sign of `-0` is preserved.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to process.
|
||||
* @returns {string} Returns the string.
|
||||
* @example
|
||||
*
|
||||
* _.toString(null);
|
||||
* // => ''
|
||||
*
|
||||
* _.toString(-0);
|
||||
* // => '-0'
|
||||
*
|
||||
* _.toString([1, 2, 3]);
|
||||
* // => '1,2,3'
|
||||
*/
|
||||
function toString(value) {
|
||||
return value == null ? '' : baseToString(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value at `path` of `object`. If the resolved value is
|
||||
* `undefined`, the `defaultValue` is returned in its place.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 3.7.0
|
||||
* @category Object
|
||||
* @param {Object} object The object to query.
|
||||
* @param {Array|string} path The path of the property to get.
|
||||
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
|
||||
* @returns {*} Returns the resolved value.
|
||||
* @example
|
||||
*
|
||||
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
||||
*
|
||||
* _.get(object, 'a[0].b.c');
|
||||
* // => 3
|
||||
*
|
||||
* _.get(object, ['a', '0', 'b', 'c']);
|
||||
* // => 3
|
||||
*
|
||||
* _.get(object, 'a.b.c', 'default');
|
||||
* // => 'default'
|
||||
*/
|
||||
function get(object, path, defaultValue) {
|
||||
var result = object == null ? undefined : baseGet(object, path);
|
||||
return result === undefined ? defaultValue : result;
|
||||
}
|
||||
|
||||
module.exports = get;
|
||||
69
node_modules/lodash.get/package.json
generated
vendored
Normal file
69
node_modules/lodash.get/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
{
|
||||
"_from": "lodash.get@^4.4.2",
|
||||
"_id": "lodash.get@4.4.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk=",
|
||||
"_location": "/lodash.get",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "lodash.get@^4.4.2",
|
||||
"name": "lodash.get",
|
||||
"escapedName": "lodash.get",
|
||||
"rawSpec": "^4.4.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^4.4.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@sinonjs/samsam"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
|
||||
"_shasum": "2d177f652fa31e939b4438d5341499dfa3825e99",
|
||||
"_spec": "lodash.get@^4.4.2",
|
||||
"_where": "/Users/sam/code/codeql-action/node_modules/@sinonjs/samsam",
|
||||
"author": {
|
||||
"name": "John-David Dalton",
|
||||
"email": "john.david.dalton@gmail.com",
|
||||
"url": "http://allyoucanleet.com/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/lodash/lodash/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "John-David Dalton",
|
||||
"email": "john.david.dalton@gmail.com",
|
||||
"url": "http://allyoucanleet.com/"
|
||||
},
|
||||
{
|
||||
"name": "Blaine Bublitz",
|
||||
"email": "blaine.bublitz@gmail.com",
|
||||
"url": "https://github.com/phated"
|
||||
},
|
||||
{
|
||||
"name": "Mathias Bynens",
|
||||
"email": "mathias@qiwi.be",
|
||||
"url": "https://mathiasbynens.be/"
|
||||
}
|
||||
],
|
||||
"deprecated": false,
|
||||
"description": "The lodash method `_.get` exported as a module.",
|
||||
"homepage": "https://lodash.com/",
|
||||
"icon": "https://lodash.com/icon.svg",
|
||||
"keywords": [
|
||||
"lodash-modularized",
|
||||
"get"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "lodash.get",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/lodash/lodash.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\""
|
||||
},
|
||||
"version": "4.4.2"
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue