Socket
Socket
Sign inDemoInstall

react

Package Overview
Dependencies
Maintainers
1
Versions
1983
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.2.4 to 0.2.5

8

lib/core.js

@@ -16,6 +16,6 @@ 'use strict';

var reactOptions = {
stackTraceLimitMin: 30
stackTraceLimitMin: 30
};
var reactEmitter = EventManager.create(); // the top emitter
var reactEmitter = EventManager.globalEventManager; // the top emitter

@@ -43,3 +43,3 @@ /**

if (arguments.length) throw new Error('react() takes no args, check API');
error.ensureStackTraceLimitSet(reactOptions.stackTraceLimitMin);

@@ -80,3 +80,3 @@ var flowEmitter = EventManager.create();

}
tasks.forEach(function (t) {

@@ -83,0 +83,0 @@ t.id = idGenerator.createUniqueId();

@@ -57,2 +57,3 @@ 'use strict';

module.exports = EventManager;
module.exports.TYPES = TYPES;
module.exports.TYPES = TYPES;
module.exports.globalEventManager = EventManager.create(); // create one top level emitter

@@ -16,2 +16,5 @@ 'use strict';

// match any of our literals true, false, int, float, quoted strings, or is property (has dot)
var LITERAL_OR_PROP_RE = /^(true|false|\-?[0-9\.]+)$|'|"|\./i;
var validateInParams, validateTasks, validateOutTask, validateTaskNamesUnique;

@@ -24,6 +27,11 @@ var validateLocals, validateOuputsUnique, validateNoMissingNames;

function isProp(str) { // true if is a property name (contains a dot)
return (str.indexOf('.') !== -1);
/**
true if is a literal name
*/
function isLiteralOrProp(name) { // need to match what is in vcon.js, TODO consolidate?
return LITERAL_OR_PROP_RE.test(name);
}
/**

@@ -110,2 +118,3 @@ validate the AST return Errors

/**

@@ -140,3 +149,3 @@ validate there are no missing or mispelled param names in any task inputs

return t.a.reduce(function (innerAccum, p) { // for all in params, except property
if (!isProp(p) && !names[p]) innerAccum.push(sprintf(MISSING_INPUTS, p)); // add error if missing
if (!isLiteralOrProp(p) && !names[p]) innerAccum.push(sprintf(MISSING_INPUTS, p)); // add error if missing
return innerAccum;

@@ -148,3 +157,3 @@ }, accum);

ast.outTask.a.reduce(function (accum, p) { // for final task out params
if (!isProp(p) && !names[p]) accum.push(sprintf(MISSING_INPUTS, p)); // add error if missing
if (!isLiteralOrProp(p) && !names[p]) accum.push(sprintf(MISSING_INPUTS, p)); // add error if missing
return accum;

@@ -151,0 +160,0 @@ }, errors);

@@ -12,5 +12,7 @@ 'use strict';

VContext.prototype.getVar = function (name) { //name might be simple or obj.prop, also literals
/*jshint regexp: false */
var vConValues = this.values;
if (typeof(name) !== 'string') return name; // literal boolean or number
name = name.trim();
// literal checks need to match what is in validate.js
if (name === 'true') return true;

@@ -17,0 +19,0 @@ if (name === 'false') return false;

{
"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.4",
"version": "0.2.5",
"author": "Jeff Barczewski <jeff.barczewski@gmail.com>",

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

@@ -245,3 +245,3 @@ # React.js

- 2012-01-11 - Provide warning/error when name is skipped in default DSL (v0.2.4)
- 2012-01-11 - Provide warning/error when name is skipped in default DSL, literal check in validate (v0.2.5)
- 2012-01-10 - Create default DSL for react(), create error for missing variables, list remaining tasks when flow won't complete

@@ -258,3 +258,3 @@ - 2011-12-21 - Refactor from ground up with tests, changes to the interfaces

ok core.test.js ................... 98/98
ok dsl.test.js .................... 58/58
ok dsl.test.js .................... 63/63
ok event-manager.test.js .......... 13/13

@@ -271,5 +271,5 @@ ok exec-options.test.js ............. 3/3

ok validate-ret-task.test.js ........ 7/7
ok validate.test.js ............... 26/26
ok validate.test.js ............... 31/31
ok vcon.test.js ................... 42/42
total ........................... 613/613
total ........................... 623/623

@@ -276,0 +276,0 @@ ok

@@ -266,2 +266,28 @@ 'use strict';

t.end();
});
});
test('missing or mispelled validation ignores properties', function (t) {
var ast = {
inParams: ['obj'],
tasks: [
{ f: foo, a: ['obj.foo'], out: [] },
{ f: bar, a: ['obj.bar'], out: [] }
],
outTask: { a: ['obj.cat'] }
};
t.deepEqual(validate(ast), []);
t.end();
});
test('missing or mispelled validation ignores literals', function (t) {
var ast = {
inParams: [],
tasks: [
{ f: foo, a: ['true', 'false', '123', '123.1'], out: [] },
{ f: bar, a: ['-123', '-123.4', '"wow"', "'hey'"], out: [] }
],
outTask: { a: [] }
};
t.deepEqual(validate(ast), []);
t.end();
});
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