[Pkg-javascript-commits] [node-process-nextick-args] 01/05: New upstream version 2.0.0
Bastien Roucariès
rouca at moszumanska.debian.org
Mon Mar 12 10:05:32 UTC 2018
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-process-nextick-args.
commit 1e25647394f199c41f50442957a0f0e75c5a94ea
Author: Bastien ROUCARIÈS <roucaries.bastien at gmail.com>
Date: Thu Feb 22 14:54:11 2018 +0100
New upstream version 2.0.0
---
index.js | 5 +++--
package.json | 2 +-
readme.md | 4 ++--
test.js | 22 +++++++++++++++++-----
4 files changed, 23 insertions(+), 10 deletions(-)
diff --git a/index.js b/index.js
index a4f40f8..5f585e8 100644
--- a/index.js
+++ b/index.js
@@ -3,9 +3,9 @@
if (!process.version ||
process.version.indexOf('v0.') === 0 ||
process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
- module.exports = nextTick;
+ module.exports = { nextTick: nextTick };
} else {
- module.exports = process.nextTick;
+ module.exports = process
}
function nextTick(fn, arg1, arg2, arg3) {
@@ -41,3 +41,4 @@ function nextTick(fn, arg1, arg2, arg3) {
});
}
}
+
diff --git a/package.json b/package.json
index dea5e2c..42c5b67 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "process-nextick-args",
- "version": "1.0.8",
+ "version": "2.0.0",
"description": "process.nextTick but always with args",
"main": "index.js",
"files": [
diff --git a/readme.md b/readme.md
index 78e7cfa..ecb432c 100644
--- a/readme.md
+++ b/readme.md
@@ -10,9 +10,9 @@ 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');
+var pna = require('process-nextick-args');
-nextTick(function (a, b, c) {
+pna.nextTick(function (a, b, c) {
console.log(a, b, c);
}, 'step', 3, 'profit');
```
diff --git a/test.js b/test.js
index ef15721..ab45e38 100644
--- a/test.js
+++ b/test.js
@@ -1,15 +1,15 @@
var test = require("tap").test;
-var nextTick = require('./');
+var pna = require('./');
test('should work', function (t) {
t.plan(5);
- nextTick(function (a) {
+ pna.nextTick(function (a) {
t.ok(a);
- nextTick(function (thing) {
+ pna.nextTick(function (thing) {
t.equals(thing, 7);
}, 7);
}, true);
- nextTick(function (a, b, c) {
+ pna.nextTick(function (a, b, c) {
t.equals(a, 'step');
t.equals(b, 3);
t.equals(c, 'profit');
@@ -18,7 +18,19 @@ test('should work', function (t) {
test('correct number of arguments', function (t) {
t.plan(1);
- nextTick(function () {
+ pna.nextTick(function () {
t.equals(2, arguments.length, 'correct number');
}, 1, 2);
});
+
+test('uses the current value of process.nextTick', function (t) {
+ t.plan(1);
+ var oldNextTick = process.nextTick;
+ var called = false;
+ process.nextTick = function() {
+ called = true
+ };
+ pna.nextTick(function () {});
+ process.nextTick = oldNextTick;
+ t.ok(called);
+});
--
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