source: trip-planner-front/node_modules/process-nextick-args/index.js@ 6fe77af

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

initial commit

  • Property mode set to 100644
File size: 1.1 KB
Line 
1'use strict';
2
3if (typeof process === 'undefined' ||
4 !process.version ||
5 process.version.indexOf('v0.') === 0 ||
6 process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
7 module.exports = { nextTick: nextTick };
8} else {
9 module.exports = process
10}
11
12function nextTick(fn, arg1, arg2, arg3) {
13 if (typeof fn !== 'function') {
14 throw new TypeError('"callback" argument must be a function');
15 }
16 var len = arguments.length;
17 var args, i;
18 switch (len) {
19 case 0:
20 case 1:
21 return process.nextTick(fn);
22 case 2:
23 return process.nextTick(function afterTickOne() {
24 fn.call(null, arg1);
25 });
26 case 3:
27 return process.nextTick(function afterTickTwo() {
28 fn.call(null, arg1, arg2);
29 });
30 case 4:
31 return process.nextTick(function afterTickThree() {
32 fn.call(null, arg1, arg2, arg3);
33 });
34 default:
35 args = new Array(len - 1);
36 i = 0;
37 while (i < args.length) {
38 args[i++] = arguments[i];
39 }
40 return process.nextTick(function afterTick() {
41 fn.apply(null, args);
42 });
43 }
44}
45
Note: See TracBrowser for help on using the repository browser.