Skip to content

Commit

Permalink
dns: avoid use of arguments
Browse files Browse the repository at this point in the history
PR-URL: #11359
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Сковорода Никита Андреевич <[email protected]
  • Loading branch information
jasnell authored and italoacasas committed Feb 22, 2017
1 parent 678ea11 commit 662b0c3
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/dns.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,12 @@ function errnoException(err, syscall, hostname) {
// callback.immediately = true;
// }
function makeAsync(callback) {
return function asyncCallback() {
return function asyncCallback(...args) {
if (asyncCallback.immediately) {
// The API already returned, we can invoke the callback immediately.
callback.apply(null, arguments);
callback.apply(null, args);
} else {
var args = new Array(arguments.length + 1);
args[0] = callback;
for (var i = 0; i < arguments.length; ++i)
args[i + 1] = arguments[i];
args.unshift(callback);
process.nextTick.apply(null, args);
}
};
Expand Down

0 comments on commit 662b0c3

Please sign in to comment.