🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

nextflow

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nextflow - npm Package Compare versions

Comparing version

to
0.2.0

3

CHANGELOG.md

@@ -0,1 +1,4 @@

0.2.0 / 2012-08-6
* Added an error handling method.
0.1.2 / 2012-06-29

@@ -2,0 +5,0 @@ ------------------

@@ -17,2 +17,4 @@ // Generated by CoffeeScript 1.3.3

this.current = null;
this.errorFunc = null;
this._checkForErrorFunction();
_ref = this.nextObject;

@@ -34,7 +36,19 @@ for (key in _ref) {

NextFlow.prototype.next = function() {
NextFlow.prototype.next = function(err) {
var idx;
if ((err != null) && (this.errorFunc != null)) {
this.errorFunc(err);
return;
}
if (this.current === null) {
this.current = this.keys[0];
return this.funcs[0].apply(this, arguments);
try {
return this.funcs[0].apply(this, arguments);
} catch (error) {
if (this.errorFunc != null) {
return this.errorFunc(error);
} else {
throw error;
}
}
} else {

@@ -44,6 +58,34 @@ idx = this.keys.indexOf(this.current);

this.current = this.keys[idx];
return this.funcs[idx].apply(this, arguments);
try {
return this.funcs[idx].apply(this, arguments);
} catch (error) {
if (this.errorFunc != null) {
return this.errorFunc(error);
} else {
throw error;
}
}
}
};
NextFlow.prototype._checkForErrorFunction = function() {
var key, val, _ref, _results;
_ref = this.nextObject;
_results = [];
for (key in _ref) {
val = _ref[key];
if (this.nextObject.hasOwnProperty(key)) {
if (key.toLowerCase() === 'error') {
this.errorFunc = val;
_results.push(delete this.nextObject[key]);
} else {
_results.push(void 0);
}
} else {
_results.push(void 0);
}
}
return _results;
};
return NextFlow;

@@ -50,0 +92,0 @@

2

package.json

@@ -5,3 +5,3 @@ {

"description": "A simple control-flow library for Node.js targetted towards CoffeeScript developers.",
"version": "0.1.2",
"version": "0.2.0",
"homepage": "https://github.com/jprichardson/node-nextflow",

@@ -8,0 +8,0 @@ "keywords": ["async", "seq", "step", "asynchronous", "sequential", "control", "flow", "coffee", "coffee-script", "coffeescript"],

@@ -6,2 +6,4 @@ Node.js - NextFlow

Why?

@@ -58,2 +60,3 @@ ----

Usage

@@ -76,3 +79,3 @@ -----

flow =
next flow =
1: ->

@@ -97,3 +100,3 @@ vals.push(1)

next(flow)
```

@@ -107,3 +110,3 @@

flow =
next flow =
a1: ->

@@ -128,3 +131,2 @@ vals.push(1)

next(flow)
```

@@ -139,3 +141,3 @@

flow =
next flow =
a1: ->

@@ -161,5 +163,31 @@ vals.push(1)

next(flow)
```
Handle errors in one function:
```coffee
next flow =
error: (err) ->
console.log err.message
1: ->
throw new Error('some error')
```
Handle errors by passing them as first params of the @next callback:
```coffee
next flow =
error: (err) ->
console.log err.message #ENOENT, open '/tmp/this_file_hopefully_does_not_exist'
1: ->
nonExistentFile = '/tmp/this_file_hopefully_does_not_exist'
fs.readFile nonExistentFile, @next
```
License
-------
MIT Licensed

@@ -171,2 +199,5 @@

[2]: https://github.com/creationix/step
[3]: https://github.com/substack/node-seq
[3]: https://github.com/substack/node-seq

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet