.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / core-js / internals / function-bind-context.js
1 var aFunction = require('../internals/a-function');
2
3 // optional / simple context binding
4 module.exports = function (fn, that, length) {
5   aFunction(fn);
6   if (that === undefined) return fn;
7   switch (length) {
8     case 0: return function () {
9       return fn.call(that);
10     };
11     case 1: return function (a) {
12       return fn.call(that, a);
13     };
14     case 2: return function (a, b) {
15       return fn.call(that, a, b);
16     };
17     case 3: return function (a, b, c) {
18       return fn.call(that, a, b, c);
19     };
20   }
21   return function (/* ...args */) {
22     return fn.apply(that, arguments);
23   };
24 };