source: trip-planner-front/node_modules/core-js/internals/function-bind-context.js@ 8d391a1

Last change on this file since 8d391a1 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 599 bytes
Line 
1var aFunction = require('../internals/a-function');
2
3// optional / simple context binding
4module.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};
Note: See TracBrowser for help on using the repository browser.