From 35f481182643a0ee702af5ba3a7c09328f3324dc Mon Sep 17 00:00:00 2001 From: calebboyd Date: Tue, 9 Oct 2018 14:07:32 -0500 Subject: [PATCH] fix: remove spread operator --- src/fs/bootstrap.js | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/fs/bootstrap.js b/src/fs/bootstrap.js index 8af92d2..a790b91 100644 --- a/src/fs/bootstrap.js +++ b/src/fs/bootstrap.js @@ -1,15 +1,20 @@ -const __nexe_patches = (process.nexe = { patches: {} }).patches -function __nexe_noop_patch(original, ...args) { - return original.call(this, ...args) -} -function __nexe_patch(obj, method, patch) { - const original = obj[method] - if (!original) return - __nexe_patches[method] = patch - obj[method] = function( ...args) { - return __nexe_patches[method].call(this, original, ...args) +if (true) { + const __nexe_patches = (process.nexe = { patches: {} }).patches + const slice = [].slice + const __nexe_noop_patch = function (original) { + const args = slice.call(arguments, 1) + return original.apply(this, args) } + const __nexe_patch = function (obj, method, patch) { + const original = obj[method] + if (!original) return + __nexe_patches[method] = patch + obj[method] = function() { + const args = [original].concat(slice.call(arguments)) + return __nexe_patches[method].apply(this, args) + } + } + __nexe_patch((process).binding('fs'), 'internalModuleReadFile', __nexe_noop_patch) + __nexe_patch((process).binding('fs'), 'internalModuleReadJSON', __nexe_noop_patch) + __nexe_patch((process).binding('fs'), 'internalModuleStat', __nexe_noop_patch) } -__nexe_patch((process).binding('fs'), 'internalModuleReadFile', __nexe_noop_patch) -__nexe_patch((process).binding('fs'), 'internalModuleReadJSON', __nexe_noop_patch) -__nexe_patch((process).binding('fs'), 'internalModuleStat', __nexe_noop_patch)