Browse Source

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>
v7.x
Vse Mozhet Byt 8 years ago
committed by Evan Lucas
parent
commit
cffbfba4df
  1. 4
      doc/api/repl.md

4
doc/api/repl.md

@ -328,14 +328,14 @@ const repl = require('repl');
const replServer = repl.start({prompt: '> '}); const replServer = repl.start({prompt: '> '});
replServer.defineCommand('sayhello', { replServer.defineCommand('sayhello', {
help: 'Say hello', help: 'Say hello',
action: function(name) { action(name) {
this.lineParser.reset(); this.lineParser.reset();
this.bufferedCommand = ''; this.bufferedCommand = '';
console.log(`Hello, ${name}!`); console.log(`Hello, ${name}!`);
this.displayPrompt(); this.displayPrompt();
} }
}); });
replServer.defineCommand('saybye', function() { replServer.defineCommand('saybye', () => {
console.log('Goodbye!'); console.log('Goodbye!');
this.close(); this.close();
}); });

Loading…
Cancel
Save