summaryrefslogtreecommitdiffstats
path: root/node_modules/call-bind
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/call-bind')
-rw-r--r--node_modules/call-bind/.eslintrc15
-rw-r--r--node_modules/call-bind/.github/FUNDING.yml12
-rw-r--r--node_modules/call-bind/.github/rebase.yml15
-rw-r--r--node_modules/call-bind/.github/require-allow-edits.yml12
-rw-r--r--node_modules/call-bind/.travis.yml9
-rw-r--r--node_modules/call-bind/CHANGELOG.md21
-rw-r--r--node_modules/call-bind/LICENSE21
-rw-r--r--node_modules/call-bind/README.md2
-rw-r--r--node_modules/call-bind/callBound.js15
-rw-r--r--node_modules/call-bind/index.js33
-rw-r--r--node_modules/call-bind/package.json107
-rw-r--r--node_modules/call-bind/test/callBound.js55
-rw-r--r--node_modules/call-bind/test/index.js52
13 files changed, 369 insertions, 0 deletions
diff --git a/node_modules/call-bind/.eslintrc b/node_modules/call-bind/.eslintrc
new file mode 100644
index 0000000..559f191
--- /dev/null
+++ b/node_modules/call-bind/.eslintrc
@@ -0,0 +1,15 @@
+{
+ "root": true,
+
+ "extends": "@ljharb",
+
+ "rules": {
+ "func-name-matching": 0,
+ "new-cap": [2, {
+ "capIsNewExceptions": [
+ "GetIntrinsic",
+ ],
+ }],
+ "no-magic-numbers": 0,
+ },
+}
diff --git a/node_modules/call-bind/.github/FUNDING.yml b/node_modules/call-bind/.github/FUNDING.yml
new file mode 100644
index 0000000..8e8da0d
--- /dev/null
+++ b/node_modules/call-bind/.github/FUNDING.yml
@@ -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/get-intrinsic
+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']
diff --git a/node_modules/call-bind/.github/rebase.yml b/node_modules/call-bind/.github/rebase.yml
new file mode 100644
index 0000000..027aed0
--- /dev/null
+++ b/node_modules/call-bind/.github/rebase.yml
@@ -0,0 +1,15 @@
+name: Automatic Rebase
+
+on: [pull_request_target]
+
+jobs:
+ _:
+ name: "Automatic Rebase"
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+ - uses: ljharb/rebase@master
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/node_modules/call-bind/.github/require-allow-edits.yml b/node_modules/call-bind/.github/require-allow-edits.yml
new file mode 100644
index 0000000..549d7b4
--- /dev/null
+++ b/node_modules/call-bind/.github/require-allow-edits.yml
@@ -0,0 +1,12 @@
+name: Require “Allow Edits”
+
+on: [pull_request_target]
+
+jobs:
+ _:
+ name: "Require “Allow Edits”"
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: ljharb/require-allow-edits@main
diff --git a/node_modules/call-bind/.travis.yml b/node_modules/call-bind/.travis.yml
new file mode 100644
index 0000000..9c37f1b
--- /dev/null
+++ b/node_modules/call-bind/.travis.yml
@@ -0,0 +1,9 @@
+version: ~> 1.0
+language: node_js
+os:
+ - linux
+import:
+ - ljharb/travis-ci:node/all.yml
+ - ljharb/travis-ci:node/pretest.yml
+ - ljharb/travis-ci:node/posttest.yml
+ - ljharb/travis-ci:node/coverage.yml
diff --git a/node_modules/call-bind/CHANGELOG.md b/node_modules/call-bind/CHANGELOG.md
new file mode 100644
index 0000000..4e76026
--- /dev/null
+++ b/node_modules/call-bind/CHANGELOG.md
@@ -0,0 +1,21 @@
+# 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 - 2020-10-30
+
+### Commits
+
+- Initial commit [`306cf98`](https://github.com/ljharb/call-bind/commit/306cf98c7ec9e7ef66b653ec152277ac1381eb50)
+- Tests [`e10d0bb`](https://github.com/ljharb/call-bind/commit/e10d0bbdadc7a10ecedc9a1c035112d3e368b8df)
+- Implementation [`43852ed`](https://github.com/ljharb/call-bind/commit/43852eda0f187327b7fad2423ca972149a52bd65)
+- npm init [`408f860`](https://github.com/ljharb/call-bind/commit/408f860b773a2f610805fd3613d0d71bac1b6249)
+- [meta] add Automatic Rebase and Require Allow Edits workflows [`fb349b2`](https://github.com/ljharb/call-bind/commit/fb349b2e48defbec8b5ec8a8395cc8f69f220b13)
+- [meta] add `auto-changelog` [`c4001fc`](https://github.com/ljharb/call-bind/commit/c4001fc43031799ef908211c98d3b0fb2b60fde4)
+- [meta] add "funding"; create `FUNDING.yml` [`d4d6d29`](https://github.com/ljharb/call-bind/commit/d4d6d2974a14bc2e98830468eda7fe6d6a776717)
+- [Tests] add `npm run lint` [`dedfb98`](https://github.com/ljharb/call-bind/commit/dedfb98bd0ecefb08ddb9a94061bd10cde4332af)
+- Only apps should have lockfiles [`54ac776`](https://github.com/ljharb/call-bind/commit/54ac77653db45a7361dc153d2f478e743f110650)
+- [meta] add `safe-publish-latest` [`9ea8e43`](https://github.com/ljharb/call-bind/commit/9ea8e435b950ce9b705559cd651039f9bf40140f)
diff --git a/node_modules/call-bind/LICENSE b/node_modules/call-bind/LICENSE
new file mode 100644
index 0000000..48f05d0
--- /dev/null
+++ b/node_modules/call-bind/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2020 Jordan Harband
+
+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.
diff --git a/node_modules/call-bind/README.md b/node_modules/call-bind/README.md
new file mode 100644
index 0000000..53649eb
--- /dev/null
+++ b/node_modules/call-bind/README.md
@@ -0,0 +1,2 @@
+# call-bind
+Robustly `.call.bind()` a function.
diff --git a/node_modules/call-bind/callBound.js b/node_modules/call-bind/callBound.js
new file mode 100644
index 0000000..8374adf
--- /dev/null
+++ b/node_modules/call-bind/callBound.js
@@ -0,0 +1,15 @@
+'use strict';
+
+var GetIntrinsic = require('get-intrinsic');
+
+var callBind = require('./');
+
+var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
+
+module.exports = function callBoundIntrinsic(name, allowMissing) {
+ var intrinsic = GetIntrinsic(name, !!allowMissing);
+ if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
+ return callBind(intrinsic);
+ }
+ return intrinsic;
+};
diff --git a/node_modules/call-bind/index.js b/node_modules/call-bind/index.js
new file mode 100644
index 0000000..bae91c1
--- /dev/null
+++ b/node_modules/call-bind/index.js
@@ -0,0 +1,33 @@
+'use strict';
+
+var bind = require('function-bind');
+var GetIntrinsic = require('get-intrinsic');
+
+var $apply = GetIntrinsic('%Function.prototype.apply%');
+var $call = GetIntrinsic('%Function.prototype.call%');
+var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
+
+var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
+
+if ($defineProperty) {
+ try {
+ $defineProperty({}, 'a', { value: 1 });
+ } catch (e) {
+ // IE 8 has a broken defineProperty
+ $defineProperty = null;
+ }
+}
+
+module.exports = function callBind() {
+ return $reflectApply(bind, $call, arguments);
+};
+
+var applyBind = function applyBind() {
+ return $reflectApply(bind, $apply, arguments);
+};
+
+if ($defineProperty) {
+ $defineProperty(module.exports, 'apply', { value: applyBind });
+} else {
+ module.exports.apply = applyBind;
+}
diff --git a/node_modules/call-bind/package.json b/node_modules/call-bind/package.json
new file mode 100644
index 0000000..db16669
--- /dev/null
+++ b/node_modules/call-bind/package.json
@@ -0,0 +1,107 @@
+{
+ "_from": "call-bind@^1.0.0",
+ "_id": "call-bind@1.0.0",
+ "_inBundle": false,
+ "_integrity": "sha512-AEXsYIyyDY3MCzbwdhzG3Jx1R0J2wetQyUynn6dYHAO+bg8l1k7jwZtRv4ryryFs7EP+NDlikJlVe59jr0cM2w==",
+ "_location": "/call-bind",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "call-bind@^1.0.0",
+ "name": "call-bind",
+ "escapedName": "call-bind",
+ "rawSpec": "^1.0.0",
+ "saveSpec": null,
+ "fetchSpec": "^1.0.0"
+ },
+ "_requiredBy": [
+ "/object.assign"
+ ],
+ "_resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.0.tgz",
+ "_shasum": "24127054bb3f9bdcb4b1fb82418186072f77b8ce",
+ "_spec": "call-bind@^1.0.0",
+ "_where": "/home/pruss/Dev/3-minute-website/node_modules/object.assign",
+ "author": {
+ "name": "Jordan Harband",
+ "email": "ljharb@gmail.com"
+ },
+ "auto-changelog": {
+ "output": "CHANGELOG.md",
+ "template": "keepachangelog",
+ "unreleased": false,
+ "commitLimit": false,
+ "backfillLimit": false,
+ "hideCredit": true
+ },
+ "bugs": {
+ "url": "https://github.com/ljharb/call-bind/issues"
+ },
+ "bundleDependencies": false,
+ "dependencies": {
+ "function-bind": "^1.1.1",
+ "get-intrinsic": "^1.0.0"
+ },
+ "deprecated": false,
+ "description": "Robustly `.call.bind()` a function",
+ "devDependencies": {
+ "@ljharb/eslint-config": "^17.2.0",
+ "aud": "^1.1.2",
+ "auto-changelog": "^2.2.1",
+ "eslint": "^7.12.1",
+ "safe-publish-latest": "^1.1.4",
+ "tape": "^5.0.1"
+ },
+ "exports": {
+ ".": [
+ {
+ "default": "./index.js"
+ },
+ "./index.js"
+ ],
+ "./callBound": [
+ {
+ "default": "./callBound.js"
+ },
+ "./callBound.js"
+ ],
+ "./package.json": "./package.json"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ },
+ "homepage": "https://github.com/ljharb/call-bind#readme",
+ "keywords": [
+ "javascript",
+ "ecmascript",
+ "es",
+ "js",
+ "callbind",
+ "callbound",
+ "call",
+ "bind",
+ "bound",
+ "call-bind",
+ "call-bound",
+ "function",
+ "es-abstract"
+ ],
+ "license": "MIT",
+ "main": "index.js",
+ "name": "call-bind",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/ljharb/call-bind.git"
+ },
+ "scripts": {
+ "lint": "eslint --ext=.js,.mjs .",
+ "posttest": "aud --production",
+ "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"",
+ "prepublish": "safe-publish-latest",
+ "pretest": "npm run lint",
+ "test": "npm run tests-only",
+ "tests-only": "tape 'test/*'",
+ "version": "auto-changelog && git add CHANGELOG.md"
+ },
+ "version": "1.0.0"
+}
diff --git a/node_modules/call-bind/test/callBound.js b/node_modules/call-bind/test/callBound.js
new file mode 100644
index 0000000..209ce3c
--- /dev/null
+++ b/node_modules/call-bind/test/callBound.js
@@ -0,0 +1,55 @@
+'use strict';
+
+var test = require('tape');
+
+var callBound = require('../callBound');
+
+test('callBound', function (t) {
+ // static primitive
+ t.equal(callBound('Array.length'), Array.length, 'Array.length yields itself');
+ t.equal(callBound('%Array.length%'), Array.length, '%Array.length% yields itself');
+
+ // static non-function object
+ t.equal(callBound('Array.prototype'), Array.prototype, 'Array.prototype yields itself');
+ t.equal(callBound('%Array.prototype%'), Array.prototype, '%Array.prototype% yields itself');
+ t.equal(callBound('Array.constructor'), Array.constructor, 'Array.constructor yields itself');
+ t.equal(callBound('%Array.constructor%'), Array.constructor, '%Array.constructor% yields itself');
+
+ // static function
+ t.equal(callBound('Date.parse'), Date.parse, 'Date.parse yields itself');
+ t.equal(callBound('%Date.parse%'), Date.parse, '%Date.parse% yields itself');
+
+ // prototype primitive
+ t.equal(callBound('Error.prototype.message'), Error.prototype.message, 'Error.prototype.message yields itself');
+ t.equal(callBound('%Error.prototype.message%'), Error.prototype.message, '%Error.prototype.message% yields itself');
+
+ // prototype function
+ t.notEqual(callBound('Object.prototype.toString'), Object.prototype.toString, 'Object.prototype.toString does not yield itself');
+ t.notEqual(callBound('%Object.prototype.toString%'), Object.prototype.toString, '%Object.prototype.toString% does not yield itself');
+ t.equal(callBound('Object.prototype.toString')(true), Object.prototype.toString.call(true), 'call-bound Object.prototype.toString calls into the original');
+ t.equal(callBound('%Object.prototype.toString%')(true), Object.prototype.toString.call(true), 'call-bound %Object.prototype.toString% calls into the original');
+
+ t['throws'](
+ function () { callBound('does not exist'); },
+ SyntaxError,
+ 'nonexistent intrinsic throws'
+ );
+ t['throws'](
+ function () { callBound('does not exist', true); },
+ SyntaxError,
+ 'allowMissing arg still throws for unknown intrinsic'
+ );
+
+ /* globals WeakRef: false */
+ t.test('real but absent intrinsic', { skip: typeof WeakRef !== 'undefined' }, function (st) {
+ st['throws'](
+ function () { callBound('WeakRef'); },
+ TypeError,
+ 'real but absent intrinsic throws'
+ );
+ st.equal(callBound('WeakRef', true), undefined, 'allowMissing arg avoids exception');
+ st.end();
+ });
+
+ t.end();
+});
diff --git a/node_modules/call-bind/test/index.js b/node_modules/call-bind/test/index.js
new file mode 100644
index 0000000..2b79974
--- /dev/null
+++ b/node_modules/call-bind/test/index.js
@@ -0,0 +1,52 @@
+'use strict';
+
+var callBind = require('../');
+
+var test = require('tape');
+
+test('callBind', function (t) {
+ var sentinel = { sentinel: true };
+ var func = function (a, b) {
+ // eslint-disable-next-line no-invalid-this
+ return [this, a, b];
+ };
+ t.deepEqual(func(), [undefined, undefined, undefined], 'unbound func with too few args');
+ t.deepEqual(func(1, 2), [undefined, 1, 2], 'unbound func with right args');
+ t.deepEqual(func(1, 2, 3), [undefined, 1, 2], 'unbound func with too many args');
+
+ var bound = callBind(func);
+ t.deepEqual(bound(), [undefined, undefined, undefined], 'bound func with too few args');
+ t.deepEqual(bound(1, 2), [1, 2, undefined], 'bound func with right args');
+ t.deepEqual(bound(1, 2, 3), [1, 2, 3], 'bound func with too many args');
+
+ var boundR = callBind(func, sentinel);
+ t.deepEqual(boundR(), [sentinel, undefined, undefined], 'bound func with receiver, with too few args');
+ t.deepEqual(boundR(1, 2), [sentinel, 1, 2], 'bound func with receiver, with right args');
+ t.deepEqual(boundR(1, 2, 3), [sentinel, 1, 2], 'bound func with receiver, with too many args');
+
+ var boundArg = callBind(func, sentinel, 1);
+ t.deepEqual(boundArg(), [sentinel, 1, undefined], 'bound func with receiver and arg, with too few args');
+ t.deepEqual(boundArg(2), [sentinel, 1, 2], 'bound func with receiver and arg, with right arg');
+ t.deepEqual(boundArg(2, 3), [sentinel, 1, 2], 'bound func with receiver and arg, with too many args');
+
+ t.test('callBind.apply', function (st) {
+ var aBound = callBind.apply(func);
+ st.deepEqual(aBound(sentinel), [sentinel, undefined, undefined], 'apply-bound func with no args');
+ st.deepEqual(aBound(sentinel, [1], 4), [sentinel, 1, undefined], 'apply-bound func with too few args');
+ st.deepEqual(aBound(sentinel, [1, 2], 4), [sentinel, 1, 2], 'apply-bound func with right args');
+
+ var aBoundArg = callBind.apply(func);
+ st.deepEqual(aBoundArg(sentinel, [1, 2, 3], 4), [sentinel, 1, 2], 'apply-bound func with too many args');
+ st.deepEqual(aBoundArg(sentinel, [1, 2], 4), [sentinel, 1, 2], 'apply-bound func with right args');
+ st.deepEqual(aBoundArg(sentinel, [1], 4), [sentinel, 1, undefined], 'apply-bound func with too few args');
+
+ var aBoundR = callBind.apply(func, sentinel);
+ st.deepEqual(aBoundR([1, 2, 3], 4), [sentinel, 1, 2], 'apply-bound func with receiver and too many args');
+ st.deepEqual(aBoundR([1, 2], 4), [sentinel, 1, 2], 'apply-bound func with receiver and right args');
+ st.deepEqual(aBoundR([1], 4), [sentinel, 1, undefined], 'apply-bound func with receiver and too few args');
+
+ st.end();
+ });
+
+ t.end();
+});