1.1.0 • Published 8 years ago
node-examples v1.1.0
#node-examples
A simple tool to show and run code snippets in the node REPL. Great for talks and demos - show and run your code right in the REPL. Adds on files as named getters into the REPL context.

###Installation
Run npm i node-examples
###Usage
Start a node REPL via
node(or programmatically viarequire('repl').start) (see https://nodejs.org/api/repl.html for more info)Require node-examples
const examples = require('node-examples)Import the examples
examples({ path: 'examples' })Your example files are added as getters on the running REPL context. So
example_01_basicwill output and require the file.

###Configuration
Required
paththe absolute or relative path (from the current working directory) to the examples to be loaded
Optional
prefixthe prefix that shold preceed the getters in the REPL. Defaultexample_contextthe context to load the examples into as getters. Default is current REPL context (require('repl').repl.context) or nodeglobalif no REPL found.outthe writable stream to output on. Default isprocess.stdout.linenoswhether or not to show linenumbers in the output. Default istrueclearwhether or not to clear the REPL before showing the output. Default istruecachewhether or not to cache the example files rather than reloading fresh each time. Default istrue
###Run Tests
Run via npm test