Skip to content

Commit 662b0c3

Browse files
jasnellitaloacasas
authored andcommitted
dns: avoid use of arguments
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]
1 parent 678ea11 commit 662b0c3

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

lib/dns.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,12 @@ function errnoException(err, syscall, hostname) {
5656
// callback.immediately = true;
5757
// }
5858
function makeAsync(callback) {
59-
return function asyncCallback() {
59+
return function asyncCallback(...args) {
6060
if (asyncCallback.immediately) {
6161
// The API already returned, we can invoke the callback immediately.
62-
callback.apply(null, arguments);
62+
callback.apply(null, args);
6363
} else {
64-
var args = new Array(arguments.length + 1);
65-
args[0] = callback;
66-
for (var i = 0; i < arguments.length; ++i)
67-
args[i + 1] = arguments[i];
64+
args.unshift(callback);
6865
process.nextTick.apply(null, args);
6966
}
7067
};

0 commit comments

Comments
 (0)