react
Advanced tools
Comparing version 0.2.3 to 0.2.4
@@ -9,5 +9,7 @@ 'use strict'; | ||
var MISSING_NAME = 'param[0] should be the flow name, instead found in/out def: %s'; | ||
var INOUT_PARAMS_NO_MATCH = 'params in wrong format, wanted "foo, bar cb -> err, baz" - found: %s'; | ||
var EXTRA_TASKARG = 'extra unmatched task arg: %s'; | ||
var INOUT_RE = /\->/; // used to detect missing name, in/out as first arg | ||
var CB_NAMES_RE = /^cb|callback$/i; //cb, Cb, CB, callback, Callback | ||
@@ -85,2 +87,3 @@ var ERR_NAMES_RE = /^err$/i; // err, ERR, Err, ... | ||
var reactFn = core(); | ||
if (name && INOUT_RE.test(name)) throw new Error(sprintf(MISSING_NAME, name)); | ||
var defObj = parseVargs(Array.prototype.slice.call(arguments, 1)); // name, already used | ||
@@ -87,0 +90,0 @@ var inOutDef = parseInOutParams(defObj.inOutParamStr); |
{ | ||
"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.2.3", | ||
"version": "0.2.4", | ||
"author": "Jeff Barczewski <jeff.barczewski@gmail.com>", | ||
@@ -6,0 +6,0 @@ "repository": { "type": "git", "url": "http://github.com/jeffbski/react.git" }, |
@@ -245,2 +245,3 @@ # React.js | ||
- 2012-01-11 - Provide warning/error when name is skipped in default DSL (v0.2.4) | ||
- 2012-01-10 - Create default DSL for react(), create error for missing variables, list remaining tasks when flow won't complete | ||
@@ -247,0 +248,0 @@ - 2011-12-21 - Refactor from ground up with tests, changes to the interfaces |
@@ -194,2 +194,15 @@ 'use strict'; | ||
// Errors | ||
test('missing name, throws error', function (t) { | ||
var fn = function () { | ||
var r = react('cb -> err, c', | ||
falpha, 'cb -> err, c' | ||
); | ||
}; | ||
t.throws(fn, new Error('param[0] should be the flow name, instead found in/out def: cb -> err, c')); | ||
t.end(); | ||
}); | ||
test('extra arg throws error', function (t) { | ||
@@ -196,0 +209,0 @@ var fn = function () { |
224720
5307
290