https://github.com/zkochan/codemo
Embeds console output to the code
https://github.com/zkochan/codemo
Last synced: 2 months ago
JSON representation
Embeds console output to the code
- Host: GitHub
- URL: https://github.com/zkochan/codemo
- Owner: zkochan
- License: mit
- Created: 2016-04-16T23:45:02.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-04-14T19:58:31.000Z (about 7 years ago)
- Last Synced: 2025-03-30T14:17:06.311Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 84 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# codemo
> Embeds console output to the code
[](https://www.npmjs.com/package/codemo) [](https://travis-ci.org/zkochan/codemo) [](https://coveralls.io/r/zkochan/codemo?branch=master)
## Installation
```sh
npm i -S codemo
```## Usage
```js
const codemo = require('codemo')codemo
.process("console.log('Hello world!')")
.then(result => consle.log(result))
```The result will be
```js
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](./LICENSE) © [Zoltan Kochan](https://www.kochan.io)