diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 404abb2..0000000 --- a/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -coverage/ diff --git a/.eslintrc b/.eslintrc index 0df206d..540ac8e 100644 --- a/.eslintrc +++ b/.eslintrc @@ -4,10 +4,17 @@ "extends": "@ljharb", "rules": { - "complexity": 0, "id-length": [2, { "min": 1, "max": 26 }], - "max-statements": [2, 14], - "new-cap": [2, { capIsNewExceptions: ["GetIntrinsic", "ToObject", "ToInteger", "ToLength", "SameValueZero", "RequireObjectCoercible"] }], + "new-cap": [2, { + "capIsNewExceptions": [ + "GetIntrinsic", + "ToObject", + "ToIntegerOrInfinity", + "ToLength", + "SameValueZero", + "RequireObjectCoercible", + ], + }], }, "overrides": [ diff --git a/.github/workflows/node-4+.yml b/.github/workflows/node-4+.yml deleted file mode 100644 index ba174e1..0000000 --- a/.github/workflows/node-4+.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: 'Tests: node.js' - -on: [pull_request, push] - -jobs: - matrix: - runs-on: ubuntu-latest - outputs: - latest: ${{ steps.set-matrix.outputs.requireds }} - minors: ${{ steps.set-matrix.outputs.optionals }} - steps: - - uses: ljharb/actions/node/matrix@main - id: set-matrix - with: - preset: '>=4' - - latest: - needs: [matrix] - name: 'latest minors' - runs-on: ubuntu-latest - - strategy: - matrix: ${{ fromJson(needs.matrix.outputs.latest) }} - - steps: - - uses: actions/checkout@v2 - - uses: ljharb/actions/node/run@main - name: 'npm install && npm run tests-only' - with: - node-version: ${{ matrix.node-version }} - command: 'tests-only' - minors: - needs: [matrix, latest] - name: 'non-latest minors' - continue-on-error: true - if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }} - runs-on: ubuntu-latest - - strategy: - matrix: ${{ fromJson(needs.matrix.outputs.minors) }} - - steps: - - uses: actions/checkout@v2 - - uses: ljharb/actions/node/run@main - with: - node-version: ${{ matrix.node-version }} - command: 'tests-only' - - node: - name: 'node 4+' - needs: [latest, minors] - runs-on: ubuntu-latest - steps: - - run: 'echo tests completed' diff --git a/.github/workflows/node-aught.yml b/.github/workflows/node-aught.yml new file mode 100644 index 0000000..4213896 --- /dev/null +++ b/.github/workflows/node-aught.yml @@ -0,0 +1,11 @@ +name: 'Tests: node.js < 10' + +on: [pull_request, push] + +jobs: + tests: + uses: ljharb/actions/.github/workflows/node.yml@main + with: + range: '< 10' + type: minors + command: npm run tests-only diff --git a/.github/workflows/node-iojs.yml b/.github/workflows/node-iojs.yml deleted file mode 100644 index f707c3c..0000000 --- a/.github/workflows/node-iojs.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: 'Tests: node.js (io.js)' - -on: [pull_request, push] - -jobs: - matrix: - runs-on: ubuntu-latest - outputs: - latest: ${{ steps.set-matrix.outputs.requireds }} - minors: ${{ steps.set-matrix.outputs.optionals }} - steps: - - uses: ljharb/actions/node/matrix@main - id: set-matrix - with: - preset: 'iojs' - - latest: - needs: [matrix] - name: 'latest minors' - runs-on: ubuntu-latest - - strategy: - matrix: ${{ fromJson(needs.matrix.outputs.latest) }} - - steps: - - uses: actions/checkout@v2 - - uses: ljharb/actions/node/run@main - name: 'npm install && npm run tests-only' - with: - node-version: ${{ matrix.node-version }} - command: 'tests-only' - skip-ls-check: true - - minors: - needs: [matrix, latest] - name: 'non-latest minors' - continue-on-error: true - if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }} - runs-on: ubuntu-latest - - strategy: - matrix: ${{ fromJson(needs.matrix.outputs.minors) }} - - steps: - - uses: actions/checkout@v2 - - uses: ljharb/actions/node/run@main - name: 'npm install && npm run tests-only' - with: - node-version: ${{ matrix.node-version }} - command: 'tests-only' - skip-ls-check: true - - node: - name: 'io.js' - needs: [latest, minors] - runs-on: ubuntu-latest - steps: - - run: 'echo tests completed' diff --git a/.github/workflows/node-pretest.yml b/.github/workflows/node-pretest.yml index 3921e0a..765edf7 100644 --- a/.github/workflows/node-pretest.yml +++ b/.github/workflows/node-pretest.yml @@ -3,24 +3,5 @@ name: 'Tests: pretest/posttest' on: [pull_request, push] jobs: - pretest: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - uses: ljharb/actions/node/run@main - name: 'npm install && npm run pretest' - with: - node-version: 'lts/*' - command: 'pretest' - - posttest: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - uses: ljharb/actions/node/run@main - name: 'npm install && npm run posttest' - with: - node-version: 'lts/*' - command: 'posttest' + tests: + uses: ljharb/actions/.github/workflows/pretest.yml@main diff --git a/.github/workflows/node-tens.yml b/.github/workflows/node-tens.yml new file mode 100644 index 0000000..1f55be0 --- /dev/null +++ b/.github/workflows/node-tens.yml @@ -0,0 +1,11 @@ +name: 'Tests: node.js >= 10' + +on: [pull_request, push] + +jobs: + tests: + uses: ljharb/actions/.github/workflows/node.yml@main + with: + range: '>= 10' + type: minors + command: npm run tests-only diff --git a/.github/workflows/node-zero.yml b/.github/workflows/node-zero.yml deleted file mode 100644 index d044c60..0000000 --- a/.github/workflows/node-zero.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: 'Tests: node.js (0.x)' - -on: [pull_request, push] - -jobs: - matrix: - runs-on: ubuntu-latest - outputs: - stable: ${{ steps.set-matrix.outputs.requireds }} - unstable: ${{ steps.set-matrix.outputs.optionals }} - steps: - - uses: ljharb/actions/node/matrix@main - id: set-matrix - with: - preset: '0.x' - - stable: - needs: [matrix] - name: 'stable minors' - runs-on: ubuntu-latest - - strategy: - matrix: ${{ fromJson(needs.matrix.outputs.stable) }} - - steps: - - uses: actions/checkout@v2 - - uses: ljharb/actions/node/run@main - with: - node-version: ${{ matrix.node-version }} - command: 'tests-only' - cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }} - skip-ls-check: true - - unstable: - needs: [matrix, stable] - name: 'unstable minors' - continue-on-error: true - if: ${{ !github.head_ref || !startsWith(github.head_ref, 'renovate') }} - runs-on: ubuntu-latest - - strategy: - matrix: ${{ fromJson(needs.matrix.outputs.unstable) }} - - steps: - - uses: actions/checkout@v2 - - uses: ljharb/actions/node/run@main - with: - node-version: ${{ matrix.node-version }} - command: 'tests-only' - cache-node-modules-key: node_modules-${{ github.workflow }}-${{ github.action }}-${{ github.run_id }} - skip-ls-check: true - - node: - name: 'node 0.x' - needs: [stable, unstable] - runs-on: ubuntu-latest - steps: - - run: 'echo tests completed' diff --git a/.github/workflows/rebase.yml b/.github/workflows/rebase.yml index 0c2ad39..b9e1712 100644 --- a/.github/workflows/rebase.yml +++ b/.github/workflows/rebase.yml @@ -4,12 +4,6 @@ on: [pull_request_target] jobs: _: - name: "Automatic Rebase" - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v1 - - uses: ljharb/rebase@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: ljharb/actions/.github/workflows/rebase.yml@main + secrets: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/require-allow-edits.yml b/.github/workflows/require-allow-edits.yml index aac42d3..7b842f8 100644 --- a/.github/workflows/require-allow-edits.yml +++ b/.github/workflows/require-allow-edits.yml @@ -9,6 +9,4 @@ jobs: runs-on: ubuntu-latest steps: - - uses: ljharb/require-allow-edits@main - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: ljharb/require-allow-edits@main diff --git a/.gitignore b/.gitignore index 7c5e02e..e98a30e 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ yarn.lock # coverage coverage/ .nyc_output/ + +.npmignore diff --git a/.npmrc b/.npmrc index 43c97e7..eacea13 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,3 @@ package-lock=false +allow-same-version=true +message=v%s diff --git a/.nycrc b/.nycrc index 1826526..bdd626c 100644 --- a/.nycrc +++ b/.nycrc @@ -2,10 +2,6 @@ "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" diff --git a/CHANGELOG.md b/CHANGELOG.md index 78e09ab..4f31535 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,68 @@ +# 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). + +## [v3.1.8](https://github.com/es-shims/array-includes/compare/v3.1.7...v3.1.8) - 2024-03-20 + +### Commits + +- [Deps] update `call-bind`, `define-properties`, `es-abstract`, `get-intrinsic` [`b105f3a`](https://github.com/es-shims/array-includes/commit/b105f3a0ad1801aabf47bafd788482d8866ef0c9) +- [actions] remove redundant finisher [`fa1111d`](https://github.com/es-shims/array-includes/commit/fa1111d6d41381e4bd484e8f6d5896172874d6e7) +- [Dev Deps] update `aud`, `npmignore`, `tape` [`499e7e9`](https://github.com/es-shims/array-includes/commit/499e7e9e952faab35740dfbe0b355183100e40b7) +- [Refactor] use `es-object-atoms` where possible [`e4bd17f`](https://github.com/es-shims/array-includes/commit/e4bd17f980b557fdf2b39eb552bafedd8a8f6bfb) +- [Tests] use `call-bind` instead of `function-bind` [`3dbe456`](https://github.com/es-shims/array-includes/commit/3dbe456f14c94a5d119b35ac41712c7faea93afd) + +## [v3.1.7](https://github.com/es-shims/array-includes/compare/v3.1.6...v3.1.7) - 2023-09-03 + +### Commits + +- [Deps] update `define-properties`, `es-abstract`, `get-intrinsic` [`e217b1e`](https://github.com/es-shims/array-includes/commit/e217b1ebfe90a7425654f0fa72c59f59930d4dd8) +- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `aud`, `tape` [`93465c3`](https://github.com/es-shims/array-includes/commit/93465c3da3bd6ea0670a0bd12dc9adc9085e8130) + +## [v3.1.6](https://github.com/es-shims/array-includes/compare/v3.1.5...v3.1.6) - 2022-11-07 + +### Commits + +- [meta] add `auto-changelog` [`c5fbe72`](https://github.com/es-shims/array-includes/commit/c5fbe728395deff641d756cc9d398a949076c180) +- [meta] use `npmignore` to autogenerate an npmignore file [`dbd6dc8`](https://github.com/es-shims/array-includes/commit/dbd6dc8f8906cca6b0b493e308686c4fd05bea15) +- [Deps] update `es-abstract`, `get-intrinsic` [`b819e3b`](https://github.com/es-shims/array-includes/commit/b819e3b3dd1adce0b3359529b0276a416efce351) +- [actions] update rebase action to use reusable workflow [`6e241d5`](https://github.com/es-shims/array-includes/commit/6e241d5177513cfb0261d0fbe0c8c98daf5c5eab) +- [Dev Deps] update `aud`, `tape` [`9b2a931`](https://github.com/es-shims/array-includes/commit/9b2a931aee6fc8195a349c6fe7894445a911223f) +- [readme] note that FF 102+ no longer needs this package [`0a0c758`](https://github.com/es-shims/array-includes/commit/0a0c758ed52808428314ffe53ea8278297170c84) + + + +3.1.5 / 2022-05-03 +================= + * [Fix] install polyfill on FF 99+ + * [Deps] update `define-properties`, `es-abstract` + * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `aud`, `functions-have-names`, `safe-publish-latest`, `tape` + * [actions] reuse common workflows + * [actions] update codecov uploader + +3.1.4 / 2021-10-04 +================= + * [Robustness] avoid a runtime `Math.max` call + * [readme] add github actions/codecov badges + * [readme] fix repo URLs; remove travis badge + * [Deps] update `es-abstract`, `is-string` + * [meta] use `prepublishOnly` script for npm 7+ + * [actions] update workflows + * [actions] use `node/install` instead of `node/run`; use `codecov` action + * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `aud`, `tape` + +3.1.3 / 2021-02-20 +================= + * [Deps] update `call-bind`, `es-abstract`, `get-intrinsic` + * [meta] do not publish github action workflow files + * [meta] gitignore coverage output + * [actions] update workflows + * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `functions-have-names`, `has-strict-mode`, `tape` + * [Tests] increase coverage + 3.1.2 / 2020-11-24 ================= * [Robustness] remove dependency on `.apply` diff --git a/README.md b/README.md index fb87587..525c2a2 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # array-includes [![Version Badge][npm-version-svg]][package-url] -[![Build Status][travis-svg]][travis-url] +[![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] @@ -10,10 +11,18 @@ An ES7/ES2016 spec-compliant `Array.prototype.includes` 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](http://www.ecma-international.org/ecma-262/6.0/). +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://262.ecma-international.org/6.0/). Because `Array.prototype.includes` depends on a receiver (the `this` value), the main export takes the array to operate on as the first argument. +Engines that need this package include: + - IE (all versions) + - Safari < 9 + - Firefox < 43, and 99-101 + - Chrome < 47 + - Edge < 14 + - node < 6 + ## Getting started ```sh @@ -80,15 +89,17 @@ assert.equal(arr.includes(1, 'foo'), includes(arr, 1, 'foo')); Simply clone the repo, `npm install`, and run `npm test` [package-url]: https://npmjs.org/package/array-includes -[npm-version-svg]: http://versionbadg.es/es-shims/array-includes.svg -[travis-svg]: https://travis-ci.org/es-shims/array-includes.svg -[travis-url]: https://travis-ci.org/es-shims/array-includes +[npm-version-svg]: https://versionbadg.es/es-shims/array-includes.svg [deps-svg]: https://david-dm.org/es-shims/array-includes.svg [deps-url]: https://david-dm.org/es-shims/array-includes [dev-deps-svg]: https://david-dm.org/es-shims/array-includes/dev-status.svg [dev-deps-url]: https://david-dm.org/es-shims/array-includes#info=devDependencies [npm-badge-png]: https://nodei.co/npm/array-includes.png?downloads=true&stars=true -[license-image]: http://img.shields.io/npm/l/array-includes.svg +[license-image]: https://img.shields.io/npm/l/array-includes.svg [license-url]: LICENSE -[downloads-image]: http://img.shields.io/npm/dm/array-includes.svg -[downloads-url]: http://npm-stat.com/charts.html?package=array-includes +[downloads-image]: https://img.shields.io/npm/dm/array-includes.svg +[downloads-url]: https://npm-stat.com/charts.html?package=array-includes +[codecov-image]: https://codecov.io/gh/es-shims/array-includes/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/es-shims/array-includes/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/array-includes +[actions-url]: https://github.com/es-shims/array-includes/actions diff --git a/implementation.js b/implementation.js index 7823d5a..71add57 100644 --- a/implementation.js +++ b/implementation.js @@ -1,9 +1,9 @@ 'use strict'; -var ToInteger = require('es-abstract/2020/ToInteger'); -var ToLength = require('es-abstract/2020/ToLength'); -var ToObject = require('es-abstract/2020/ToObject'); -var SameValueZero = require('es-abstract/2020/SameValueZero'); +var ToIntegerOrInfinity = require('es-abstract/2024/ToIntegerOrInfinity'); +var ToLength = require('es-abstract/2024/ToLength'); +var ToObject = require('es-object-atoms/ToObject'); +var SameValueZero = require('es-abstract/2024/SameValueZero'); var $isNaN = require('es-abstract/helpers/isNaN'); var $isFinite = require('es-abstract/helpers/isFinite'); var GetIntrinsic = require('get-intrinsic'); @@ -12,9 +12,10 @@ var isString = require('is-string'); var $charAt = callBound('String.prototype.charAt'); var $indexOf = GetIntrinsic('%Array.prototype.indexOf%'); // TODO: use callBind.apply without breaking IE 8 +var $max = GetIntrinsic('%Math.max%'); module.exports = function includes(searchElement) { - var fromIndex = arguments.length > 1 ? ToInteger(arguments[1]) : 0; + var fromIndex = arguments.length > 1 ? ToIntegerOrInfinity(arguments[1]) : 0; if ($indexOf && !$isNaN(searchElement) && $isFinite(fromIndex) && typeof searchElement !== 'undefined') { return $indexOf.apply(this, arguments) > -1; } @@ -24,7 +25,7 @@ module.exports = function includes(searchElement) { if (length === 0) { return false; } - var k = fromIndex >= 0 ? fromIndex : Math.max(0, length + fromIndex); + var k = fromIndex >= 0 ? fromIndex : $max(0, length + fromIndex); while (k < length) { if (SameValueZero(searchElement, isString(O) ? $charAt(O, k) : O[k])) { return true; diff --git a/index.js b/index.js index bed832e..29895d2 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ 'use strict'; var define = require('define-properties'); -var RequireObjectCoercible = require('es-abstract/2020/RequireObjectCoercible'); +var RequireObjectCoercible = require('es-object-atoms/RequireObjectCoercible'); var callBind = require('call-bind'); var callBound = require('call-bind/callBound'); diff --git a/package.json b/package.json index 4918d7e..55479fc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "array-includes", - "version": "3.1.2", + "version": "3.1.8", "author": { "name": "Jordan Harband", "email": "ljharb@gmail.com", @@ -20,13 +20,18 @@ "license": "MIT", "main": "index.js", "scripts": { - "prepublish": "safe-publish-latest", - "pretest": "npm run --silent lint && evalmd README.md", + "prepack": "npmignore --auto --commentLines=autogenerated", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "pretest": "npm run --silent lint", "test": "npm run --silent tests-only", - "posttest": "npx aud --production", + "posttest": "aud --production", "tests-only": "nyc tape 'test/**/*.js'", - "lint": "eslint .", - "postlint": "es-shim-api --bound" + "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", @@ -44,26 +49,28 @@ "es-shim API" ], "dependencies": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3", - "es-abstract": "^1.18.0-next.1", - "get-intrinsic": "^1.0.1", - "is-string": "^1.0.5" + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0", + "get-intrinsic": "^1.2.4", + "is-string": "^1.0.7" }, "devDependencies": { - "@es-shims/api": "^2.1.2", - "@ljharb/eslint-config": "^17.3.0", - "aud": "^1.1.3", - "eslint": "^7.14.0", - "evalmd": "0.0.19", - "foreach": "^2.0.5", - "function-bind": "^1.1.1", - "functions-have-names": "^1.2.1", - "has-strict-mode": "^1.0.0", + "@es-shims/api": "^2.4.2", + "@ljharb/eslint-config": "^21.1.0", + "aud": "^2.0.4", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "evalmd": "^0.0.19", + "functions-have-names": "^1.2.3", + "has-strict-mode": "^1.0.1", + "in-publish": "^2.0.1", "indexof": "^0.0.1", + "npmignore": "^0.3.1", "nyc": "^10.3.2", - "safe-publish-latest": "^1.1.4", - "tape": "^5.0.1" + "safe-publish-latest": "^2.0.0", + "tape": "^5.7.5" }, "testling": { "files": [ @@ -89,5 +96,19 @@ }, "engines": { "node": ">= 0.4" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true, + "startingVersion": "3.1.6" + }, + "publishConfig": { + "ignore": [ + ".github/workflows" + ] } } diff --git a/polyfill.js b/polyfill.js index dfbaa42..6abe64b 100644 --- a/polyfill.js +++ b/polyfill.js @@ -3,5 +3,11 @@ var implementation = require('./implementation'); module.exports = function getPolyfill() { - return Array.prototype.includes || implementation; + if ( + Array.prototype.includes + && Array(1).includes(undefined) // https://bugzilla.mozilla.org/show_bug.cgi?id=1767541 + ) { + return Array.prototype.includes; + } + return implementation; }; diff --git a/test/shimmed.js b/test/shimmed.js index f69c641..98f70c0 100644 --- a/test/shimmed.js +++ b/test/shimmed.js @@ -1,16 +1,19 @@ 'use strict'; -require('../shim')(); +var orig = Array.prototype.includes; + +require('../auto'); var test = require('tape'); var defineProperties = require('define-properties'); -var bind = require('function-bind'); +var callBind = require('call-bind'); var isEnumerable = Object.prototype.propertyIsEnumerable; var functionsHaveNames = require('functions-have-names')(); var runTests = require('./tests'); test('shimmed', function (t) { + t.comment('shimmed: ' + (orig === Array.prototype.includes ? 'no' : 'yes')); t.equal(Array.prototype.includes.length, 1, 'Array#includes has a length of 1'); t.test('Function name', { skip: !functionsHaveNames }, function (st) { st.equal(Array.prototype.includes.name, 'includes', 'Array#includes has name "includes"'); @@ -30,7 +33,7 @@ test('shimmed', function (t) { st.end(); }); - runTests(bind.call(Function.call, Array.prototype.includes), t); + runTests(callBind(Array.prototype.includes), t); t.end(); });