отчет
This commit is contained in:
31
Lab/node_modules/array.prototype.tosorted/.eslintrc
generated
vendored
Normal file
31
Lab/node_modules/array.prototype.tosorted/.eslintrc
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"rules": {
|
||||
"id-length": "off",
|
||||
"new-cap": ["error", {
|
||||
"capIsNewExceptions": [
|
||||
"ArrayCreate",
|
||||
"CompareArrayElements",
|
||||
"CreateDataPropertyOrThrow",
|
||||
"GetIntrinsic",
|
||||
"IsCallable",
|
||||
"LengthOfArrayLike",
|
||||
"SortIndexedProperties",
|
||||
"ToObject",
|
||||
"ToString",
|
||||
],
|
||||
}],
|
||||
},
|
||||
|
||||
"overrides": [
|
||||
{
|
||||
"files": "test/**",
|
||||
"rules": {
|
||||
"max-lines-per-function": "off",
|
||||
},
|
||||
},
|
||||
]
|
||||
}
|
||||
12
Lab/node_modules/array.prototype.tosorted/.github/FUNDING.yml
generated
vendored
Normal file
12
Lab/node_modules/array.prototype.tosorted/.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.tosorted
|
||||
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
Lab/node_modules/array.prototype.tosorted/.nycrc
generated
vendored
Normal file
9
Lab/node_modules/array.prototype.tosorted/.nycrc
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"all": true,
|
||||
"check-coverage": false,
|
||||
"reporter": ["text-summary", "text", "html", "json"],
|
||||
"exclude": [
|
||||
"coverage",
|
||||
"test"
|
||||
]
|
||||
}
|
||||
69
Lab/node_modules/array.prototype.tosorted/CHANGELOG.md
generated
vendored
Normal file
69
Lab/node_modules/array.prototype.tosorted/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
# 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.1.4](https://github.com/es-shims/Array.prototype.toSorted/compare/v1.1.3...v1.1.4) - 2024-06-02
|
||||
|
||||
### Fixed
|
||||
|
||||
- [Refactor] update implementation to match latest spec [`#3`](https://github.com/es-shims/Array.prototype.toSorted/issues/3)
|
||||
|
||||
### Commits
|
||||
|
||||
- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `hasown`, `tape` [`159d118`](https://github.com/es-shims/Array.prototype.toSorted/commit/159d11848629e0468f9f10a1e36001f937c0c6ea)
|
||||
- [Deps] update `call-bind`, `es-abstract`, `es-errors` [`7d32e67`](https://github.com/es-shims/Array.prototype.toSorted/commit/7d32e67417f436d5e8a66bf8286b9ead9296c4f1)
|
||||
- [meta] add missing `engines.node` [`b49466b`](https://github.com/es-shims/Array.prototype.toSorted/commit/b49466b473d116b5a53209491163bfd2c3aa89bc)
|
||||
|
||||
## [v1.1.3](https://github.com/es-shims/Array.prototype.toSorted/compare/v1.1.2...v1.1.3) - 2024-02-04
|
||||
|
||||
### Commits
|
||||
|
||||
- [Refactor] use `es-errors` where possible, so things that only need those do not need `get-intrinsic` [`6c089a5`](https://github.com/es-shims/Array.prototype.toSorted/commit/6c089a5712a25008daa5d3d9dbc9d4fa7c908a64)
|
||||
- [Deps] update `call-bind`, `define-properties`, `es-abstract`, `es-shim-unscopables`, `get-intrinsic` [`d096b56`](https://github.com/es-shims/Array.prototype.toSorted/commit/d096b56d30bb5f5b09649f285eee21e22e2db8f9)
|
||||
- [Dev Deps] update `aud`, `npmignore`, `tape` [`43cea6d`](https://github.com/es-shims/Array.prototype.toSorted/commit/43cea6dfaa05669f6a60bef860f2d6fbf86f167e)
|
||||
- [Dev Deps] use `hasown` instead of `has` [`cefe5dc`](https://github.com/es-shims/Array.prototype.toSorted/commit/cefe5dc1bbc2699ca03c3e4ae9ce7fc696a76ca8)
|
||||
- [Dev Deps] update `tape` [`ad8446e`](https://github.com/es-shims/Array.prototype.toSorted/commit/ad8446ecbca6f724458af81da3aa3ffcd3552825)
|
||||
|
||||
## [v1.1.2](https://github.com/es-shims/Array.prototype.toSorted/compare/v1.1.1...v1.1.2) - 2023-09-07
|
||||
|
||||
### Commits
|
||||
|
||||
- [actions] use reusable workflows [`b3d4f1d`](https://github.com/es-shims/Array.prototype.toSorted/commit/b3d4f1dff2d0fcd30e5bb7591836f5c5133ef9be)
|
||||
- [Deps] update `define-properties`, `es-abstract`, `get-intrinsic` [`35ce967`](https://github.com/es-shims/Array.prototype.toSorted/commit/35ce96705f9201f9a416629446c7f8b739a3d0a7)
|
||||
- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `aud`, `tape` [`1a17c6a`](https://github.com/es-shims/Array.prototype.toSorted/commit/1a17c6a3492fbbb99f3543c70036c02e981d974a)
|
||||
|
||||
## [v1.1.1](https://github.com/es-shims/Array.prototype.toSorted/compare/v1.1.0...v1.1.1) - 2022-11-03
|
||||
|
||||
### Commits
|
||||
|
||||
- [Deps] update `es-abstract`, `get-intrinsic` [`b10a2a3`](https://github.com/es-shims/Array.prototype.toSorted/commit/b10a2a30772369ed3640741345225799af108e97)
|
||||
- [actions] update rebase action to use reusable workflow [`8f49d78`](https://github.com/es-shims/Array.prototype.toSorted/commit/8f49d78ac5d679c052d544a7051c3b8e5c449052)
|
||||
- [Dev Deps] update `aud`, `tape` [`2d2741b`](https://github.com/es-shims/Array.prototype.toSorted/commit/2d2741b6a0e08d1b2dbe675759f33dc3db4924a2)
|
||||
|
||||
## [v1.1.0](https://github.com/es-shims/Array.prototype.toSorted/compare/v1.0.0...v1.1.0) - 2022-08-14
|
||||
|
||||
### Commits
|
||||
|
||||
- [Tests] add coverage from https://github.com/tc39/test262/pull/3464 [`2172830`](https://github.com/es-shims/Array.prototype.toSorted/commit/21728306e552c80868753b0147dc5637e57ffd2b)
|
||||
- [meta] use `npmignore` to autogenerate an npmignore file [`972f761`](https://github.com/es-shims/Array.prototype.toSorted/commit/972f761599aaf97049a005974caa2d9b24581119)
|
||||
- [New] `shim`/`auto`: add `toSorted` to `Symbol.unscopables` [`2ad9bad`](https://github.com/es-shims/Array.prototype.toSorted/commit/2ad9bad51ab7d2e7cc579f6681809fe495682163)
|
||||
- [Deps] update `define-properties`, `es-abstract`, `get-intrinsic` [`e7b229d`](https://github.com/es-shims/Array.prototype.toSorted/commit/e7b229dbb0c199661f785dfa0d5403b81ed7811e)
|
||||
- [Dev Deps] update `@ljharb/eslint-config`, `functions-have-names`, `tape` [`2bccb92`](https://github.com/es-shims/Array.prototype.toSorted/commit/2bccb92d5314e3b86bb3ffc1144f0c86cdca285a)
|
||||
- [readme] fix link to spec [`0d024e6`](https://github.com/es-shims/Array.prototype.toSorted/commit/0d024e68e3d41b3ec8dbc8aa47e99d8987c91fea)
|
||||
|
||||
## v1.0.0 - 2022-03-31
|
||||
|
||||
### Commits
|
||||
|
||||
- initial implementation, tests, readme [`a2882bf`](https://github.com/es-shims/Array.prototype.toSorted/commit/a2882bf9f2a5d0533450a37df13ca3c1b8178bef)
|
||||
- Initial commit [`f9d05c4`](https://github.com/es-shims/Array.prototype.toSorted/commit/f9d05c4275eeeb841f357c487606cf7c83235651)
|
||||
- [meta] do not publish workflow files [`ceed80a`](https://github.com/es-shims/Array.prototype.toSorted/commit/ceed80acc95688c872dd8c69292a30589a8a9020)
|
||||
- [Tests] temporarily use actions instead of composable workflows [`496789b`](https://github.com/es-shims/Array.prototype.toSorted/commit/496789bbfb7da7e2b2cac3398491e6b58b1f169f)
|
||||
- npm init [`9405760`](https://github.com/es-shims/Array.prototype.toSorted/commit/9405760c2f52001035087a0d60f4e06465e82546)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`474180c`](https://github.com/es-shims/Array.prototype.toSorted/commit/474180c1250ec0a0ffabc80aa2733fe4abe65036)
|
||||
- [meta] add version script [`49a3b80`](https://github.com/es-shims/Array.prototype.toSorted/commit/49a3b802020c54ead862d49365555a67ac786636)
|
||||
- Only apps should have lockfiles [`0db3a5a`](https://github.com/es-shims/Array.prototype.toSorted/commit/0db3a5a7607be2a7d11fa78ae9c43907e59bdf92)
|
||||
- [Deps] update `es-abstract` [`35de1c5`](https://github.com/es-shims/Array.prototype.toSorted/commit/35de1c532245469b50bd7296ca8c19470385c622)
|
||||
21
Lab/node_modules/array.prototype.tosorted/LICENSE
generated
vendored
Normal file
21
Lab/node_modules/array.prototype.tosorted/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.
|
||||
71
Lab/node_modules/array.prototype.tosorted/README.md
generated
vendored
Normal file
71
Lab/node_modules/array.prototype.tosorted/README.md
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
# array.prototype.tosorted <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
||||
|
||||
[![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.toSorted` 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-change-array-by-copy/#sec-array.prototype.toSorted).
|
||||
|
||||
Because `Array.prototype.toSorted` 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.tosorted
|
||||
```
|
||||
|
||||
## Usage/Examples
|
||||
|
||||
```js
|
||||
var toSorted = require('array.prototype.tosorted');
|
||||
var assert = require('assert');
|
||||
|
||||
var input = [5, 4, 3, 2, 1, 0];
|
||||
|
||||
var output = toSorted(input);
|
||||
|
||||
assert.deepEqual(output, [0, 1, 2, 3, 4, 5]);
|
||||
assert.notEqual(output, input);
|
||||
assert.deepEqual(input, [5, 4, 3, 2, 1, 0]);
|
||||
```
|
||||
|
||||
```js
|
||||
var toSorted = require('array.prototype.tosorted');
|
||||
var assert = require('assert');
|
||||
/* when Array#toSorted is not present */
|
||||
delete Array.prototype.toSorted;
|
||||
var shimmed = toSorted.shim();
|
||||
|
||||
assert.equal(shimmed, toSorted.getPolyfill());
|
||||
assert.deepEqual(input.toSorted(), toSorted(input));
|
||||
```
|
||||
|
||||
```js
|
||||
var toSorted = require('array.prototype.tosorted');
|
||||
var assert = require('assert');
|
||||
/* when Array#toSorted is present */
|
||||
var shimmed = toSorted.shim();
|
||||
|
||||
assert.equal(shimmed, Array.prototype.toSorted);
|
||||
assert.deepEqual(input.toSorted(), toSorted(input));
|
||||
```
|
||||
|
||||
## Tests
|
||||
Simply clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
[package-url]: https://npmjs.org/package/array.prototype.tosorted
|
||||
[npm-version-svg]: https://versionbadg.es/es-shims/Array.prototype.toSorted.svg
|
||||
[deps-svg]: https://david-dm.org/es-shims/Array.prototype.toSorted.svg
|
||||
[deps-url]: https://david-dm.org/es-shims/Array.prototype.toSorted
|
||||
[dev-deps-svg]: https://david-dm.org/es-shims/Array.prototype.toSorted/dev-status.svg
|
||||
[dev-deps-url]: https://david-dm.org/es-shims/Array.prototype.toSorted#info=devDependencies
|
||||
[npm-badge-png]: https://nodei.co/npm/array.prototype.tosorted.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/array.prototype.tosorted.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/array.prototype.tosorted.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=array.prototype.tosorted
|
||||
3
Lab/node_modules/array.prototype.tosorted/auto.js
generated
vendored
Normal file
3
Lab/node_modules/array.prototype.tosorted/auto.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
require('./shim')();
|
||||
37
Lab/node_modules/array.prototype.tosorted/implementation.js
generated
vendored
Normal file
37
Lab/node_modules/array.prototype.tosorted/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
'use strict';
|
||||
|
||||
var ArrayCreate = require('es-abstract/2024/ArrayCreate');
|
||||
var CompareArrayElements = require('es-abstract/2024/CompareArrayElements');
|
||||
var CreateDataPropertyOrThrow = require('es-abstract/2024/CreateDataPropertyOrThrow');
|
||||
var IsCallable = require('es-abstract/2024/IsCallable');
|
||||
var LengthOfArrayLike = require('es-abstract/2024/LengthOfArrayLike');
|
||||
var SortIndexedProperties = require('es-abstract/2024/SortIndexedProperties');
|
||||
var ToObject = require('es-abstract/2024/ToObject');
|
||||
var ToString = require('es-abstract/2024/ToString');
|
||||
|
||||
var $TypeError = require('es-errors/type');
|
||||
|
||||
module.exports = function toSorted(comparefn) {
|
||||
if (typeof comparefn !== 'undefined' && !IsCallable(comparefn)) {
|
||||
throw new $TypeError('`comparefn` must be a function'); // step 1
|
||||
}
|
||||
|
||||
var O = ToObject(this); // step 2
|
||||
var len = LengthOfArrayLike(O); // step 3
|
||||
var A = ArrayCreate(len); // step 4
|
||||
|
||||
// eslint-disable-next-line no-sequences
|
||||
var SortCompare = (0, function (x, y) { // step 5
|
||||
return CompareArrayElements(x, y, comparefn); // step 5.a
|
||||
});
|
||||
|
||||
var sortedList = SortIndexedProperties(O, len, SortCompare, 'read-through-holes'); // step 6
|
||||
|
||||
var j = 0; // step 7
|
||||
while (j < len) { // step 8
|
||||
CreateDataPropertyOrThrow(A, ToString(j), sortedList[j]); // step 8.a
|
||||
j += 1; // step 8.b
|
||||
}
|
||||
|
||||
return A; // step 9
|
||||
};
|
||||
19
Lab/node_modules/array.prototype.tosorted/index.js
generated
vendored
Normal file
19
Lab/node_modules/array.prototype.tosorted/index.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var callBind = require('call-bind');
|
||||
|
||||
var implementation = require('./implementation');
|
||||
var getPolyfill = require('./polyfill');
|
||||
var polyfill = getPolyfill();
|
||||
var shim = require('./shim');
|
||||
|
||||
var bound = callBind(polyfill);
|
||||
|
||||
define(bound, {
|
||||
getPolyfill: getPolyfill,
|
||||
implementation: implementation,
|
||||
shim: shim
|
||||
});
|
||||
|
||||
module.exports = bound;
|
||||
87
Lab/node_modules/array.prototype.tosorted/package.json
generated
vendored
Normal file
87
Lab/node_modules/array.prototype.tosorted/package.json
generated
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
{
|
||||
"name": "array.prototype.tosorted",
|
||||
"version": "1.1.4",
|
||||
"description": "An ESnext spec-compliant `Array.prototype.toSorted` shim/polyfill/replacement that works as far down as ES3.",
|
||||
"main": "index.js",
|
||||
"exports": {
|
||||
".": "./index.js",
|
||||
"./auto": "./auto.js",
|
||||
"./polyfill": "./polyfill.js",
|
||||
"./implementation": "./implementation.js",
|
||||
"./shim": "./shim.js",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"scripts": {
|
||||
"prepack": "npmignore --auto --commentLines=autogenerated",
|
||||
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||
"prepublishOnly": "safe-publish-latest",
|
||||
"lint": "eslint --ext=js,mjs .",
|
||||
"postlint": "es-shim-api --bound && evalmd README.md",
|
||||
"pretest": "npm run --silent lint",
|
||||
"test": "npm run tests-only",
|
||||
"posttest": "aud --production",
|
||||
"tests-only": "nyc tape 'test/**/*.js'",
|
||||
"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.toSorted.git"
|
||||
},
|
||||
"keywords": [
|
||||
"javascript",
|
||||
"ecmascript",
|
||||
"shim",
|
||||
"polyfill",
|
||||
"es-shim API",
|
||||
"array",
|
||||
"sort",
|
||||
"sorted",
|
||||
"toSorted"
|
||||
],
|
||||
"author": "Jordan Harband <ljharb@gmail.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/es-shims/Array.prototype.toSorted/issues"
|
||||
},
|
||||
"homepage": "https://github.com/es-shims/Array.prototype.toSorted#readme",
|
||||
"dependencies": {
|
||||
"call-bind": "^1.0.7",
|
||||
"define-properties": "^1.2.1",
|
||||
"es-abstract": "^1.23.3",
|
||||
"es-errors": "^1.3.0",
|
||||
"es-shim-unscopables": "^1.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@es-shims/api": "^2.5.0",
|
||||
"@ljharb/eslint-config": "^21.1.1",
|
||||
"aud": "^2.0.4",
|
||||
"auto-changelog": "^2.4.0",
|
||||
"eslint": "=8.8.0",
|
||||
"evalmd": "^0.0.19",
|
||||
"functions-have-names": "^1.2.3",
|
||||
"has-strict-mode": "^1.0.1",
|
||||
"hasown": "^2.0.2",
|
||||
"in-publish": "^2.0.1",
|
||||
"npmignore": "^0.3.1",
|
||||
"nyc": "^10.3.2",
|
||||
"safe-publish-latest": "^2.0.0",
|
||||
"tape": "^5.7.5"
|
||||
},
|
||||
"auto-changelog": {
|
||||
"output": "CHANGELOG.md",
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false,
|
||||
"hideCredit": true
|
||||
},
|
||||
"publishConfig": {
|
||||
"ignore": [
|
||||
".github/workflows"
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
}
|
||||
7
Lab/node_modules/array.prototype.tosorted/polyfill.js
generated
vendored
Normal file
7
Lab/node_modules/array.prototype.tosorted/polyfill.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
module.exports = function getPolyfill() {
|
||||
return Array.prototype.toSorted || implementation;
|
||||
};
|
||||
20
Lab/node_modules/array.prototype.tosorted/shim.js
generated
vendored
Normal file
20
Lab/node_modules/array.prototype.tosorted/shim.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var shimUnscopables = require('es-shim-unscopables');
|
||||
|
||||
var getPolyfill = require('./polyfill');
|
||||
|
||||
module.exports = function shim() {
|
||||
var polyfill = getPolyfill();
|
||||
|
||||
define(
|
||||
Array.prototype,
|
||||
{ toSorted: polyfill },
|
||||
{ toSorted: function () { return Array.prototype.toSorted !== polyfill; } }
|
||||
);
|
||||
|
||||
shimUnscopables('toSorted');
|
||||
|
||||
return polyfill;
|
||||
};
|
||||
21
Lab/node_modules/array.prototype.tosorted/test/implementation.js
generated
vendored
Normal file
21
Lab/node_modules/array.prototype.tosorted/test/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
var callBind = require('call-bind');
|
||||
var test = require('tape');
|
||||
var hasStrictMode = require('has-strict-mode')();
|
||||
|
||||
var implementation = require('../implementation');
|
||||
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();
|
||||
});
|
||||
20
Lab/node_modules/array.prototype.tosorted/test/index.js
generated
vendored
Normal file
20
Lab/node_modules/array.prototype.tosorted/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var hasStrictMode = require('has-strict-mode')();
|
||||
|
||||
var bound = require('../');
|
||||
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 () { return bound.call(undefined); }, TypeError, 'undefined is not an object');
|
||||
st['throws'](function () { return bound.call(null); }, TypeError, 'null is not an object');
|
||||
st.end();
|
||||
});
|
||||
|
||||
runTests(bound, t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
38
Lab/node_modules/array.prototype.tosorted/test/shimmed.js
generated
vendored
Normal file
38
Lab/node_modules/array.prototype.tosorted/test/shimmed.js
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
'use strict';
|
||||
|
||||
require('../auto');
|
||||
|
||||
var test = require('tape');
|
||||
var defineProperties = require('define-properties');
|
||||
var callBind = require('call-bind');
|
||||
var hasStrictMode = require('has-strict-mode')();
|
||||
var functionsHaveNames = require('functions-have-names')();
|
||||
|
||||
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
||||
|
||||
var runTests = require('./tests');
|
||||
|
||||
test('shimmed', function (t) {
|
||||
var fn = Array.prototype.toSorted;
|
||||
t.equal(fn.length, 1, 'Array#toSorted has a length of 1');
|
||||
t.test('Function name', { skip: !functionsHaveNames }, function (st) {
|
||||
st.equal(fn.name, 'toSorted', 'Array#toSorted has name "toSorted"');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
|
||||
et.equal(false, isEnumerable.call(Array.prototype, 'toSorted'), 'Array#toSorted is not enumerable');
|
||||
et.end();
|
||||
});
|
||||
|
||||
t.test('bad array/this value', { skip: !hasStrictMode }, function (st) {
|
||||
/* eslint no-useless-call: 0 */
|
||||
st['throws'](function () { return fn.call(undefined); }, TypeError, 'undefined is not an object');
|
||||
st['throws'](function () { return fn.call(null); }, TypeError, 'null is not an object');
|
||||
st.end();
|
||||
});
|
||||
|
||||
runTests(callBind(fn), t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
150
Lab/node_modules/array.prototype.tosorted/test/tests.js
generated
vendored
Normal file
150
Lab/node_modules/array.prototype.tosorted/test/tests.js
generated
vendored
Normal file
@@ -0,0 +1,150 @@
|
||||
'use strict';
|
||||
|
||||
var hasOwn = require('hasown');
|
||||
|
||||
module.exports = function (toSorted, t) {
|
||||
var nums = [2, 1, 3];
|
||||
var result = toSorted(nums);
|
||||
t.deepEqual(
|
||||
result,
|
||||
[1, 2, 3],
|
||||
'array is sorted'
|
||||
);
|
||||
t.notEqual(nums, result, 'original array is not returned');
|
||||
t.deepEqual(nums, [2, 1, 3], 'original array is unchanged');
|
||||
|
||||
nums.sort();
|
||||
t.deepEqual(nums, result, 'mutated original matches result');
|
||||
|
||||
t.deepEqual(
|
||||
toSorted('acab'),
|
||||
['a', 'a', 'b', 'c'],
|
||||
'string sorts to array'
|
||||
);
|
||||
|
||||
var halfPoo = '\uD83D';
|
||||
var endPoo = '\uDCA9';
|
||||
var poo = halfPoo + endPoo;
|
||||
t.deepEqual(
|
||||
toSorted('a' + poo + 'c'),
|
||||
['a', 'c', halfPoo, endPoo],
|
||||
'code point is sorted as expected'
|
||||
);
|
||||
|
||||
var arrayLikeLengthValueOf = {
|
||||
length: {
|
||||
valueOf: function () { return 2; }
|
||||
},
|
||||
0: 4,
|
||||
1: 0,
|
||||
2: 1
|
||||
};
|
||||
t.deepEqual(toSorted(arrayLikeLengthValueOf), [0, 4]);
|
||||
|
||||
t.test('not positive integer lengths', function (st) {
|
||||
st.deepEqual(toSorted({ length: -2 }), []);
|
||||
st.deepEqual(toSorted({ length: 'dog' }), []);
|
||||
st.deepEqual(toSorted({ length: NaN }), []);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('getters', { skip: !Object.defineProperty }, function (st) {
|
||||
var getCalls = [];
|
||||
|
||||
var arrayLike = {
|
||||
0: 2,
|
||||
1: 1,
|
||||
2: 3,
|
||||
length: 3
|
||||
};
|
||||
Object.defineProperty(arrayLike, '0', {
|
||||
get: function () {
|
||||
getCalls.push(0);
|
||||
return 2;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(arrayLike, '1', {
|
||||
get: function () {
|
||||
getCalls.push(1);
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(arrayLike, '2', {
|
||||
get: function () {
|
||||
getCalls.push(2);
|
||||
return 3;
|
||||
}
|
||||
});
|
||||
|
||||
var up = { gross: true };
|
||||
st['throws'](
|
||||
function () {
|
||||
toSorted(arrayLike, function () {
|
||||
throw up;
|
||||
});
|
||||
},
|
||||
up
|
||||
);
|
||||
st.deepEqual(getCalls, [0, 1, 2]);
|
||||
|
||||
var arr1 = [5, 0, 3];
|
||||
Object.defineProperty(arr1, '0', {
|
||||
get: function () {
|
||||
arr1.push(1);
|
||||
return 5;
|
||||
}
|
||||
});
|
||||
st.deepEqual(toSorted(arr1), [0, 3, 5]);
|
||||
|
||||
var arr = [5, 1, 4, 6, 3];
|
||||
Array.prototype[3] = 2; // eslint-disable-line no-extend-native
|
||||
st.teardown(function () {
|
||||
delete Array.prototype[3];
|
||||
});
|
||||
|
||||
Object.defineProperty(arr, '2', {
|
||||
get: function () {
|
||||
arr.length = 1;
|
||||
return 4;
|
||||
}
|
||||
});
|
||||
|
||||
st.deepEqual(toSorted(arr), [1, 2, 4, 5, undefined]);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('too-large lengths', function (st) {
|
||||
var arrayLike = {
|
||||
0: 0,
|
||||
4294967295: 4294967295,
|
||||
4294967296: 4294967296,
|
||||
length: Math.pow(2, 32)
|
||||
};
|
||||
|
||||
st['throws'](
|
||||
function () { toSorted(arrayLike); },
|
||||
RangeError
|
||||
);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.deepEqual(toSorted(true), [], 'true yields empty array');
|
||||
t.deepEqual(toSorted(false), [], 'false yields empty array');
|
||||
|
||||
t.test('holes', function (st) {
|
||||
var arr = [3, /* hole */, 4, /* hole */, 1]; // eslint-disable-line no-sparse-arrays
|
||||
Array.prototype[3] = 2; // eslint-disable-line no-extend-native
|
||||
st.teardown(function () {
|
||||
delete Array.prototype[3];
|
||||
});
|
||||
|
||||
var sorted = toSorted(arr);
|
||||
st.deepEqual(sorted, [1, 2, 3, 4, undefined]);
|
||||
st.ok(hasOwn(sorted, 4));
|
||||
|
||||
st.end();
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user