repl-utils
REPL utilities. This package provides additional utilities when working with node projects in repl. At the moment two helper function are exposed:
doc
prints documentation for the given function if documented as defined in expected format (https://github.com/Gozala/doc)use
requires given module and puts all it's exports into the scope (For details trydoc(use)
)
Setup
To use this repl-utilitis form your package add it to your devDependencies
and
optionally add npm script "repl": "node node_modules/repl-utils"
. Example
package.json
file will look as follows:
Usage
From your package dir run
npm run repl
And from the repl you'll be able to use:
// try this: /*function doc(source) { ... }-----------------------------------------------Prints documentanion of the given function*/ // Now this: /*function use(id, options) { ... }-----------------------------------------------Like `require`, but also copies exports from the given module to the currentcontext. Optionally `options` can be passed to limit imports. Usage:use('fs')use('fs', { only: [ 'readFile' ] }) // only imports readFileuse('fs', { as: { writeFile: write }) // imports fs.writeFile as writeuse('fs', { reload: true }) // reloads module*/ // Enjoy hacking!