Bump the npm group with 2 updates (#1819)
* Bump the npm group with 2 updates Bumps the npm group with 2 updates: [eslint](https://github.com/eslint/eslint) and [eslint-plugin-import](https://github.com/import-js/eslint-plugin-import). Updates `eslint` from 8.45.0 to 8.46.0 - [Release notes](https://github.com/eslint/eslint/releases) - [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md) - [Commits](https://github.com/eslint/eslint/compare/v8.45.0...v8.46.0) Updates `eslint-plugin-import` from 2.27.5 to 2.28.0 - [Release notes](https://github.com/import-js/eslint-plugin-import/releases) - [Changelog](https://github.com/import-js/eslint-plugin-import/blob/main/CHANGELOG.md) - [Commits](https://github.com/import-js/eslint-plugin-import/compare/v2.27.5...v2.28.0) --- updated-dependencies: - dependency-name: eslint dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm - dependency-name: eslint-plugin-import dependency-type: direct:development update-type: version-update:semver-minor dependency-group: npm ... Signed-off-by: dependabot[bot] <support@github.com> * Update checked-in dependencies --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
parent
a6b0ced86b
commit
e7e35baaf0
1408 changed files with 27215 additions and 9910 deletions
36
node_modules/array.prototype.findlastindex/.eslintrc
generated
vendored
Normal file
36
node_modules/array.prototype.findlastindex/.eslintrc
generated
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"rules": {
|
||||
"array-bracket-newline": 0,
|
||||
"id-length": 0,
|
||||
"new-cap": [2, {
|
||||
"capIsNewExceptions": [
|
||||
"GetIntrinsic",
|
||||
"Call",
|
||||
"Get",
|
||||
"IsCallable",
|
||||
"LengthOfArrayLike",
|
||||
"RequireObjectCoercible",
|
||||
"ToBoolean",
|
||||
"ToObject",
|
||||
"ToString",
|
||||
],
|
||||
}],
|
||||
"no-magic-numbers": 0,
|
||||
},
|
||||
|
||||
"overrides": [
|
||||
{
|
||||
"files": "test/**",
|
||||
"rules": {
|
||||
"func-name-matching": 0,
|
||||
"max-lines-per-function": 0,
|
||||
"no-invalid-this": 1,
|
||||
"strict": 1,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
12
node_modules/array.prototype.findlastindex/.github/FUNDING.yml
generated
vendored
Normal file
12
node_modules/array.prototype.findlastindex/.github/FUNDING.yml
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# These are supported funding model platforms
|
||||
|
||||
github: [ljharb]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: npm/array.prototype.findlastindex
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
9
node_modules/array.prototype.findlastindex/.nycrc
generated
vendored
Normal file
9
node_modules/array.prototype.findlastindex/.nycrc
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"all": true,
|
||||
"check-coverage": false,
|
||||
"reporter": ["text-summary", "text", "html", "json"],
|
||||
"exclude": [
|
||||
"coverage",
|
||||
"test"
|
||||
]
|
||||
}
|
||||
66
node_modules/array.prototype.findlastindex/CHANGELOG.md
generated
vendored
Normal file
66
node_modules/array.prototype.findlastindex/CHANGELOG.md
generated
vendored
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [v1.2.2](https://github.com/es-shims/Array.prototype.findLastIndex/compare/v1.2.1...v1.2.2) - 2022-11-02
|
||||
|
||||
### Commits
|
||||
|
||||
- [meta] use `npmignore` to autogenerate an npmignore file [`f910dc6`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/f910dc6e5999e6941892232810ae9b3910d925ec)
|
||||
- [Deps] update `es-abstract`, `get-intrinsic` [`6e44207`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/6e4420705d7435b8b9bb978e4858814ba0216fa5)
|
||||
- [actions] update rebase action to use reusable workflow [`aac0471`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/aac0471a0b2f0f44765ac6055211b58f26fa6636)
|
||||
- [Deps] update `define-properties`, `es-abstract`, `get-intrinsic` [`c1d1d70`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/c1d1d7083bfa8ab32a9e5560e4b2aa16ce9d0a6d)
|
||||
- [Dev Deps] update `es-value-fixtures`, `object-inspect`, `tape` [`64c4c0f`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/64c4c0f6dda4793c5d9db5110ec82c6004bcc4ef)
|
||||
- [Dev Deps] update `aud`, `tape` [`603fbac`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/603fbacf4d034298ff40ab6886f6af7031651acd)
|
||||
- [Tests] add indication of whether it was shimmed [`7d711f6`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/7d711f6e68c9c5e4e0556946d026c159f7d82f22)
|
||||
- [Tests] make nullish receiver tests more robust [`335cf53`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/335cf5381ec0bc7ce60de8824b736cb3b40918ae)
|
||||
|
||||
## [v1.2.1](https://github.com/es-shims/Array.prototype.findLastIndex/compare/v1.2.0...v1.2.1) - 2022-04-11
|
||||
|
||||
### Commits
|
||||
|
||||
- [Refactor] use `es-shim-unscopables` [`abe84ee`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/abe84ee8794ce9c84180bc01cf499a7bb2494b3d)
|
||||
|
||||
## [v1.2.0](https://github.com/es-shims/Array.prototype.findLastIndex/compare/v1.1.1...v1.2.0) - 2022-04-11
|
||||
|
||||
### Commits
|
||||
|
||||
- [actions] reuse common workflows [`670cc4c`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/670cc4c0b6f23b7f01d365a9afd2dd88ee2e4967)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `object-inspect`, `safe-publish-latest`, `tape` [`11bc460`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/11bc460ab842d2a08c43b67aab182e0697d65308)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `object-inspect`, `tape` [`b076ad6`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/b076ad6ed9246f3139efa72d0ddbf2e0d861f982)
|
||||
- [actions] update codecov uploader [`0d62d86`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/0d62d8602c2d3ecefdd0965c25cafb2a864c0903)
|
||||
- [New] `shim`/`auto`: add `findLast` to `Symbol.unscopables` [`b09e4a6`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/b09e4a6a194366b45945c6d65cdcc64ca786e570)
|
||||
- [Deps] update `es-abstract` [`024128c`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/024128c1abc5b58863859ea8b9cf4c1cb1df548b)
|
||||
- [Deps] update `es-abstract` [`2dcab99`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/2dcab99e3ed43546cd6610b12d489d95d8e94d90)
|
||||
|
||||
## [v1.1.1](https://github.com/es-shims/Array.prototype.findLastIndex/compare/v1.1.0...v1.1.1) - 2021-10-01
|
||||
|
||||
### Commits
|
||||
|
||||
- [Refactor] remove unnecessary ESM files [`35161c7`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/35161c76758835dd3fbecdf0b5fbf41a3ce9f218)
|
||||
- [Tests] add new tests from test262 [`e26fa25`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/e26fa256601f60b1feb5918e4fbcc76d0d773d13)
|
||||
- [Deps] update `es-abstract` [`5ff80b1`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/5ff80b116f2e083ae72605275af0efec367f3a89)
|
||||
- [readme] fix URLs [`b962fe2`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/b962fe225fac8a450624d861b5d6e444526bcf32)
|
||||
- [Dev Deps] update `@ljharb/eslint-config`, `@es-shims/api` [`5aa11dd`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/5aa11dd23ee2bcdc9ca7d2d6007e7f44a9356743)
|
||||
|
||||
## [v1.1.0](https://github.com/es-shims/Array.prototype.findLastIndex/compare/v1.0.0...v1.1.0) - 2021-08-07
|
||||
|
||||
### Commits
|
||||
|
||||
- [New] add ESM entry points [`ac5ada3`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/ac5ada3d359ff267e6933dd817f4106e6de2c157)
|
||||
- [Fix] ES3 engines: ensure nullish receiver throws [`4c6592a`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/4c6592a7962351e82bb1b06c79de496bf4bcd08d)
|
||||
- [Dev Deps] update `eslint`, `@tape` [`6895166`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/6895166742a738a80d19ac4eaa6f12c97a5c7814)
|
||||
- [Fix] add missing entry points to `exports` [`ac2f138`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/ac2f1384dcd9a9f736ce1c3c5dc7ac87e16c4f90)
|
||||
- [Deps] update `es-abstract` [`c379fb7`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/c379fb7681ea3bb078891bf394756b1086bc43e7)
|
||||
|
||||
## v1.0.0 - 2021-07-13
|
||||
|
||||
### Commits
|
||||
|
||||
- Implementation & Tests [`cf5cae1`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/cf5cae1d78c0c74588a5baade5156950e17f4558)
|
||||
- Initial commit [`2778f1c`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/2778f1cc708cc79d3bdbc20d5b84d210b9670b8a)
|
||||
- npm init [`873482d`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/873482d650b6800e9484865c3b0d6d33664bcf9e)
|
||||
- Only apps should have lockfiles [`b7c73ee`](https://github.com/es-shims/Array.prototype.findLastIndex/commit/b7c73ee858f01b0b1ff70800e09c0bbc2632e1a5)
|
||||
21
node_modules/array.prototype.findlastindex/LICENSE
generated
vendored
Normal file
21
node_modules/array.prototype.findlastindex/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2021 ECMAScript Shims
|
||||
|
||||
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.
|
||||
74
node_modules/array.prototype.findlastindex/README.md
generated
vendored
Normal file
74
node_modules/array.prototype.findlastindex/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
# array.prototype.findlastindex <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
||||
|
||||
[![github actions][actions-image]][actions-url]
|
||||
[![coverage][codecov-image]][codecov-url]
|
||||
[![dependency status][deps-svg]][deps-url]
|
||||
[![dev dependency status][dev-deps-svg]][dev-deps-url]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][npm-badge-png]][package-url]
|
||||
|
||||
An ESnext spec-compliant `Array.prototype.findLastIndex` shim/polyfill/replacement that works as far down as ES3.
|
||||
|
||||
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 proposed [spec](https://tc39.es/proposal-array-find-from-last).
|
||||
|
||||
Because `Array.prototype.findLastIndex` depends on a receiver (the `this` value), the main export takes the array to operate on as the first argument.
|
||||
|
||||
## Getting started
|
||||
|
||||
```sh
|
||||
npm install --save array.prototype.findlastindex
|
||||
```
|
||||
|
||||
## Usage/Examples
|
||||
|
||||
```js
|
||||
var findLastIndex = require('array.prototype.findlastindex');
|
||||
var assert = require('assert');
|
||||
|
||||
var arr = [1, [2], [], 3, [[4]]];
|
||||
var isNumber = function (x) { return typeof x === 'number' };
|
||||
|
||||
assert.deepEqual(findLastIndex(arr, isNumber), 3);
|
||||
```
|
||||
|
||||
```js
|
||||
var findLastIndex = require('array.prototype.findlastindex');
|
||||
var assert = require('assert');
|
||||
/* when Array#findLastIndex is not present */
|
||||
delete Array.prototype.findLastIndex;
|
||||
var shimmed = findLastIndex.shim();
|
||||
|
||||
assert.equal(shimmed, findLastIndex.getPolyfill());
|
||||
assert.deepEqual(arr.findLastIndex(isNumber), findLastIndex(arr, isNumber));
|
||||
```
|
||||
|
||||
```js
|
||||
var findLastIndex = require('array.prototype.findlastindex');
|
||||
var assert = require('assert');
|
||||
/* when Array#findLastIndex is present */
|
||||
var shimmed = findLastIndex.shim();
|
||||
|
||||
assert.equal(shimmed, Array.prototype.findLastIndex);
|
||||
assert.deepEqual(arr.findLastIndex(isNumber), findLastIndex(arr, isNumber));
|
||||
```
|
||||
|
||||
## Tests
|
||||
Simply clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
[package-url]: https://npmjs.org/package/array.prototype.findlastindex
|
||||
[npm-version-svg]: https://versionbadg.es/es-shims/Array.prototype.findLastIndex.svg
|
||||
[deps-svg]: https://david-dm.org/es-shims/Array.prototype.findLastIndex.svg
|
||||
[deps-url]: https://david-dm.org/es-shims/Array.prototype.findLastIndex
|
||||
[dev-deps-svg]: https://david-dm.org/es-shims/Array.prototype.findLastIndex/dev-status.svg
|
||||
[dev-deps-url]: https://david-dm.org/es-shims/Array.prototype.findLastIndex#info=devDependencies
|
||||
[npm-badge-png]: https://nodei.co/npm/array.prototype.findlastindex.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/array.prototype.findlastindex.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/array.prototype.findlastindex.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=array.prototype.findlastindex
|
||||
[codecov-image]: https://codecov.io/gh/es-shims/Array.prototype.findLastIndex/branch/main/graphs/badge.svg
|
||||
[codecov-url]: https://app.codecov.io/gh/es-shims/Array.prototype.findLastIndex/
|
||||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/Array.prototype.findLastIndex
|
||||
[actions-url]: https://github.com/es-shims/Array.prototype.findLastIndex
|
||||
3
node_modules/array.prototype.findlastindex/auto.js
generated
vendored
Normal file
3
node_modules/array.prototype.findlastindex/auto.js
generated
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
'use strict';
|
||||
|
||||
require('./shim')();
|
||||
39
node_modules/array.prototype.findlastindex/implementation.js
generated
vendored
Normal file
39
node_modules/array.prototype.findlastindex/implementation.js
generated
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var Call = require('es-abstract/2022/Call');
|
||||
var Get = require('es-abstract/2022/Get');
|
||||
var IsCallable = require('es-abstract/2022/IsCallable');
|
||||
var LengthOfArrayLike = require('es-abstract/2022/LengthOfArrayLike');
|
||||
var ToBoolean = require('es-abstract/2022/ToBoolean');
|
||||
var ToObject = require('es-abstract/2022/ToObject');
|
||||
var ToString = require('es-abstract/2022/ToString');
|
||||
|
||||
module.exports = function findLastIndex(predicate) {
|
||||
var O = ToObject(this);
|
||||
var len = LengthOfArrayLike(O);
|
||||
|
||||
if (!IsCallable(predicate)) {
|
||||
throw new $TypeError('predicate must be a function');
|
||||
}
|
||||
|
||||
var thisArg;
|
||||
if (arguments.length > 1) {
|
||||
thisArg = arguments[1];
|
||||
}
|
||||
|
||||
var k = len - 1;
|
||||
while (k >= 0) {
|
||||
var Pk = ToString(k);
|
||||
var kValue = Get(O, Pk);
|
||||
var testResult = ToBoolean(Call(predicate, thisArg, [kValue, k, O]));
|
||||
if (testResult) {
|
||||
return k;
|
||||
}
|
||||
k -= 1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
};
|
||||
28
node_modules/array.prototype.findlastindex/index.js
generated
vendored
Normal file
28
node_modules/array.prototype.findlastindex/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var callBind = require('call-bind');
|
||||
var callBound = require('call-bind/callBound');
|
||||
var RequireObjectCoercible = require('es-abstract/2022/RequireObjectCoercible');
|
||||
|
||||
var implementation = require('./implementation');
|
||||
var getPolyfill = require('./polyfill');
|
||||
var polyfill = getPolyfill();
|
||||
var shim = require('./shim');
|
||||
|
||||
var $slice = callBound('Array.prototype.slice');
|
||||
|
||||
var bound = callBind.apply(polyfill);
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
var boundFindLast = function findLastIndex(array, predicate) {
|
||||
RequireObjectCoercible(array);
|
||||
return bound(array, $slice(arguments, 1));
|
||||
};
|
||||
|
||||
define(boundFindLast, {
|
||||
getPolyfill: getPolyfill,
|
||||
implementation: implementation,
|
||||
shim: shim
|
||||
});
|
||||
|
||||
module.exports = boundFindLast;
|
||||
18
node_modules/array.prototype.findlastindex/index.mjs
generated
vendored
Normal file
18
node_modules/array.prototype.findlastindex/index.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import callBind from 'call-bind';
|
||||
import callBound from 'call-bind/callBound';
|
||||
import RequireObjectCoercible from 'es-abstract/2022/RequireObjectCoercible.js';
|
||||
|
||||
import getPolyfill from 'array.prototype.findlastindex/polyfill';
|
||||
|
||||
const bound = callBind.apply(getPolyfill());
|
||||
const $slice = callBound('Array.prototype.slice');
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
export default function findLastIndex(array, predicate) {
|
||||
RequireObjectCoercible(array);
|
||||
return bound(array, $slice(arguments, 1));
|
||||
}
|
||||
|
||||
export { default as getPolyfill } from 'array.prototype.findlastindex/polyfill';
|
||||
export { default as implementation } from 'array.prototype.findlastindex/implementation';
|
||||
export { default as shim } from 'array.prototype.findlastindex/shim';
|
||||
119
node_modules/array.prototype.findlastindex/package.json
generated
vendored
Normal file
119
node_modules/array.prototype.findlastindex/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
{
|
||||
"name": "array.prototype.findlastindex",
|
||||
"version": "1.2.2",
|
||||
"description": "An ESnext spec-compliant `Array.prototype.findLastIndex` shim/polyfill/replacement that works as far down as ES3.",
|
||||
"author": {
|
||||
"name": "Jordan Harband",
|
||||
"email": "ljharb@gmail.com",
|
||||
"url": "http://ljharb.codes"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
},
|
||||
"contributors": [
|
||||
{
|
||||
"name": "Jordan Harband",
|
||||
"email": "ljharb@gmail.com",
|
||||
"url": "http://ljharb.codes"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/es-shims/Array.prototype.findLastIndex/issues"
|
||||
},
|
||||
"homepage": "https://github.com/es-shims/Array.prototype.findLastIndex#readme",
|
||||
"main": "index.js",
|
||||
"exports": {
|
||||
".": [
|
||||
{
|
||||
"import": "./index.mjs",
|
||||
"require": "./index.js",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"./index.js"
|
||||
],
|
||||
"./auto": "./auto.js",
|
||||
"./polyfill": "./polyfill.js",
|
||||
"./implementation": "./implementation.js",
|
||||
"./shim": "./shim.js",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"scripts": {
|
||||
"prepack": "npmignore --auto --commentLines=autogenerated",
|
||||
"prepublishOnly": "safe-publish-latest",
|
||||
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||
"pretest": "npm run --silent lint",
|
||||
"posttest": "aud --production",
|
||||
"tests-only": "nyc tape 'test/**/*.js'",
|
||||
"tests-esm": "nyc node test/index.mjs",
|
||||
"test": "npm run tests-only && npm run tests-esm",
|
||||
"prelint": "evalmd README.md",
|
||||
"lint": "eslint --ext=js,mjs .",
|
||||
"postlint": "es-shim-api --bound",
|
||||
"version": "auto-changelog && git add CHANGELOG.md",
|
||||
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/es-shims/Array.prototype.findLastIndex.git"
|
||||
},
|
||||
"keywords": [
|
||||
"Array.prototype.findLastIndex",
|
||||
"find",
|
||||
"findLast",
|
||||
"findLastIndex",
|
||||
"array",
|
||||
"ESnext",
|
||||
"shim",
|
||||
"polyfill",
|
||||
"last",
|
||||
"es-shim API"
|
||||
],
|
||||
"dependencies": {
|
||||
"call-bind": "^1.0.2",
|
||||
"define-properties": "^1.1.4",
|
||||
"es-abstract": "^1.20.4",
|
||||
"es-shim-unscopables": "^1.0.0",
|
||||
"get-intrinsic": "^1.1.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@es-shims/api": "^2.2.3",
|
||||
"@ljharb/eslint-config": "^21.0.0",
|
||||
"aud": "^2.0.1",
|
||||
"auto-changelog": "^2.4.0",
|
||||
"es-value-fixtures": "^1.4.2",
|
||||
"eslint": "=8.8.0",
|
||||
"evalmd": "^0.0.19",
|
||||
"for-each": "^0.3.3",
|
||||
"has": "^1.0.3",
|
||||
"has-strict-mode": "^1.0.1",
|
||||
"in-publish": "^2.0.1",
|
||||
"npmignore": "^0.3.0",
|
||||
"nyc": "^10.3.2",
|
||||
"object-inspect": "^1.12.2",
|
||||
"safe-publish-latest": "^2.0.0",
|
||||
"tape": "^5.6.1"
|
||||
},
|
||||
"testling": {
|
||||
"files": [
|
||||
"test/index.js",
|
||||
"test/shimmed.js"
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"auto-changelog": {
|
||||
"output": "CHANGELOG.md",
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false,
|
||||
"hideCredit": true
|
||||
},
|
||||
"publishConfig": {
|
||||
"ignore": [
|
||||
".github/workflows"
|
||||
]
|
||||
}
|
||||
}
|
||||
7
node_modules/array.prototype.findlastindex/polyfill.js
generated
vendored
Normal file
7
node_modules/array.prototype.findlastindex/polyfill.js
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
module.exports = function getPolyfill() {
|
||||
return Array.prototype.findLastIndex || implementation;
|
||||
};
|
||||
18
node_modules/array.prototype.findlastindex/shim.js
generated
vendored
Normal file
18
node_modules/array.prototype.findlastindex/shim.js
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var getPolyfill = require('./polyfill');
|
||||
var shimUnscopables = require('es-shim-unscopables');
|
||||
|
||||
module.exports = function shimFindLastIndex() {
|
||||
var polyfill = getPolyfill();
|
||||
define(
|
||||
Array.prototype,
|
||||
{ findLastIndex: polyfill },
|
||||
{ findLastIndex: function () { return Array.prototype.findLastIndex !== polyfill; } }
|
||||
);
|
||||
|
||||
shimUnscopables('findLastIndex');
|
||||
|
||||
return polyfill;
|
||||
};
|
||||
20
node_modules/array.prototype.findlastindex/test/implementation.js
generated
vendored
Normal file
20
node_modules/array.prototype.findlastindex/test/implementation.js
generated
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
'use strict';
|
||||
|
||||
var implementation = require('../implementation');
|
||||
var callBind = require('call-bind');
|
||||
var test = require('tape');
|
||||
var hasStrictMode = require('has-strict-mode')();
|
||||
var runTests = require('./tests');
|
||||
|
||||
test('as a function', function (t) {
|
||||
t.test('bad array/this value', { skip: !hasStrictMode }, function (st) {
|
||||
/* eslint no-useless-call: 0 */
|
||||
st['throws'](function () { implementation.call(undefined); }, TypeError, 'undefined is not an object');
|
||||
st['throws'](function () { implementation.call(null); }, TypeError, 'null is not an object');
|
||||
st.end();
|
||||
});
|
||||
|
||||
runTests(callBind(implementation), t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
18
node_modules/array.prototype.findlastindex/test/index.js
generated
vendored
Normal file
18
node_modules/array.prototype.findlastindex/test/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
'use strict';
|
||||
|
||||
var index = require('../');
|
||||
var callBind = require('call-bind');
|
||||
var test = require('tape');
|
||||
var runTests = require('./tests');
|
||||
|
||||
test('as a function', function (t) {
|
||||
t.test('bad array/this value', function (st) {
|
||||
st['throws'](callBind(index, null, undefined, function () {}), TypeError, 'undefined is not an object');
|
||||
st['throws'](callBind(index, null, null, function () {}), TypeError, 'null is not an object');
|
||||
st.end();
|
||||
});
|
||||
|
||||
runTests(index, t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
31
node_modules/array.prototype.findlastindex/test/index.mjs
generated
vendored
Normal file
31
node_modules/array.prototype.findlastindex/test/index.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import findLastIndex from 'array.prototype.findlastindex';
|
||||
import * as Module from 'array.prototype.findlastindex';
|
||||
import test from 'tape';
|
||||
import runTests from './tests.js';
|
||||
|
||||
test('as a function', (t) => {
|
||||
t.test('bad array/this value', (st) => {
|
||||
st.throws(() => findLastIndex(undefined), TypeError, 'undefined is not an object');
|
||||
st.throws(() => findLastIndex(null), TypeError, 'null is not an object');
|
||||
st.end();
|
||||
});
|
||||
|
||||
runTests(findLastIndex, t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('named exports', async (t) => {
|
||||
t.deepEqual(
|
||||
Object.keys(Module).sort(),
|
||||
['default', 'shim', 'getPolyfill', 'implementation'].sort(),
|
||||
'has expected named exports',
|
||||
);
|
||||
|
||||
const { shim, getPolyfill, implementation } = Module;
|
||||
t.equal((await import('array.prototype.findlastindex/shim')).default, shim, 'shim named export matches deep export');
|
||||
t.equal((await import('array.prototype.findlastindex/implementation')).default, implementation, 'implementation named export matches deep export');
|
||||
t.equal((await import('array.prototype.findlastindex/polyfill')).default, getPolyfill, 'getPolyfill named export matches deep export');
|
||||
|
||||
t.end();
|
||||
});
|
||||
47
node_modules/array.prototype.findlastindex/test/shimmed.js
generated
vendored
Normal file
47
node_modules/array.prototype.findlastindex/test/shimmed.js
generated
vendored
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
'use strict';
|
||||
|
||||
var orig = Array.prototype.findLastIndex;
|
||||
|
||||
require('../auto');
|
||||
|
||||
var test = require('tape');
|
||||
var has = require('has');
|
||||
var defineProperties = require('define-properties');
|
||||
var callBind = require('call-bind');
|
||||
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
||||
var functionsHaveNames = function f() {}.name === 'f';
|
||||
|
||||
var runTests = require('./tests');
|
||||
|
||||
test('shimmed', function (t) {
|
||||
t.comment('shimmed: ' + (orig === Array.prototype.findLastIndex ? 'no' : 'yes'));
|
||||
|
||||
t.equal(Array.prototype.findLastIndex.length, 1, 'Array#findLastIndex has a length of 1');
|
||||
t.test('Function name', { skip: !functionsHaveNames }, function (st) {
|
||||
st.equal(Array.prototype.findLastIndex.name, 'findLastIndex', 'Array#findLastIndex has name "findLastIndex"');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
|
||||
et.equal(false, isEnumerable.call(Array.prototype, 'findLastIndex'), 'Array#findLastIndex is not enumerable');
|
||||
et.end();
|
||||
});
|
||||
|
||||
var supportsStrictMode = (function () { return typeof this === 'undefined'; }());
|
||||
|
||||
t.test('bad array/this value', { skip: !supportsStrictMode }, function (st) {
|
||||
st['throws'](function () { return Array.prototype.findLastIndex.call(undefined, function () {}); }, TypeError, 'undefined is not an object');
|
||||
st['throws'](function () { return Array.prototype.findLastIndex.call(null, function () {}); }, TypeError, 'null is not an object');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('Symbol.unscopables', { skip: typeof Symbol !== 'function' || typeof Symbol.unscopables !== 'symbol' }, function (st) {
|
||||
st.ok(has(Array.prototype[Symbol.unscopables], 'findLastIndex'), 'Array.prototype[Symbol.unscopables] has own `findLastIndex` property');
|
||||
st.equal(Array.prototype[Symbol.unscopables].findLastIndex, true, 'Array.prototype[Symbol.unscopables].findLastIndex is true');
|
||||
st.end();
|
||||
});
|
||||
|
||||
runTests(callBind(Array.prototype.findLastIndex), t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
230
node_modules/array.prototype.findlastindex/test/tests.js
generated
vendored
Normal file
230
node_modules/array.prototype.findlastindex/test/tests.js
generated
vendored
Normal file
|
|
@ -0,0 +1,230 @@
|
|||
var hasStrictMode = require('has-strict-mode')();
|
||||
var v = require('es-value-fixtures');
|
||||
var forEach = require('for-each');
|
||||
var inspect = require('object-inspect');
|
||||
|
||||
var global = Function('return this')(); // eslint-disable-line no-new-func
|
||||
var trueThunk = function () { return true; };
|
||||
var falseThunk = function () { return false; };
|
||||
|
||||
var canDistinguishSparseFromUndefined = 0 in [undefined]; // IE 6 - 8 have a bug where this returns false.
|
||||
var undefinedIfNoSparseBug = canDistinguishSparseFromUndefined ? undefined : { valueOf: function () { return 0; } };
|
||||
|
||||
var createArrayLikeFromArray = function createArrayLikeFromArray(arr) {
|
||||
var o = {};
|
||||
for (var i = 0; i < arr.length; i += 1) {
|
||||
if (i in arr) {
|
||||
o[i] = arr[i];
|
||||
}
|
||||
}
|
||||
o.length = arr.length;
|
||||
return o;
|
||||
};
|
||||
|
||||
var getTestArr = function () {
|
||||
var arr = [0, false, null, 'hej', true, undefinedIfNoSparseBug, 3, 2];
|
||||
delete arr[6];
|
||||
return arr;
|
||||
};
|
||||
|
||||
module.exports = function (findLastIndex, t) {
|
||||
forEach(v.nonArrays, function (nonArray) {
|
||||
if (nonArray != null) { // eslint-disable-line eqeqeq
|
||||
t.equal(
|
||||
findLastIndex(nonArray, function () { return true; }),
|
||||
typeof nonArray.length === 'number' ? nonArray.length - 1 : -1,
|
||||
inspect(nonArray) + ' is not an array'
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
t.test('throws on a non-callable predicate', function (st) {
|
||||
forEach(v.nonFunctions, function (nonFunction) {
|
||||
st['throws'](
|
||||
function () { findLastIndex([], nonFunction); },
|
||||
TypeError,
|
||||
inspect(nonFunction) + ' is not a Function'
|
||||
);
|
||||
});
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('passes the correct values to the callback', function (st) {
|
||||
st.plan(5);
|
||||
|
||||
var expectedValue = {};
|
||||
var arr = [expectedValue];
|
||||
var context = {};
|
||||
findLastIndex(arr, function (value, key, list) {
|
||||
st.equal(arguments.length, 3);
|
||||
st.equal(value, expectedValue, 'first argument is the value');
|
||||
st.equal(key, 0, 'second argument is the index');
|
||||
st.equal(list, arr, 'third argument is the array being iterated');
|
||||
st.equal(this, context, 'receiver is the expected value');
|
||||
return true;
|
||||
}, context);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('does not visit elements added to the array after it has begun', function (st) {
|
||||
st.plan(2);
|
||||
|
||||
var arr = [1, 2, 3];
|
||||
var i = 0;
|
||||
findLastIndex(arr, function (a) {
|
||||
i += 1;
|
||||
arr.push(a + 3);
|
||||
return i > 3;
|
||||
});
|
||||
st.deepEqual(arr, [1, 2, 3, 6, 5, 4], 'array has received 3 new elements');
|
||||
st.equal(i, 3, 'findLastIndex callback only called thrice');
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('does not visit elements deleted from the array after it has begun', function (st) {
|
||||
var arr = [1, 2, 3];
|
||||
var actual = [];
|
||||
findLastIndex(arr, function (x, i) {
|
||||
actual.push([i, x]);
|
||||
delete arr[1];
|
||||
return false;
|
||||
});
|
||||
st.deepEqual(actual, [[2, 3], [1, undefined], [0, 1]]);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('sets the right context when given none', function (st) {
|
||||
var context;
|
||||
findLastIndex([1], function () { context = this; });
|
||||
st.equal(context, global, 'receiver is global object in sloppy mode');
|
||||
|
||||
st.test('strict mode', { skip: !hasStrictMode }, function (sst) {
|
||||
findLastIndex([1], function () {
|
||||
'use strict';
|
||||
|
||||
context = this;
|
||||
});
|
||||
sst.equal(context, undefined, 'receiver is undefined in strict mode');
|
||||
sst.end();
|
||||
});
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('empty array', function (st) {
|
||||
st.equal(findLastIndex([], trueThunk), -1, 'true thunk callback yields -1');
|
||||
st.equal(findLastIndex([], falseThunk), -1, 'false thunk callback yields -1');
|
||||
|
||||
var counter = 0;
|
||||
var callback = function () { counter += 1; };
|
||||
findLastIndex([], callback);
|
||||
st.equal(counter, 0, 'counter is not incremented');
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.equal(findLastIndex([1, 2, 3], trueThunk), 2, 'returns last index if findLastIndex callback returns true');
|
||||
t.equal(findLastIndex([1, 2, 3], falseThunk), -1, 'returns -1 if no callback returns true');
|
||||
|
||||
t.test('stopping after N elements', function (st) {
|
||||
st.test('no context', function (sst) {
|
||||
var actual = {};
|
||||
var count = 0;
|
||||
findLastIndex(getTestArr(), function (obj, index) {
|
||||
actual[index] = obj;
|
||||
count += 1;
|
||||
return count === 4;
|
||||
});
|
||||
sst.deepEqual(actual, { 4: true, 5: undefinedIfNoSparseBug, 6: undefined, 7: 2 });
|
||||
sst.end();
|
||||
});
|
||||
|
||||
st.test('with context', function (sst) {
|
||||
var actual = {};
|
||||
var context = { actual: actual };
|
||||
var count = 0;
|
||||
findLastIndex(getTestArr(), function (obj, index) {
|
||||
this.actual[index] = obj;
|
||||
count += 1;
|
||||
return count === 4;
|
||||
}, context);
|
||||
sst.deepEqual(actual, { 4: true, 5: undefinedIfNoSparseBug, 6: undefined, 7: 2 });
|
||||
sst.end();
|
||||
});
|
||||
|
||||
st.test('arraylike, no context', function (sst) {
|
||||
var actual = {};
|
||||
var count = 0;
|
||||
findLastIndex(createArrayLikeFromArray(getTestArr()), function (obj, index) {
|
||||
actual[index] = obj;
|
||||
count += 1;
|
||||
return count === 4;
|
||||
});
|
||||
sst.deepEqual(actual, { 4: true, 5: undefinedIfNoSparseBug, 6: undefined, 7: 2 });
|
||||
sst.end();
|
||||
});
|
||||
|
||||
st.test('arraylike, context', function (sst) {
|
||||
var actual = {};
|
||||
var count = 0;
|
||||
var context = { actual: actual };
|
||||
findLastIndex(createArrayLikeFromArray(getTestArr()), function (obj, index) {
|
||||
this.actual[index] = obj;
|
||||
count += 1;
|
||||
return count === 4;
|
||||
}, context);
|
||||
sst.deepEqual(actual, { 4: true, 5: undefinedIfNoSparseBug, 6: undefined, 7: 2 });
|
||||
sst.end();
|
||||
});
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('list arg boxing', function (st) {
|
||||
st.plan(3);
|
||||
|
||||
findLastIndex('bar', function (item, index, list) {
|
||||
st.equal(item, 'r', 'last letter matches');
|
||||
st.equal(typeof list, 'object', 'primitive list arg is boxed');
|
||||
st.equal(Object.prototype.toString.call(list), '[object String]', 'boxed list arg is a String');
|
||||
return true;
|
||||
});
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('array altered during loop', function (st) {
|
||||
var arr = ['Shoes', 'Car', 'Bike'];
|
||||
var results = [];
|
||||
|
||||
findLastIndex(arr, function (kValue) {
|
||||
if (results.length === 0) {
|
||||
arr.splice(1, 1);
|
||||
}
|
||||
results.push(kValue);
|
||||
});
|
||||
|
||||
st.equal(results.length, 3, 'predicate called three times');
|
||||
st.deepEqual(results, ['Bike', 'Bike', 'Shoes']);
|
||||
|
||||
results = [];
|
||||
arr = ['Skateboard', 'Barefoot'];
|
||||
findLastIndex(arr, function (kValue) {
|
||||
if (results.length === 0) {
|
||||
arr.push('Motorcycle');
|
||||
arr[0] = 'Magic Carpet';
|
||||
}
|
||||
|
||||
results.push(kValue);
|
||||
});
|
||||
|
||||
st.equal(results.length, 2, 'predicate called twice');
|
||||
st.deepEqual(results, ['Barefoot', 'Magic Carpet']);
|
||||
|
||||
st.end();
|
||||
});
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue