aboutsummaryrefslogtreecommitdiffstats
path: root/backend/node_modules/call-bind/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'backend/node_modules/call-bind/index.js')
-rw-r--r--backend/node_modules/call-bind/index.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/backend/node_modules/call-bind/index.js b/backend/node_modules/call-bind/index.js
new file mode 100644
index 0000000..01c5b3d
--- /dev/null
+++ b/backend/node_modules/call-bind/index.js
@@ -0,0 +1,35 @@
+'use strict';
+
+var bind = require('function-bind');
+var GetIntrinsic = require('get-intrinsic');
+var setFunctionLength = require('set-function-length');
+
+var $TypeError = require('es-errors/type');
+var $apply = GetIntrinsic('%Function.prototype.apply%');
+var $call = GetIntrinsic('%Function.prototype.call%');
+var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
+
+var $defineProperty = require('es-define-property');
+var $max = GetIntrinsic('%Math.max%');
+
+module.exports = function callBind(originalFunction) {
+ if (typeof originalFunction !== 'function') {
+ throw new $TypeError('a function is required');
+ }
+ var func = $reflectApply(bind, $call, arguments);
+ return setFunctionLength(
+ func,
+ 1 + $max(0, originalFunction.length - (arguments.length - 1)),
+ true
+ );
+};
+
+var applyBind = function applyBind() {
+ return $reflectApply(bind, $apply, arguments);
+};
+
+if ($defineProperty) {
+ $defineProperty(module.exports, 'apply', { value: applyBind });
+} else {
+ module.exports.apply = applyBind;
+}