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

Ross Gammon ross-guest at moszumanska.debian.org
Sun Sep 13 15:43:43 UTC 2015


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 2b893064aa7bab252a63098d14c08499d05d54ae
Author: Ross Gammon <rossgammon at mail.dk>
Date:   Sun Sep 13 16:35:35 2015 +0200

    Imported Upstream version 1.0.3
---
 .travis.yml  |  7 +++++++
 index.js     | 13 +++++++++++++
 license.md   | 19 +++++++++++++++++++
 package.json | 22 ++++++++++++++++++++++
 readme.md    | 18 ++++++++++++++++++
 test.js      | 24 ++++++++++++++++++++++++
 6 files changed, 103 insertions(+)

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..5ac9885
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,7 @@
+language: node_js
+node_js:
+  - "0.8"
+  - "0.10"
+  - "0.11"
+  - "0.12"
+  - "iojs"
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..049521c
--- /dev/null
+++ b/index.js
@@ -0,0 +1,13 @@
+'use strict';
+module.exports = nextTick;
+
+function nextTick(fn) {
+  var args = new Array(arguments.length - 1);
+  var i = 0;
+  while (i < args.length) {
+    args[i++] = arguments[i];
+  }
+  process.nextTick(function afterTick() {
+    fn.apply(null, args);
+  });
+}
diff --git a/license.md b/license.md
new file mode 100644
index 0000000..c67e353
--- /dev/null
+++ b/license.md
@@ -0,0 +1,19 @@
+# Copyright (c) 2015 Calvin Metcalf
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+**THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.**
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..31cb335
--- /dev/null
+++ b/package.json
@@ -0,0 +1,22 @@
+{
+  "name": "process-nextick-args",
+  "version": "1.0.3",
+  "description": "process.nextTick but always with args",
+  "main": "index.js",
+  "scripts": {
+    "test": "node test.js"
+  },
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/calvinmetcalf/process-nextick-args.git"
+  },
+  "author": "",
+  "license": "MIT",
+  "bugs": {
+    "url": "https://github.com/calvinmetcalf/process-nextick-args/issues"
+  },
+  "homepage": "https://github.com/calvinmetcalf/process-nextick-args",
+  "devDependencies": {
+    "tap": "~0.2.6"
+  }
+}
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000..78e7cfa
--- /dev/null
+++ b/readme.md
@@ -0,0 +1,18 @@
+process-nextick-args
+=====
+
+[![Build Status](https://travis-ci.org/calvinmetcalf/process-nextick-args.svg?branch=master)](https://travis-ci.org/calvinmetcalf/process-nextick-args)
+
+```bash
+npm install --save process-nextick-args
+```
+
+Always be able to pass arguments to process.nextTick, no matter the platform
+
+```js
+var nextTick = require('process-nextick-args');
+
+nextTick(function (a, b, c) {
+  console.log(a, b, c);
+}, 'step', 3,  'profit');
+```
diff --git a/test.js b/test.js
new file mode 100644
index 0000000..ef15721
--- /dev/null
+++ b/test.js
@@ -0,0 +1,24 @@
+var test = require("tap").test;
+var nextTick = require('./');
+
+test('should work', function (t) {
+  t.plan(5);
+  nextTick(function (a) {
+    t.ok(a);
+    nextTick(function (thing) {
+      t.equals(thing, 7);
+    }, 7);
+  }, true);
+  nextTick(function (a, b, c) {
+    t.equals(a, 'step');
+    t.equals(b, 3);
+    t.equals(c, 'profit');
+  }, 'step', 3,  'profit');
+});
+
+test('correct number of arguments', function (t) {
+  t.plan(1);
+  nextTick(function () {
+    t.equals(2, arguments.length, 'correct number');
+  }, 1, 2);
+});

-- 
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