mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
doc: replace anonymous functions in repl.md
Replaced with an object shorthand and an arrow function. PR-URL: https://github.com/nodejs/node/pull/10244 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
committed by
Anna Henningsen
parent
224cbf8bd8
commit
5f8aa1fcb1
@@ -328,14 +328,14 @@ const repl = require('repl');
|
||||
const replServer = repl.start({prompt: '> '});
|
||||
replServer.defineCommand('sayhello', {
|
||||
help: 'Say hello',
|
||||
action: function(name) {
|
||||
action(name) {
|
||||
this.lineParser.reset();
|
||||
this.bufferedCommand = '';
|
||||
console.log(`Hello, ${name}!`);
|
||||
this.displayPrompt();
|
||||
}
|
||||
});
|
||||
replServer.defineCommand('saybye', function() {
|
||||
replServer.defineCommand('saybye', () => {
|
||||
console.log('Goodbye!');
|
||||
this.close();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user