[Pkg-javascript-commits] [node-process-nextick-args] 01/06: Imported Upstream version 1.0.8

Ross Gammon ross-guest at moszumanska.debian.org
Sat Jun 11 13:57:41 UTC 2016


This is an automated email from the git hooks/post-receive script.

ross-guest pushed a commit to branch master
in repository node-process-nextick-args.

commit f1ca93bbf983426202a034e0f2ef641e358bd903
Author: Ross Gammon <rossgammon at mail.dk>
Date:   Sat Jun 11 15:29:44 2016 +0200

    Imported Upstream version 1.0.8
---
 index.js     | 39 +++++++++++++++++++++++++++++++--------
 package.json |  5 ++++-
 2 files changed, 35 insertions(+), 9 deletions(-)

diff --git a/index.js b/index.js
index 571c276..a4f40f8 100644
--- a/index.js
+++ b/index.js
@@ -8,13 +8,36 @@ if (!process.version ||
   module.exports = process.nextTick;
 }
 
-function nextTick(fn) {
-  var args = new Array(arguments.length - 1);
-  var i = 0;
-  while (i < args.length) {
-    args[i++] = arguments[i];
+function nextTick(fn, arg1, arg2, arg3) {
+  if (typeof fn !== 'function') {
+    throw new TypeError('"callback" argument must be a function');
+  }
+  var len = arguments.length;
+  var args, i;
+  switch (len) {
+  case 0:
+  case 1:
+    return process.nextTick(fn);
+  case 2:
+    return process.nextTick(function afterTickOne() {
+      fn.call(null, arg1);
+    });
+  case 3:
+    return process.nextTick(function afterTickTwo() {
+      fn.call(null, arg1, arg2);
+    });
+  case 4:
+    return process.nextTick(function afterTickThree() {
+      fn.call(null, arg1, arg2, arg3);
+    });
+  default:
+    args = new Array(len - 1);
+    i = 0;
+    while (i < args.length) {
+      args[i++] = arguments[i];
+    }
+    return process.nextTick(function afterTick() {
+      fn.apply(null, args);
+    });
   }
-  process.nextTick(function afterTick() {
-    fn.apply(null, args);
-  });
 }
diff --git a/package.json b/package.json
index b6718d0..dea5e2c 100644
--- a/package.json
+++ b/package.json
@@ -1,8 +1,11 @@
 {
   "name": "process-nextick-args",
-  "version": "1.0.6",
+  "version": "1.0.8",
   "description": "process.nextTick but always with args",
   "main": "index.js",
+  "files": [
+    "index.js"
+  ],
   "scripts": {
     "test": "node test.js"
   },

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-process-nextick-args.git



More information about the Pkg-javascript-commits mailing list