Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jpommerening/node-eval-stream

Evaluate streams of JavaScript code in a given context
https://github.com/jpommerening/node-eval-stream

Last synced: 24 days ago
JSON representation

Evaluate streams of JavaScript code in a given context

Awesome Lists containing this project

README

        

# eval-stream

> Evaluate streams of JavaScript code in a given context.

## Examples

Here, we read the body of an adding function from a simple
through-stream:

```js
var PassThrough = require('stream').PassThrough ||
require('readable-stream/passthrough');
var assert = require('assert');

var evalStream = require('eval-stream');

var ts = new PassThrough();

ts.pipe(evalStream({
a: 1,
b: 2
}, function (err, result) {
assert(!err);
assert.equal(result, 3);
}));

ts.write('return a + b;');
ts.end();
```