"Fossies" - the Fresh Open Source Software Archive

Member "Atom/resources/app/apm/node_modules/process-nextick-args/index.js" (7 Feb 2017, 1040 Bytes) of archive /windows/misc/atom-windows.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Javascript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

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