mirror of
https://github.com/github/codeql-action.git
synced 2025-12-26 17:20:10 +08:00
Update checked-in dependencies
This commit is contained in:
6
node_modules/string.prototype.includes/.editorconfig
generated
vendored
Normal file
6
node_modules/string.prototype.includes/.editorconfig
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = tab
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
30
node_modules/string.prototype.includes/.eslintrc
generated
vendored
Normal file
30
node_modules/string.prototype.includes/.eslintrc
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"rules": {
|
||||
"id-length": "off",
|
||||
"new-cap": ["error", {
|
||||
"capIsNewExceptions": [
|
||||
"IsRegExp",
|
||||
"RequireObjectCoercible",
|
||||
"ToIntegerOrInfinity",
|
||||
"ToString",
|
||||
],
|
||||
}],
|
||||
"no-magic-numbers": "off",
|
||||
},
|
||||
|
||||
"overrides": [
|
||||
{
|
||||
"files": "tests/**/*",
|
||||
"rules": {
|
||||
"func-style": "off",
|
||||
"max-lines-per-function": "off",
|
||||
"max-statements-per-line": "off",
|
||||
"no-magic-numbers": "off",
|
||||
},
|
||||
},
|
||||
]
|
||||
}
|
||||
2
node_modules/string.prototype.includes/.gitattributes
generated
vendored
Normal file
2
node_modules/string.prototype.includes/.gitattributes
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# Automatically normalize line endings for all text-based files
|
||||
* text=auto
|
||||
11
node_modules/string.prototype.includes/.github/workflows/node-aught.yml
generated
vendored
Normal file
11
node_modules/string.prototype.includes/.github/workflows/node-aught.yml
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
name: 'Tests: node.js < 10'
|
||||
|
||||
on: [pull_request, push]
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
uses: ljharb/actions/.github/workflows/node.yml@main
|
||||
with:
|
||||
range: '< 10'
|
||||
type: minors
|
||||
command: npm run tests-only
|
||||
7
node_modules/string.prototype.includes/.github/workflows/node-pretest.yml
generated
vendored
Normal file
7
node_modules/string.prototype.includes/.github/workflows/node-pretest.yml
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
name: 'Tests: pretest/posttest'
|
||||
|
||||
on: [pull_request, push]
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
uses: ljharb/actions/.github/workflows/pretest.yml@main
|
||||
11
node_modules/string.prototype.includes/.github/workflows/node-tens.yml
generated
vendored
Normal file
11
node_modules/string.prototype.includes/.github/workflows/node-tens.yml
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
name: 'Tests: node.js >= 10'
|
||||
|
||||
on: [pull_request, push]
|
||||
|
||||
jobs:
|
||||
tests:
|
||||
uses: ljharb/actions/.github/workflows/node.yml@main
|
||||
with:
|
||||
range: '>= 10'
|
||||
type: minors
|
||||
command: npm run tests-only
|
||||
28
node_modules/string.prototype.includes/.github/workflows/publish-on-tag.yml
generated
vendored
Normal file
28
node_modules/string.prototype.includes/.github/workflows/publish-on-tag.yml
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
name: publish-on-tag
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
- name: Test
|
||||
run: npm test
|
||||
- name: Publish
|
||||
env:
|
||||
NPM_TOKEN: ${{secrets.NPM_TOKEN}}
|
||||
run: |
|
||||
npm config set registry 'https://wombat-dressing-room.appspot.com/'
|
||||
npm config set '//wombat-dressing-room.appspot.com/:_authToken' '${NPM_TOKEN}'
|
||||
npm publish
|
||||
9
node_modules/string.prototype.includes/.github/workflows/rebase.yml
generated
vendored
Normal file
9
node_modules/string.prototype.includes/.github/workflows/rebase.yml
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
name: Automatic Rebase
|
||||
|
||||
on: [pull_request_target]
|
||||
|
||||
jobs:
|
||||
_:
|
||||
uses: ljharb/actions/.github/workflows/rebase.yml@main
|
||||
secrets:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
12
node_modules/string.prototype.includes/.github/workflows/require-allow-edits.yml
generated
vendored
Normal file
12
node_modules/string.prototype.includes/.github/workflows/require-allow-edits.yml
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
name: Require “Allow Edits”
|
||||
|
||||
on: [pull_request_target]
|
||||
|
||||
jobs:
|
||||
_:
|
||||
name: "Require “Allow Edits”"
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: ljharb/require-allow-edits@main
|
||||
7
node_modules/string.prototype.includes/.travis.yml
generated
vendored
Normal file
7
node_modules/string.prototype.includes/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
version: ~> 1.0
|
||||
language: node_js
|
||||
os:
|
||||
- linux
|
||||
import:
|
||||
- ljharb/travis-ci:node/all.yml
|
||||
- ljharb/travis-ci:node/pretest.yml
|
||||
20
node_modules/string.prototype.includes/LICENSE
generated
vendored
Normal file
20
node_modules/string.prototype.includes/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
Copyright Mathias Bynens <https://mathiasbynens.be/>
|
||||
|
||||
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.
|
||||
48
node_modules/string.prototype.includes/README.md
generated
vendored
Normal file
48
node_modules/string.prototype.includes/README.md
generated
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
# ES6 `String.prototype.includes` polyfill [](https://travis-ci.org/mathiasbynens/String.prototype.includes)
|
||||
|
||||
A robust & optimized polyfill for [the `String.prototype.includes` method (previously known as `String.prototype.contains`) in ECMAScript 6](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.includes).
|
||||
|
||||
This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec](https://tc39.es/ecma262/#sec-string.prototype.includes).
|
||||
|
||||
Other polyfills for `String.prototype.includes` are available:
|
||||
|
||||
* <https://github.com/paulmillr/es6-shim/blob/d8c4ec246a15e7df55da60b7f9b745af84ca9021/es6-shim.js#L186-L190> by [Paul Miller](http://paulmillr.com/) (~~[fails some tests](https://github.com/paulmillr/es6-shim/issues/175)~~ passes all tests)
|
||||
* <https://github.com/google/traceur-compiler/blob/315bdad05d41de46d25337422d66686d63100d7a/src/runtime/polyfills/String.js#L68-L86> by Google (~~[fails a lot of tests](https://github.com/google/traceur-compiler/pull/556)~~ now uses this polyfill and passes all tests)
|
||||
|
||||
## Installation
|
||||
|
||||
Via [npm](http://npmjs.org/):
|
||||
|
||||
```bash
|
||||
npm install string.prototype.includes
|
||||
```
|
||||
|
||||
Then, in [Node.js](http://nodejs.org/):
|
||||
|
||||
```js
|
||||
var includes = require('string.prototype.includes');
|
||||
```
|
||||
|
||||
In a browser:
|
||||
|
||||
```html
|
||||
<script src="https://bundle.run/string.prototype.includes"></script>
|
||||
```
|
||||
|
||||
> **NOTE**: It's recommended that you install this module using a package manager
|
||||
> such as `npm`, because loading multiple polyfills from a CDN (such as `bundle.run`)
|
||||
> will lead to duplicated code.
|
||||
|
||||
## Notes
|
||||
|
||||
Polyfills + test suites for [`String.prototype.startsWith`](https://mths.be/startswith) and [`String.prototype.endsWith`](https://mths.be/endswith) are available, too.
|
||||
|
||||
## Author
|
||||
|
||||
| [](https://twitter.com/mathias "Follow @mathias on Twitter") |
|
||||
|---|
|
||||
| [Mathias Bynens](https://mathiasbynens.be/) |
|
||||
|
||||
## License
|
||||
|
||||
This polyfill is available under the [MIT](https://mths.be/mit) license.
|
||||
5
node_modules/string.prototype.includes/auto.js
generated
vendored
Normal file
5
node_modules/string.prototype.includes/auto.js
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
/*! https://mths.be/includes v2.0.0 by @mathias */
|
||||
|
||||
'use strict';
|
||||
|
||||
require('./shim')();
|
||||
32
node_modules/string.prototype.includes/implementation.js
generated
vendored
Normal file
32
node_modules/string.prototype.includes/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
/*! https://mths.be/includes v2.0.0 by @mathias */
|
||||
|
||||
'use strict';
|
||||
|
||||
var callBound = require('call-bind/callBound');
|
||||
var RequireObjectCoercible = require('es-abstract/2024/RequireObjectCoercible');
|
||||
var ToString = require('es-abstract/2024/ToString');
|
||||
var ToIntegerOrInfinity = require('es-abstract/2024/ToIntegerOrInfinity');
|
||||
var IsRegExp = require('es-abstract/2024/IsRegExp');
|
||||
|
||||
var min = Math.min;
|
||||
var max = Math.max;
|
||||
var indexOf = callBound('String.prototype.indexOf');
|
||||
|
||||
module.exports = function includes(searchString) {
|
||||
var O = RequireObjectCoercible(this);
|
||||
var S = ToString(O);
|
||||
if (IsRegExp(searchString)) {
|
||||
throw new TypeError('Argument to String.prototype.includes cannot be a RegExp');
|
||||
}
|
||||
var searchStr = String(searchString);
|
||||
var searchLength = searchStr.length;
|
||||
var position = arguments.length > 1 ? arguments[1] : undefined;
|
||||
var pos = ToIntegerOrInfinity(position);
|
||||
var len = S.length;
|
||||
var start = min(max(pos, 0), len);
|
||||
// Avoid the `indexOf` call if no match is possible
|
||||
if (searchLength + start > len) {
|
||||
return false;
|
||||
}
|
||||
return indexOf(S, searchStr, pos) !== -1;
|
||||
};
|
||||
20
node_modules/string.prototype.includes/index.js
generated
vendored
Normal file
20
node_modules/string.prototype.includes/index.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
/*! https://mths.be/includes v2.0.0 by @mathias */
|
||||
|
||||
'use strict';
|
||||
|
||||
var callBind = require('call-bind');
|
||||
var define = require('define-properties');
|
||||
|
||||
var implementation = require('./implementation');
|
||||
var getPolyfill = require('./polyfill');
|
||||
var shim = require('./shim');
|
||||
|
||||
var boundIncludes = callBind(getPolyfill());
|
||||
|
||||
define(boundIncludes, {
|
||||
getPolyfill: getPolyfill,
|
||||
implementation: implementation,
|
||||
shim: shim
|
||||
});
|
||||
|
||||
module.exports = boundIncludes;
|
||||
61
node_modules/string.prototype.includes/package.json
generated
vendored
Normal file
61
node_modules/string.prototype.includes/package.json
generated
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
{
|
||||
"name": "string.prototype.includes",
|
||||
"version": "2.0.1",
|
||||
"description": "A robust & optimized `String.prototype.includes` polyfill, based on the ECMAScript 6 specification.",
|
||||
"homepage": "https://mths.be/includes",
|
||||
"main": "index.js",
|
||||
"exports": {
|
||||
".": "./index.js",
|
||||
"./auto": "./auto.js",
|
||||
"./polyfill": "./polyfill.js",
|
||||
"./implementation": "./implementation.js",
|
||||
"./shim": "./shim.js",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"keywords": [
|
||||
"string",
|
||||
"includes",
|
||||
"es6",
|
||||
"ecmascript",
|
||||
"polyfill"
|
||||
],
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
"name": "Mathias Bynens",
|
||||
"url": "https://mathiasbynens.be/"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mathiasbynens/String.prototype.includes.git"
|
||||
},
|
||||
"bugs": "https://github.com/mathiasbynens/String.prototype.includes/issues",
|
||||
"scripts": {
|
||||
"lint": "eslint --ext=js,mjs .",
|
||||
"postlint": "es-shim-api --bound",
|
||||
"pretest": "npm run lint",
|
||||
"test": "npm run tests-only",
|
||||
"tests-only": "tape 'tests/*.js'",
|
||||
"posttest": "npx npm@'>=10.2' audit --production",
|
||||
"cover": "istanbul cover --report html --verbose --dir coverage tape 'tests/*.js'"
|
||||
},
|
||||
"dependencies": {
|
||||
"call-bind": "^1.0.7",
|
||||
"define-properties": "^1.2.1",
|
||||
"es-abstract": "^1.23.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@es-shims/api": "^2.5.1",
|
||||
"@ljharb/eslint-config": "^21.1.1",
|
||||
"eslint": "=8.8.0",
|
||||
"functions-have-names": "^1.2.3",
|
||||
"istanbul": "^0.4.5",
|
||||
"mock-property": "^1.1.0",
|
||||
"tape": "^5.9.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"directories": {
|
||||
"test": "tests"
|
||||
}
|
||||
}
|
||||
9
node_modules/string.prototype.includes/polyfill.js
generated
vendored
Normal file
9
node_modules/string.prototype.includes/polyfill.js
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
/*! https://mths.be/includes v2.0.0 by @mathias */
|
||||
|
||||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
module.exports = function getPolyfill() {
|
||||
return String.prototype.includes || implementation;
|
||||
};
|
||||
17
node_modules/string.prototype.includes/shim.js
generated
vendored
Normal file
17
node_modules/string.prototype.includes/shim.js
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/*! https://mths.be/includes v2.0.0 by @mathias */
|
||||
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
|
||||
var getPolyfill = require('./polyfill');
|
||||
|
||||
module.exports = function shimIncludes() {
|
||||
var polyfill = getPolyfill();
|
||||
|
||||
if (String.prototype.includes !== polyfill) {
|
||||
define(String.prototype, { includes: polyfill });
|
||||
}
|
||||
|
||||
return polyfill;
|
||||
};
|
||||
12
node_modules/string.prototype.includes/tests/index.js
generated
vendored
Normal file
12
node_modules/string.prototype.includes/tests/index.js
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
var includes = require('../');
|
||||
var test = require('tape');
|
||||
|
||||
var runTests = require('./tests');
|
||||
|
||||
test('as a function', function (t) {
|
||||
runTests(includes, t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
30
node_modules/string.prototype.includes/tests/shimmed.js
generated
vendored
Normal file
30
node_modules/string.prototype.includes/tests/shimmed.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
'use strict';
|
||||
|
||||
var includes = require('../');
|
||||
includes.shim();
|
||||
|
||||
var test = require('tape');
|
||||
var defineProperties = require('define-properties');
|
||||
var callBind = require('call-bind');
|
||||
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
||||
var functionsHaveNames = require('functions-have-names')();
|
||||
|
||||
var runTests = require('./tests');
|
||||
|
||||
test('shimmed', function (t) {
|
||||
t.equal(String.prototype.includes.length, 1, 'String#includes has a length of 1');
|
||||
|
||||
t.test('Function name', { skip: !functionsHaveNames }, function (st) {
|
||||
st.equal(String.prototype.includes.name, 'includes', 'String#includes has name "includes"');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (st) {
|
||||
st.equal(false, isEnumerable.call(String.prototype, 'includes'), 'String#includes is not enumerable');
|
||||
st.end();
|
||||
});
|
||||
|
||||
runTests(callBind(String.prototype.includes), t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
137
node_modules/string.prototype.includes/tests/tests.js
generated
vendored
Normal file
137
node_modules/string.prototype.includes/tests/tests.js
generated
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
'use strict';
|
||||
|
||||
var mockProperty = require('mock-property');
|
||||
|
||||
function fakeArg(fn) {
|
||||
return function (st) {
|
||||
// try to break `arguments[1]`
|
||||
st.teardown(mockProperty(Object.prototype, 1, { value: 2 }));
|
||||
return fn(st);
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = function (includes, t) {
|
||||
t.test('cast searchString arg', fakeArg(function (st) {
|
||||
st.equals(includes('abc'), false);
|
||||
st.equals(includes('aundefinedb'), true);
|
||||
st.equals(includes('abc', undefined), false);
|
||||
st.equals(includes('aundefinedb', undefined), true);
|
||||
st.equals(includes('abc', null), false);
|
||||
st.equals(includes('anullb', null), true);
|
||||
st.equals(includes('abc', false), false);
|
||||
st.equals(includes('afalseb', false), true);
|
||||
st.equals(includes('abc', NaN), false);
|
||||
st.equals(includes('aNaNb', NaN), true);
|
||||
st.end();
|
||||
}));
|
||||
|
||||
t.test('basic support', fakeArg(function (st) {
|
||||
st.equals(includes('abc', 'abc'), true);
|
||||
st.equals(includes('abc', 'def'), false);
|
||||
st.equals(includes('abc', ''), true);
|
||||
st.equals(includes('', ''), true);
|
||||
st.equals(includes('abc', 'bc'), true);
|
||||
st.equals(includes('abc', 'bc\0'), false);
|
||||
st.end();
|
||||
}));
|
||||
|
||||
t.test('pos argument', function (st) {
|
||||
st.equals(includes('abc', 'b', -Infinity), true);
|
||||
st.equals(includes('abc', 'b', -1), true);
|
||||
st.equals(includes('abc', 'b', -0), true);
|
||||
st.equals(includes('abc', 'b', +0), true);
|
||||
st.equals(includes('abc', 'b', NaN), true);
|
||||
st.equals(includes('abc', 'b', 'x'), true);
|
||||
st.equals(includes('abc', 'b', false), true);
|
||||
st.equals(includes('abc', 'b', undefined), true);
|
||||
st.equals(includes('abc', 'b', null), true);
|
||||
st.equals(includes('abc', 'b', 1), true);
|
||||
st.equals(includes('abc', 'b', 2), false);
|
||||
st.equals(includes('abc', 'b', 3), false);
|
||||
st.equals(includes('abc', 'b', 4), false);
|
||||
st.equals(includes('abc', 'b', Number(Infinity)), false);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('cast stringSearch arg with pos - included', function (st) {
|
||||
st.equals(includes('abc123def', 1, -Infinity), true);
|
||||
st.equals(includes('abc123def', 1, -1), true);
|
||||
st.equals(includes('abc123def', 1, -0), true);
|
||||
st.equals(includes('abc123def', 1, +0), true);
|
||||
st.equals(includes('abc123def', 1, NaN), true);
|
||||
st.equals(includes('abc123def', 1, 'x'), true);
|
||||
st.equals(includes('abc123def', 1, false), true);
|
||||
st.equals(includes('abc123def', 1, undefined), true);
|
||||
st.equals(includes('abc123def', 1, null), true);
|
||||
st.equals(includes('abc123def', 1, 1), true);
|
||||
st.equals(includes('abc123def', 1, 2), true);
|
||||
st.equals(includes('abc123def', 1, 3), true);
|
||||
st.equals(includes('abc123def', 1, 4), false);
|
||||
st.equals(includes('abc123def', 1, 5), false);
|
||||
st.equals(includes('abc123def', 1, Number(Infinity)), false);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('cast stringSearch arg with pos - not included', function (st) {
|
||||
st.equals(includes('abc123def', 9, -Infinity), false);
|
||||
st.equals(includes('abc123def', 9, -1), false);
|
||||
st.equals(includes('abc123def', 9, -0), false);
|
||||
st.equals(includes('abc123def', 9, +0), false);
|
||||
st.equals(includes('abc123def', 9, NaN), false);
|
||||
st.equals(includes('abc123def', 9, 'x'), false);
|
||||
st.equals(includes('abc123def', 9, false), false);
|
||||
st.equals(includes('abc123def', 9, undefined), false);
|
||||
st.equals(includes('abc123def', 9, null), false);
|
||||
st.equals(includes('abc123def', 9, 1), false);
|
||||
st.equals(includes('abc123def', 9, 2), false);
|
||||
st.equals(includes('abc123def', 9, 3), false);
|
||||
st.equals(includes('abc123def', 9, 4), false);
|
||||
st.equals(includes('abc123def', 9, 5), false);
|
||||
st.equals(includes('abc123def', 9, Number(Infinity)), false);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('regex searchString', function (st) {
|
||||
st.equals(includes('foo[a-z]+(bar)?', '[a-z]+'), true);
|
||||
st['throws'](function () { includes('foo[a-z]+(bar)?', /[a-z]+/); }, TypeError);
|
||||
st['throws'](function () { includes('foo/[a-z]+/(bar)?', /[a-z]+/); }, TypeError);
|
||||
st.equals(includes('foo[a-z]+(bar)?', '(bar)?'), true);
|
||||
st['throws'](function () { includes('foo[a-z]+(bar)?', /(bar)?/); }, TypeError);
|
||||
st['throws'](function () { includes('foo[a-z]+/(bar)?/', /(bar)?/); }, TypeError);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('astral symbols', function (st) {
|
||||
// https://mathiasbynens.be/notes/javascript-unicode#poo-test
|
||||
var string = 'I\xF1t\xEBrn\xE2ti\xF4n\xE0liz\xE6ti\xF8n\u2603\uD83D\uDCA9';
|
||||
st.equals(string.includes(''), true);
|
||||
st.equals(string.includes('\xF1t\xEBr'), true);
|
||||
st.equals(string.includes('\xE0liz\xE6'), true);
|
||||
st.equals(string.includes('\xF8n\u2603\uD83D\uDCA9'), true);
|
||||
st.equals(string.includes('\u2603'), true);
|
||||
st.equals(string.includes('\uD83D\uDCA9'), true);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('nullish this object', function (st) {
|
||||
st['throws'](function () { includes(undefined); }, TypeError);
|
||||
st['throws'](function () { includes(undefined, 'b'); }, TypeError);
|
||||
st['throws'](function () { includes(undefined, 'b', 4); }, TypeError);
|
||||
st['throws'](function () { includes(null); }, TypeError);
|
||||
st['throws'](function () { includes(null, 'b'); }, TypeError);
|
||||
st['throws'](function () { includes(null, 'b', 4); }, TypeError);
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('cast this object', function (st) {
|
||||
st.equals(includes(42, '2'), true);
|
||||
st.equals(includes(42, 'b', 4), false);
|
||||
st.equals(includes(42, '2', 4), false);
|
||||
st.equals(includes({ toString: function () { return 'abc'; } }, 'b', 0), true);
|
||||
st.equals(includes({ toString: function () { return 'abc'; } }, 'b', 1), true);
|
||||
st.equals(includes({ toString: function () { return 'abc'; } }, 'b', 2), false);
|
||||
st['throws'](function () { includes({ toString: function () { throw new RangeError(); } }, /./); }, RangeError);
|
||||
st['throws'](function () { includes({ toString: function () { return 'abc'; } }, /./); }, TypeError);
|
||||
st.end();
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user