Socket
Socket
Sign inDemoInstall

react

Package Overview
Dependencies
Maintainers
1
Versions
1975
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react - npm Package Compare versions

Comparing version 0.3.4 to 0.3.5

doc/default-simple.dot

4

package.json
{
"name": "react",
"description": "React is a javascript module to make it easier to work with asynchronous code, by reducing boilerplate code and improving error and exception handling while allowing variable and task dependencies when defining flow.",
"version": "0.3.4",
"description": "React is a javascript module implementing a lightweight rules engine to make it easier to work with asynchronous code, by reducing boilerplate code and improving error and exception handling while allowing variable and task dependencies when defining flow.",
"version": "0.3.5",
"author": "Jeff Barczewski <jeff.barczewski@gmail.com>",

@@ -6,0 +6,0 @@ "repository": { "type": "git", "url": "http://github.com/jeffbski/react.git" },

@@ -87,37 +87,60 @@ # React.js

- Simple example showing flow definition of two async functions feeding a
synchronous function.
- First two async functions inputs are satisfied by the flow inputs, so
they will both run immediately in parallel.
- The last function waits for the outputs of the previous ones, then
executes synchronously.
- Finally the flow calls the callback with the output values once all
the tasks have completed.
```javascript
// in your foo module
// in your foobar module
var react = require('react');
// some normal async and sync functions
function loadUser(uid, cb){ }
function loadFile(filename, cb){ }
function markdown(filedata) { }
function writeOutput(html, user, cb){ }
function loadEmailTemplate(cb) { }
function customizeEmail(user, emailHtml, cb) { }
function deliverEmail(custEmailHtml, cb) { }
function loadFoo(fooPath, cb) {
setTimeout(function () {
cb(null, [fooPath, 'data'].join(':'));
}, 10);
}
function loadBar(barPath, barP2, cb) {
setTimeout(function () {
cb(null, [barPath, barP2, 'data'].join(':'));
}, 10);
}
function render(foo, bar) {
return ['<html>', foo, '/', bar, '</html>'].join('');
}
// define fn, glue together with react, it will parallelize
// starts with name and in/out params, then the tasks
var loadAndSend = react('loadAndSend', 'uid, filename, cb -> err, user',
loadUser, 'uid, cb -> err, user',
loadFile, 'filename, cb -> err, filemd',
markdown, 'filemd -> html', // no cb, implies sync fn
writeOutput, 'html, user, cb -> err, htmlBytesWritten',
loadEmailTemplate, 'cb -> err, emailmd',
markdown, 'emailmd -> emailHtml', // no cb, implies sync fn
customizeEmail, 'user, emailHtml, cb -> err, custEHtml',
deliverEmail, 'custEHtml, cb -> err, custBytesWritten'
var loadRender = react('loadRender', 'fooPath, barPath, barP2, cb -> err, renderedOut',
loadFoo, 'fooPath, cb -> err, foo', // async cb function
loadBar, 'barPath, barP2, cb -> err, bar', // async cb function
render, 'foo, bar -> renderedOut' // sync function using outputs from first two
);
exports.loadAndSend = loadAndSend; // is a normal fn created by react
exports.loadRender = loadRender; // is a normal fn created by react
// in a different module far far away, use this as any other node function
var foo = require('foo');
foo.loadAndSend(100, 'bar.md', function (err, user) {
// tasks were parallelized based on their depedencies
}
var foobar = require('foobar');
foobar.loadRender('foo.txt', 'bar.txt', 'BBB', function (err, renderedOut) {
// tasks in loadRender were parallelized based on their input dependencies
console.error('results:', renderedOut);
});
```
Below is a graph of how the dependencies are mapped by React which
also indicates how the tasks will be executed
![default-simple.dot.png](https://github.com/jeffbski/react/raw/master/doc/default-simple.dot.png)
<a name="directAST"/>

@@ -155,5 +178,5 @@ ### Example directly using AST

1. [Using pseudocode DSL](http://github.com/jeffbski/react/raw/master/doc/alternate-dsls.md#pcode)
2. [Using jquery-like chaining DSL](http://github.com/jeffbski/react/raw/master/doc/alternate-dsls.md#chain)
3. [Using function string DSL](http://github.com/jeffbski/react/raw/master/doc/alternate-dsls.md#fstr)
1. [Using pseudocode DSL](https://github.com/jeffbski/react/blob/master/doc/alternate-dsls.md#pcode)
2. [Using jquery-like chaining DSL](https://github.com/jeffbski/react/blob/master/doc/alternate-dsls.md#chain)
3. [Using function string DSL](https://github.com/jeffbski/react/blob/master/doc/alternate-dsls.md#fstr)

@@ -287,3 +310,3 @@

Additional DSL's can be loaded by requiring them. See the [Alternate DSL](http://github.com/jeffbski/react/raw/master/doc/alternate-dsls.md) page for more info.
Additional DSL's can be loaded by requiring them. See the [Alternate DSL](https://github.com/jeffbski/react/blob/master/doc/alternate-dsls.md) page for more info.

@@ -293,3 +316,3 @@

- 2012-01-17 - Additional documentation (v0.3.4)
- 2012-01-17 - Additional documentation (v0.3.5)
- 2012-01-16 - Refine events and create logging plugin (v0.3.3)

@@ -296,0 +319,0 @@ - 2012-01-13 - Add promise tasks, promise resolution, refactor alternate DSL interfaces as optional requires (v0.3.0)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc