Browse Source

dns: avoid use of arguments

PR-URL: https://github.com/nodejs/node/pull/11359
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com
v7.x
James M Snell 8 years ago
committed by Italo A. Casas
parent
commit
662b0c31ce
No known key found for this signature in database GPG Key ID: 23EFEFE93C4CFFFE
  1. 9
      lib/dns.js

9
lib/dns.js

@ -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);
}
};

Loading…
Cancel
Save