bare-repl
v6.0.1
Published
Read-Evaluate-Print-Loop environment for JavaScript
Readme
bare-repl
Read-Evaluate-Print-Loop environment for JavaScript.
npm i bare-replUsage
const { start } = require('bare-repl')
const repl = start()API
const repl = start([options])
Options include:
{
prompt: string, // sets repl prompt
useColors: boolean, // toogles ANSI style codes to colorize the output
writer: (message) => message, // converts repl output
input: stream, // sets repl input stream
output: stream, // sets repl output stream
eval: (cmd) => {} // sets eval function
}repl.defineCommand(keyword, { help, action })
Define a repl command keyword.
repl.defineCommand('greet', {
help: 'Greetings',
action: () => console.log('hello')
})bare-repl
> .greet
hellorepl.context
Set execution context.
repl.context.f = () => console.log('Hello from context')bare-repl
> f()
Hello from contextLicense
Apache-2.0
