A REPL with support for await
- Track Promise results
- Support for
await
keyword (expl:user = await db.User.get('foobar')
will populate user variable once promise is resolved)
Installation
# For the command line "replico" npm install --global replico # And/or to use replico api in a project npm install --save replico
Command line usage
replico
Api usage
https://nodejs.org/dist/latest-v5.x/docs/api/repl.html#repl_class_replserver)
Basic replacement of repl (seevar replico = let replServer =
Define your own eval
var replico = let replServer = replServer { if cmd === 'foo' // ... your own implementation return else if /yield/ // Or use replico's eval (with bluebird-co): return replicocoEval else // If you need it, superEval is a reference to the default repl eval return this }
Plug it in your project
'use strict'const net = const replico = const CRESET = '\x1b[0m'const CBLUE = '\x1b[34m' var history = 'console.log("ok")' net
Then you can use netcat or repli:
nc localhost 5423# Or repli repli localhost 5423