From 715baf82144792fdc0f40af74d7247689b317fb9 Mon Sep 17 00:00:00 2001 From: Mithun Sasidharan Date: Wed, 6 Dec 2017 23:15:34 +0530 Subject: [PATCH] fs: use rest param & Reflect.apply in makeCallback PR-URL: https://github.com/nodejs/node/pull/17486 Reviewed-By: Anatoli Papirovski Reviewed-By: Benjamin Gruenbaum Reviewed-By: Colin Ihrig Reviewed-By: Benedikt Meurer Reviewed-By: Timothy Gu --- lib/fs.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/fs.js b/lib/fs.js index a53290274c331e..eb781b0add8588 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -145,8 +145,8 @@ function makeCallback(cb) { throw new errors.TypeError('ERR_INVALID_CALLBACK'); } - return function() { - return cb.apply(undefined, arguments); + return function(...args) { + return Reflect.apply(cb, undefined, args); }; }