mirror of
https://github.com/github/codeql-action.git
synced 2026-05-01 19:30:49 +00:00
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:
+270
-130
@@ -416,18 +416,18 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint-community/regexpp": {
|
||||
"version": "4.5.1",
|
||||
"resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.5.1.tgz",
|
||||
"integrity": "sha512-Z5ba73P98O1KUYCCJTUeVpja9RcGoMdncZ6T49FCUl2lN38JtCJ+3WgIDBv0AuY4WChU5PmtJmOCTlN6FZTFKQ==",
|
||||
"version": "4.6.2",
|
||||
"resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.6.2.tgz",
|
||||
"integrity": "sha512-pPTNuaAG3QMH+buKyBIGJs3g/S5y0caxw0ygM3YyE6yJFySwiGGSzA+mM3KJ8QQvzeLh3blwgSonkFjgQdxzMw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^12.0.0 || ^14.0.0 || >=16.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/eslintrc": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.0.tgz",
|
||||
"integrity": "sha512-Lj7DECXqIVCqnqjjHMPna4vn6GJcMgul/wuS0je9OZ9gsL0zzDpKPVtcG1HaDVc+9y+qgXneTeUMbCqXJNpH1A==",
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.1.tgz",
|
||||
"integrity": "sha512-9t7ZA7NGGK8ckelF0PQCfcxIUzs1Md5rrO6U/c+FIQNanea5UZC0wqKXH4vHBccmu4ZJgZ2idtPeW7+Q2npOEA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ajv": "^6.12.4",
|
||||
@@ -448,9 +448,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/js": {
|
||||
"version": "8.44.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.44.0.tgz",
|
||||
"integrity": "sha512-Ag+9YM4ocKQx9AarydN0KY2j0ErMHNIocPDrVo8zAE44xLTjEtz81OdR68/cydGtk6m6jDb5Za3r2useMzYmSw==",
|
||||
"version": "8.46.0",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.46.0.tgz",
|
||||
"integrity": "sha512-a8TLtmPi8xzPkCbp/OGFUo5yhRkHM2Ko9kOWP4znJr0WAhWyThaw3PnwX4vOTWOAMsV2uRt32PPDcEz63esSaA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
@@ -1252,6 +1252,19 @@
|
||||
"dequal": "^2.0.3"
|
||||
}
|
||||
},
|
||||
"node_modules/array-buffer-byte-length": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.0.tgz",
|
||||
"integrity": "sha512-LPuwb2P+NrQw3XhxGc36+XSvuBPopovXYTR9Ew++Du9Yb/bx5AzBfrIsBoj0EZUifjQU+sHL21sseZ3jerWO/A==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"call-bind": "^1.0.2",
|
||||
"is-array-buffer": "^3.0.1"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/array-find-index": {
|
||||
"version": "1.0.2",
|
||||
"integrity": "sha1-3wEKoSh+Fku9pvlyOwqWoexBh6E=",
|
||||
@@ -1286,6 +1299,25 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/array.prototype.findlastindex": {
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.2.tgz",
|
||||
"integrity": "sha512-tb5thFFlUcp7NdNF6/MpDk/1r/4awWG1FIz3YqDf+/zJSTezBb+/5WViH41obXULHVpDzoiCLpJ/ZO9YbJMsdw==",
|
||||
"dev": true,
|
||||
"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"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/array.prototype.flat": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.1.tgz",
|
||||
@@ -1322,6 +1354,26 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/arraybuffer.prototype.slice": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.1.tgz",
|
||||
"integrity": "sha512-09x0ZWFEjj4WD8PDbykUwo3t9arLn8NIzmmYEJFpYekOAQjpkGSyrQhNoRTcwwcFRu+ycWF78QZ63oWTqSjBcw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"array-buffer-byte-length": "^1.0.0",
|
||||
"call-bind": "^1.0.2",
|
||||
"define-properties": "^1.2.0",
|
||||
"get-intrinsic": "^1.2.1",
|
||||
"is-array-buffer": "^3.0.2",
|
||||
"is-shared-array-buffer": "^1.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/arrgv": {
|
||||
"version": "1.0.2",
|
||||
"integrity": "sha512-a4eg4yhp7mmruZDQFqVMlxNRFGi/i1r87pt8SDHy0/I8PqSXoUTlWZRdAZo0VXgvEARcujbtTk8kiZRi1uDGRw==",
|
||||
@@ -2096,9 +2148,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/define-properties": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz",
|
||||
"integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz",
|
||||
"integrity": "sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"has-property-descriptors": "^1.0.0",
|
||||
@@ -2270,18 +2322,19 @@
|
||||
}
|
||||
},
|
||||
"node_modules/es-abstract": {
|
||||
"version": "1.21.1",
|
||||
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.21.1.tgz",
|
||||
"integrity": "sha512-QudMsPOz86xYz/1dG1OuGBKOELjCh99IIWHLzy5znUB6j8xG2yMA7bfTV86VSqKF+Y/H08vQPR+9jyXpuC6hfg==",
|
||||
"version": "1.22.1",
|
||||
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.22.1.tgz",
|
||||
"integrity": "sha512-ioRRcXMO6OFyRpyzV3kE1IIBd4WG5/kltnzdxSCqoP8CMGs/Li+M1uF5o7lOkZVFjDs+NLesthnF66Pg/0q0Lw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"array-buffer-byte-length": "^1.0.0",
|
||||
"arraybuffer.prototype.slice": "^1.0.1",
|
||||
"available-typed-arrays": "^1.0.5",
|
||||
"call-bind": "^1.0.2",
|
||||
"es-set-tostringtag": "^2.0.1",
|
||||
"es-to-primitive": "^1.2.1",
|
||||
"function-bind": "^1.1.1",
|
||||
"function.prototype.name": "^1.1.5",
|
||||
"get-intrinsic": "^1.1.3",
|
||||
"get-intrinsic": "^1.2.1",
|
||||
"get-symbol-description": "^1.0.0",
|
||||
"globalthis": "^1.0.3",
|
||||
"gopd": "^1.0.1",
|
||||
@@ -2289,8 +2342,8 @@
|
||||
"has-property-descriptors": "^1.0.0",
|
||||
"has-proto": "^1.0.1",
|
||||
"has-symbols": "^1.0.3",
|
||||
"internal-slot": "^1.0.4",
|
||||
"is-array-buffer": "^3.0.1",
|
||||
"internal-slot": "^1.0.5",
|
||||
"is-array-buffer": "^3.0.2",
|
||||
"is-callable": "^1.2.7",
|
||||
"is-negative-zero": "^2.0.2",
|
||||
"is-regex": "^1.1.4",
|
||||
@@ -2298,16 +2351,21 @@
|
||||
"is-string": "^1.0.7",
|
||||
"is-typed-array": "^1.1.10",
|
||||
"is-weakref": "^1.0.2",
|
||||
"object-inspect": "^1.12.2",
|
||||
"object-inspect": "^1.12.3",
|
||||
"object-keys": "^1.1.1",
|
||||
"object.assign": "^4.1.4",
|
||||
"regexp.prototype.flags": "^1.4.3",
|
||||
"regexp.prototype.flags": "^1.5.0",
|
||||
"safe-array-concat": "^1.0.0",
|
||||
"safe-regex-test": "^1.0.0",
|
||||
"string.prototype.trim": "^1.2.7",
|
||||
"string.prototype.trimend": "^1.0.6",
|
||||
"string.prototype.trimstart": "^1.0.6",
|
||||
"typed-array-buffer": "^1.0.0",
|
||||
"typed-array-byte-length": "^1.0.0",
|
||||
"typed-array-byte-offset": "^1.0.0",
|
||||
"typed-array-length": "^1.0.4",
|
||||
"unbox-primitive": "^1.0.2",
|
||||
"which-typed-array": "^1.1.9"
|
||||
"which-typed-array": "^1.1.10"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
@@ -2400,27 +2458,27 @@
|
||||
}
|
||||
},
|
||||
"node_modules/eslint": {
|
||||
"version": "8.45.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.45.0.tgz",
|
||||
"integrity": "sha512-pd8KSxiQpdYRfYa9Wufvdoct3ZPQQuVuU5O6scNgMuOMYuxvH0IGaYK0wUFjo4UYYQQCUndlXiMbnxopwvvTiw==",
|
||||
"version": "8.46.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-8.46.0.tgz",
|
||||
"integrity": "sha512-cIO74PvbW0qU8e0mIvk5IV3ToWdCq5FYG6gWPHHkx6gNdjlbAYvtfHmlCMXxjcoVaIdwy/IAt3+mDkZkfvb2Dg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.2.0",
|
||||
"@eslint-community/regexpp": "^4.4.0",
|
||||
"@eslint/eslintrc": "^2.1.0",
|
||||
"@eslint/js": "8.44.0",
|
||||
"@eslint-community/regexpp": "^4.6.1",
|
||||
"@eslint/eslintrc": "^2.1.1",
|
||||
"@eslint/js": "^8.46.0",
|
||||
"@humanwhocodes/config-array": "^0.11.10",
|
||||
"@humanwhocodes/module-importer": "^1.0.1",
|
||||
"@nodelib/fs.walk": "^1.2.8",
|
||||
"ajv": "^6.10.0",
|
||||
"ajv": "^6.12.4",
|
||||
"chalk": "^4.0.0",
|
||||
"cross-spawn": "^7.0.2",
|
||||
"debug": "^4.3.2",
|
||||
"doctrine": "^3.0.0",
|
||||
"escape-string-regexp": "^4.0.0",
|
||||
"eslint-scope": "^7.2.0",
|
||||
"eslint-visitor-keys": "^3.4.1",
|
||||
"espree": "^9.6.0",
|
||||
"eslint-scope": "^7.2.2",
|
||||
"eslint-visitor-keys": "^3.4.2",
|
||||
"espree": "^9.6.1",
|
||||
"esquery": "^1.4.2",
|
||||
"esutils": "^2.0.2",
|
||||
"fast-deep-equal": "^3.1.3",
|
||||
@@ -2543,9 +2601,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-module-utils": {
|
||||
"version": "2.7.4",
|
||||
"resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.4.tgz",
|
||||
"integrity": "sha512-j4GT+rqzCoRKHwURX7pddtIPGySnX9Si/cgMI5ztrcqOPtk5dDEeZ34CQVPphnqkJytlc97Vuk05Um2mJ3gEQA==",
|
||||
"version": "2.8.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.0.tgz",
|
||||
"integrity": "sha512-aWajIYfsqCKRDgUfjEXNN/JlrzauMuSEy5sbd7WXbtW3EH6A6MpwEh42c7qD+MqQo9QMJ6fWLAeIJynx0g6OAw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"debug": "^3.2.7"
|
||||
@@ -2653,26 +2711,29 @@
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-import": {
|
||||
"version": "2.27.5",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.27.5.tgz",
|
||||
"integrity": "sha512-LmEt3GVofgiGuiE+ORpnvP+kAm3h6MLZJ4Q5HCyHADofsb4VzXFsRiWj3c0OFiV+3DWFh0qg3v9gcPlfc3zRow==",
|
||||
"version": "2.28.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.28.0.tgz",
|
||||
"integrity": "sha512-B8s/n+ZluN7sxj9eUf7/pRFERX0r5bnFA2dCaLHy2ZeaQEAz0k+ZZkFWRFHJAqxfxQDx6KLv9LeIki7cFdwW+Q==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"array-includes": "^3.1.6",
|
||||
"array.prototype.findlastindex": "^1.2.2",
|
||||
"array.prototype.flat": "^1.3.1",
|
||||
"array.prototype.flatmap": "^1.3.1",
|
||||
"debug": "^3.2.7",
|
||||
"doctrine": "^2.1.0",
|
||||
"eslint-import-resolver-node": "^0.3.7",
|
||||
"eslint-module-utils": "^2.7.4",
|
||||
"eslint-module-utils": "^2.8.0",
|
||||
"has": "^1.0.3",
|
||||
"is-core-module": "^2.11.0",
|
||||
"is-core-module": "^2.12.1",
|
||||
"is-glob": "^4.0.3",
|
||||
"minimatch": "^3.1.2",
|
||||
"object.fromentries": "^2.0.6",
|
||||
"object.groupby": "^1.0.0",
|
||||
"object.values": "^1.1.6",
|
||||
"resolve": "^1.22.1",
|
||||
"semver": "^6.3.0",
|
||||
"tsconfig-paths": "^3.14.1"
|
||||
"resolve": "^1.22.3",
|
||||
"semver": "^6.3.1",
|
||||
"tsconfig-paths": "^3.14.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
@@ -2690,15 +2751,6 @@
|
||||
"ms": "^2.1.1"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-import/node_modules/semver": {
|
||||
"version": "6.3.1",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
|
||||
"integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-plugin-jsx-a11y": {
|
||||
"version": "6.7.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.7.1.tgz",
|
||||
@@ -2801,10 +2853,26 @@
|
||||
"node": ">=4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-scope": {
|
||||
"version": "7.2.2",
|
||||
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz",
|
||||
"integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"esrecurse": "^4.3.0",
|
||||
"estraverse": "^5.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-visitor-keys": {
|
||||
"version": "3.4.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.1.tgz",
|
||||
"integrity": "sha512-pZnmmLwYzf+kWaM/Qgrvpen51upAktaaiI01nsJD/Yr3lMOdNtq0cxkrrg16w64VtisN6okbs7Q8AfGqj4c9fA==",
|
||||
"version": "3.4.2",
|
||||
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.2.tgz",
|
||||
"integrity": "sha512-8drBzUEyZ2llkpCA67iYrgEssKDUu68V8ChqqOfFupIaG/LCVPUT+CoGJpT77zJprs4T/W7p07LP7zAIMuweVw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
@@ -2866,31 +2934,6 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint/node_modules/eslint-scope": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.0.tgz",
|
||||
"integrity": "sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"esrecurse": "^4.3.0",
|
||||
"estraverse": "^5.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://opencollective.com/eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint/node_modules/estraverse": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
|
||||
"integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint/node_modules/find-up": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
|
||||
@@ -3005,9 +3048,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/espree": {
|
||||
"version": "9.6.0",
|
||||
"resolved": "https://registry.npmjs.org/espree/-/espree-9.6.0.tgz",
|
||||
"integrity": "sha512-1FH/IiruXZ84tpUlm0aCUEwMl2Ho5ilqVh0VvQXw+byAz/4SAciyHLlfmL5WYqsvD38oymdUwBss0LtK8m4s/A==",
|
||||
"version": "9.6.1",
|
||||
"resolved": "https://registry.npmjs.org/espree/-/espree-9.6.1.tgz",
|
||||
"integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"acorn": "^8.9.0",
|
||||
@@ -3046,17 +3089,9 @@
|
||||
"node": ">=0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/esquery/node_modules/estraverse": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
|
||||
"integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/esrecurse": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
|
||||
"integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
@@ -3066,9 +3101,10 @@
|
||||
"node": ">=4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/esrecurse/node_modules/estraverse": {
|
||||
"version": "5.2.0",
|
||||
"integrity": "sha512-BxbNGGNm0RyRYvUdHpIwv9IWzeM9XClbOxwoATuFdOE7ZE6wHL+HQ5T8hoPM+zHvmKzzsEqhgy0GrQ5X13afiQ==",
|
||||
"node_modules/estraverse": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
|
||||
"integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
@@ -3360,13 +3396,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/get-intrinsic": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.3.tgz",
|
||||
"integrity": "sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==",
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz",
|
||||
"integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.1",
|
||||
"has": "^1.0.3",
|
||||
"has-proto": "^1.0.1",
|
||||
"has-symbols": "^1.0.3"
|
||||
},
|
||||
"funding": {
|
||||
@@ -3652,12 +3689,12 @@
|
||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
|
||||
},
|
||||
"node_modules/internal-slot": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.4.tgz",
|
||||
"integrity": "sha512-tA8URYccNzMo94s5MQZgH8NB/XTa6HsOo0MLfXTKKEnHVVdegzaQoFZ7Jp44bdvLvY2waT5dc+j5ICEswhi7UQ==",
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz",
|
||||
"integrity": "sha512-Y+R5hJrzs52QCG2laLn4udYVnxsfny9CpOhNhUvk/SSSVyF6T27FzRbF0sroPidSu3X8oEAkOn2K804mjpt6UQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"get-intrinsic": "^1.1.3",
|
||||
"get-intrinsic": "^1.2.0",
|
||||
"has": "^1.0.3",
|
||||
"side-channel": "^1.0.4"
|
||||
},
|
||||
@@ -3691,13 +3728,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/is-array-buffer": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.1.tgz",
|
||||
"integrity": "sha512-ASfLknmY8Xa2XtB4wmbz13Wu202baeA18cJBCeCy0wXUHZF0IPyVEXqKEcd+t2fNSLLL1vC6k7lxZEojNbISXQ==",
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz",
|
||||
"integrity": "sha512-y+FyyR/w8vfIRq4eQcM1EYgSTnmHXPqaF+IgzgraytCFq5Xh8lllDVmAZolPJiZttZLeFSINPYMaEJ7/vWUa1w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"call-bind": "^1.0.2",
|
||||
"get-intrinsic": "^1.1.3",
|
||||
"get-intrinsic": "^1.2.0",
|
||||
"is-typed-array": "^1.1.10"
|
||||
},
|
||||
"funding": {
|
||||
@@ -3757,9 +3794,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/is-core-module": {
|
||||
"version": "2.11.0",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.11.0.tgz",
|
||||
"integrity": "sha512-RRjxlvLDkD1YJwDbroBHMb+cukurkDWNyHx7D3oNB5x9rb5ogcksMC5wHCadcXoo67gVr/+3GFySh3134zi6rw==",
|
||||
"version": "2.12.1",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz",
|
||||
"integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"has": "^1.0.3"
|
||||
@@ -4421,9 +4458,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/minimist": {
|
||||
"version": "1.2.7",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz",
|
||||
"integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==",
|
||||
"version": "1.2.8",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
|
||||
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
|
||||
"dev": true,
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
@@ -4644,6 +4681,18 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/object.groupby": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.0.tgz",
|
||||
"integrity": "sha512-70MWG6NfRH9GnbZOikuhPPYzpUpof9iW2J9E4dW7FXTqPNb6rllE6u39SKwwiNh8lCwX3DDb5OgcKGiEBrTTyw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"call-bind": "^1.0.2",
|
||||
"define-properties": "^1.2.0",
|
||||
"es-abstract": "^1.21.2",
|
||||
"get-intrinsic": "^1.2.1"
|
||||
}
|
||||
},
|
||||
"node_modules/object.values": {
|
||||
"version": "1.1.6",
|
||||
"resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.6.tgz",
|
||||
@@ -5039,14 +5088,14 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/regexp.prototype.flags": {
|
||||
"version": "1.4.3",
|
||||
"resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz",
|
||||
"integrity": "sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==",
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.0.tgz",
|
||||
"integrity": "sha512-0SutC3pNudRKgquxGoRGIz946MZVHqbNfPjBdxeOhBrdgDKlRoXmYLQN9xRbrR09ZXWeGAdPuif7egofn6v5LA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"call-bind": "^1.0.2",
|
||||
"define-properties": "^1.1.3",
|
||||
"functions-have-names": "^1.2.2"
|
||||
"define-properties": "^1.2.0",
|
||||
"functions-have-names": "^1.2.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
@@ -5085,12 +5134,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/resolve": {
|
||||
"version": "1.22.1",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.1.tgz",
|
||||
"integrity": "sha512-nBpuuYuY5jFsli/JIs1oldw6fOQCBioohqWZg/2hiaOybXOft4lonv85uDOKXdf8rhyK159cxU5cDcK/NKk8zw==",
|
||||
"version": "1.22.3",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.3.tgz",
|
||||
"integrity": "sha512-P8ur/gp/AmbEzjr729bZnLjXK5Z+4P0zhIJgBgzqRih7hL7BOukHGtSTA3ACMY467GRFz3duQsi0bDZdR7DKdw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"is-core-module": "^2.9.0",
|
||||
"is-core-module": "^2.12.0",
|
||||
"path-parse": "^1.0.7",
|
||||
"supports-preserve-symlinks-flag": "^1.0.0"
|
||||
},
|
||||
@@ -5297,6 +5346,30 @@
|
||||
"queue-microtask": "^1.2.2"
|
||||
}
|
||||
},
|
||||
"node_modules/safe-array-concat": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/safe-array-concat/-/safe-array-concat-1.0.0.tgz",
|
||||
"integrity": "sha512-9dVEFruWIsnie89yym+xWTAYASdpw3CJV7Li/6zBewGf9z2i1j31rP6jnY0pHEO4QZh6N0K11bFjWmdR8UGdPQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"call-bind": "^1.0.2",
|
||||
"get-intrinsic": "^1.2.0",
|
||||
"has-symbols": "^1.0.3",
|
||||
"isarray": "^2.0.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/safe-array-concat/node_modules/isarray": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz",
|
||||
"integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/safe-regex-test": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/safe-regex-test/-/safe-regex-test-1.0.0.tgz",
|
||||
@@ -5543,6 +5616,23 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/string.prototype.trim": {
|
||||
"version": "1.2.7",
|
||||
"resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.7.tgz",
|
||||
"integrity": "sha512-p6TmeT1T3411M8Cgg9wBTMRtY2q9+PNy9EV1i2lIXUN/btt763oIfxwN3RR8VU6wHX8j/1CFy0L+YuThm6bgOg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"call-bind": "^1.0.2",
|
||||
"define-properties": "^1.1.4",
|
||||
"es-abstract": "^1.20.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/string.prototype.trimend": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.6.tgz",
|
||||
@@ -5819,13 +5909,13 @@
|
||||
}
|
||||
},
|
||||
"node_modules/tsconfig-paths": {
|
||||
"version": "3.14.1",
|
||||
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz",
|
||||
"integrity": "sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ==",
|
||||
"version": "3.14.2",
|
||||
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz",
|
||||
"integrity": "sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/json5": "^0.0.29",
|
||||
"json5": "^1.0.1",
|
||||
"json5": "^1.0.2",
|
||||
"minimist": "^1.2.6",
|
||||
"strip-bom": "^3.0.0"
|
||||
}
|
||||
@@ -5875,6 +5965,57 @@
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/typed-array-buffer": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/typed-array-buffer/-/typed-array-buffer-1.0.0.tgz",
|
||||
"integrity": "sha512-Y8KTSIglk9OZEr8zywiIHG/kmQ7KWyjseXs1CbSo8vC42w7hg2HgYTxSWwP0+is7bWDc1H+Fo026CpHFwm8tkw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"call-bind": "^1.0.2",
|
||||
"get-intrinsic": "^1.2.1",
|
||||
"is-typed-array": "^1.1.10"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/typed-array-byte-length": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/typed-array-byte-length/-/typed-array-byte-length-1.0.0.tgz",
|
||||
"integrity": "sha512-Or/+kvLxNpeQ9DtSydonMxCx+9ZXOswtwJn17SNLvhptaXYDJvkFFP5zbfU/uLmvnBJlI4yrnXRxpdWH/M5tNA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"call-bind": "^1.0.2",
|
||||
"for-each": "^0.3.3",
|
||||
"has-proto": "^1.0.1",
|
||||
"is-typed-array": "^1.1.10"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/typed-array-byte-offset": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/typed-array-byte-offset/-/typed-array-byte-offset-1.0.0.tgz",
|
||||
"integrity": "sha512-RD97prjEt9EL8YgAgpOkf3O4IF9lhJFr9g0htQkm0rchFp/Vx7LW5Q8fSXXub7BXAODyUQohRMyOc3faCPd0hg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"available-typed-arrays": "^1.0.5",
|
||||
"call-bind": "^1.0.2",
|
||||
"for-each": "^0.3.3",
|
||||
"has-proto": "^1.0.1",
|
||||
"is-typed-array": "^1.1.10"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/typed-array-length": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/typed-array-length/-/typed-array-length-1.0.4.tgz",
|
||||
@@ -6051,17 +6192,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/which-typed-array": {
|
||||
"version": "1.1.9",
|
||||
"resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz",
|
||||
"integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==",
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.11.tgz",
|
||||
"integrity": "sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"available-typed-arrays": "^1.0.5",
|
||||
"call-bind": "^1.0.2",
|
||||
"for-each": "^0.3.3",
|
||||
"gopd": "^1.0.1",
|
||||
"has-tostringtag": "^1.0.0",
|
||||
"is-typed-array": "^1.1.10"
|
||||
"has-tostringtag": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
|
||||
+7
-7
@@ -79,7 +79,7 @@ Parse a regular expression literal.
|
||||
- **Return:**
|
||||
- The AST of the regular expression.
|
||||
|
||||
#### parser.parsePattern(source, start?, end?, uFlag?)
|
||||
#### parser.parsePattern(source, start?, end?, flags?)
|
||||
|
||||
Parse a regular expression pattern.
|
||||
|
||||
@@ -87,7 +87,7 @@ Parse a regular expression pattern.
|
||||
- `source` (`string`) The source code to parse. E.g. `"abc"`.
|
||||
- `start?` (`number`) The start index in the source code. Default is `0`.
|
||||
- `end?` (`number`) The end index in the source code. Default is `source.length`.
|
||||
- `uFlag?` (`boolean`) The flag to enable Unicode mode.
|
||||
- `flags?` (`{ unicode?: boolean, unicodeSets?: boolean }`) The flags to enable Unicode mode, and Unicode Set mode.
|
||||
- **Return:**
|
||||
- The AST of the regular expression pattern.
|
||||
|
||||
@@ -118,7 +118,7 @@ Validate a regular expression literal.
|
||||
- `start?` (`number`) The start index in the source code. Default is `0`.
|
||||
- `end?` (`number`) The end index in the source code. Default is `source.length`.
|
||||
|
||||
#### validator.validatePattern(source, start, end, uFlag)
|
||||
#### validator.validatePattern(source, start, end, flags)
|
||||
|
||||
Validate a regular expression pattern.
|
||||
|
||||
@@ -126,7 +126,7 @@ Validate a regular expression pattern.
|
||||
- `source` (`string`) The source code to validate.
|
||||
- `start?` (`number`) The start index in the source code. Default is `0`.
|
||||
- `end?` (`number`) The end index in the source code. Default is `source.length`.
|
||||
- `uFlag?` (`boolean`) The flag to enable Unicode mode.
|
||||
- `flags?` (`{ unicode?: boolean, unicodeSets?: boolean }`) The flags to enable Unicode mode, and Unicode Set mode.
|
||||
|
||||
#### validator.validateFlags(source, start, end)
|
||||
|
||||
@@ -172,6 +172,6 @@ Please use GitHub's Issues/PRs.
|
||||
- `npm run watch` runs tests with `--watch` option.
|
||||
|
||||
[`AST.Node`]: src/ast.ts#L4
|
||||
[`RegExpParser.Options`]: src/parser.ts#L539
|
||||
[`RegExpValidator.Options`]: src/validator.ts#L127
|
||||
[`RegExpVisitor.Handlers`]: src/visitor.ts#L204
|
||||
[`RegExpParser.Options`]: src/parser.ts#L743
|
||||
[`RegExpValidator.Options`]: src/validator.ts#L220
|
||||
[`RegExpVisitor.Handlers`]: src/visitor.ts#L291
|
||||
|
||||
+258
-12
@@ -44,11 +44,16 @@ declare module "@eslint-community/regexpp/ast" {
|
||||
| CapturingGroup
|
||||
| CharacterClass
|
||||
| CharacterClassRange
|
||||
| ClassIntersection
|
||||
| ClassStringDisjunction
|
||||
| ClassSubtraction
|
||||
| ExpressionCharacterClass
|
||||
| Group
|
||||
| LookaroundAssertion
|
||||
| Pattern
|
||||
| Quantifier
|
||||
| RegExpLiteral;
|
||||
| RegExpLiteral
|
||||
| StringAlternative;
|
||||
/**
|
||||
* The type which includes all leaf nodes.
|
||||
*/
|
||||
@@ -71,16 +76,28 @@ declare module "@eslint-community/regexpp/ast" {
|
||||
| Character
|
||||
| CharacterClass
|
||||
| CharacterSet
|
||||
| ExpressionCharacterClass
|
||||
| Group
|
||||
| LookaheadAssertion;
|
||||
/**
|
||||
* The type which includes all character class atom nodes.
|
||||
*/
|
||||
export type CharacterClassElement =
|
||||
| ClassRangesCharacterClassElement
|
||||
| UnicodeSetsCharacterClassElement;
|
||||
export type ClassRangesCharacterClassElement =
|
||||
| Character
|
||||
| CharacterClassRange
|
||||
| EscapeCharacterSet
|
||||
| UnicodePropertyCharacterSet;
|
||||
export type UnicodeSetsCharacterClassElement =
|
||||
| Character
|
||||
| CharacterClassRange
|
||||
| ClassStringDisjunction
|
||||
| EscapeCharacterSet
|
||||
| ExpressionCharacterClass
|
||||
| UnicodePropertyCharacterSet
|
||||
| UnicodeSetsCharacterClass;
|
||||
/**
|
||||
* The type which defines common properties for all node types.
|
||||
*/
|
||||
@@ -184,12 +201,35 @@ declare module "@eslint-community/regexpp/ast" {
|
||||
* The character class.
|
||||
* E.g. `[ab]`, `[^ab]`
|
||||
*/
|
||||
export interface CharacterClass extends NodeBase {
|
||||
export type CharacterClass =
|
||||
| ClassRangesCharacterClass
|
||||
| UnicodeSetsCharacterClass;
|
||||
interface BaseCharacterClass extends NodeBase {
|
||||
type: "CharacterClass";
|
||||
parent: Alternative | Quantifier;
|
||||
parent:
|
||||
| Alternative
|
||||
| ExpressionCharacterClass
|
||||
| Quantifier
|
||||
| UnicodeSetsCharacterClass;
|
||||
unicodeSets: boolean;
|
||||
negate: boolean;
|
||||
elements: CharacterClassElement[];
|
||||
}
|
||||
export interface ClassRangesCharacterClass extends BaseCharacterClass {
|
||||
parent: Alternative | Quantifier;
|
||||
unicodeSets: false;
|
||||
elements: ClassRangesCharacterClassElement[];
|
||||
}
|
||||
/** UnicodeSetsCharacterClass is the CharacterClass when in Unicode sets mode. So it may contain strings. */
|
||||
export interface UnicodeSetsCharacterClass extends BaseCharacterClass {
|
||||
parent:
|
||||
| Alternative
|
||||
| ExpressionCharacterClass
|
||||
| Quantifier
|
||||
| UnicodeSetsCharacterClass;
|
||||
unicodeSets: true;
|
||||
elements: UnicodeSetsCharacterClassElement[];
|
||||
}
|
||||
/**
|
||||
* The character class.
|
||||
* E.g. `[a-b]`
|
||||
@@ -249,7 +289,12 @@ declare module "@eslint-community/regexpp/ast" {
|
||||
*/
|
||||
export interface EscapeCharacterSet extends NodeBase {
|
||||
type: "CharacterSet";
|
||||
parent: Alternative | CharacterClass | Quantifier;
|
||||
parent:
|
||||
| Alternative
|
||||
| CharacterClass
|
||||
| ClassIntersection
|
||||
| ClassSubtraction
|
||||
| Quantifier;
|
||||
kind: "digit" | "space" | "word";
|
||||
negate: boolean;
|
||||
}
|
||||
@@ -257,14 +302,92 @@ declare module "@eslint-community/regexpp/ast" {
|
||||
* The unicode property escape.
|
||||
* E.g. `\p{ASCII}`, `\P{ASCII}`, `\p{Script=Hiragana}`
|
||||
*/
|
||||
export interface UnicodePropertyCharacterSet extends NodeBase {
|
||||
export type UnicodePropertyCharacterSet =
|
||||
| CharacterUnicodePropertyCharacterSet
|
||||
| StringsUnicodePropertyCharacterSet;
|
||||
interface BaseUnicodePropertyCharacterSet extends NodeBase {
|
||||
type: "CharacterSet";
|
||||
parent: Alternative | CharacterClass | Quantifier;
|
||||
parent:
|
||||
| Alternative
|
||||
| CharacterClass
|
||||
| ClassIntersection
|
||||
| ClassSubtraction
|
||||
| Quantifier;
|
||||
kind: "property";
|
||||
strings: boolean;
|
||||
key: string;
|
||||
value: string | null;
|
||||
negate: boolean;
|
||||
}
|
||||
export interface CharacterUnicodePropertyCharacterSet
|
||||
extends BaseUnicodePropertyCharacterSet {
|
||||
strings: false;
|
||||
value: string | null;
|
||||
negate: boolean;
|
||||
}
|
||||
/** StringsUnicodePropertyCharacterSet is Unicode property escape with property of strings. */
|
||||
export interface StringsUnicodePropertyCharacterSet
|
||||
extends BaseUnicodePropertyCharacterSet {
|
||||
strings: true;
|
||||
value: null;
|
||||
negate: false;
|
||||
}
|
||||
/**
|
||||
* The expression character class.
|
||||
* E.g. `[a--b]`, `[a&&b]`,`[^a--b]`, `[^a&&b]`
|
||||
*/
|
||||
export interface ExpressionCharacterClass extends NodeBase {
|
||||
type: "ExpressionCharacterClass";
|
||||
parent:
|
||||
| Alternative
|
||||
| ExpressionCharacterClass
|
||||
| Quantifier
|
||||
| UnicodeSetsCharacterClass;
|
||||
negate: boolean;
|
||||
expression: ClassIntersection | ClassSubtraction;
|
||||
}
|
||||
export type ClassSetOperand =
|
||||
| Character
|
||||
| ClassStringDisjunction
|
||||
| EscapeCharacterSet
|
||||
| ExpressionCharacterClass
|
||||
| UnicodePropertyCharacterSet
|
||||
| UnicodeSetsCharacterClass;
|
||||
/**
|
||||
* The character class intersection.
|
||||
* E.g. `a&&b`
|
||||
*/
|
||||
export interface ClassIntersection extends NodeBase {
|
||||
type: "ClassIntersection";
|
||||
parent: ClassIntersection | ExpressionCharacterClass;
|
||||
left: ClassIntersection | ClassSetOperand;
|
||||
right: ClassSetOperand;
|
||||
}
|
||||
/**
|
||||
* The character class subtraction.
|
||||
* E.g. `a--b`
|
||||
*/
|
||||
export interface ClassSubtraction extends NodeBase {
|
||||
type: "ClassSubtraction";
|
||||
parent: ClassSubtraction | ExpressionCharacterClass;
|
||||
left: ClassSetOperand | ClassSubtraction;
|
||||
right: ClassSetOperand;
|
||||
}
|
||||
/**
|
||||
* The character class string disjunction.
|
||||
* E.g. `\q{a|b}`
|
||||
*/
|
||||
export interface ClassStringDisjunction extends NodeBase {
|
||||
type: "ClassStringDisjunction";
|
||||
parent: ClassIntersection | ClassSubtraction | UnicodeSetsCharacterClass;
|
||||
alternatives: StringAlternative[];
|
||||
}
|
||||
/** StringAlternative is only used for `\q{alt}`({@link ClassStringDisjunction}). */
|
||||
export interface StringAlternative extends NodeBase {
|
||||
type: "StringAlternative";
|
||||
parent: ClassStringDisjunction;
|
||||
elements: Character[];
|
||||
}
|
||||
/**
|
||||
* The character.
|
||||
* This includes escape sequences which mean a character.
|
||||
@@ -272,7 +395,14 @@ declare module "@eslint-community/regexpp/ast" {
|
||||
*/
|
||||
export interface Character extends NodeBase {
|
||||
type: "Character";
|
||||
parent: Alternative | CharacterClass | CharacterClassRange | Quantifier;
|
||||
parent:
|
||||
| Alternative
|
||||
| CharacterClass
|
||||
| CharacterClassRange
|
||||
| ClassIntersection
|
||||
| ClassSubtraction
|
||||
| Quantifier
|
||||
| StringAlternative;
|
||||
value: number;
|
||||
}
|
||||
/**
|
||||
@@ -298,7 +428,9 @@ declare module "@eslint-community/regexpp/ast" {
|
||||
multiline: boolean;
|
||||
sticky: boolean;
|
||||
unicode: boolean;
|
||||
unicodeSets: boolean;
|
||||
}
|
||||
export {};
|
||||
}
|
||||
|
||||
declare module "@eslint-community/regexpp/parser" {
|
||||
@@ -318,13 +450,14 @@ declare module "@eslint-community/regexpp/parser" {
|
||||
*/
|
||||
strict?: boolean;
|
||||
/**
|
||||
* ECMAScript version. Default is `2023`.
|
||||
* ECMAScript version. Default is `2024`.
|
||||
* - `2015` added `u` and `y` flags.
|
||||
* - `2018` added `s` flag, Named Capturing Group, Lookbehind Assertion,
|
||||
* and Unicode Property Escape.
|
||||
* - `2019`, `2020`, and `2021` added more valid Unicode Property Escapes.
|
||||
* - `2022` added `d` flag.
|
||||
* - `2023` added more valid Unicode Property Escapes.
|
||||
* - `2024` added `v` flag.
|
||||
*/
|
||||
ecmaVersion?: EcmaVersion;
|
||||
}
|
||||
@@ -356,6 +489,25 @@ declare module "@eslint-community/regexpp/parser" {
|
||||
* @param source The source code to parse.
|
||||
* @param start The start index in the source code.
|
||||
* @param end The end index in the source code.
|
||||
* @param flags The flags.
|
||||
* @returns The AST of the given pattern.
|
||||
*/
|
||||
parsePattern(
|
||||
source: string,
|
||||
start?: number,
|
||||
end?: number,
|
||||
flags?: {
|
||||
unicode?: boolean;
|
||||
unicodeSets?: boolean;
|
||||
}
|
||||
): Pattern;
|
||||
/**
|
||||
* @deprecated Backward compatibility
|
||||
* Use object `flags` instead of boolean `uFlag`.
|
||||
*
|
||||
* @param source The source code to parse.
|
||||
* @param start The start index in the source code.
|
||||
* @param end The end index in the source code.
|
||||
* @param uFlag The flag to set unicode mode.
|
||||
* @returns The AST of the given pattern.
|
||||
*/
|
||||
@@ -370,6 +522,12 @@ declare module "@eslint-community/regexpp/parser" {
|
||||
|
||||
declare module "@eslint-community/regexpp/validator" {
|
||||
import type { EcmaVersion } from "@eslint-community/regexpp/ecma-versions";
|
||||
export type RegExpValidatorSourceContext = {
|
||||
readonly source: string;
|
||||
readonly start: number;
|
||||
readonly end: number;
|
||||
readonly kind: "flags" | "literal" | "pattern";
|
||||
};
|
||||
export namespace RegExpValidator {
|
||||
/**
|
||||
* The options for RegExpValidator construction.
|
||||
@@ -380,13 +538,14 @@ declare module "@eslint-community/regexpp/validator" {
|
||||
*/
|
||||
strict?: boolean;
|
||||
/**
|
||||
* ECMAScript version. Default is `2023`.
|
||||
* ECMAScript version. Default is `2024`.
|
||||
* - `2015` added `u` and `y` flags.
|
||||
* - `2018` added `s` flag, Named Capturing Group, Lookbehind Assertion,
|
||||
* and Unicode Property Escape.
|
||||
* - `2019`, `2020`, and `2021` added more valid Unicode Property Escapes.
|
||||
* - `2022` added `d` flag.
|
||||
* - `2023` added more valid Unicode Property Escapes.
|
||||
* - `2024` added `v` flag.
|
||||
*/
|
||||
ecmaVersion?: EcmaVersion;
|
||||
/**
|
||||
@@ -411,6 +570,7 @@ declare module "@eslint-community/regexpp/validator" {
|
||||
* @param flags.sticky `y` flag.
|
||||
* @param flags.dotAll `s` flag.
|
||||
* @param flags.hasIndices `d` flag.
|
||||
* @param flags.unicodeSets `v` flag.
|
||||
*/
|
||||
onRegExpFlags?: (
|
||||
start: number,
|
||||
@@ -423,6 +583,7 @@ declare module "@eslint-community/regexpp/validator" {
|
||||
sticky: boolean;
|
||||
dotAll: boolean;
|
||||
hasIndices: boolean;
|
||||
unicodeSets: boolean;
|
||||
}
|
||||
) => void;
|
||||
/**
|
||||
@@ -604,6 +765,7 @@ declare module "@eslint-community/regexpp/validator" {
|
||||
* @param key The property name.
|
||||
* @param value The property value.
|
||||
* @param negate The flag which represents that the character set is negative.
|
||||
* @param strings If true, the given property is property of strings.
|
||||
*/
|
||||
onUnicodePropertyCharacterSet?: (
|
||||
start: number,
|
||||
@@ -611,7 +773,8 @@ declare module "@eslint-community/regexpp/validator" {
|
||||
kind: "property",
|
||||
key: string,
|
||||
value: string | null,
|
||||
negate: boolean
|
||||
negate: boolean,
|
||||
strings: boolean
|
||||
) => void;
|
||||
/**
|
||||
* A function that is called when the validator found a character.
|
||||
@@ -635,8 +798,13 @@ declare module "@eslint-community/regexpp/validator" {
|
||||
* A function that is called when the validator entered a character class.
|
||||
* @param start The 0-based index of the first character.
|
||||
* @param negate The flag which represents that the character class is negative.
|
||||
* @param unicodeSets `true` if unicodeSets mode.
|
||||
*/
|
||||
onCharacterClassEnter?: (start: number, negate: boolean) => void;
|
||||
onCharacterClassEnter?: (
|
||||
start: number,
|
||||
negate: boolean,
|
||||
unicodeSets: boolean
|
||||
) => void;
|
||||
/**
|
||||
* A function that is called when the validator left a character class.
|
||||
* @param start The 0-based index of the first character.
|
||||
@@ -661,6 +829,46 @@ declare module "@eslint-community/regexpp/validator" {
|
||||
min: number,
|
||||
max: number
|
||||
) => void;
|
||||
/**
|
||||
* A function that is called when the validator found a class intersection.
|
||||
* @param start The 0-based index of the first character.
|
||||
* @param end The next 0-based index of the last character.
|
||||
*/
|
||||
onClassIntersection?: (start: number, end: number) => void;
|
||||
/**
|
||||
* A function that is called when the validator found a class subtraction.
|
||||
* @param start The 0-based index of the first character.
|
||||
* @param end The next 0-based index of the last character.
|
||||
*/
|
||||
onClassSubtraction?: (start: number, end: number) => void;
|
||||
/**
|
||||
* A function that is called when the validator entered a class string disjunction.
|
||||
* @param start The 0-based index of the first character.
|
||||
*/
|
||||
onClassStringDisjunctionEnter?: (start: number) => void;
|
||||
/**
|
||||
* A function that is called when the validator left a class string disjunction.
|
||||
* @param start The 0-based index of the first character.
|
||||
* @param end The next 0-based index of the last character.
|
||||
*/
|
||||
onClassStringDisjunctionLeave?: (start: number, end: number) => void;
|
||||
/**
|
||||
* A function that is called when the validator entered a string alternative.
|
||||
* @param start The 0-based index of the first character.
|
||||
* @param index The 0-based index of alternatives in a disjunction.
|
||||
*/
|
||||
onStringAlternativeEnter?: (start: number, index: number) => void;
|
||||
/**
|
||||
* A function that is called when the validator left a string alternative.
|
||||
* @param start The 0-based index of the first character.
|
||||
* @param end The next 0-based index of the last character.
|
||||
* @param index The 0-based index of alternatives in a disjunction.
|
||||
*/
|
||||
onStringAlternativeLeave?: (
|
||||
start: number,
|
||||
end: number,
|
||||
index: number
|
||||
) => void;
|
||||
}
|
||||
}
|
||||
/**
|
||||
@@ -691,6 +899,23 @@ declare module "@eslint-community/regexpp/validator" {
|
||||
* @param source The source code to validate.
|
||||
* @param start The start index in the source code.
|
||||
* @param end The end index in the source code.
|
||||
* @param flags The flags.
|
||||
*/
|
||||
validatePattern(
|
||||
source: string,
|
||||
start?: number,
|
||||
end?: number,
|
||||
flags?: {
|
||||
unicode?: boolean;
|
||||
unicodeSets?: boolean;
|
||||
}
|
||||
): void;
|
||||
/**
|
||||
* @deprecated Backward compatibility
|
||||
* Use object `flags` instead of boolean `uFlag`.
|
||||
* @param source The source code to validate.
|
||||
* @param start The start index in the source code.
|
||||
* @param end The end index in the source code.
|
||||
* @param uFlag The flag to set unicode mode.
|
||||
*/
|
||||
validatePattern(
|
||||
@@ -712,12 +937,17 @@ declare module "@eslint-community/regexpp/visitor" {
|
||||
CharacterClass,
|
||||
CharacterClassRange,
|
||||
CharacterSet,
|
||||
ClassIntersection,
|
||||
ClassStringDisjunction,
|
||||
ClassSubtraction,
|
||||
ExpressionCharacterClass,
|
||||
Flags,
|
||||
Group,
|
||||
Node,
|
||||
Pattern,
|
||||
Quantifier,
|
||||
RegExpLiteral,
|
||||
StringAlternative,
|
||||
} from "@eslint-community/regexpp/ast";
|
||||
/**
|
||||
* The visitor to walk on AST.
|
||||
@@ -752,6 +982,18 @@ declare module "@eslint-community/regexpp/visitor" {
|
||||
onCharacterClassRangeLeave?: (node: CharacterClassRange) => void;
|
||||
onCharacterSetEnter?: (node: CharacterSet) => void;
|
||||
onCharacterSetLeave?: (node: CharacterSet) => void;
|
||||
onClassIntersectionEnter?: (node: ClassIntersection) => void;
|
||||
onClassIntersectionLeave?: (node: ClassIntersection) => void;
|
||||
onClassStringDisjunctionEnter?: (node: ClassStringDisjunction) => void;
|
||||
onClassStringDisjunctionLeave?: (node: ClassStringDisjunction) => void;
|
||||
onClassSubtractionEnter?: (node: ClassSubtraction) => void;
|
||||
onClassSubtractionLeave?: (node: ClassSubtraction) => void;
|
||||
onExpressionCharacterClassEnter?: (
|
||||
node: ExpressionCharacterClass
|
||||
) => void;
|
||||
onExpressionCharacterClassLeave?: (
|
||||
node: ExpressionCharacterClass
|
||||
) => void;
|
||||
onFlagsEnter?: (node: Flags) => void;
|
||||
onFlagsLeave?: (node: Flags) => void;
|
||||
onGroupEnter?: (node: Group) => void;
|
||||
@@ -762,6 +1004,8 @@ declare module "@eslint-community/regexpp/visitor" {
|
||||
onQuantifierLeave?: (node: Quantifier) => void;
|
||||
onRegExpLiteralEnter?: (node: RegExpLiteral) => void;
|
||||
onRegExpLiteralLeave?: (node: RegExpLiteral) => void;
|
||||
onStringAlternativeEnter?: (node: StringAlternative) => void;
|
||||
onStringAlternativeLeave?: (node: StringAlternative) => void;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -777,5 +1021,7 @@ declare module "@eslint-community/regexpp/ecma-versions" {
|
||||
| 2020
|
||||
| 2021
|
||||
| 2022
|
||||
| 2023;
|
||||
| 2023
|
||||
| 2024;
|
||||
export const latestEcmaVersion = 2024;
|
||||
}
|
||||
|
||||
+750
-139
File diff suppressed because it is too large
Load Diff
+1
-1
File diff suppressed because one or more lines are too long
+750
-139
File diff suppressed because it is too large
Load Diff
+1
-1
File diff suppressed because one or more lines are too long
+6
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@eslint-community/regexpp",
|
||||
"version": "4.5.1",
|
||||
"version": "4.6.2",
|
||||
"description": "Regular expression parser for ECMAScript.",
|
||||
"keywords": [
|
||||
"regexp",
|
||||
@@ -53,10 +53,12 @@
|
||||
"clean": "rimraf .temp index.*",
|
||||
"lint": "eslint . --ext .ts",
|
||||
"test": "nyc _mocha \"test/*.ts\" --reporter dot --timeout 10000",
|
||||
"debug": "mocha --require ts-node/register/transpile-only \"test/*.ts\" --reporter dot --timeout 10000",
|
||||
"update:test": "ts-node scripts/update-fixtures.ts",
|
||||
"update:unicode": "run-s update:unicode:*",
|
||||
"update:unicode:ids": "ts-node scripts/update-unicode-ids.ts",
|
||||
"update:unicode:props": "ts-node scripts/update-unicode-properties.ts",
|
||||
"update:test262:extract": "ts-node -T scripts/extract-test262.ts",
|
||||
"preversion": "npm test && npm run -s build",
|
||||
"postversion": "git push && git push --tags",
|
||||
"prewatch": "npm run -s clean",
|
||||
@@ -72,6 +74,7 @@
|
||||
"@types/node": "^12.20.55",
|
||||
"dts-bundle": "^0.7.3",
|
||||
"eslint": "^8.31.0",
|
||||
"js-tokens": "^8.0.1",
|
||||
"jsdom": "^19.0.0",
|
||||
"mocha": "^9.2.2",
|
||||
"npm-run-all": "^4.1.5",
|
||||
@@ -79,6 +82,8 @@
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup": "^2.79.1",
|
||||
"rollup-plugin-sourcemaps": "^0.6.3",
|
||||
"test262": "git+https://github.com/tc39/test262.git",
|
||||
"test262-stream": "^1.4.0",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "~5.0.2"
|
||||
},
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@eslint/eslintrc",
|
||||
"version": "2.1.0",
|
||||
"version": "2.1.1",
|
||||
"description": "The legacy ESLintRC config file format for ESLint",
|
||||
"type": "module",
|
||||
"main": "./dist/eslintrc.cjs",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@eslint/js",
|
||||
"version": "8.44.0",
|
||||
"version": "8.46.0",
|
||||
"description": "ESLint JavaScript language implementation",
|
||||
"main": "./src/index.js",
|
||||
"scripts": {},
|
||||
|
||||
-1
@@ -172,7 +172,6 @@ module.exports = Object.freeze({
|
||||
"no-restricted-properties": "error",
|
||||
"no-restricted-syntax": "error",
|
||||
"no-return-assign": "error",
|
||||
"no-return-await": "error",
|
||||
"no-script-url": "error",
|
||||
"no-self-assign": "error",
|
||||
"no-self-compare": "error",
|
||||
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
}
|
||||
+12
@@ -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-buffer-byte-length
|
||||
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']
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"all": true,
|
||||
"check-coverage": false,
|
||||
"reporter": ["text-summary", "text", "html", "json"],
|
||||
"lines": 86,
|
||||
"statements": 85.93,
|
||||
"functions": 82.43,
|
||||
"branches": 76.06,
|
||||
"exclude": [
|
||||
"coverage",
|
||||
"test"
|
||||
]
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
# 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.0.0 - 2023-02-28
|
||||
|
||||
### Commits
|
||||
|
||||
- Initial implementation, tests, readme [`2db6cad`](https://github.com/inspect-js/array-buffer-byte-length/commit/2db6cad79270ab1966f5ea80160abbcd4534c91d)
|
||||
- Initial commit [`b2a0c9c`](https://github.com/inspect-js/array-buffer-byte-length/commit/b2a0c9c2246514b7999d331aad868c4f32326db7)
|
||||
- npm init [`376acdb`](https://github.com/inspect-js/array-buffer-byte-length/commit/376acdbd4435cb1d4c31d107cacb3b86f2363aee)
|
||||
- Only apps should have lockfiles [`70cf325`](https://github.com/inspect-js/array-buffer-byte-length/commit/70cf32526fc727d0d16a12d85a4bddea70075e31)
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 Inspect JS
|
||||
|
||||
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.
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
# array-buffer-byte-length <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
||||
|
||||
[![github actions][actions-image]][actions-url]
|
||||
[![coverage][codecov-image]][codecov-url]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][npm-badge-png]][package-url]
|
||||
|
||||
Get the byte length of an ArrayBuffer, even in engines without a `.byteLength` method.
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
const assert = require('assert');
|
||||
const byteLength = require('array-buffer-byte-length');
|
||||
|
||||
assert.equal(byteLength([]), NaN, 'an array is not an ArrayBuffer, yields NaN');
|
||||
|
||||
assert.equal(byteLength(new ArrayBuffer(0)), 0, 'ArrayBuffer of byteLength 0, yields 0');
|
||||
```
|
||||
|
||||
## Tests
|
||||
Simply clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
[package-url]: https://npmjs.org/package/array-buffer-byte-length
|
||||
[npm-version-svg]: https://versionbadg.es/inspect-js/array-buffer-byte-length.svg
|
||||
[deps-svg]: https://david-dm.org/inspect-js/array-buffer-byte-length.svg
|
||||
[deps-url]: https://david-dm.org/inspect-js/array-buffer-byte-length
|
||||
[dev-deps-svg]: https://david-dm.org/inspect-js/array-buffer-byte-length/dev-status.svg
|
||||
[dev-deps-url]: https://david-dm.org/inspect-js/array-buffer-byte-length#info=devDependencies
|
||||
[npm-badge-png]: https://nodei.co/npm/array-buffer-byte-length.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/array-buffer-byte-length.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/array-buffer-byte-length.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=array-buffer-byte-length
|
||||
[codecov-image]: https://codecov.io/gh/inspect-js/array-buffer-byte-length/branch/main/graphs/badge.svg
|
||||
[codecov-url]: https://app.codecov.io/gh/inspect-js/array-buffer-byte-length/
|
||||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/array-buffer-byte-length
|
||||
[actions-url]: https://github.com/inspect-js/array-buffer-byte-length/actions
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
var callBound = require('call-bind/callBound');
|
||||
var $byteLength = callBound('ArrayBuffer.prototype.byteLength', true);
|
||||
|
||||
var isArrayBuffer = require('is-array-buffer');
|
||||
|
||||
module.exports = function byteLength(ab) {
|
||||
if (!isArrayBuffer(ab)) {
|
||||
return NaN;
|
||||
}
|
||||
return $byteLength ? $byteLength(ab) : ab.byteLength;
|
||||
}; // in node < 0.11, byteLength is an own nonconfigurable property
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"name": "array-buffer-byte-length",
|
||||
"version": "1.0.0",
|
||||
"description": "Get the byte length of an ArrayBuffer, even in engines without a `.byteLength` method.",
|
||||
"main": "index.js",
|
||||
"exports": {
|
||||
".": "./index.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 lint",
|
||||
"prelint": "evalmd README.md",
|
||||
"lint": "eslint --ext=js,mjs .",
|
||||
"tests-only": "nyc tape 'test/**/*.js'",
|
||||
"test": "npm run tests-only",
|
||||
"posttest": "aud --production",
|
||||
"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)\")\""
|
||||
},
|
||||
"keywords": [
|
||||
"shim",
|
||||
"polyfill",
|
||||
"ArrayBuffer",
|
||||
"byteLength",
|
||||
"byte",
|
||||
"length",
|
||||
"es-shim API",
|
||||
"es-shims"
|
||||
],
|
||||
"author": "Jordan Harband <ljharb@gmail.com>",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
},
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/inspect-js/array-buffer-byte-length.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/inspect-js/array-buffer-byte-length/issues"
|
||||
},
|
||||
"homepage": "https://github.com/inspect-js/array-buffer-byte-length#readme",
|
||||
"dependencies": {
|
||||
"call-bind": "^1.0.2",
|
||||
"is-array-buffer": "^3.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^21.0.1",
|
||||
"aud": "^2.0.2",
|
||||
"auto-changelog": "^2.4.0",
|
||||
"es-value-fixtures": "^1.4.2",
|
||||
"eslint": "=8.8.0",
|
||||
"evalmd": "^0.0.19",
|
||||
"for-each": "^0.3.3",
|
||||
"in-publish": "^2.0.1",
|
||||
"npmignore": "^0.3.0",
|
||||
"nyc": "^10.3.2",
|
||||
"object-inspect": "^1.12.3",
|
||||
"safe-publish-latest": "^2.0.0",
|
||||
"tape": "^5.6.3"
|
||||
},
|
||||
"auto-changelog": {
|
||||
"output": "CHANGELOG.md",
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false,
|
||||
"hideCredit": true
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/index.js"
|
||||
},
|
||||
"publishConfig": {
|
||||
"ignore": [
|
||||
".github/workflows"
|
||||
]
|
||||
}
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var forEach = require('for-each');
|
||||
var v = require('es-value-fixtures');
|
||||
var inspect = require('object-inspect');
|
||||
|
||||
var byteLength = require('../');
|
||||
|
||||
test('byteLength', function (t) {
|
||||
forEach(v.objects.concat(v.primitives), function (nonAB) {
|
||||
t.equal(byteLength(nonAB), NaN, inspect(nonAB) + ' is not an ArrayBuffer, and yields NaN');
|
||||
});
|
||||
|
||||
t.test('ArrayBuffers', { skip: typeof ArrayBuffer !== 'function' }, function (st) {
|
||||
var ab32 = new ArrayBuffer(32);
|
||||
st.equal(byteLength(ab32), 32, 'works on an ArrayBuffer of length 32: ' + inspect(ab32));
|
||||
|
||||
var ab0 = new ArrayBuffer(0);
|
||||
st.equal(byteLength(ab0), 0, 'works on an ArrayBuffer of length 0: ' + inspect(ab0));
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
+36
@@ -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
@@ -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
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"all": true,
|
||||
"check-coverage": false,
|
||||
"reporter": ["text-summary", "text", "html", "json"],
|
||||
"exclude": [
|
||||
"coverage",
|
||||
"test"
|
||||
]
|
||||
}
|
||||
+66
@@ -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
@@ -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
@@ -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
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
require('./shim')();
|
||||
+39
@@ -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
@@ -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
@@ -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
@@ -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
@@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
module.exports = function getPolyfill() {
|
||||
return Array.prototype.findLastIndex || implementation;
|
||||
};
|
||||
+18
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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();
|
||||
});
|
||||
};
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = tab;
|
||||
insert_final_newline = true;
|
||||
quote_type = auto;
|
||||
space_after_anonymous_functions = true;
|
||||
space_after_control_statements = true;
|
||||
spaces_around_operators = true;
|
||||
trim_trailing_whitespace = true;
|
||||
spaces_in_brackets = false;
|
||||
end_of_line = lf;
|
||||
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"rules": {
|
||||
"id-length": 0,
|
||||
"max-params": 0,
|
||||
"max-statements": 0,
|
||||
"multiline-comment-style": 0,
|
||||
"new-cap": [2, {
|
||||
"capIsNewExceptions": [
|
||||
"IsSharedArrayBuffer",
|
||||
"ToIntegerOrInfinity",
|
||||
"GetIntrinsic",
|
||||
"IsDetachedBuffer",
|
||||
"SpeciesConstructor",
|
||||
],
|
||||
}],
|
||||
},
|
||||
|
||||
"overrides": [
|
||||
{
|
||||
"files": "test/**",
|
||||
"globals": {
|
||||
"ArrayBuffer": false,
|
||||
"Uint8Array": false,
|
||||
},
|
||||
"rules": {
|
||||
"max-lines-per-function": 0,
|
||||
},
|
||||
},
|
||||
],
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"all": true,
|
||||
"check-coverage": false,
|
||||
"reporter": ["text-summary", "text", "html", "json"],
|
||||
"exclude": [
|
||||
"coverage",
|
||||
"test"
|
||||
]
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
# 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.0.1](https://github.com/es-shims/ArrayBuffer.prototype.slice/compare/v1.0.0...v1.0.1) - 2023-07-11
|
||||
|
||||
### Commits
|
||||
|
||||
- [Fix] node < 0.11 has an own nonconfigurable `slice` property; use it [`554823c`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/554823c92ce16d6b7184a7d0ccfe315b663584d7)
|
||||
- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `aud`, `es-abstract`, `tape` [`53b0421`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/53b04217048c645306597e2cfc55adb69c384146)
|
||||
- [Deps] update `define-properties`, `get-intrinsic` [`4966b02`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/4966b02bc25ac006709b29ca370b9f6e159f723a)
|
||||
|
||||
## v1.0.0 - 2023-07-09
|
||||
|
||||
### Commits
|
||||
|
||||
- Initial implementation, tests, readme [`36b4b5e`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/36b4b5eedfa225c3086e9453b9db0088c299640a)
|
||||
- Initial commit [`51499df`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/51499dfac7d8c67c2928cb47363a4de7ff17904a)
|
||||
- npm init [`8ec604e`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/8ec604e7d3ef8d4c27376b09645f779c2244b08f)
|
||||
- Only apps should have lockfiles [`ac54435`](https://github.com/es-shims/ArrayBuffer.prototype.slice/commit/ac54435161d4415e2122e3a682499f3a6df2f6de)
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2023 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.
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
# ArrayBuffer.prototype.slice <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
||||
|
||||
[![github actions][actions-image]][actions-url]
|
||||
[![coverage][codecov-image]][codecov-url]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][npm-badge-png]][package-url]
|
||||
|
||||
An ES spec-compliant `ArrayBuffer.prototype.slice` shim. Invoke its "shim" method to shim ArrayBuffer.prototype.slice if it is unavailable.
|
||||
|
||||
This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES5-supported environment and complies with the [spec](https://tc39.es/ecma262/#sec-arraybuffer.prototype.slice).
|
||||
|
||||
Most common usage:
|
||||
```js
|
||||
var assert = require('assert');
|
||||
var slice = require('arraybuffer.prototype.slice');
|
||||
|
||||
var ab = new ArrayBuffer(1);
|
||||
var arr = new Uint8Array(ab);
|
||||
arr[0] = 123;
|
||||
|
||||
var ab2 = slice(ab);
|
||||
|
||||
var arr2 = new Uint8Array(ab2);
|
||||
arr2[0] = 234;
|
||||
|
||||
assert.deepEqual(arr, new Uint8Array([123]));
|
||||
assert.deepEqual(arr2, new Uint8Array([234]));
|
||||
|
||||
if (!ArrayBuffer.prototype.transfer) {
|
||||
slice.shim();
|
||||
}
|
||||
|
||||
var ab2 = ab.slice();
|
||||
|
||||
var arr2 = new Uint8Array(ab2);
|
||||
arr2[0] = 234;
|
||||
|
||||
assert.deepEqual(arr, new Uint8Array([123]));
|
||||
assert.deepEqual(arr2, new Uint8Array([234]));
|
||||
```
|
||||
|
||||
## Tests
|
||||
Simply clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
[package-url]: https://npmjs.org/package/arraybuffer.prototype.slice
|
||||
[npm-version-svg]: https://versionbadg.es/es-shims/ArrayBuffer.prototype.slice.svg
|
||||
[deps-svg]: https://david-dm.org/es-shims/ArrayBuffer.prototype.slice.svg
|
||||
[deps-url]: https://david-dm.org/es-shims/ArrayBuffer.prototype.slice
|
||||
[dev-deps-svg]: https://david-dm.org/es-shims/ArrayBuffer.prototype.slice/dev-status.svg
|
||||
[dev-deps-url]: https://david-dm.org/es-shims/ArrayBuffer.prototype.slice#info=devDependencies
|
||||
[npm-badge-png]: https://nodei.co/npm/arraybuffer.prototype.slice.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/arraybuffer.prototype.slice.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/arraybuffer.prototype.slice.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=arraybuffer.prototype.slice
|
||||
[codecov-image]: https://codecov.io/gh/es-shims/ArrayBuffer.prototype.slice/branch/main/graphs/badge.svg
|
||||
[codecov-url]: https://app.codecov.io/gh/es-shims/ArrayBuffer.prototype.slice/
|
||||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/ArrayBuffer.prototype.slice
|
||||
[actions-url]: https://github.com/es-shims/ArrayBuffer.prototype.slice/actions
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
require('./shim')();
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $ArrayBuffer = GetIntrinsic('%ArrayBuffer%', true);
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
var $Uint8Array = GetIntrinsic('%Uint8Array%', true);
|
||||
|
||||
var IsDetachedBuffer = require('es-abstract/2022/IsDetachedBuffer');
|
||||
var IsSharedArrayBuffer = require('es-abstract/2022/IsSharedArrayBuffer');
|
||||
var max = require('es-abstract/2022/max');
|
||||
var min = require('es-abstract/2022/min');
|
||||
var SpeciesConstructor = require('es-abstract/2022/SpeciesConstructor');
|
||||
var ToIntegerOrInfinity = require('es-abstract/2022/ToIntegerOrInfinity');
|
||||
|
||||
var arrayBufferByteLength = require('array-buffer-byte-length');
|
||||
var isArrayBuffer = require('is-array-buffer');
|
||||
|
||||
module.exports = function slice(start, end) {
|
||||
var O = this; // step 1
|
||||
|
||||
if (!isArrayBuffer(O) || IsSharedArrayBuffer(O) || IsDetachedBuffer(O)) {
|
||||
throw new $TypeError('receiver must be a non-detached, non-shared ArrayBuffer'); // steps 2-4
|
||||
}
|
||||
|
||||
var len = arrayBufferByteLength(O); // step 5
|
||||
|
||||
var relativeStart = ToIntegerOrInfinity(start); // step 6
|
||||
|
||||
var first;
|
||||
if (relativeStart === -Infinity) {
|
||||
first = 0; // step 7
|
||||
} else if (relativeStart < 0) {
|
||||
first = max(len + relativeStart, 0); // step 8
|
||||
} else {
|
||||
first = min(relativeStart, len); // step 9
|
||||
}
|
||||
|
||||
var relativeEnd = typeof end === 'undefined' ? len : ToIntegerOrInfinity(end); // step 10
|
||||
|
||||
var final;
|
||||
if (relativeEnd === -Infinity) {
|
||||
final = 0; // step 11
|
||||
} else if (relativeEnd < 0) {
|
||||
final = max(len + relativeEnd, 0); // step 12
|
||||
} else {
|
||||
final = min(relativeEnd, len); // step 13
|
||||
}
|
||||
|
||||
var newLen = max(final - first, 0); // step 14
|
||||
|
||||
var Ctor = SpeciesConstructor(O, $ArrayBuffer); // step 15
|
||||
|
||||
var new$ = new Ctor(newLen); // step 16
|
||||
|
||||
if (!isArrayBuffer(new$) || IsSharedArrayBuffer(new$) || IsDetachedBuffer(new$)) {
|
||||
throw new $TypeError('Species constructor must produce a non-detached, non-shared Array Buffer'); // steps 17-19
|
||||
}
|
||||
|
||||
if (new$ === O) {
|
||||
throw new $TypeError('new ArrayBuffer should not have been the same as the receiver'); // step 20
|
||||
}
|
||||
|
||||
if (arrayBufferByteLength(new$) < newLen) {
|
||||
throw new $TypeError('new ArrayBuffer\'s byteLength must be at least the requested length'); // step 21
|
||||
}
|
||||
|
||||
if (IsDetachedBuffer(O)) {
|
||||
throw new $TypeError('receiver became an detached ArrayBuffer'); // step 23
|
||||
}
|
||||
|
||||
/*
|
||||
24. Let fromBuf be O.[[ArrayBufferData]].
|
||||
25. Let toBuf be new.[[ArrayBufferData]].
|
||||
26. Perform CopyDataBlockBytes(toBuf, 0, fromBuf, first, newLen).
|
||||
*/
|
||||
var sourceArr = new $Uint8Array(O);
|
||||
var destArr = new $Uint8Array(new$);
|
||||
for (var i = start, ii = 0; i < end; i++, ii++) {
|
||||
destArr[ii] = sourceArr[i];
|
||||
}
|
||||
|
||||
return new$; // step 27
|
||||
};
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
var callBind = require('call-bind');
|
||||
|
||||
var implementation = require('./implementation');
|
||||
var getPolyfill = require('./polyfill');
|
||||
var shim = require('./shim');
|
||||
|
||||
var bound = callBind(getPolyfill());
|
||||
|
||||
define(bound, {
|
||||
getPolyfill: getPolyfill,
|
||||
implementation: implementation,
|
||||
shim: shim
|
||||
});
|
||||
|
||||
module.exports = bound;
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
{
|
||||
"name": "arraybuffer.prototype.slice",
|
||||
"version": "1.0.1",
|
||||
"description": "ES spec-compliant shim for ArrayBuffer.prototype.slice",
|
||||
"author": "Jordan Harband <ljharb@gmail.com>",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
},
|
||||
"license": "MIT",
|
||||
"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",
|
||||
"pretest": "npm run lint",
|
||||
"test": "npm run tests-only",
|
||||
"posttest": "aud --production",
|
||||
"tests-only": "nyc tape 'test/**/*.js'",
|
||||
"prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')",
|
||||
"lint": "eslint --ext=js,mjs .",
|
||||
"postlint": "evalmd README.md && 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/ArrayBuffer.prototype.slice.git"
|
||||
},
|
||||
"homepage": "https://github.com/es-shims/ArrayBuffer.prototype.slice#readme",
|
||||
"bugs": {
|
||||
"url": "https://github.com/es-shims/ArrayBuffer.prototype.slice/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"javascript",
|
||||
"ecmascript",
|
||||
"ArrayBuffer.prototype.slice",
|
||||
"polyfill",
|
||||
"shim",
|
||||
"ArrayBuffer",
|
||||
"array",
|
||||
"buffer",
|
||||
"ArrayBuffer#slice",
|
||||
"slice",
|
||||
"typed array",
|
||||
"es-shim API"
|
||||
],
|
||||
"dependencies": {
|
||||
"array-buffer-byte-length": "^1.0.0",
|
||||
"call-bind": "^1.0.2",
|
||||
"define-properties": "^1.2.0",
|
||||
"get-intrinsic": "^1.2.1",
|
||||
"is-array-buffer": "^3.0.2",
|
||||
"is-shared-array-buffer": "^1.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@es-shims/api": "^2.4.2",
|
||||
"@ljharb/eslint-config": "^21.1.0",
|
||||
"aud": "^2.0.3",
|
||||
"auto-changelog": "^2.4.0",
|
||||
"covert": "^1.1.1",
|
||||
"eclint": "^2.8.1",
|
||||
"es-abstract": "^1.21.2",
|
||||
"es-value-fixtures": "^1.4.2",
|
||||
"eslint": "=8.8.0",
|
||||
"evalmd": "^0.0.19",
|
||||
"for-each": "^0.3.3",
|
||||
"functions-have-names": "^1.2.3",
|
||||
"has-strict-mode": "^1.0.1",
|
||||
"in-publish": "^2.0.1",
|
||||
"npmignore": "^0.3.0",
|
||||
"nyc": "^10.3.2",
|
||||
"object-inspect": "^1.12.3",
|
||||
"safe-publish-latest": "^2.0.0",
|
||||
"tape": "^5.6.4"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/index.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"auto-changelog": {
|
||||
"output": "CHANGELOG.md",
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false,
|
||||
"hideCredit": true
|
||||
},
|
||||
"publishConfig": {
|
||||
"ignore": [
|
||||
".github/workflows"
|
||||
]
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
var callBind = require('call-bind');
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
var ownSlice = typeof ArrayBuffer === 'function' && new ArrayBuffer(0).slice;
|
||||
var ownSliceBound = ownSlice && callBind(ownSlice);
|
||||
var ownSliceWrapper = ownSliceBound && function slice(start, end) {
|
||||
/* eslint no-invalid-this: 0 */
|
||||
if (arguments.length < 2) {
|
||||
return ownSliceBound(this, arguments.length > 0 ? start : 0);
|
||||
}
|
||||
return ownSliceBound(this, start, end);
|
||||
};
|
||||
|
||||
module.exports = function getPolyfill() {
|
||||
return (typeof ArrayBuffer === 'function' && ArrayBuffer.prototype.slice)
|
||||
|| ownSliceWrapper
|
||||
|| implementation;
|
||||
};
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
var define = require('define-properties');
|
||||
|
||||
var getPolyfill = require('./polyfill');
|
||||
|
||||
module.exports = function shimArrayBufferSlice() {
|
||||
if (typeof ArrayBuffer === 'function') {
|
||||
var polyfill = getPolyfill();
|
||||
define(
|
||||
ArrayBuffer.prototype,
|
||||
{ slice: polyfill },
|
||||
{ slice: function () { return ArrayBuffer.prototype.slice !== polyfill; } }
|
||||
);
|
||||
}
|
||||
|
||||
return polyfill;
|
||||
};
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
'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('ArrayBuffer support', { skip: typeof ArrayBuffer === 'undefined' }, function (st) {
|
||||
st.test('bad array/this value', { skip: !hasStrictMode }, function (s2t) {
|
||||
/* eslint no-useless-call: 0 */
|
||||
s2t['throws'](function () { implementation.call(undefined); }, TypeError, 'undefined is not an object');
|
||||
s2t['throws'](function () { implementation.call(null); }, TypeError, 'null is not an object');
|
||||
s2t.end();
|
||||
});
|
||||
|
||||
runTests(callBind(implementation), st);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('no ArrayBuffer support', { skip: typeof ArrayBuffer !== 'undefined' }, function (st) {
|
||||
st['throws'](
|
||||
function () { implementation.call({}); },
|
||||
SyntaxError,
|
||||
'ArrayBuffer is not supported'
|
||||
);
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
var index = require('../');
|
||||
var test = require('tape');
|
||||
var runTests = require('./tests');
|
||||
|
||||
test('as a function', function (t) {
|
||||
t.test('ArrayBuffer support', { skip: typeof ArrayBuffer === 'undefined' }, function (st) {
|
||||
st.test('bad array/this value', function (s2t) {
|
||||
s2t['throws'](function () { index(undefined); }, TypeError, 'undefined is not an object');
|
||||
s2t['throws'](function () { index(null); }, TypeError, 'null is not an object');
|
||||
s2t.end();
|
||||
});
|
||||
|
||||
runTests(index, st);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('no ArrayBuffer support', { skip: typeof ArrayBuffer !== 'undefined' }, function (st) {
|
||||
st['throws'](
|
||||
function () { index({}); },
|
||||
SyntaxError,
|
||||
'ArrayBuffer is not supported'
|
||||
);
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
'use strict';
|
||||
|
||||
require('../auto');
|
||||
|
||||
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 hasStrictMode = require('has-strict-mode')();
|
||||
|
||||
var runTests = require('./tests');
|
||||
|
||||
test('shimmed', function (t) {
|
||||
t.test('ArrayBuffer support', { skip: typeof ArrayBuffer === 'undefined' }, function (st) {
|
||||
var method = ArrayBuffer.prototype.slice;
|
||||
|
||||
st.equal(method.length, 2, 'ArrayBuffer#slice has a length of 2');
|
||||
|
||||
st.test('Function name', { skip: !functionsHaveNames }, function (s2t) {
|
||||
s2t.equal(method.name, 'slice', 'ArrayBuffer#slice name "slice"');
|
||||
s2t.end();
|
||||
});
|
||||
|
||||
st.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
|
||||
et.equal(false, isEnumerable.call(ArrayBuffer.prototype, 'slice'), 'ArrayBuffer#slice is not enumerable');
|
||||
et.end();
|
||||
});
|
||||
|
||||
st.test('bad array/this value', { skip: !hasStrictMode }, function (s2t) {
|
||||
/* eslint no-useless-call: 0 */
|
||||
s2t['throws'](function () { return method.call(undefined); }, TypeError, 'undefined is not an object');
|
||||
s2t['throws'](function () { return method.call(null); }, TypeError, 'null is not an object');
|
||||
s2t.end();
|
||||
});
|
||||
|
||||
t.test('has the correct descriptor', { skip: !Object.getOwnPropertyDescriptor }, function (s2t) {
|
||||
var descriptor = Object.getOwnPropertyDescriptor(ArrayBuffer.prototype, 'slice');
|
||||
|
||||
s2t.equal(descriptor.configurable, true);
|
||||
s2t.equal(descriptor.enumerable, false);
|
||||
s2t.equal(typeof descriptor.value, 'function');
|
||||
s2t.equal(descriptor.writable, true);
|
||||
s2t.end();
|
||||
});
|
||||
|
||||
runTests(callBind(method), st);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
'use strict';
|
||||
|
||||
var inspect = require('object-inspect');
|
||||
var IsDetachedBuffer = require('es-abstract/2022/IsDetachedBuffer');
|
||||
|
||||
var forEach = require('for-each');
|
||||
var v = require('es-value-fixtures');
|
||||
|
||||
var byteLength = require('array-buffer-byte-length');
|
||||
|
||||
module.exports = function runTests(slice, t) {
|
||||
forEach(v.primitives.concat(v.objects), function (nonAB) {
|
||||
t['throws'](
|
||||
function () { slice(nonAB); },
|
||||
TypeError,
|
||||
inspect(nonAB) + ' is not an ArrayBuffer'
|
||||
);
|
||||
});
|
||||
|
||||
t.test('ArrayBuffers', { skip: typeof ArrayBuffer === 'undefined' }, function (st) {
|
||||
var ab = new ArrayBuffer(0);
|
||||
|
||||
st.equal(IsDetachedBuffer(ab), false, 'ArrayBuffer is not detached');
|
||||
|
||||
try {
|
||||
var nb = slice(ab);
|
||||
} catch (e) {
|
||||
if (e instanceof SyntaxError) {
|
||||
st.skip('Detaching ArrayBuffer is not supported');
|
||||
return st.end();
|
||||
}
|
||||
console.log(e.stack);
|
||||
}
|
||||
|
||||
st.notEqual(nb, ab, 'new ArrayBuffer is not the same as the original');
|
||||
st.equal(IsDetachedBuffer(ab), false, 'old ArrayBuffer is not detached');
|
||||
st.equal(IsDetachedBuffer(nb), false, 'new ArrayBuffer is not detached');
|
||||
|
||||
var ab2 = new ArrayBuffer(8);
|
||||
st.equal(byteLength(ab2), 8, 'original ArrayBuffer has length 8');
|
||||
try {
|
||||
var nbLen = slice(ab2, 4);
|
||||
} catch (e) {
|
||||
if (e instanceof SyntaxError) {
|
||||
st.skip('Detaching ArrayBuffer is not supported');
|
||||
return st.end();
|
||||
}
|
||||
}
|
||||
st.equal(IsDetachedBuffer(ab2), false, 'old ArrayBuffer is not detached');
|
||||
st.equal(IsDetachedBuffer(nbLen), false, 'new ArrayBuffer is not detached');
|
||||
|
||||
st.equal(byteLength(ab2), 8, 'original ArrayBuffer has length 8');
|
||||
st.equal(byteLength(nbLen), 4, 'newly sliced ArrayBuffer has length 4');
|
||||
|
||||
var one = new ArrayBuffer(1);
|
||||
var arr = new Uint8Array(one);
|
||||
arr[0] = 123;
|
||||
|
||||
var two = slice(one);
|
||||
|
||||
var arr2 = new Uint8Array(two);
|
||||
arr2[0] = 234;
|
||||
|
||||
st.deepEqual(arr, new Uint8Array([123]), 'original buffer is unchanged');
|
||||
st.deepEqual(arr2, new Uint8Array([234]), 'sliced buffer is changed');
|
||||
|
||||
return st.end();
|
||||
});
|
||||
|
||||
t.test('SharedArrayBuffers', { skip: typeof SharedArrayBuffer === 'undefined' }, function (st) {
|
||||
var sab = new SharedArrayBuffer(0);
|
||||
|
||||
st['throws'](
|
||||
function () { slice(sab); },
|
||||
TypeError,
|
||||
inspect(sab) + ' is not an ArrayBuffer'
|
||||
);
|
||||
|
||||
st.end();
|
||||
});
|
||||
};
|
||||
+20
@@ -1,3 +1,23 @@
|
||||
# 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.0](https://github.com/ljharb/define-properties/compare/v1.1.4...v1.2.0) - 2023-02-10
|
||||
|
||||
### Commits
|
||||
|
||||
- [New] if the predicate is boolean `true`, it compares the existing value with `===` as the predicate [`d8dd6fc`](https://github.com/ljharb/define-properties/commit/d8dd6fca40d7c5878a4b643b91e66ae5a513a194)
|
||||
- [meta] add `auto-changelog` [`7ebe2b0`](https://github.com/ljharb/define-properties/commit/7ebe2b0a0f90e62b842942cd45e86864fe75d9f6)
|
||||
- [meta] use `npmignore` to autogenerate an npmignore file [`647478a`](https://github.com/ljharb/define-properties/commit/647478a8401fbf053fb633c0a3a7c982da6bad74)
|
||||
- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`e620d70`](https://github.com/ljharb/define-properties/commit/e620d707d2e1118a38796f22a862200eb0a53fff)
|
||||
- [Dev Deps] update `aud`, `tape` [`f1e5072`](https://github.com/ljharb/define-properties/commit/f1e507225c2551a99ed4fe40d3fe71b0f44acf88)
|
||||
- [actions] update checkout action [`628b3af`](https://github.com/ljharb/define-properties/commit/628b3af5c74b8f0963296d811a8f6fa657baf964)
|
||||
|
||||
<!-- auto-changelog-above -->
|
||||
|
||||
1.1.4 / 2022-04-14
|
||||
=================
|
||||
* [Refactor] use `has-property-descriptors`
|
||||
|
||||
+8
-2
@@ -16,8 +16,14 @@ var hasPropertyDescriptors = require('has-property-descriptors')();
|
||||
var supportsDescriptors = origDefineProperty && hasPropertyDescriptors;
|
||||
|
||||
var defineProperty = function (object, name, value, predicate) {
|
||||
if (name in object && (!isFunction(predicate) || !predicate())) {
|
||||
return;
|
||||
if (name in object) {
|
||||
if (predicate === true) {
|
||||
if (object[name] === value) {
|
||||
return;
|
||||
}
|
||||
} else if (!isFunction(predicate) || !predicate()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (supportsDescriptors) {
|
||||
origDefineProperty(object, name, {
|
||||
|
||||
+26
-5
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "define-properties",
|
||||
"version": "1.1.4",
|
||||
"version": "1.2.0",
|
||||
"author": "Jordan Harband <ljharb@gmail.com>",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
@@ -9,13 +9,16 @@
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"prepack": "npmignore --auto --commentLines=autogenerated",
|
||||
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||
"prepublishOnly": "safe-publish-latest",
|
||||
"pretest": "npm run lint",
|
||||
"test": "npm run tests-only",
|
||||
"posttest": "aud --production",
|
||||
"tests-only": "nyc tape 'test/**/*.js'",
|
||||
"lint": "eslint --ext=js,mjs ."
|
||||
"lint": "eslint --ext=js,mjs .",
|
||||
"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",
|
||||
@@ -35,12 +38,15 @@
|
||||
"object-keys": "^1.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ljharb/eslint-config": "^21.0.0",
|
||||
"aud": "^2.0.0",
|
||||
"@ljharb/eslint-config": "^21.0.1",
|
||||
"aud": "^2.0.2",
|
||||
"auto-changelog": "^2.4.0",
|
||||
"eslint": "=8.8.0",
|
||||
"in-publish": "^2.0.1",
|
||||
"npmignore": "^0.3.0",
|
||||
"nyc": "^10.3.2",
|
||||
"safe-publish-latest": "^2.0.0",
|
||||
"tape": "^5.5.3"
|
||||
"tape": "^5.6.3"
|
||||
},
|
||||
"testling": {
|
||||
"files": "test/index.js",
|
||||
@@ -62,5 +68,20 @@
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"auto-changelog": {
|
||||
"output": "CHANGELOG.md",
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false,
|
||||
"hideCredit": true,
|
||||
"startingVersion": "1.1.5"
|
||||
},
|
||||
"publishConfig": {
|
||||
"ignore": [
|
||||
".github/workflows",
|
||||
"test/"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
+10
-2
@@ -13,7 +13,7 @@
|
||||
"eqeqeq": [2, "allow-null"],
|
||||
"func-name-matching": 0,
|
||||
"id-length": [2, { "min": 1, "max": 40 }],
|
||||
"max-params": [2, 4],
|
||||
"max-params": [2, 5],
|
||||
"max-lines-per-function": 1,
|
||||
"max-statements": 1,
|
||||
"max-statements-per-line": [2, { "max": 2 }],
|
||||
@@ -67,8 +67,16 @@
|
||||
},
|
||||
},
|
||||
{
|
||||
"files": "*/RawBytesToNum*.js",
|
||||
"files": [
|
||||
"*/Num*ToRawBytes.js",
|
||||
"*/RawBytesToNum*.js",
|
||||
"helpers/bytesAs*.js",
|
||||
"helpers/valueToFloat*.js",
|
||||
],
|
||||
"rules": {
|
||||
"max-lines-per-function": "off",
|
||||
"max-statements": "off",
|
||||
"no-redeclare": "warn",
|
||||
"operator-linebreak": [2, "before", {
|
||||
"overrides": {
|
||||
"=": "none"
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ var ToNumber = require('./ToNumber');
|
||||
var ToPrimitive = require('./ToPrimitive');
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-abstract-equality-comparison
|
||||
// https://262.ecma-international.org/6.0/#sec-abstract-equality-comparison
|
||||
|
||||
module.exports = function AbstractEqualityComparison(x, y) {
|
||||
var xType = Type(x);
|
||||
|
||||
+4
-4
@@ -2,24 +2,24 @@
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var IsInteger = require('./IsInteger');
|
||||
var Type = require('./Type');
|
||||
|
||||
var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger');
|
||||
var isInteger = require('../helpers/isInteger');
|
||||
var isLeadingSurrogate = require('../helpers/isLeadingSurrogate');
|
||||
var isTrailingSurrogate = require('../helpers/isTrailingSurrogate');
|
||||
var MAX_SAFE_INTEGER = require('../helpers/maxSafeInteger');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var $charCodeAt = require('call-bind/callBound')('String.prototype.charCodeAt');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-advancestringindex
|
||||
// https://262.ecma-international.org/6.0/#sec-advancestringindex
|
||||
|
||||
module.exports = function AdvanceStringIndex(S, index, unicode) {
|
||||
if (Type(S) !== 'String') {
|
||||
throw new $TypeError('Assertion failed: `S` must be a String');
|
||||
}
|
||||
if (!IsInteger(index) || index < 0 || index > MAX_SAFE_INTEGER) {
|
||||
if (!isInteger(index) || index < 0 || index > MAX_SAFE_INTEGER) {
|
||||
throw new $TypeError('Assertion failed: `length` must be an integer >= 0 and <= 2**53');
|
||||
}
|
||||
if (Type(unicode) !== 'Boolean') {
|
||||
|
||||
+3
-3
@@ -7,7 +7,7 @@ var $RangeError = GetIntrinsic('%RangeError%');
|
||||
var $SyntaxError = GetIntrinsic('%SyntaxError%');
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var IsInteger = require('./IsInteger');
|
||||
var isInteger = require('../helpers/isInteger');
|
||||
|
||||
var hasProto = require('has-proto')();
|
||||
|
||||
@@ -22,10 +22,10 @@ var $setProto = GetIntrinsic('%Object.setPrototypeOf%', true) || (
|
||||
: null
|
||||
);
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-arraycreate
|
||||
// https://262.ecma-international.org/6.0/#sec-arraycreate
|
||||
|
||||
module.exports = function ArrayCreate(length) {
|
||||
if (!IsInteger(length) || length < 0) {
|
||||
if (!isInteger(length) || length < 0) {
|
||||
throw new $TypeError('Assertion failed: `length` must be an integer Number >= 0');
|
||||
}
|
||||
if (length > MAX_ARRAY_LENGTH) {
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ var ToString = require('./ToString');
|
||||
var ToUint32 = require('./ToUint32');
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-arraysetlength
|
||||
// https://262.ecma-international.org/6.0/#sec-arraysetlength
|
||||
|
||||
// eslint-disable-next-line max-statements, max-lines-per-function
|
||||
module.exports = function ArraySetLength(A, Desc) {
|
||||
|
||||
+4
-3
@@ -9,13 +9,14 @@ var $TypeError = GetIntrinsic('%TypeError%');
|
||||
var Get = require('./Get');
|
||||
var IsArray = require('./IsArray');
|
||||
var IsConstructor = require('./IsConstructor');
|
||||
var IsInteger = require('./IsInteger');
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-arrayspeciescreate
|
||||
var isInteger = require('../helpers/isInteger');
|
||||
|
||||
// https://262.ecma-international.org/6.0/#sec-arrayspeciescreate
|
||||
|
||||
module.exports = function ArraySpeciesCreate(originalArray, length) {
|
||||
if (!IsInteger(length) || length < 0) {
|
||||
if (!isInteger(length) || length < 0) {
|
||||
throw new $TypeError('Assertion failed: length must be an integer >= 0');
|
||||
}
|
||||
var len = length === 0 ? 0 : length;
|
||||
|
||||
+2
-2
@@ -7,9 +7,9 @@ var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var IsArray = require('./IsArray');
|
||||
|
||||
var $apply = GetIntrinsic('%Reflect.apply%', true) || callBound('%Function.prototype.apply%');
|
||||
var $apply = GetIntrinsic('%Reflect.apply%', true) || callBound('Function.prototype.apply');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-call
|
||||
// https://262.ecma-international.org/6.0/#sec-call
|
||||
|
||||
module.exports = function Call(F, V) {
|
||||
var argumentsList = arguments.length > 2 ? arguments[2] : [];
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ var ToNumber = require('./ToNumber');
|
||||
var ToString = require('./ToString');
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-canonicalnumericindexstring
|
||||
// https://262.ecma-international.org/6.0/#sec-canonicalnumericindexstring
|
||||
|
||||
module.exports = function CanonicalNumericIndexString(argument) {
|
||||
if (Type(argument) !== 'String') {
|
||||
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var callBound = require('call-bind/callBound');
|
||||
var has = require('has');
|
||||
|
||||
var $charCodeAt = callBound('String.prototype.charCodeAt');
|
||||
var $toUpperCase = callBound('String.prototype.toUpperCase');
|
||||
|
||||
var Type = require('./Type');
|
||||
|
||||
var caseFolding = require('../helpers/caseFolding');
|
||||
|
||||
// https://262.ecma-international.org/6.0/#sec-runtime-semantics-canonicalize-ch
|
||||
|
||||
module.exports = function Canonicalize(ch, IgnoreCase, Unicode) {
|
||||
if (Type(ch) !== 'String') {
|
||||
throw new $TypeError('Assertion failed: `ch` must be a character');
|
||||
}
|
||||
|
||||
if (Type(IgnoreCase) !== 'Boolean' || Type(Unicode) !== 'Boolean') {
|
||||
throw new $TypeError('Assertion failed: `IgnoreCase` and `Unicode` must be Booleans');
|
||||
}
|
||||
|
||||
if (!IgnoreCase) {
|
||||
return ch; // step 1
|
||||
}
|
||||
|
||||
if (Unicode) { // step 2
|
||||
if (has(caseFolding.C, ch)) {
|
||||
return caseFolding.C[ch];
|
||||
}
|
||||
if (has(caseFolding.S, ch)) {
|
||||
return caseFolding.S[ch];
|
||||
}
|
||||
return ch; // step 2.b
|
||||
}
|
||||
|
||||
var u = $toUpperCase(ch); // step 2
|
||||
|
||||
if (u.length !== 1) {
|
||||
return ch; // step 3
|
||||
}
|
||||
|
||||
var cu = u; // step 4
|
||||
|
||||
if ($charCodeAt(ch, 0) >= 128 && $charCodeAt(cu, 0) < 128) {
|
||||
return ch; // step 5
|
||||
}
|
||||
|
||||
return cu;
|
||||
};
|
||||
+2
-2
@@ -5,8 +5,8 @@ var callBound = require('call-bind/callBound');
|
||||
|
||||
var $fromCharCode = GetIntrinsic('%String.fromCharCode%');
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
var $charCodeAt = callBound('%String.prototype.charCodeAt%');
|
||||
var $push = callBound('%Array.prototype.push%');
|
||||
var $charCodeAt = callBound('String.prototype.charCodeAt');
|
||||
var $push = callBound('Array.prototype.push');
|
||||
|
||||
module.exports = function CharacterRange(A, B) {
|
||||
if (A.length !== 1 || B.length !== 1) {
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ var IsDataDescriptor = require('./IsDataDescriptor');
|
||||
var IsGenericDescriptor = require('./IsGenericDescriptor');
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-completepropertydescriptor
|
||||
// https://262.ecma-international.org/6.0/#sec-completepropertydescriptor
|
||||
|
||||
module.exports = function CompletePropertyDescriptor(Desc) {
|
||||
/* eslint no-param-reassign: 0 */
|
||||
|
||||
+9
-27
@@ -4,17 +4,11 @@ var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var DefineOwnProperty = require('../helpers/DefineOwnProperty');
|
||||
|
||||
var FromPropertyDescriptor = require('./FromPropertyDescriptor');
|
||||
var OrdinaryGetOwnProperty = require('./OrdinaryGetOwnProperty');
|
||||
var IsDataDescriptor = require('./IsDataDescriptor');
|
||||
var IsExtensible = require('./IsExtensible');
|
||||
var IsPropertyKey = require('./IsPropertyKey');
|
||||
var SameValue = require('./SameValue');
|
||||
var OrdinaryDefineOwnProperty = require('./OrdinaryDefineOwnProperty');
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-createdataproperty
|
||||
// https://262.ecma-international.org/6.0/#sec-createdataproperty
|
||||
|
||||
module.exports = function CreateDataProperty(O, P, V) {
|
||||
if (Type(O) !== 'Object') {
|
||||
@@ -23,23 +17,11 @@ module.exports = function CreateDataProperty(O, P, V) {
|
||||
if (!IsPropertyKey(P)) {
|
||||
throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
|
||||
}
|
||||
var oldDesc = OrdinaryGetOwnProperty(O, P);
|
||||
var extensible = !oldDesc || IsExtensible(O);
|
||||
var nonConfigurable = oldDesc && !oldDesc['[[Configurable]]'];
|
||||
if (nonConfigurable || !extensible) {
|
||||
return false;
|
||||
}
|
||||
return DefineOwnProperty(
|
||||
IsDataDescriptor,
|
||||
SameValue,
|
||||
FromPropertyDescriptor,
|
||||
O,
|
||||
P,
|
||||
{
|
||||
'[[Configurable]]': true,
|
||||
'[[Enumerable]]': true,
|
||||
'[[Value]]': V,
|
||||
'[[Writable]]': true
|
||||
}
|
||||
);
|
||||
var newDesc = {
|
||||
'[[Configurable]]': true,
|
||||
'[[Enumerable]]': true,
|
||||
'[[Value]]': V,
|
||||
'[[Writable]]': true
|
||||
};
|
||||
return OrdinaryDefineOwnProperty(O, P, newDesc);
|
||||
};
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ var CreateDataProperty = require('./CreateDataProperty');
|
||||
var IsPropertyKey = require('./IsPropertyKey');
|
||||
var Type = require('./Type');
|
||||
|
||||
// // https://ecma-international.org/ecma-262/6.0/#sec-createdatapropertyorthrow
|
||||
// // https://262.ecma-international.org/6.0/#sec-createdatapropertyorthrow
|
||||
|
||||
module.exports = function CreateDataPropertyOrThrow(O, P, V) {
|
||||
if (Type(O) !== 'Object') {
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ var RequireObjectCoercible = require('./RequireObjectCoercible');
|
||||
var ToString = require('./ToString');
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-createhtml
|
||||
// https://262.ecma-international.org/6.0/#sec-createhtml
|
||||
|
||||
module.exports = function CreateHTML(string, tag, attribute, value) {
|
||||
if (Type(tag) !== 'String' || Type(attribute) !== 'String') {
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-createiterresultobject
|
||||
// https://262.ecma-international.org/6.0/#sec-createiterresultobject
|
||||
|
||||
module.exports = function CreateIterResultObject(value, done) {
|
||||
if (Type(done) !== 'Boolean') {
|
||||
|
||||
+4
-2
@@ -14,11 +14,13 @@ var ToLength = require('./ToLength');
|
||||
var ToString = require('./ToString');
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-createlistfromarraylike
|
||||
var defaultElementTypes = ['Undefined', 'Null', 'Boolean', 'String', 'Symbol', 'Number', 'Object'];
|
||||
|
||||
// https://262.ecma-international.org/6.0/#sec-createlistfromarraylike
|
||||
module.exports = function CreateListFromArrayLike(obj) {
|
||||
var elementTypes = arguments.length > 1
|
||||
? arguments[1]
|
||||
: ['Undefined', 'Null', 'Boolean', 'String', 'Symbol', 'Number', 'Object'];
|
||||
: defaultElementTypes;
|
||||
|
||||
if (Type(obj) !== 'Object') {
|
||||
throw new $TypeError('Assertion failed: `obj` must be an Object');
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ var IsPropertyKey = require('./IsPropertyKey');
|
||||
var SameValue = require('./SameValue');
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-createmethodproperty
|
||||
// https://262.ecma-international.org/6.0/#sec-createmethodproperty
|
||||
|
||||
module.exports = function CreateMethodProperty(O, P, V) {
|
||||
if (Type(O) !== 'Object') {
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ var SameValue = require('./SameValue');
|
||||
var ToPropertyDescriptor = require('./ToPropertyDescriptor');
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-definepropertyorthrow
|
||||
// https://262.ecma-international.org/6.0/#sec-definepropertyorthrow
|
||||
|
||||
module.exports = function DefinePropertyOrThrow(O, P, desc) {
|
||||
if (Type(O) !== 'Object') {
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ var $TypeError = GetIntrinsic('%TypeError%');
|
||||
var IsPropertyKey = require('./IsPropertyKey');
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-deletepropertyorthrow
|
||||
// https://262.ecma-international.org/6.0/#sec-deletepropertyorthrow
|
||||
|
||||
module.exports = function DeletePropertyOrThrow(O, P) {
|
||||
if (Type(O) !== 'Object') {
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ var keys = require('object-keys');
|
||||
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-enumerableownnames
|
||||
// https://262.ecma-international.org/6.0/#sec-enumerableownnames
|
||||
|
||||
module.exports = function EnumerableOwnNames(O) {
|
||||
if (Type(O) !== 'Object') {
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ var fromPropertyDescriptor = require('../helpers/fromPropertyDescriptor');
|
||||
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-frompropertydescriptor
|
||||
// https://262.ecma-international.org/6.0/#sec-frompropertydescriptor
|
||||
|
||||
module.exports = function FromPropertyDescriptor(Desc) {
|
||||
if (typeof Desc !== 'undefined') {
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ var inspect = require('object-inspect');
|
||||
var IsPropertyKey = require('./IsPropertyKey');
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-get-o-p
|
||||
// https://262.ecma-international.org/6.0/#sec-get-o-p
|
||||
|
||||
module.exports = function Get(O, P) {
|
||||
// 7.3.1.1
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ var GetMethod = require('./GetMethod');
|
||||
var IsArray = require('./IsArray');
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-getiterator
|
||||
// https://262.ecma-international.org/6.0/#sec-getiterator
|
||||
|
||||
module.exports = function GetIterator(obj, method) {
|
||||
var actualMethod = method;
|
||||
|
||||
+3
-3
@@ -8,9 +8,9 @@ var GetV = require('./GetV');
|
||||
var IsCallable = require('./IsCallable');
|
||||
var IsPropertyKey = require('./IsPropertyKey');
|
||||
|
||||
var debug = require('object-inspect');
|
||||
var inspect = require('object-inspect');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-getmethod
|
||||
// https://262.ecma-international.org/6.0/#sec-getmethod
|
||||
|
||||
module.exports = function GetMethod(O, P) {
|
||||
// 7.3.9.1
|
||||
@@ -28,7 +28,7 @@ module.exports = function GetMethod(O, P) {
|
||||
|
||||
// 7.3.9.5
|
||||
if (!IsCallable(func)) {
|
||||
throw new $TypeError(P + ' is not a function: ' + debug(func));
|
||||
throw new $TypeError(inspect(P) + ' is not a function: ' + inspect(func));
|
||||
}
|
||||
|
||||
// 7.3.9.6
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ var keys = require('object-keys');
|
||||
|
||||
var esType = require('./Type');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-getownpropertykeys
|
||||
// https://262.ecma-international.org/6.0/#sec-getownpropertykeys
|
||||
|
||||
module.exports = function GetOwnPropertyKeys(O, Type) {
|
||||
if (esType(O) !== 'Object') {
|
||||
|
||||
+4
-1
@@ -10,10 +10,13 @@ var Get = require('./Get');
|
||||
var IsConstructor = require('./IsConstructor');
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-getprototypefromconstructor
|
||||
// https://262.ecma-international.org/6.0/#sec-getprototypefromconstructor
|
||||
|
||||
module.exports = function GetPrototypeFromConstructor(constructor, intrinsicDefaultProto) {
|
||||
var intrinsic = GetIntrinsic(intrinsicDefaultProto); // throws if not a valid intrinsic
|
||||
if (Type(intrinsic) !== 'Object') {
|
||||
throw new $TypeError('intrinsicDefaultProto must be an object');
|
||||
}
|
||||
if (!IsConstructor(constructor)) {
|
||||
throw new $TypeError('Assertion failed: `constructor` must be a constructor');
|
||||
}
|
||||
|
||||
+5
-9
@@ -18,18 +18,14 @@ var $charAt = callBound('String.prototype.charAt');
|
||||
var $strSlice = callBound('String.prototype.slice');
|
||||
|
||||
var IsArray = require('./IsArray');
|
||||
var IsInteger = require('./IsInteger');
|
||||
var Type = require('./Type');
|
||||
|
||||
var canDistinguishSparseFromUndefined = 0 in [undefined]; // IE 6 - 8 have a bug where this returns false
|
||||
var isInteger = require('../helpers/isInteger');
|
||||
var isStringOrHole = require('../helpers/isStringOrHole');
|
||||
|
||||
var isStringOrHole = function (capture, index, arr) {
|
||||
return Type(capture) === 'String' || (canDistinguishSparseFromUndefined ? !(index in arr) : Type(capture) === 'Undefined');
|
||||
};
|
||||
// https://262.ecma-international.org/6.0/#sec-getsubstitution
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-getsubstitution
|
||||
|
||||
// eslint-disable-next-line max-statements, max-params, max-lines-per-function
|
||||
// eslint-disable-next-line max-statements, max-lines-per-function
|
||||
module.exports = function GetSubstitution(matched, str, position, captures, replacement) {
|
||||
if (Type(matched) !== 'String') {
|
||||
throw new $TypeError('Assertion failed: `matched` must be a String');
|
||||
@@ -41,7 +37,7 @@ module.exports = function GetSubstitution(matched, str, position, captures, repl
|
||||
}
|
||||
var stringLength = str.length;
|
||||
|
||||
if (!IsInteger(position) || position < 0 || position > stringLength) {
|
||||
if (!isInteger(position) || position < 0 || position > stringLength) {
|
||||
throw new $TypeError('Assertion failed: `position` must be a nonnegative integer, and less than or equal to the length of `string`, got ' + inspect(position));
|
||||
}
|
||||
|
||||
|
||||
+8
-6
@@ -4,20 +4,22 @@ var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var IsPropertyKey = require('./IsPropertyKey');
|
||||
var ToObject = require('./ToObject');
|
||||
var inspect = require('object-inspect');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-getv
|
||||
var IsPropertyKey = require('./IsPropertyKey');
|
||||
// var ToObject = require('./ToObject');
|
||||
|
||||
// https://262.ecma-international.org/6.0/#sec-getv
|
||||
|
||||
module.exports = function GetV(V, P) {
|
||||
// 7.3.2.1
|
||||
if (!IsPropertyKey(P)) {
|
||||
throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
|
||||
throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P));
|
||||
}
|
||||
|
||||
// 7.3.2.2-3
|
||||
var O = ToObject(V);
|
||||
// var O = ToObject(V);
|
||||
|
||||
// 7.3.2.4
|
||||
return O[P];
|
||||
return V[P];
|
||||
};
|
||||
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
var $Uint8Array = GetIntrinsic('%Uint8Array%', true);
|
||||
|
||||
var callBound = require('call-bind/callBound');
|
||||
|
||||
var $charAt = callBound('String.prototype.charAt');
|
||||
var $reverse = callBound('Array.prototype.reverse');
|
||||
var $slice = callBound('Array.prototype.slice');
|
||||
|
||||
var bytesAsFloat32 = require('../helpers/bytesAsFloat32');
|
||||
var bytesAsFloat64 = require('../helpers/bytesAsFloat64');
|
||||
var bytesAsInteger = require('../helpers/bytesAsInteger');
|
||||
var defaultEndianness = require('../helpers/defaultEndianness');
|
||||
var isInteger = require('../helpers/isInteger');
|
||||
|
||||
var IsDetachedBuffer = require('./IsDetachedBuffer');
|
||||
|
||||
var isArrayBuffer = require('is-array-buffer');
|
||||
var safeConcat = require('safe-array-concat');
|
||||
|
||||
var table49 = {
|
||||
__proto__: null,
|
||||
$Int8: 1,
|
||||
$Uint8: 1,
|
||||
$Uint8C: 1,
|
||||
$Int16: 2,
|
||||
$Uint16: 2,
|
||||
$Int32: 4,
|
||||
$Uint32: 4,
|
||||
$Float32: 4,
|
||||
$Float64: 8
|
||||
};
|
||||
|
||||
var isUnsignedElementType = function isUnsignedElementType(type) { return $charAt(type, 0) === 'U'; };
|
||||
|
||||
// https://262.ecma-international.org/6.0/#sec-getvaluefrombuffer
|
||||
|
||||
module.exports = function GetValueFromBuffer(arrayBuffer, byteIndex, type) {
|
||||
if (!isArrayBuffer(arrayBuffer)) {
|
||||
throw new $TypeError('Assertion failed: `arrayBuffer` must be an ArrayBuffer');
|
||||
}
|
||||
|
||||
if (!isInteger(byteIndex)) {
|
||||
throw new $TypeError('Assertion failed: `byteIndex` must be an integer');
|
||||
}
|
||||
|
||||
if (typeof type !== 'string') {
|
||||
throw new $TypeError('Assertion failed: `type` must be a string');
|
||||
}
|
||||
|
||||
if (arguments.length > 3 && typeof arguments[3] !== 'boolean') {
|
||||
throw new $TypeError('Assertion failed: `isLittleEndian` must be a boolean, if present');
|
||||
}
|
||||
|
||||
if (IsDetachedBuffer(arrayBuffer)) {
|
||||
throw new $TypeError('Assertion failed: ArrayBuffer is detached'); // step 1
|
||||
}
|
||||
|
||||
// 2. Assert: There are sufficient bytes in arrayBuffer starting at byteIndex to represent a value of type.
|
||||
|
||||
if (byteIndex < 0) {
|
||||
throw new $TypeError('Assertion failed: `byteIndex` must be non-negative'); // step 3
|
||||
}
|
||||
|
||||
// 4. Let block be arrayBuffer’s [[ArrayBufferData]] internal slot.
|
||||
|
||||
var elementSize = table49['$' + type]; // step 5
|
||||
if (!elementSize) {
|
||||
throw new $TypeError('Assertion failed: `type` must be one of "Int8", "Uint8", "Uint8C", "Int16", "Uint16", "Int32", "Uint32", "Float32", or "Float64"');
|
||||
}
|
||||
|
||||
// 6. Let rawValue be a List of elementSize containing, in order, the elementSize sequence of bytes starting with block[byteIndex].
|
||||
var rawValue = $slice(new $Uint8Array(arrayBuffer, byteIndex), 0, elementSize); // step 6
|
||||
|
||||
// 8. If isLittleEndian is not present, set isLittleEndian to either true or false. The choice is implementation dependent and should be the alternative that is most efficient for the implementation. An implementation must use the same value each time this step is executed and the same value must be used for the corresponding step in the SetValueInBuffer abstract operation.
|
||||
var isLittleEndian = arguments.length > 3 ? arguments[3] : defaultEndianness === 'little'; // step 7
|
||||
|
||||
if (!isLittleEndian) {
|
||||
$reverse(rawValue); // step 8
|
||||
}
|
||||
|
||||
var bytes = $slice(safeConcat([0, 0, 0, 0, 0, 0, 0, 0], rawValue), -elementSize);
|
||||
|
||||
if (type === 'Float32') { // step 3
|
||||
return bytesAsFloat32(bytes, true);
|
||||
}
|
||||
|
||||
if (type === 'Float64') { // step 4
|
||||
return bytesAsFloat64(bytes, true);
|
||||
}
|
||||
|
||||
return bytesAsInteger(bytes, elementSize, isUnsignedElementType(type), false);
|
||||
};
|
||||
+1
-1
@@ -9,7 +9,7 @@ var has = require('has');
|
||||
var IsPropertyKey = require('./IsPropertyKey');
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-hasownproperty
|
||||
// https://262.ecma-international.org/6.0/#sec-hasownproperty
|
||||
|
||||
module.exports = function HasOwnProperty(O, P) {
|
||||
if (Type(O) !== 'Object') {
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ var $TypeError = GetIntrinsic('%TypeError%');
|
||||
var IsPropertyKey = require('./IsPropertyKey');
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-hasproperty
|
||||
// https://262.ecma-international.org/6.0/#sec-hasproperty
|
||||
|
||||
module.exports = function HasProperty(O, P) {
|
||||
if (Type(O) !== 'Object') {
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ var OrdinaryHasInstance = require('./OrdinaryHasInstance');
|
||||
var ToBoolean = require('./ToBoolean');
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-instanceofoperator
|
||||
// https://262.ecma-international.org/6.0/#sec-instanceofoperator
|
||||
|
||||
module.exports = function InstanceofOperator(O, C) {
|
||||
if (Type(O) !== 'Object') {
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ var IsArray = require('./IsArray');
|
||||
var GetV = require('./GetV');
|
||||
var IsPropertyKey = require('./IsPropertyKey');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-invoke
|
||||
// https://262.ecma-international.org/6.0/#sec-invoke
|
||||
|
||||
module.exports = function Invoke(O, P) {
|
||||
if (!IsPropertyKey(P)) {
|
||||
|
||||
+3
-3
@@ -2,11 +2,11 @@
|
||||
|
||||
var has = require('has');
|
||||
|
||||
var assertRecord = require('../helpers/assertRecord');
|
||||
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-isaccessordescriptor
|
||||
var assertRecord = require('../helpers/assertRecord');
|
||||
|
||||
// https://262.ecma-international.org/5.1/#sec-8.10.1
|
||||
|
||||
module.exports = function IsAccessorDescriptor(Desc) {
|
||||
if (typeof Desc === 'undefined') {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
'use strict';
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-isarray
|
||||
// https://262.ecma-international.org/6.0/#sec-isarray
|
||||
module.exports = require('../helpers/IsArray');
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@ var IsArray = require('./IsArray');
|
||||
var ToBoolean = require('./ToBoolean');
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-isconcatspreadable
|
||||
// https://262.ecma-international.org/6.0/#sec-isconcatspreadable
|
||||
|
||||
module.exports = function IsConcatSpreadable(O) {
|
||||
if (Type(O) !== 'Object') {
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ try {
|
||||
DefinePropertyOrThrow = null;
|
||||
}
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-isconstructor
|
||||
// https://262.ecma-international.org/6.0/#sec-isconstructor
|
||||
|
||||
if (DefinePropertyOrThrow && $construct) {
|
||||
var isConstructorMarker = {};
|
||||
|
||||
+3
-3
@@ -2,11 +2,11 @@
|
||||
|
||||
var has = require('has');
|
||||
|
||||
var assertRecord = require('../helpers/assertRecord');
|
||||
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-isdatadescriptor
|
||||
var assertRecord = require('../helpers/assertRecord');
|
||||
|
||||
// https://262.ecma-international.org/5.1/#sec-8.10.2
|
||||
|
||||
module.exports = function IsDataDescriptor(Desc) {
|
||||
if (typeof Desc === 'undefined') {
|
||||
|
||||
+2
-5
@@ -4,10 +4,7 @@ var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var $TypeError = GetIntrinsic('%TypeError%');
|
||||
|
||||
var callBound = require('call-bind/callBound');
|
||||
|
||||
var $byteLength = callBound('%ArrayBuffer.prototype.byteLength%', true)
|
||||
|| function byteLength(ab) { return ab.byteLength; }; // in node < 0.11, byteLength is an own nonconfigurable property
|
||||
var $byteLength = require('array-buffer-byte-length');
|
||||
|
||||
var isArrayBuffer = require('is-array-buffer');
|
||||
|
||||
@@ -23,7 +20,7 @@ module.exports = function IsDetachedBuffer(arrayBuffer) {
|
||||
try {
|
||||
new global[availableTypedArrays[0]](arrayBuffer); // eslint-disable-line no-new
|
||||
} catch (error) {
|
||||
return error.name === 'TypeError';
|
||||
return !!error && error.name === 'TypeError';
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ var $isExtensible = GetIntrinsic('%Object.isExtensible%', true);
|
||||
|
||||
var isPrimitive = require('../helpers/isPrimitive');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-isextensible-o
|
||||
// https://262.ecma-international.org/6.0/#sec-isextensible-o
|
||||
|
||||
module.exports = $preventExtensions
|
||||
? function IsExtensible(obj) {
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ var IsAccessorDescriptor = require('./IsAccessorDescriptor');
|
||||
var IsDataDescriptor = require('./IsDataDescriptor');
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-isgenericdescriptor
|
||||
// https://262.ecma-international.org/6.0/#sec-isgenericdescriptor
|
||||
|
||||
module.exports = function IsGenericDescriptor(Desc) {
|
||||
if (typeof Desc === 'undefined') {
|
||||
|
||||
+3
-11
@@ -1,17 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
var abs = require('./abs');
|
||||
var floor = require('./floor');
|
||||
var isInteger = require('../helpers/isInteger');
|
||||
|
||||
var $isNaN = require('../helpers/isNaN');
|
||||
var $isFinite = require('../helpers/isFinite');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-isinteger
|
||||
// https://262.ecma-international.org/6.0/#sec-isinteger
|
||||
|
||||
module.exports = function IsInteger(argument) {
|
||||
if (typeof argument !== 'number' || $isNaN(argument) || !$isFinite(argument)) {
|
||||
return false;
|
||||
}
|
||||
var absValue = abs(argument);
|
||||
return floor(absValue) === absValue;
|
||||
return isInteger(argument);
|
||||
};
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ var $PromiseThen = callBound('Promise.prototype.then', true);
|
||||
|
||||
var Type = require('./Type');
|
||||
|
||||
// https://ecma-international.org/ecma-262/6.0/#sec-ispromise
|
||||
// https://262.ecma-international.org/6.0/#sec-ispromise
|
||||
|
||||
module.exports = function IsPromise(x) {
|
||||
if (Type(x) !== 'Object') {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user