From c7d222a21ca64f33941dfbdcf80b5659ad63fb58 Mon Sep 17 00:00:00 2001 From: /Jesse Date: Sat, 24 Nov 2018 16:42:51 +0900 Subject: [PATCH 1/4] lib: changed to arrow function --- lib/internal/bootstrap/node.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index 21544bceb463d1..b1920ad4c54acd 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -240,7 +240,7 @@ // To allow people to extend Node in different ways, this hook allows // one to drop a file lib/_third_party_main.js into the build // directory which will be executed instead of Node's normal loading. - process.nextTick(function() { + process.nextTick(() => { NativeModule.require('_third_party_main'); }); } else if (process.argv[1] === 'inspect' || process.argv[1] === 'debug') { @@ -251,7 +251,7 @@ } // Start the debugger agent. - process.nextTick(function() { + process.nextTick(() => { NativeModule.require('internal/deps/node-inspect/lib/_inspect').start(); }); @@ -304,14 +304,14 @@ if (process._forceRepl || NativeModule.require('tty').isatty(0)) { // REPL const cliRepl = NativeModule.require('internal/repl'); - cliRepl.createInternalRepl(process.env, function(err, repl) { + cliRepl.createInternalRepl(process.env, (err, repl) => { if (err) { throw err; } - repl.on('exit', function() { + repl.on('exit', () => { if (repl._flushing) { repl.pause(); - return repl.once('flushHistory', function() { + return repl.once('flushHistory', () => { process.exit(); }); } @@ -328,11 +328,11 @@ process.stdin.setEncoding('utf8'); let code = ''; - process.stdin.on('data', function(d) { + process.stdin.on('data', (d) => { code += d; }); - process.stdin.on('end', function() { + process.stdin.on('end', () => { if (process._syntax_check_only != null) { checkScriptSyntax(code, '[stdin]'); } else { @@ -389,13 +389,13 @@ const util = NativeModule.require('util'); function makeGetter(name) { - return util.deprecate(function() { + return util.deprecate(() => { return this; }, `'${name}' is deprecated, use 'global'`, 'DEP0016'); } function makeSetter(name) { - return util.deprecate(function(value) { + return util.deprecate((value) => { Object.defineProperty(this, name, { configurable: true, writable: true, @@ -567,7 +567,7 @@ emitAfter } = NativeModule.require('internal/async_hooks'); - process._fatalException = function(er) { + process._fatalException = (er) => { // It's possible that defaultTriggerAsyncId was set for a constructor // call that threw and was never cleared. So clear it now. clearDefaultTriggerAsyncId(); From cfd900dd250dcb39e6f8e17e577a088f7552b537 Mon Sep 17 00:00:00 2001 From: /Jesse Date: Sat, 24 Nov 2018 17:23:27 +0900 Subject: [PATCH 2/4] lib: changed arrow function that uses 'this' back to function --- lib/internal/bootstrap/node.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index b1920ad4c54acd..af342ae3df6f84 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -389,7 +389,7 @@ const util = NativeModule.require('util'); function makeGetter(name) { - return util.deprecate(() => { + return util.deprecate(function() { return this; }, `'${name}' is deprecated, use 'global'`, 'DEP0016'); } From b9d8a018482184c61c50efb26197e8dd1ca4de9a Mon Sep 17 00:00:00 2001 From: /Jesse Date: Sat, 24 Nov 2018 17:57:13 +0900 Subject: [PATCH 3/4] lib: changed arrow function that uses 'this' back to function --- lib/internal/bootstrap/node.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index af342ae3df6f84..37bf593632975b 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -395,7 +395,7 @@ } function makeSetter(name) { - return util.deprecate((value) => { + return util.deprecate(function(value) { Object.defineProperty(this, name, { configurable: true, writable: true, From aa572e5e7dfe4c05ae13f5c677e8f244ea451293 Mon Sep 17 00:00:00 2001 From: Jesse Katsumata Date: Mon, 26 Nov 2018 23:57:27 +0900 Subject: [PATCH 4/4] lib: change arrow function with argv back to function --- lib/internal/bootstrap/node.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index 37bf593632975b..a207dd648f7f7c 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -332,7 +332,7 @@ code += d; }); - process.stdin.on('end', () => { + process.stdin.on('end', function() { if (process._syntax_check_only != null) { checkScriptSyntax(code, '[stdin]'); } else {