Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zkochan/codemo
Embeds console output to the code
https://github.com/zkochan/codemo
Last synced: 3 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 (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-14T19:58:31.000Z (over 6 years ago)
- Last Synced: 2024-10-04T10:06:25.327Z (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
[![npm version](https://img.shields.io/npm/v/codemo.svg?style=flat-square)](https://www.npmjs.com/package/codemo) [![Build Status](https://img.shields.io/travis/zkochan/codemo/master.svg?style=flat-square)](https://travis-ci.org/zkochan/codemo) [![Coverage Status](https://img.shields.io/coveralls/zkochan/codemo/master.svg?style=flat-square)](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)