Skip to content

zkochan/codemo

Repository files navigation

codemo

Embeds console output to the code

npm version Build Status Coverage Status

Installation

npm i -S codemo

Usage

const codemo = require('codemo')

codemo
  .process("console.log('Hello world!')")
  .then(result => consle.log(result))

The result will be

console.log('Hello world!')
//> Hello world!

API

codemo.process(code, [opts])

Return a promise with the resulting file combined with output.

  • opts.cwd - the directory in which the code should be executed
  • opts.es6 - whether the code is written using ES6

codemo.processFile(filePath, [opts])

Return a promise with the resulting file combined with output.

  • opts.es6 - whether the code is written using ES6

License

MIT © Zoltan Kochan