initial commit of actions
This commit is contained in:
commit
949ece5785
44660 changed files with 12034344 additions and 0 deletions
27
github/codeql-action-v2/node_modules/@sinonjs/samsam/LICENSE
generated
vendored
Normal file
27
github/codeql-action-v2/node_modules/@sinonjs/samsam/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
(The BSD License)
|
||||
|
||||
Copyright (c) 2010-2012, Christian Johansen, christian@cjohansen.no and
|
||||
August Lilleaas, august.lilleaas@gmail.com. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
* Neither the name of Christian Johansen nor the names of his contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
83
github/codeql-action-v2/node_modules/@sinonjs/samsam/README.md
generated
vendored
Normal file
83
github/codeql-action-v2/node_modules/@sinonjs/samsam/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
# 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)
|
||||
390
github/codeql-action-v2/node_modules/@sinonjs/samsam/docs/index.md
generated
vendored
Normal file
390
github/codeql-action-v2/node_modules/@sinonjs/samsam/docs/index.md
generated
vendored
Normal file
|
|
@ -0,0 +1,390 @@
|
|||
# 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`. If supported, this object matchers
|
||||
include [symbolic properties](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol)
|
||||
in the comparison.
|
||||
|
||||
```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
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/array-types.js
generated
vendored
Normal file
16
github/codeql-action-v2/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;
|
||||
413
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/create-matcher.js
generated
vendored
Normal file
413
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/create-matcher.js
generated
vendored
Normal file
|
|
@ -0,0 +1,413 @@
|
|||
"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)})`;
|
||||
}
|
||||
|
||||
// ensure that nothing mutates the exported message value, ref https://github.com/sinonjs/sinon/issues/2502
|
||||
Object.defineProperty(m, "message", {
|
||||
configurable: false,
|
||||
writable: false,
|
||||
value: m.message,
|
||||
});
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
var jsonParseResultTypes = {
|
||||
null: true,
|
||||
boolean: true,
|
||||
number: true,
|
||||
string: true,
|
||||
object: true,
|
||||
array: true,
|
||||
};
|
||||
createMatcher.json = function (value) {
|
||||
if (!jsonParseResultTypes[typeOf(value)]) {
|
||||
throw new TypeError("Value cannot be the result of JSON.parse");
|
||||
}
|
||||
var message = `json(${JSON.stringify(value, null, " ")})`;
|
||||
return createMatcher(function (actual) {
|
||||
var parsed;
|
||||
try {
|
||||
parsed = JSON.parse(actual);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
return deepEqual(parsed, 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
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/create-matcher/assert-matcher.js
generated
vendored
Normal file
17
github/codeql-action-v2/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;
|
||||
19
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/create-matcher/assert-method-exists.js
generated
vendored
Normal file
19
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/create-matcher/assert-method-exists.js
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
"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;
|
||||
24
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/create-matcher/assert-type.js
generated
vendored
Normal file
24
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/create-matcher/assert-type.js
generated
vendored
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
"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
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/create-matcher/is-iterable.js
generated
vendored
Normal file
16
github/codeql-action-v2/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
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/create-matcher/is-matcher.js
generated
vendored
Normal file
18
github/codeql-action-v2/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;
|
||||
59
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/create-matcher/match-object.js
generated
vendored
Normal file
59
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/create-matcher/match-object.js
generated
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
"use strict";
|
||||
|
||||
var every = require("@sinonjs/commons").prototypes.array.every;
|
||||
var concat = require("@sinonjs/commons").prototypes.array.concat;
|
||||
var typeOf = require("@sinonjs/commons").typeOf;
|
||||
|
||||
var deepEqualFactory = require("../deep-equal").use;
|
||||
|
||||
var identical = require("../identical");
|
||||
var isMatcher = require("./is-matcher");
|
||||
|
||||
var keys = Object.keys;
|
||||
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
var expectedKeys = keys(expectation);
|
||||
/* istanbul ignore else: cannot collect coverage for engine that doesn't support Symbol */
|
||||
if (typeOf(getOwnPropertySymbols) === "function") {
|
||||
expectedKeys = concat(expectedKeys, getOwnPropertySymbols(expectation));
|
||||
}
|
||||
|
||||
return every(expectedKeys, 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 (identical(exp, act)) {
|
||||
return true;
|
||||
}
|
||||
if (!matchObject(act, exp, matcher)) {
|
||||
return false;
|
||||
}
|
||||
} else if (!deepEqual(act, exp)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = matchObject;
|
||||
49
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/create-matcher/matcher-prototype.js
generated
vendored
Normal file
49
github/codeql-action-v2/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
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/create-matcher/type-map.js
generated
vendored
Normal file
62
github/codeql-action-v2/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
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/create-set.js
generated
vendored
Normal file
34
github/codeql-action-v2/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
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/deep-equal-benchmark.js
generated
vendored
Normal file
74
github/codeql-action-v2/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
|
||||
new WeakMap(),
|
||||
// eslint-disable-next-line no-undef
|
||||
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 });
|
||||
304
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/deep-equal.js
generated
vendored
Normal file
304
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/deep-equal.js
generated
vendored
Normal file
|
|
@ -0,0 +1,304 @@
|
|||
"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 isArrayType = require("./is-array-type");
|
||||
var isDate = require("./is-date");
|
||||
var isElement = require("./is-element");
|
||||
var isIterable = require("./is-iterable");
|
||||
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 Promise && expectationObj instanceof Promise) {
|
||||
return actualObj === expectationObj;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// jQuery objects have iteration protocols
|
||||
// see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols
|
||||
// But, they don't work well with the implementation concerning iterables below,
|
||||
// so we will detect them and use jQuery's own equality function
|
||||
/* istanbul ignore next -- this can only be tested in the `test-headless` script */
|
||||
if (
|
||||
actualObj.constructor &&
|
||||
actualObj.constructor.name === "jQuery" &&
|
||||
typeof actualObj.is === "function"
|
||||
) {
|
||||
return actualObj.is(expectationObj);
|
||||
}
|
||||
|
||||
var isActualNonArrayIterable =
|
||||
isIterable(actualObj) &&
|
||||
!isArrayType(actualObj) &&
|
||||
!isArguments(actualObj);
|
||||
var isExpectationNonArrayIterable =
|
||||
isIterable(expectationObj) &&
|
||||
!isArrayType(expectationObj) &&
|
||||
!isArguments(expectationObj);
|
||||
if (isActualNonArrayIterable || isExpectationNonArrayIterable) {
|
||||
var actualArray = Array.from(actualObj);
|
||||
var expectationArray = Array.from(expectationObj);
|
||||
if (actualArray.length !== expectationArray.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var arrayDeeplyEquals = true;
|
||||
every(actualArray, function (key) {
|
||||
arrayDeeplyEquals =
|
||||
arrayDeeplyEquals &&
|
||||
deepEqualCyclic(actualArray[key], expectationArray[key]);
|
||||
});
|
||||
|
||||
return arrayDeeplyEquals;
|
||||
}
|
||||
|
||||
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
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/get-class.js
generated
vendored
Normal file
18
github/codeql-action-v2/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
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/identical.js
generated
vendored
Normal file
31
github/codeql-action-v2/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
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/is-arguments.js
generated
vendored
Normal file
16
github/codeql-action-v2/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
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/is-array-type.js
generated
vendored
Normal file
20
github/codeql-action-v2/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
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/is-date.js
generated
vendored
Normal file
14
github/codeql-action-v2/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
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/is-element.js
generated
vendored
Normal file
29
github/codeql-action-v2/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;
|
||||
18
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/is-iterable.js
generated
vendored
Normal file
18
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/is-iterable.js
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
"use strict";
|
||||
|
||||
/**
|
||||
* Returns `true` when the argument is an iterable, `false` otherwise
|
||||
*
|
||||
* @alias module:samsam.isIterable
|
||||
* @param {*} val - A value to examine
|
||||
* @returns {boolean} Returns `true` when the argument is an iterable, `false` otherwise
|
||||
*/
|
||||
function isIterable(val) {
|
||||
// checks for null and undefined
|
||||
if (typeof val !== "object") {
|
||||
return false;
|
||||
}
|
||||
return typeof val[Symbol.iterator] === "function";
|
||||
}
|
||||
|
||||
module.exports = isIterable;
|
||||
14
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/is-map.js
generated
vendored
Normal file
14
github/codeql-action-v2/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
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/is-nan.js
generated
vendored
Normal file
19
github/codeql-action-v2/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
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/is-neg-zero.js
generated
vendored
Normal file
14
github/codeql-action-v2/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
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/is-object.js
generated
vendored
Normal file
31
github/codeql-action-v2/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
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/is-set.js
generated
vendored
Normal file
14
github/codeql-action-v2/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
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/is-subset.js
generated
vendored
Normal file
30
github/codeql-action-v2/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
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/iterable-to-string.js
generated
vendored
Normal file
71
github/codeql-action-v2/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 @sinonjs/no-prototype-methods/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 @sinonjs/no-prototype-methods/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
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/match.js
generated
vendored
Normal file
174
github/codeql-action-v2/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
github/codeql-action-v2/node_modules/@sinonjs/samsam/lib/samsam.js
generated
vendored
Normal file
26
github/codeql-action-v2/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,
|
||||
};
|
||||
19
github/codeql-action-v2/node_modules/@sinonjs/samsam/node_modules/type-detect/LICENSE
generated
vendored
Normal file
19
github/codeql-action-v2/node_modules/@sinonjs/samsam/node_modules/type-detect/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
Copyright (c) 2013 Jake Luer <jake@alogicalparadox.com> (http://alogicalparadox.com)
|
||||
|
||||
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.
|
||||
235
github/codeql-action-v2/node_modules/@sinonjs/samsam/node_modules/type-detect/README.md
generated
vendored
Normal file
235
github/codeql-action-v2/node_modules/@sinonjs/samsam/node_modules/type-detect/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,235 @@
|
|||
<h1 align=center>
|
||||
<a href="http://chaijs.com" title="Chai Documentation">
|
||||
<img alt="type-detect" src="https://raw.githubusercontent.com/chaijs/type-detect/master/type-detect-logo.svg"/>
|
||||
</a>
|
||||
</h1>
|
||||
<br>
|
||||
<p align=center>
|
||||
Improved typeof detection for <a href="https://nodejs.org">node</a>, <a href="https://deno.land/">Deno</a>, and the browser.
|
||||
</p>
|
||||
|
||||
<p align=center>
|
||||
<a href="./LICENSE">
|
||||
<img
|
||||
alt="license:mit"
|
||||
src="https://img.shields.io/badge/license-mit-green.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://www.npmjs.com/packages/type-detect">
|
||||
<img
|
||||
alt="npm:?"
|
||||
src="https://img.shields.io/npm/v/type-detect.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://github.com/chaijs/type-detect">
|
||||
<img
|
||||
alt="build:?"
|
||||
src="https://github.com/chaijs/type-detect/workflows/Build/badge.svg"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://coveralls.io/r/chaijs/type-detect">
|
||||
<img
|
||||
alt="coverage:?"
|
||||
src="https://img.shields.io/coveralls/chaijs/type-detect/master.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://www.npmjs.com/packages/type-detect">
|
||||
<img
|
||||
alt="dependencies:?"
|
||||
src="https://img.shields.io/npm/dm/type-detect.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<a href="">
|
||||
<img
|
||||
alt="devDependencies:?"
|
||||
src="https://img.shields.io/david/chaijs/type-detect.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<br>
|
||||
<a href="https://chai-slack.herokuapp.com/">
|
||||
<img
|
||||
alt="Join the Slack chat"
|
||||
src="https://img.shields.io/badge/slack-join%20chat-E2206F.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
<a href="https://gitter.im/chaijs/chai">
|
||||
<img
|
||||
alt="Join the Gitter chat"
|
||||
src="https://img.shields.io/badge/gitter-join%20chat-D0104D.svg?style=flat-square"
|
||||
/>
|
||||
</a>
|
||||
</p>
|
||||
<div align=center>
|
||||
<table width="100%">
|
||||
<tr><th colspan=6>Supported Browsers</th></tr> <tr>
|
||||
<th align=center><img src="https://camo.githubusercontent.com/ab586f11dfcb49bf5f2c2fa9adadc5e857de122a/687474703a2f2f73766773686172652e636f6d2f692f3278532e737667" alt=""> Chrome</th>
|
||||
<th align=center><img src="https://camo.githubusercontent.com/98cca3108c18dcfaa62667b42046540c6822cdac/687474703a2f2f73766773686172652e636f6d2f692f3279352e737667" alt=""> Edge</th>
|
||||
<th align=center><img src="https://camo.githubusercontent.com/acdcb09840a9e1442cbaf1b684f95ab3c3f41cf4/687474703a2f2f73766773686172652e636f6d2f692f3279462e737667" alt=""> Firefox</th>
|
||||
<th align=center><img src="https://camo.githubusercontent.com/728f8cb0bee9ed58ab85e39266f1152c53e0dffd/687474703a2f2f73766773686172652e636f6d2f692f3278342e737667" alt=""> Safari</th>
|
||||
<th align=center><img src="https://camo.githubusercontent.com/96a2317034dee0040d0a762e7a30c3c650c45aac/687474703a2f2f73766773686172652e636f6d2f692f3279532e737667" alt=""> IE</th>
|
||||
</tr><tr>
|
||||
<td align=center>✅</td>
|
||||
<td align=center>✅</td>
|
||||
<td align=center>✅</td>
|
||||
<td align=center>✅</td>
|
||||
<td align=center>9, 10, 11</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
## What is Type-Detect?
|
||||
|
||||
Type Detect is a module which you can use to detect the type of a given object. It returns a string representation of the object's type, either using [`typeof`](http://www.ecma-international.org/ecma-262/6.0/index.html#sec-typeof-operator) or [`@@toStringTag`](http://www.ecma-international.org/ecma-262/6.0/index.html#sec-symbol.tostringtag). It also normalizes some object names for consistency among browsers.
|
||||
|
||||
## Why?
|
||||
|
||||
The `typeof` operator will only specify primitive values; everything else is `"object"` (including `null`, arrays, regexps, etc). Many developers use `Object.prototype.toString()` - which is a fine alternative and returns many more types (null returns `[object Null]`, Arrays as `[object Array]`, regexps as `[object RegExp]` etc).
|
||||
|
||||
Sadly, `Object.prototype.toString` is slow, and buggy. By slow - we mean it is slower than `typeof`. By buggy - we mean that some values (like Promises, the global object, iterators, dataviews, a bunch of HTML elements) all report different things in different browsers.
|
||||
|
||||
`type-detect` fixes all of the shortcomings with `Object.prototype.toString`. We have extra code to speed up checks of JS and DOM objects, as much as 20-30x faster for some values. `type-detect` also fixes any consistencies with these objects.
|
||||
|
||||
## Installation
|
||||
|
||||
### Node.js
|
||||
|
||||
`type-detect` is available on [npm](http://npmjs.org). To install it, type:
|
||||
|
||||
$ npm install type-detect
|
||||
|
||||
### Deno
|
||||
|
||||
`type-detect` can be imported with the following line:
|
||||
|
||||
```js
|
||||
import type from 'https://deno.land/x/type_detect@v4.1.0/index.ts'
|
||||
```
|
||||
|
||||
### Browsers
|
||||
|
||||
You can also use it within the browser; install via npm and use the `type-detect.js` file found within the download. For example:
|
||||
|
||||
```html
|
||||
<script src="./node_modules/type-detect/type-detect.js"></script>
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
The primary export of `type-detect` is function that can serve as a replacement for `typeof`. The results of this function will be more specific than that of native `typeof`.
|
||||
|
||||
```js
|
||||
var type = require('type-detect');
|
||||
```
|
||||
Or, in the browser use case, after the <script> tag,
|
||||
```js
|
||||
var type = typeDetect;
|
||||
```
|
||||
|
||||
#### array
|
||||
|
||||
```js
|
||||
assert(type([]) === 'Array');
|
||||
assert(type(new Array()) === 'Array');
|
||||
```
|
||||
|
||||
#### regexp
|
||||
|
||||
```js
|
||||
assert(type(/a-z/gi) === 'RegExp');
|
||||
assert(type(new RegExp('a-z')) === 'RegExp');
|
||||
```
|
||||
|
||||
#### function
|
||||
|
||||
```js
|
||||
assert(type(function () {}) === 'function');
|
||||
```
|
||||
|
||||
#### arguments
|
||||
|
||||
```js
|
||||
(function () {
|
||||
assert(type(arguments) === 'Arguments');
|
||||
})();
|
||||
```
|
||||
|
||||
#### date
|
||||
|
||||
```js
|
||||
assert(type(new Date) === 'Date');
|
||||
```
|
||||
|
||||
#### number
|
||||
|
||||
```js
|
||||
assert(type(1) === 'number');
|
||||
assert(type(1.234) === 'number');
|
||||
assert(type(-1) === 'number');
|
||||
assert(type(-1.234) === 'number');
|
||||
assert(type(Infinity) === 'number');
|
||||
assert(type(NaN) === 'number');
|
||||
assert(type(new Number(1)) === 'Number'); // note - the object version has a capital N
|
||||
```
|
||||
|
||||
#### string
|
||||
|
||||
```js
|
||||
assert(type('hello world') === 'string');
|
||||
assert(type(new String('hello')) === 'String'); // note - the object version has a capital S
|
||||
```
|
||||
|
||||
#### null
|
||||
|
||||
```js
|
||||
assert(type(null) === 'null');
|
||||
assert(type(undefined) !== 'null');
|
||||
```
|
||||
|
||||
#### undefined
|
||||
|
||||
```js
|
||||
assert(type(undefined) === 'undefined');
|
||||
assert(type(null) !== 'undefined');
|
||||
```
|
||||
|
||||
#### object
|
||||
|
||||
```js
|
||||
var Noop = function () {};
|
||||
assert(type({}) === 'Object');
|
||||
assert(type(Noop) !== 'Object');
|
||||
assert(type(new Noop) === 'Object');
|
||||
assert(type(new Object) === 'Object');
|
||||
```
|
||||
|
||||
#### ECMA6 Types
|
||||
|
||||
All new ECMAScript 2015 objects are also supported, such as Promises and Symbols:
|
||||
|
||||
```js
|
||||
assert(type(new Map() === 'Map');
|
||||
assert(type(new WeakMap()) === 'WeakMap');
|
||||
assert(type(new Set()) === 'Set');
|
||||
assert(type(new WeakSet()) === 'WeakSet');
|
||||
assert(type(Symbol()) === 'symbol');
|
||||
assert(type(new Promise(callback) === 'Promise');
|
||||
assert(type(new Int8Array()) === 'Int8Array');
|
||||
assert(type(new Uint8Array()) === 'Uint8Array');
|
||||
assert(type(new UInt8ClampedArray()) === 'Uint8ClampedArray');
|
||||
assert(type(new Int16Array()) === 'Int16Array');
|
||||
assert(type(new Uint16Array()) === 'Uint16Array');
|
||||
assert(type(new Int32Array()) === 'Int32Array');
|
||||
assert(type(new UInt32Array()) === 'Uint32Array');
|
||||
assert(type(new Float32Array()) === 'Float32Array');
|
||||
assert(type(new Float64Array()) === 'Float64Array');
|
||||
assert(type(new ArrayBuffer()) === 'ArrayBuffer');
|
||||
assert(type(new DataView(arrayBuffer)) === 'DataView');
|
||||
```
|
||||
|
||||
Also, if you use `Symbol.toStringTag` to change an Objects return value of the `toString()` Method, `type()` will return this value, e.g:
|
||||
|
||||
```js
|
||||
var myObject = {};
|
||||
myObject[Symbol.toStringTag] = 'myCustomType';
|
||||
assert(type(myObject) === 'myCustomType');
|
||||
```
|
||||
1
github/codeql-action-v2/node_modules/@sinonjs/samsam/node_modules/type-detect/index.d.ts
generated
vendored
Normal file
1
github/codeql-action-v2/node_modules/@sinonjs/samsam/node_modules/type-detect/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export default function typeDetect(obj: unknown): string;
|
||||
129
github/codeql-action-v2/node_modules/@sinonjs/samsam/node_modules/type-detect/index.js
generated
vendored
Normal file
129
github/codeql-action-v2/node_modules/@sinonjs/samsam/node_modules/type-detect/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
const promiseExists = typeof Promise === 'function';
|
||||
const globalObject = ((Obj) => {
|
||||
if (typeof globalThis === 'object') {
|
||||
return globalThis;
|
||||
}
|
||||
Object.defineProperty(Obj, 'typeDetectGlobalObject', {
|
||||
get() {
|
||||
return this;
|
||||
},
|
||||
configurable: true,
|
||||
});
|
||||
const global = typeDetectGlobalObject;
|
||||
delete Obj.typeDetectGlobalObject;
|
||||
return global;
|
||||
})(Object.prototype);
|
||||
const symbolExists = typeof Symbol !== 'undefined';
|
||||
const mapExists = typeof Map !== 'undefined';
|
||||
const setExists = typeof Set !== 'undefined';
|
||||
const weakMapExists = typeof WeakMap !== 'undefined';
|
||||
const weakSetExists = typeof WeakSet !== 'undefined';
|
||||
const dataViewExists = typeof DataView !== 'undefined';
|
||||
const symbolIteratorExists = symbolExists && typeof Symbol.iterator !== 'undefined';
|
||||
const symbolToStringTagExists = symbolExists && typeof Symbol.toStringTag !== 'undefined';
|
||||
const setEntriesExists = setExists && typeof Set.prototype.entries === 'function';
|
||||
const mapEntriesExists = mapExists && typeof Map.prototype.entries === 'function';
|
||||
const setIteratorPrototype = setEntriesExists && Object.getPrototypeOf(new Set().entries());
|
||||
const mapIteratorPrototype = mapEntriesExists && Object.getPrototypeOf(new Map().entries());
|
||||
const arrayIteratorExists = symbolIteratorExists && typeof Array.prototype[Symbol.iterator] === 'function';
|
||||
const arrayIteratorPrototype = arrayIteratorExists && Object.getPrototypeOf([][Symbol.iterator]());
|
||||
const stringIteratorExists = symbolIteratorExists && typeof String.prototype[Symbol.iterator] === 'function';
|
||||
const stringIteratorPrototype = stringIteratorExists && Object.getPrototypeOf(''[Symbol.iterator]());
|
||||
const toStringLeftSliceLength = 8;
|
||||
const toStringRightSliceLength = -1;
|
||||
export default function typeDetect(obj) {
|
||||
const typeofObj = typeof obj;
|
||||
if (typeofObj !== 'object') {
|
||||
return typeofObj;
|
||||
}
|
||||
if (obj === null) {
|
||||
return 'null';
|
||||
}
|
||||
if (obj === globalObject) {
|
||||
return 'global';
|
||||
}
|
||||
if (Array.isArray(obj) &&
|
||||
(symbolToStringTagExists === false || !(Symbol.toStringTag in obj))) {
|
||||
return 'Array';
|
||||
}
|
||||
if (typeof window === 'object' && window !== null) {
|
||||
if (typeof window.location === 'object' && obj === window.location) {
|
||||
return 'Location';
|
||||
}
|
||||
if (typeof window.document === 'object' && obj === window.document) {
|
||||
return 'Document';
|
||||
}
|
||||
if (typeof window.navigator === 'object') {
|
||||
if (typeof window.navigator.mimeTypes === 'object' &&
|
||||
obj === window.navigator.mimeTypes) {
|
||||
return 'MimeTypeArray';
|
||||
}
|
||||
if (typeof window.navigator.plugins === 'object' &&
|
||||
obj === window.navigator.plugins) {
|
||||
return 'PluginArray';
|
||||
}
|
||||
}
|
||||
if ((typeof window.HTMLElement === 'function' ||
|
||||
typeof window.HTMLElement === 'object') &&
|
||||
obj instanceof window.HTMLElement) {
|
||||
if (obj.tagName === 'BLOCKQUOTE') {
|
||||
return 'HTMLQuoteElement';
|
||||
}
|
||||
if (obj.tagName === 'TD') {
|
||||
return 'HTMLTableDataCellElement';
|
||||
}
|
||||
if (obj.tagName === 'TH') {
|
||||
return 'HTMLTableHeaderCellElement';
|
||||
}
|
||||
}
|
||||
}
|
||||
const stringTag = (symbolToStringTagExists && obj[Symbol.toStringTag]);
|
||||
if (typeof stringTag === 'string') {
|
||||
return stringTag;
|
||||
}
|
||||
const objPrototype = Object.getPrototypeOf(obj);
|
||||
if (objPrototype === RegExp.prototype) {
|
||||
return 'RegExp';
|
||||
}
|
||||
if (objPrototype === Date.prototype) {
|
||||
return 'Date';
|
||||
}
|
||||
if (promiseExists && objPrototype === Promise.prototype) {
|
||||
return 'Promise';
|
||||
}
|
||||
if (setExists && objPrototype === Set.prototype) {
|
||||
return 'Set';
|
||||
}
|
||||
if (mapExists && objPrototype === Map.prototype) {
|
||||
return 'Map';
|
||||
}
|
||||
if (weakSetExists && objPrototype === WeakSet.prototype) {
|
||||
return 'WeakSet';
|
||||
}
|
||||
if (weakMapExists && objPrototype === WeakMap.prototype) {
|
||||
return 'WeakMap';
|
||||
}
|
||||
if (dataViewExists && objPrototype === DataView.prototype) {
|
||||
return 'DataView';
|
||||
}
|
||||
if (mapExists && objPrototype === mapIteratorPrototype) {
|
||||
return 'Map Iterator';
|
||||
}
|
||||
if (setExists && objPrototype === setIteratorPrototype) {
|
||||
return 'Set Iterator';
|
||||
}
|
||||
if (arrayIteratorExists && objPrototype === arrayIteratorPrototype) {
|
||||
return 'Array Iterator';
|
||||
}
|
||||
if (stringIteratorExists && objPrototype === stringIteratorPrototype) {
|
||||
return 'String Iterator';
|
||||
}
|
||||
if (objPrototype === null) {
|
||||
return 'Object';
|
||||
}
|
||||
return Object
|
||||
.prototype
|
||||
.toString
|
||||
.call(obj)
|
||||
.slice(toStringLeftSliceLength, toStringRightSliceLength);
|
||||
}
|
||||
393
github/codeql-action-v2/node_modules/@sinonjs/samsam/node_modules/type-detect/index.ts
generated
vendored
Normal file
393
github/codeql-action-v2/node_modules/@sinonjs/samsam/node_modules/type-detect/index.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,393 @@
|
|||
/* !
|
||||
* type-detect
|
||||
* Copyright(c) 2013 jake luer <jake@alogicalparadox.com>
|
||||
* MIT Licensed
|
||||
*/
|
||||
const promiseExists = typeof Promise === 'function';
|
||||
|
||||
const globalObject = ((Obj) => {
|
||||
if (typeof globalThis === 'object') {
|
||||
return globalThis; // eslint-disable-line
|
||||
}
|
||||
Object.defineProperty(Obj, 'typeDetectGlobalObject', {
|
||||
get() {
|
||||
return this;
|
||||
},
|
||||
configurable: true,
|
||||
});
|
||||
// @ts-ignore
|
||||
const global = typeDetectGlobalObject; // eslint-disable-line
|
||||
// @ts-ignore
|
||||
delete Obj.typeDetectGlobalObject;
|
||||
return global;
|
||||
})(Object.prototype);
|
||||
|
||||
const symbolExists = typeof Symbol !== 'undefined';
|
||||
const mapExists = typeof Map !== 'undefined';
|
||||
const setExists = typeof Set !== 'undefined';
|
||||
const weakMapExists = typeof WeakMap !== 'undefined';
|
||||
const weakSetExists = typeof WeakSet !== 'undefined';
|
||||
const dataViewExists = typeof DataView !== 'undefined';
|
||||
const symbolIteratorExists = symbolExists && typeof Symbol.iterator !== 'undefined';
|
||||
const symbolToStringTagExists = symbolExists && typeof Symbol.toStringTag !== 'undefined';
|
||||
const setEntriesExists = setExists && typeof Set.prototype.entries === 'function';
|
||||
const mapEntriesExists = mapExists && typeof Map.prototype.entries === 'function';
|
||||
const setIteratorPrototype = setEntriesExists && Object.getPrototypeOf(new Set().entries());
|
||||
const mapIteratorPrototype = mapEntriesExists && Object.getPrototypeOf(new Map().entries());
|
||||
const arrayIteratorExists = symbolIteratorExists && typeof Array.prototype[Symbol.iterator] === 'function';
|
||||
const arrayIteratorPrototype = arrayIteratorExists && Object.getPrototypeOf([][Symbol.iterator]());
|
||||
const stringIteratorExists = symbolIteratorExists && typeof String.prototype[Symbol.iterator] === 'function';
|
||||
const stringIteratorPrototype = stringIteratorExists && Object.getPrototypeOf(''[Symbol.iterator]());
|
||||
const toStringLeftSliceLength = 8;
|
||||
const toStringRightSliceLength = -1;
|
||||
|
||||
/**
|
||||
* ### typeOf (obj)
|
||||
*
|
||||
* Uses `Object.prototype.toString` to determine the type of an object,
|
||||
* normalising behaviour across engine versions & well optimised.
|
||||
*
|
||||
* @param {Mixed} object
|
||||
* @return {String} object type
|
||||
* @api public
|
||||
*/
|
||||
export default function typeDetect(obj: unknown): string {
|
||||
/* ! Speed optimisation
|
||||
* Pre:
|
||||
* string literal x 3,039,035 ops/sec ±1.62% (78 runs sampled)
|
||||
* boolean literal x 1,424,138 ops/sec ±4.54% (75 runs sampled)
|
||||
* number literal x 1,653,153 ops/sec ±1.91% (82 runs sampled)
|
||||
* undefined x 9,978,660 ops/sec ±1.92% (75 runs sampled)
|
||||
* function x 2,556,769 ops/sec ±1.73% (77 runs sampled)
|
||||
* Post:
|
||||
* string literal x 38,564,796 ops/sec ±1.15% (79 runs sampled)
|
||||
* boolean literal x 31,148,940 ops/sec ±1.10% (79 runs sampled)
|
||||
* number literal x 32,679,330 ops/sec ±1.90% (78 runs sampled)
|
||||
* undefined x 32,363,368 ops/sec ±1.07% (82 runs sampled)
|
||||
* function x 31,296,870 ops/sec ±0.96% (83 runs sampled)
|
||||
*/
|
||||
const typeofObj = typeof obj;
|
||||
if (typeofObj !== 'object') {
|
||||
return typeofObj;
|
||||
}
|
||||
|
||||
/* ! Speed optimisation
|
||||
* Pre:
|
||||
* null x 28,645,765 ops/sec ±1.17% (82 runs sampled)
|
||||
* Post:
|
||||
* null x 36,428,962 ops/sec ±1.37% (84 runs sampled)
|
||||
*/
|
||||
if (obj === null) {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
/* ! Spec Conformance
|
||||
* Test: `Object.prototype.toString.call(window)``
|
||||
* - Node === "[object global]"
|
||||
* - Chrome === "[object global]"
|
||||
* - Firefox === "[object Window]"
|
||||
* - PhantomJS === "[object Window]"
|
||||
* - Safari === "[object Window]"
|
||||
* - IE 11 === "[object Window]"
|
||||
* - IE Edge === "[object Window]"
|
||||
* Test: `Object.prototype.toString.call(this)``
|
||||
* - Chrome Worker === "[object global]"
|
||||
* - Firefox Worker === "[object DedicatedWorkerGlobalScope]"
|
||||
* - Safari Worker === "[object DedicatedWorkerGlobalScope]"
|
||||
* - IE 11 Worker === "[object WorkerGlobalScope]"
|
||||
* - IE Edge Worker === "[object WorkerGlobalScope]"
|
||||
*/
|
||||
if (obj === globalObject) {
|
||||
return 'global';
|
||||
}
|
||||
|
||||
/* ! Speed optimisation
|
||||
* Pre:
|
||||
* array literal x 2,888,352 ops/sec ±0.67% (82 runs sampled)
|
||||
* Post:
|
||||
* array literal x 22,479,650 ops/sec ±0.96% (81 runs sampled)
|
||||
*/
|
||||
if (
|
||||
Array.isArray(obj) &&
|
||||
(symbolToStringTagExists === false || !(Symbol.toStringTag in obj))
|
||||
) {
|
||||
return 'Array';
|
||||
}
|
||||
|
||||
// Not caching existence of `window` and related properties due to potential
|
||||
// for `window` to be unset before tests in quasi-browser environments.
|
||||
if (typeof window === 'object' && window !== null) {
|
||||
/* ! Spec Conformance
|
||||
* (https://html.spec.whatwg.org/multipage/browsers.html#location)
|
||||
* WhatWG HTML$7.7.3 - The `Location` interface
|
||||
* Test: `Object.prototype.toString.call(window.location)``
|
||||
* - IE <=11 === "[object Object]"
|
||||
* - IE Edge <=13 === "[object Object]"
|
||||
*/
|
||||
if (typeof (window as any).location === 'object' && obj === (window as any).location) {
|
||||
return 'Location';
|
||||
}
|
||||
|
||||
/* ! Spec Conformance
|
||||
* (https://html.spec.whatwg.org/#document)
|
||||
* WhatWG HTML$3.1.1 - The `Document` object
|
||||
* Note: Most browsers currently adher to the W3C DOM Level 2 spec
|
||||
* (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-26809268)
|
||||
* which suggests that browsers should use HTMLTableCellElement for
|
||||
* both TD and TH elements. WhatWG separates these.
|
||||
* WhatWG HTML states:
|
||||
* > For historical reasons, Window objects must also have a
|
||||
* > writable, configurable, non-enumerable property named
|
||||
* > HTMLDocument whose value is the Document interface object.
|
||||
* Test: `Object.prototype.toString.call(document)``
|
||||
* - Chrome === "[object HTMLDocument]"
|
||||
* - Firefox === "[object HTMLDocument]"
|
||||
* - Safari === "[object HTMLDocument]"
|
||||
* - IE <=10 === "[object Document]"
|
||||
* - IE 11 === "[object HTMLDocument]"
|
||||
* - IE Edge <=13 === "[object HTMLDocument]"
|
||||
*/
|
||||
if (typeof (window as any).document === 'object' && obj === (window as any).document) {
|
||||
return 'Document';
|
||||
}
|
||||
|
||||
if (typeof (window as any).navigator === 'object') {
|
||||
/* ! Spec Conformance
|
||||
* (https://html.spec.whatwg.org/multipage/webappapis.html#mimetypearray)
|
||||
* WhatWG HTML$8.6.1.5 - Plugins - Interface MimeTypeArray
|
||||
* Test: `Object.prototype.toString.call(navigator.mimeTypes)``
|
||||
* - IE <=10 === "[object MSMimeTypesCollection]"
|
||||
*/
|
||||
if (typeof (window as any).navigator.mimeTypes === 'object' &&
|
||||
obj === (window as any).navigator.mimeTypes) {
|
||||
return 'MimeTypeArray';
|
||||
}
|
||||
|
||||
/* ! Spec Conformance
|
||||
* (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray)
|
||||
* WhatWG HTML$8.6.1.5 - Plugins - Interface PluginArray
|
||||
* Test: `Object.prototype.toString.call(navigator.plugins)``
|
||||
* - IE <=10 === "[object MSPluginsCollection]"
|
||||
*/
|
||||
if (typeof (window as any).navigator.plugins === 'object' &&
|
||||
obj === (window as any).navigator.plugins) {
|
||||
return 'PluginArray';
|
||||
}
|
||||
}
|
||||
|
||||
if ((typeof (window as any).HTMLElement === 'function' ||
|
||||
typeof (window as any).HTMLElement === 'object') &&
|
||||
obj instanceof (window as any).HTMLElement) {
|
||||
/* ! Spec Conformance
|
||||
* (https://html.spec.whatwg.org/multipage/webappapis.html#pluginarray)
|
||||
* WhatWG HTML$4.4.4 - The `blockquote` element - Interface `HTMLQuoteElement`
|
||||
* Test: `Object.prototype.toString.call(document.createElement('blockquote'))``
|
||||
* - IE <=10 === "[object HTMLBlockElement]"
|
||||
*/
|
||||
if ((obj as any).tagName === 'BLOCKQUOTE') {
|
||||
return 'HTMLQuoteElement';
|
||||
}
|
||||
|
||||
/* ! Spec Conformance
|
||||
* (https://html.spec.whatwg.org/#htmltabledatacellelement)
|
||||
* WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableDataCellElement`
|
||||
* Note: Most browsers currently adher to the W3C DOM Level 2 spec
|
||||
* (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075)
|
||||
* which suggests that browsers should use HTMLTableCellElement for
|
||||
* both TD and TH elements. WhatWG separates these.
|
||||
* Test: Object.prototype.toString.call(document.createElement('td'))
|
||||
* - Chrome === "[object HTMLTableCellElement]"
|
||||
* - Firefox === "[object HTMLTableCellElement]"
|
||||
* - Safari === "[object HTMLTableCellElement]"
|
||||
*/
|
||||
if ((obj as any).tagName === 'TD') {
|
||||
return 'HTMLTableDataCellElement';
|
||||
}
|
||||
|
||||
/* ! Spec Conformance
|
||||
* (https://html.spec.whatwg.org/#htmltableheadercellelement)
|
||||
* WhatWG HTML$4.9.9 - The `td` element - Interface `HTMLTableHeaderCellElement`
|
||||
* Note: Most browsers currently adher to the W3C DOM Level 2 spec
|
||||
* (https://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-82915075)
|
||||
* which suggests that browsers should use HTMLTableCellElement for
|
||||
* both TD and TH elements. WhatWG separates these.
|
||||
* Test: Object.prototype.toString.call(document.createElement('th'))
|
||||
* - Chrome === "[object HTMLTableCellElement]"
|
||||
* - Firefox === "[object HTMLTableCellElement]"
|
||||
* - Safari === "[object HTMLTableCellElement]"
|
||||
*/
|
||||
if ((obj as any).tagName === 'TH') {
|
||||
return 'HTMLTableHeaderCellElement';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ! Speed optimisation
|
||||
* Pre:
|
||||
* Float64Array x 625,644 ops/sec ±1.58% (80 runs sampled)
|
||||
* Float32Array x 1,279,852 ops/sec ±2.91% (77 runs sampled)
|
||||
* Uint32Array x 1,178,185 ops/sec ±1.95% (83 runs sampled)
|
||||
* Uint16Array x 1,008,380 ops/sec ±2.25% (80 runs sampled)
|
||||
* Uint8Array x 1,128,040 ops/sec ±2.11% (81 runs sampled)
|
||||
* Int32Array x 1,170,119 ops/sec ±2.88% (80 runs sampled)
|
||||
* Int16Array x 1,176,348 ops/sec ±5.79% (86 runs sampled)
|
||||
* Int8Array x 1,058,707 ops/sec ±4.94% (77 runs sampled)
|
||||
* Uint8ClampedArray x 1,110,633 ops/sec ±4.20% (80 runs sampled)
|
||||
* Post:
|
||||
* Float64Array x 7,105,671 ops/sec ±13.47% (64 runs sampled)
|
||||
* Float32Array x 5,887,912 ops/sec ±1.46% (82 runs sampled)
|
||||
* Uint32Array x 6,491,661 ops/sec ±1.76% (79 runs sampled)
|
||||
* Uint16Array x 6,559,795 ops/sec ±1.67% (82 runs sampled)
|
||||
* Uint8Array x 6,463,966 ops/sec ±1.43% (85 runs sampled)
|
||||
* Int32Array x 5,641,841 ops/sec ±3.49% (81 runs sampled)
|
||||
* Int16Array x 6,583,511 ops/sec ±1.98% (80 runs sampled)
|
||||
* Int8Array x 6,606,078 ops/sec ±1.74% (81 runs sampled)
|
||||
* Uint8ClampedArray x 6,602,224 ops/sec ±1.77% (83 runs sampled)
|
||||
*/
|
||||
const stringTag = (symbolToStringTagExists && (obj as any)[Symbol.toStringTag]);
|
||||
if (typeof stringTag === 'string') {
|
||||
return stringTag;
|
||||
}
|
||||
|
||||
const objPrototype = Object.getPrototypeOf(obj);
|
||||
/* ! Speed optimisation
|
||||
* Pre:
|
||||
* regex literal x 1,772,385 ops/sec ±1.85% (77 runs sampled)
|
||||
* regex constructor x 2,143,634 ops/sec ±2.46% (78 runs sampled)
|
||||
* Post:
|
||||
* regex literal x 3,928,009 ops/sec ±0.65% (78 runs sampled)
|
||||
* regex constructor x 3,931,108 ops/sec ±0.58% (84 runs sampled)
|
||||
*/
|
||||
if (objPrototype === RegExp.prototype) {
|
||||
return 'RegExp';
|
||||
}
|
||||
|
||||
/* ! Speed optimisation
|
||||
* Pre:
|
||||
* date x 2,130,074 ops/sec ±4.42% (68 runs sampled)
|
||||
* Post:
|
||||
* date x 3,953,779 ops/sec ±1.35% (77 runs sampled)
|
||||
*/
|
||||
if (objPrototype === Date.prototype) {
|
||||
return 'Date';
|
||||
}
|
||||
|
||||
/* ! Spec Conformance
|
||||
* (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-promise.prototype-@@tostringtag)
|
||||
* ES6$25.4.5.4 - Promise.prototype[@@toStringTag] should be "Promise":
|
||||
* Test: `Object.prototype.toString.call(Promise.resolve())``
|
||||
* - Chrome <=47 === "[object Object]"
|
||||
* - Edge <=20 === "[object Object]"
|
||||
* - Firefox 29-Latest === "[object Promise]"
|
||||
* - Safari 7.1-Latest === "[object Promise]"
|
||||
*/
|
||||
if (promiseExists && objPrototype === Promise.prototype) {
|
||||
return 'Promise';
|
||||
}
|
||||
|
||||
/* ! Speed optimisation
|
||||
* Pre:
|
||||
* set x 2,222,186 ops/sec ±1.31% (82 runs sampled)
|
||||
* Post:
|
||||
* set x 4,545,879 ops/sec ±1.13% (83 runs sampled)
|
||||
*/
|
||||
if (setExists && objPrototype === Set.prototype) {
|
||||
return 'Set';
|
||||
}
|
||||
|
||||
/* ! Speed optimisation
|
||||
* Pre:
|
||||
* map x 2,396,842 ops/sec ±1.59% (81 runs sampled)
|
||||
* Post:
|
||||
* map x 4,183,945 ops/sec ±6.59% (82 runs sampled)
|
||||
*/
|
||||
if (mapExists && objPrototype === Map.prototype) {
|
||||
return 'Map';
|
||||
}
|
||||
|
||||
/* ! Speed optimisation
|
||||
* Pre:
|
||||
* weakset x 1,323,220 ops/sec ±2.17% (76 runs sampled)
|
||||
* Post:
|
||||
* weakset x 4,237,510 ops/sec ±2.01% (77 runs sampled)
|
||||
*/
|
||||
if (weakSetExists && objPrototype === WeakSet.prototype) {
|
||||
return 'WeakSet';
|
||||
}
|
||||
|
||||
/* ! Speed optimisation
|
||||
* Pre:
|
||||
* weakmap x 1,500,260 ops/sec ±2.02% (78 runs sampled)
|
||||
* Post:
|
||||
* weakmap x 3,881,384 ops/sec ±1.45% (82 runs sampled)
|
||||
*/
|
||||
if (weakMapExists && objPrototype === WeakMap.prototype) {
|
||||
return 'WeakMap';
|
||||
}
|
||||
|
||||
/* ! Spec Conformance
|
||||
* (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-dataview.prototype-@@tostringtag)
|
||||
* ES6$24.2.4.21 - DataView.prototype[@@toStringTag] should be "DataView":
|
||||
* Test: `Object.prototype.toString.call(new DataView(new ArrayBuffer(1)))``
|
||||
* - Edge <=13 === "[object Object]"
|
||||
*/
|
||||
if (dataViewExists && objPrototype === DataView.prototype) {
|
||||
return 'DataView';
|
||||
}
|
||||
|
||||
/* ! Spec Conformance
|
||||
* (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%mapiteratorprototype%-@@tostringtag)
|
||||
* ES6$23.1.5.2.2 - %MapIteratorPrototype%[@@toStringTag] should be "Map Iterator":
|
||||
* Test: `Object.prototype.toString.call(new Map().entries())``
|
||||
* - Edge <=13 === "[object Object]"
|
||||
*/
|
||||
if (mapExists && objPrototype === mapIteratorPrototype) {
|
||||
return 'Map Iterator';
|
||||
}
|
||||
|
||||
/* ! Spec Conformance
|
||||
* (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%setiteratorprototype%-@@tostringtag)
|
||||
* ES6$23.2.5.2.2 - %SetIteratorPrototype%[@@toStringTag] should be "Set Iterator":
|
||||
* Test: `Object.prototype.toString.call(new Set().entries())``
|
||||
* - Edge <=13 === "[object Object]"
|
||||
*/
|
||||
if (setExists && objPrototype === setIteratorPrototype) {
|
||||
return 'Set Iterator';
|
||||
}
|
||||
|
||||
/* ! Spec Conformance
|
||||
* (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%arrayiteratorprototype%-@@tostringtag)
|
||||
* ES6$22.1.5.2.2 - %ArrayIteratorPrototype%[@@toStringTag] should be "Array Iterator":
|
||||
* Test: `Object.prototype.toString.call([][Symbol.iterator]())``
|
||||
* - Edge <=13 === "[object Object]"
|
||||
*/
|
||||
if (arrayIteratorExists && objPrototype === arrayIteratorPrototype) {
|
||||
return 'Array Iterator';
|
||||
}
|
||||
|
||||
/* ! Spec Conformance
|
||||
* (http://www.ecma-international.org/ecma-262/6.0/index.html#sec-%stringiteratorprototype%-@@tostringtag)
|
||||
* ES6$21.1.5.2.2 - %StringIteratorPrototype%[@@toStringTag] should be "String Iterator":
|
||||
* Test: `Object.prototype.toString.call(''[Symbol.iterator]())``
|
||||
* - Edge <=13 === "[object Object]"
|
||||
*/
|
||||
if (stringIteratorExists && objPrototype === stringIteratorPrototype) {
|
||||
return 'String Iterator';
|
||||
}
|
||||
|
||||
/* ! Speed optimisation
|
||||
* Pre:
|
||||
* object from null x 2,424,320 ops/sec ±1.67% (76 runs sampled)
|
||||
* Post:
|
||||
* object from null x 5,838,000 ops/sec ±0.99% (84 runs sampled)
|
||||
*/
|
||||
if (objPrototype === null) {
|
||||
return 'Object';
|
||||
}
|
||||
|
||||
return Object
|
||||
.prototype
|
||||
.toString
|
||||
.call(obj)
|
||||
.slice(toStringLeftSliceLength, toStringRightSliceLength);
|
||||
}
|
||||
113
github/codeql-action-v2/node_modules/@sinonjs/samsam/node_modules/type-detect/package.json
generated
vendored
Normal file
113
github/codeql-action-v2/node_modules/@sinonjs/samsam/node_modules/type-detect/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
{
|
||||
"name": "type-detect",
|
||||
"version": "4.1.0",
|
||||
"description": "Improved typeof detection for node.js and the browser.",
|
||||
"keywords": [
|
||||
"type",
|
||||
"typeof",
|
||||
"types"
|
||||
],
|
||||
"license": "MIT",
|
||||
"author": "Jake Luer <jake@alogicalparadox.com> (http://alogicalparadox.com)",
|
||||
"contributors": [
|
||||
"Keith Cirkel (https://github.com/keithamus)",
|
||||
"David Losert (https://github.com/davelosert)",
|
||||
"Aleksey Shvayka (https://github.com/shvaikalesh)",
|
||||
"Lucas Fernandes da Costa (https://github.com/lucasfcosta)",
|
||||
"Grant Snodgrass (https://github.com/meeber)",
|
||||
"Jeremy Tice (https://github.com/jetpacmonkey)",
|
||||
"Edward Betts (https://github.com/EdwardBetts)",
|
||||
"dvlsg (https://github.com/dvlsg)",
|
||||
"Amila Welihinda (https://github.com/amilajack)",
|
||||
"Jake Champion (https://github.com/JakeChampion)",
|
||||
"Miroslav Bajtoš (https://github.com/bajtos)"
|
||||
],
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.ts",
|
||||
"index.d.ts",
|
||||
"type-detect.js"
|
||||
],
|
||||
"main": "./type-detect.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/chaijs/type-detect.git"
|
||||
},
|
||||
"scripts": {
|
||||
"bench": "node bench",
|
||||
"build": "tsc && rollup -c rollup.conf.js",
|
||||
"commit-msg": "commitlint -x angular",
|
||||
"lint": "eslint --ignore-path .gitignore . --ext .js,.ts",
|
||||
"prepare": "cross-env NODE_ENV=production npm run build",
|
||||
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
|
||||
"pretest:node": "cross-env NODE_ENV=test npm run build",
|
||||
"pretest:browser": "cross-env NODE_ENV=test npm run build",
|
||||
"test": "npm run test:node && npm run test:browser",
|
||||
"test:browser": "karma start --singleRun=true",
|
||||
"test:node": "nyc mocha type-detect.test.js",
|
||||
"test:deno": "deno test test/deno-test.ts",
|
||||
"posttest:node": "nyc report --report-dir \"coverage/node-$(node --version)\" --reporter=lcovonly && npm run upload-coverage",
|
||||
"posttest:browser": "npm run upload-coverage",
|
||||
"upload-coverage": "codecov"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"plugins": [
|
||||
"@typescript-eslint"
|
||||
],
|
||||
"env": {
|
||||
"es6": true
|
||||
},
|
||||
"extends": [
|
||||
"strict/es6"
|
||||
],
|
||||
"globals": {
|
||||
"HTMLElement": false,
|
||||
"window": false
|
||||
},
|
||||
"rules": {
|
||||
"complexity": 0,
|
||||
"max-statements": 0,
|
||||
"prefer-rest-params": 0
|
||||
}
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "^13.1.0",
|
||||
"@rollup/plugin-buble": "^0.21.3",
|
||||
"@rollup/plugin-commonjs": "^20.0.0",
|
||||
"@rollup/plugin-node-resolve": "^13.0.5",
|
||||
"@typescript-eslint/eslint-plugin": "^4.31.2",
|
||||
"@typescript-eslint/parser": "^4.31.2",
|
||||
"benchmark": "^2.1.4",
|
||||
"buble": "^0.20.0",
|
||||
"codecov": "^3.8.3",
|
||||
"commitlint-config-angular": "^13.1.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-config-strict": "^14.0.1",
|
||||
"eslint-plugin-filenames": "^1.3.2",
|
||||
"husky": "^7.0.2",
|
||||
"karma": "^6.3.4",
|
||||
"karma-chrome-launcher": "^3.1.0",
|
||||
"karma-coverage": "^2.0.3",
|
||||
"karma-detect-browsers": "^2.3.3",
|
||||
"karma-edge-launcher": "^0.4.2",
|
||||
"karma-firefox-launcher": "^2.1.1",
|
||||
"karma-ie-launcher": "^1.0.0",
|
||||
"karma-mocha": "^2.0.1",
|
||||
"karma-opera-launcher": "^1.0.0",
|
||||
"karma-safari-launcher": "^1.0.0",
|
||||
"karma-safaritechpreview-launcher": "^2.0.2",
|
||||
"karma-sauce-launcher": "^4.3.6",
|
||||
"mocha": "^9.1.1",
|
||||
"nyc": "^15.1.0",
|
||||
"rollup": "^2.57.0",
|
||||
"rollup-plugin-istanbul": "^3.0.0",
|
||||
"semantic-release": "^18.0.0",
|
||||
"simple-assert": "^1.0.0",
|
||||
"typescript": "^4.4.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
}
|
||||
139
github/codeql-action-v2/node_modules/@sinonjs/samsam/node_modules/type-detect/type-detect.js
generated
vendored
Normal file
139
github/codeql-action-v2/node_modules/@sinonjs/samsam/node_modules/type-detect/type-detect.js
generated
vendored
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
||||
typeof define === 'function' && define.amd ? define(factory) :
|
||||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.typeDetect = factory());
|
||||
})(this, (function () { 'use strict';
|
||||
|
||||
var promiseExists = typeof Promise === 'function';
|
||||
var globalObject = (function (Obj) {
|
||||
if (typeof globalThis === 'object') {
|
||||
return globalThis;
|
||||
}
|
||||
Object.defineProperty(Obj, 'typeDetectGlobalObject', {
|
||||
get: function get() {
|
||||
return this;
|
||||
},
|
||||
configurable: true,
|
||||
});
|
||||
var global = typeDetectGlobalObject;
|
||||
delete Obj.typeDetectGlobalObject;
|
||||
return global;
|
||||
})(Object.prototype);
|
||||
var symbolExists = typeof Symbol !== 'undefined';
|
||||
var mapExists = typeof Map !== 'undefined';
|
||||
var setExists = typeof Set !== 'undefined';
|
||||
var weakMapExists = typeof WeakMap !== 'undefined';
|
||||
var weakSetExists = typeof WeakSet !== 'undefined';
|
||||
var dataViewExists = typeof DataView !== 'undefined';
|
||||
var symbolIteratorExists = symbolExists && typeof Symbol.iterator !== 'undefined';
|
||||
var symbolToStringTagExists = symbolExists && typeof Symbol.toStringTag !== 'undefined';
|
||||
var setEntriesExists = setExists && typeof Set.prototype.entries === 'function';
|
||||
var mapEntriesExists = mapExists && typeof Map.prototype.entries === 'function';
|
||||
var setIteratorPrototype = setEntriesExists && Object.getPrototypeOf(new Set().entries());
|
||||
var mapIteratorPrototype = mapEntriesExists && Object.getPrototypeOf(new Map().entries());
|
||||
var arrayIteratorExists = symbolIteratorExists && typeof Array.prototype[Symbol.iterator] === 'function';
|
||||
var arrayIteratorPrototype = arrayIteratorExists && Object.getPrototypeOf([][Symbol.iterator]());
|
||||
var stringIteratorExists = symbolIteratorExists && typeof String.prototype[Symbol.iterator] === 'function';
|
||||
var stringIteratorPrototype = stringIteratorExists && Object.getPrototypeOf(''[Symbol.iterator]());
|
||||
var toStringLeftSliceLength = 8;
|
||||
var toStringRightSliceLength = -1;
|
||||
function typeDetect(obj) {
|
||||
var typeofObj = typeof obj;
|
||||
if (typeofObj !== 'object') {
|
||||
return typeofObj;
|
||||
}
|
||||
if (obj === null) {
|
||||
return 'null';
|
||||
}
|
||||
if (obj === globalObject) {
|
||||
return 'global';
|
||||
}
|
||||
if (Array.isArray(obj) &&
|
||||
(symbolToStringTagExists === false || !(Symbol.toStringTag in obj))) {
|
||||
return 'Array';
|
||||
}
|
||||
if (typeof window === 'object' && window !== null) {
|
||||
if (typeof window.location === 'object' && obj === window.location) {
|
||||
return 'Location';
|
||||
}
|
||||
if (typeof window.document === 'object' && obj === window.document) {
|
||||
return 'Document';
|
||||
}
|
||||
if (typeof window.navigator === 'object') {
|
||||
if (typeof window.navigator.mimeTypes === 'object' &&
|
||||
obj === window.navigator.mimeTypes) {
|
||||
return 'MimeTypeArray';
|
||||
}
|
||||
if (typeof window.navigator.plugins === 'object' &&
|
||||
obj === window.navigator.plugins) {
|
||||
return 'PluginArray';
|
||||
}
|
||||
}
|
||||
if ((typeof window.HTMLElement === 'function' ||
|
||||
typeof window.HTMLElement === 'object') &&
|
||||
obj instanceof window.HTMLElement) {
|
||||
if (obj.tagName === 'BLOCKQUOTE') {
|
||||
return 'HTMLQuoteElement';
|
||||
}
|
||||
if (obj.tagName === 'TD') {
|
||||
return 'HTMLTableDataCellElement';
|
||||
}
|
||||
if (obj.tagName === 'TH') {
|
||||
return 'HTMLTableHeaderCellElement';
|
||||
}
|
||||
}
|
||||
}
|
||||
var stringTag = (symbolToStringTagExists && obj[Symbol.toStringTag]);
|
||||
if (typeof stringTag === 'string') {
|
||||
return stringTag;
|
||||
}
|
||||
var objPrototype = Object.getPrototypeOf(obj);
|
||||
if (objPrototype === RegExp.prototype) {
|
||||
return 'RegExp';
|
||||
}
|
||||
if (objPrototype === Date.prototype) {
|
||||
return 'Date';
|
||||
}
|
||||
if (promiseExists && objPrototype === Promise.prototype) {
|
||||
return 'Promise';
|
||||
}
|
||||
if (setExists && objPrototype === Set.prototype) {
|
||||
return 'Set';
|
||||
}
|
||||
if (mapExists && objPrototype === Map.prototype) {
|
||||
return 'Map';
|
||||
}
|
||||
if (weakSetExists && objPrototype === WeakSet.prototype) {
|
||||
return 'WeakSet';
|
||||
}
|
||||
if (weakMapExists && objPrototype === WeakMap.prototype) {
|
||||
return 'WeakMap';
|
||||
}
|
||||
if (dataViewExists && objPrototype === DataView.prototype) {
|
||||
return 'DataView';
|
||||
}
|
||||
if (mapExists && objPrototype === mapIteratorPrototype) {
|
||||
return 'Map Iterator';
|
||||
}
|
||||
if (setExists && objPrototype === setIteratorPrototype) {
|
||||
return 'Set Iterator';
|
||||
}
|
||||
if (arrayIteratorExists && objPrototype === arrayIteratorPrototype) {
|
||||
return 'Array Iterator';
|
||||
}
|
||||
if (stringIteratorExists && objPrototype === stringIteratorPrototype) {
|
||||
return 'String Iterator';
|
||||
}
|
||||
if (objPrototype === null) {
|
||||
return 'Object';
|
||||
}
|
||||
return Object
|
||||
.prototype
|
||||
.toString
|
||||
.call(obj)
|
||||
.slice(toStringLeftSliceLength, toStringRightSliceLength);
|
||||
}
|
||||
|
||||
return typeDetect;
|
||||
|
||||
}));
|
||||
85
github/codeql-action-v2/node_modules/@sinonjs/samsam/package.json
generated
vendored
Normal file
85
github/codeql-action-v2/node_modules/@sinonjs/samsam/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
{
|
||||
"name": "@sinonjs/samsam",
|
||||
"version": "8.0.2",
|
||||
"description": "Value identification and comparison functions",
|
||||
"homepage": "http://sinonjs.github.io/samsam/",
|
||||
"author": "Christian Johansen",
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "./lib/samsam",
|
||||
"types": "./types/samsam.d.ts",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sinonjs/samsam.git"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,css,md}": "prettier --check",
|
||||
"*.js": "eslint"
|
||||
},
|
||||
"scripts": {
|
||||
"benchmark": "node lib/deep-equal-benchmark.js",
|
||||
"build": "rm -rf types && tsc",
|
||||
"jsdoc": "jsdoc -c jsdoc.conf.json",
|
||||
"lint": "eslint .",
|
||||
"prepublishOnly": "npm run build && mkdocs gh-deploy -r upstream || mkdocs gh-deploy -r origin",
|
||||
"test": "mocha ./lib/*.test.js",
|
||||
"test-cloud": "npm run test-headless -- --wd",
|
||||
"test-check-coverage": "npm run test-coverage && nyc check-coverage --branches 100 --functions 100 --lines 100",
|
||||
"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\"",
|
||||
"prettier:check": "prettier --check '**/*.{js,css,md}'",
|
||||
"prettier:write": "prettier --write '**/*.{js,css,md}'",
|
||||
"preversion": "./check-external-dependencies.sh && npm run test-check-coverage",
|
||||
"version": "changes --commits --footer",
|
||||
"postversion": "git push --follow-tags && npm publish --access public",
|
||||
"prepare": "husky install"
|
||||
},
|
||||
"browser": {
|
||||
"jsdom": false,
|
||||
"jsdom-global": false
|
||||
},
|
||||
"files": [
|
||||
"docs/",
|
||||
"lib/",
|
||||
"!lib/**/*.test.js",
|
||||
"types/"
|
||||
],
|
||||
"dependencies": {
|
||||
"@sinonjs/commons": "^3.0.1",
|
||||
"lodash.get": "^4.4.2",
|
||||
"type-detect": "^4.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sinonjs/eslint-config": "^5.0.3",
|
||||
"@sinonjs/eslint-plugin-no-prototype-methods": "^0.1.1",
|
||||
"@sinonjs/referee": "^11.0.1",
|
||||
"@studio/changes": "^3.0.0",
|
||||
"benchmark": "^2.1.4",
|
||||
"husky": "^9.1.6",
|
||||
"jquery": "^3.7.1",
|
||||
"jsdoc": "^4.0.3",
|
||||
"jsdom": "^25.0.0",
|
||||
"jsdom-global": "^3.0.2",
|
||||
"lint-staged": "^15.2.10",
|
||||
"microtime": "^3.1.1",
|
||||
"mocha": "^10.7.3",
|
||||
"mochify": "^9.2.0",
|
||||
"nyc": "^17.0.0",
|
||||
"prettier": "^3.3.3",
|
||||
"proxyquire": "^2.1.3",
|
||||
"proxyquire-universal": "^3.0.1",
|
||||
"proxyquireify": "^3.2.1",
|
||||
"typescript": "^5.6.2"
|
||||
},
|
||||
"nyc": {
|
||||
"exclude": [
|
||||
"**/*.test.js",
|
||||
"coverage/**",
|
||||
"dist/**",
|
||||
"out/**",
|
||||
"site/**",
|
||||
"eslint-local-rules.js",
|
||||
"rollup.config.js",
|
||||
"lib/deep-equal-benchmark.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
2
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/array-types.d.ts
generated
vendored
Normal file
2
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/array-types.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export = ARRAY_TYPES;
|
||||
declare var ARRAY_TYPES: (ArrayConstructor | Int8ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor)[];
|
||||
40
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/create-matcher.d.ts
generated
vendored
Normal file
40
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/create-matcher.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
export = createMatcher;
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
declare function createMatcher(expectation: any, message: string, ...args: any[]): object;
|
||||
declare namespace createMatcher {
|
||||
export { isMatcher };
|
||||
export let any: any;
|
||||
export let defined: any;
|
||||
export let truthy: any;
|
||||
export let falsy: any;
|
||||
export function same(expectation: any): any;
|
||||
function _in(arrayOfExpectations: any): any;
|
||||
export { _in as in };
|
||||
export function typeOf(type: any): any;
|
||||
export function instanceOf(type: any): any;
|
||||
export let has: any;
|
||||
export let hasOwn: any;
|
||||
export function hasNested(property: any, value: any, ...args: any[]): any;
|
||||
export function json(value: any): any;
|
||||
export function every(predicate: any): any;
|
||||
export function some(predicate: any): any;
|
||||
export let array: any;
|
||||
export let map: any;
|
||||
export let set: any;
|
||||
export let bool: any;
|
||||
export let number: any;
|
||||
export let string: any;
|
||||
export let object: any;
|
||||
export let func: any;
|
||||
export let regexp: any;
|
||||
export let date: any;
|
||||
export let symbol: any;
|
||||
}
|
||||
import isMatcher = require("./create-matcher/is-matcher");
|
||||
8
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/create-matcher/assert-matcher.d.ts
generated
vendored
Normal file
8
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/create-matcher/assert-matcher.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
export = assertMatcher;
|
||||
/**
|
||||
* Throws a TypeError when `value` is not a matcher
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to examine
|
||||
*/
|
||||
declare function assertMatcher(value: any): void;
|
||||
12
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/create-matcher/assert-method-exists.d.ts
generated
vendored
Normal file
12
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/create-matcher/assert-method-exists.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
export = assertMethodExists;
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
declare function assertMethodExists(value: any, method: string, name: void, methodPath: string): void;
|
||||
12
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/create-matcher/assert-type.d.ts
generated
vendored
Normal file
12
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/create-matcher/assert-type.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
export = assertType;
|
||||
/**
|
||||
* 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}
|
||||
*/
|
||||
declare function assertType(value: any, type: string, name: string): undefined;
|
||||
9
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/create-matcher/is-iterable.d.ts
generated
vendored
Normal file
9
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/create-matcher/is-iterable.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
export = isIterable;
|
||||
/**
|
||||
* Returns `true` for iterables
|
||||
*
|
||||
* @private
|
||||
* @param {*} value A value to examine
|
||||
* @returns {boolean} Returns `true` when `value` looks like an iterable
|
||||
*/
|
||||
declare function isIterable(value: any): boolean;
|
||||
9
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/create-matcher/is-matcher.d.ts
generated
vendored
Normal file
9
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/create-matcher/is-matcher.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
export = isMatcher;
|
||||
/**
|
||||
* Returns `true` when `object` is a matcher
|
||||
*
|
||||
* @private
|
||||
* @param {*} object A value to examine
|
||||
* @returns {boolean} Returns `true` when `object` is a matcher
|
||||
*/
|
||||
declare function isMatcher(object: any): boolean;
|
||||
11
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/create-matcher/match-object.d.ts
generated
vendored
Normal file
11
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/create-matcher/match-object.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
export = matchObject;
|
||||
/**
|
||||
* 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`
|
||||
*/
|
||||
declare function matchObject(actual: any, expectation: object, matcher: object): boolean;
|
||||
2
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/create-matcher/matcher-prototype.d.ts
generated
vendored
Normal file
2
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/create-matcher/matcher-prototype.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
export function or(valueOrMatcher: any, ...args: any[]): any;
|
||||
export function and(valueOrMatcher: any, ...args: any[]): any;
|
||||
8
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/create-matcher/type-map.d.ts
generated
vendored
Normal file
8
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/create-matcher/type-map.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
export = createTypeMap;
|
||||
declare function createTypeMap(match: any): {
|
||||
function: (m: any, expectation: any, message: any) => void;
|
||||
number: (m: any, expectation: any) => void;
|
||||
object: (m: any, expectation: any) => any;
|
||||
regexp: (m: any, expectation: any) => void;
|
||||
string: (m: any, expectation: any) => void;
|
||||
};
|
||||
13
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/create-set.d.ts
generated
vendored
Normal file
13
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/create-set.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
export = createSet;
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
declare function createSet(array: any[], ...args: any[]): Set<any>;
|
||||
1
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/deep-equal-benchmark.d.ts
generated
vendored
Normal file
1
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/deep-equal-benchmark.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
export {};
|
||||
22
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/deep-equal.d.ts
generated
vendored
Normal file
22
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/deep-equal.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
export = deepEqualCyclic;
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
declare function deepEqualCyclic(actual: any, expectation: any, match: object): boolean;
|
||||
declare namespace deepEqualCyclic {
|
||||
function use(match: any): (a: any, b: any) => boolean;
|
||||
}
|
||||
11
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/get-class.d.ts
generated
vendored
Normal file
11
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/get-class.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
export = getClass;
|
||||
/**
|
||||
* 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`
|
||||
*/
|
||||
declare function getClass(value: any): string;
|
||||
19
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/identical.d.ts
generated
vendored
Normal file
19
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/identical.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
export = identical;
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
declare function identical(obj1: any, obj2: any): boolean;
|
||||
9
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/is-arguments.d.ts
generated
vendored
Normal file
9
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/is-arguments.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
export = isArguments;
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
declare function isArguments(object: any): boolean;
|
||||
9
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/is-array-type.d.ts
generated
vendored
Normal file
9
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/is-array-type.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
export = isArrayType;
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
declare function isArrayType(object: any): boolean;
|
||||
9
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/is-date.d.ts
generated
vendored
Normal file
9
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/is-date.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
export = isDate;
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
declare function isDate(value: Date): boolean;
|
||||
13
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/is-element.d.ts
generated
vendored
Normal file
13
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/is-element.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
export = isElement;
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
declare function isElement(object: object): boolean;
|
||||
9
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/is-iterable.d.ts
generated
vendored
Normal file
9
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/is-iterable.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
export = isIterable;
|
||||
/**
|
||||
* Returns `true` when the argument is an iterable, `false` otherwise
|
||||
*
|
||||
* @alias module:samsam.isIterable
|
||||
* @param {*} val - A value to examine
|
||||
* @returns {boolean} Returns `true` when the argument is an iterable, `false` otherwise
|
||||
*/
|
||||
declare function isIterable(val: any): boolean;
|
||||
9
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/is-map.d.ts
generated
vendored
Normal file
9
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/is-map.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
export = isMap;
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
declare function isMap(value: any): boolean;
|
||||
9
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/is-nan.d.ts
generated
vendored
Normal file
9
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/is-nan.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
export = isNaN;
|
||||
/**
|
||||
* Compares a `value` to `NaN`
|
||||
*
|
||||
* @private
|
||||
* @param {*} value A value to examine
|
||||
* @returns {boolean} Returns `true` when `value` is `NaN`
|
||||
*/
|
||||
declare function isNaN(value: any): boolean;
|
||||
9
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/is-neg-zero.d.ts
generated
vendored
Normal file
9
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/is-neg-zero.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
export = isNegZero;
|
||||
/**
|
||||
* Returns `true` when `value` is `-0`
|
||||
*
|
||||
* @alias module:samsam.isNegZero
|
||||
* @param {*} value A value to examine
|
||||
* @returns {boolean} Returns `true` when `value` is `-0`
|
||||
*/
|
||||
declare function isNegZero(value: any): boolean;
|
||||
16
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/is-object.d.ts
generated
vendored
Normal file
16
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/is-object.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
export = isObject;
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
declare function isObject(value: object): boolean;
|
||||
9
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/is-set.d.ts
generated
vendored
Normal file
9
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/is-set.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
export = isSet;
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
declare function isSet(val: any): boolean;
|
||||
12
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/is-subset.d.ts
generated
vendored
Normal file
12
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/is-subset.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
export = isSubset;
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
declare function isSubset(s1: any[] | Set<any>, s2: any[] | Set<any>, compare: Function): boolean;
|
||||
9
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/iterable-to-string.d.ts
generated
vendored
Normal file
9
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/iterable-to-string.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
export = iterableToString;
|
||||
/**
|
||||
* Creates a string represenation of an iterable object
|
||||
*
|
||||
* @private
|
||||
* @param {object} obj The iterable object to stringify
|
||||
* @returns {string} A string representation
|
||||
*/
|
||||
declare function iterableToString(obj: object): string;
|
||||
10
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/match.d.ts
generated
vendored
Normal file
10
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/match.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
export = match;
|
||||
/**
|
||||
* 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`
|
||||
*/
|
||||
declare function match(object: object, matcherOrValue: object): boolean;
|
||||
10
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/samsam.d.ts
generated
vendored
Normal file
10
github/codeql-action-v2/node_modules/@sinonjs/samsam/types/samsam.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
import createMatcher = require("./create-matcher");
|
||||
declare var deepEqualCyclic: (a: any, b: any) => boolean;
|
||||
import identical = require("./identical");
|
||||
import isArguments = require("./is-arguments");
|
||||
import isElement = require("./is-element");
|
||||
import isMap = require("./is-map");
|
||||
import isNegZero = require("./is-neg-zero");
|
||||
import isSet = require("./is-set");
|
||||
import match = require("./match");
|
||||
export { createMatcher, deepEqualCyclic as deepEqual, identical, isArguments, isElement, isMap, isNegZero, isSet, match };
|
||||
Loading…
Add table
Add a link
Reference in a new issue