Skip to content

Commit

Permalink
process: make this value consistent
Browse files Browse the repository at this point in the history
The value of `this` for callbacks of `nextTick()` can vary depending on
the number of arguments. Make it consistent.
  • Loading branch information
Trott committed Aug 9, 2017
1 parent 23918c4 commit aa07e87
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/internal/process/next_tick.js
Expand Up @@ -141,7 +141,7 @@ function setupNextTick() {
callback(args[0], args[1], args[2]);
break;
default:
callback.apply(null, args);
callback(...args);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-next-tick.js
Expand Up @@ -51,7 +51,7 @@ process.nextTick((a, b) => {
}, 42, obj);

process.nextTick(function() {
assert.strictEqual(this, null);
assert.strictEqual(this, undefined);
}, 1, 2, 3, 4);

process.nextTick(() => {
Expand Down

0 comments on commit aa07e87

Please sign in to comment.