Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react

Package Overview
Dependencies
Maintainers
1
Versions
2045
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.1 to 0.2.2

6

examples/default-events1.js

@@ -27,3 +27,3 @@ 'use strict';

function loadEmailTemplate(cb) { setTimeout(cb, 50, null, 'emailmd'); }
function customizeEmail(user, emailHtml, cb) { return 'cust-'+user+emailHtml; }
function customizeEmail(user, emailHtml) { return 'cust-'+user+emailHtml; }
function deliverEmail(custEmailHtml, cb) { setTimeout(cb, 100, null, 'delivered-'+custEmailHtml); }

@@ -47,5 +47,5 @@

markdown, 'emailmd -> emailHtml', // using a sync function
customizeEmail, 'user, emailHtml, cb -> err, custEmailHtml',
customizeEmail, 'user, emailHtml -> err, custEmailHtml', // sync fn
deliverEmail, 'custEmailHtml, cb -> err, deliveredEmail', { after: writeOutput } // only after writeOutput is done
);
);

@@ -52,0 +52,0 @@ loadAndSave('file.md', 100, '/tmp/foo', useHtml); // executing the flow

@@ -12,3 +12,3 @@ 'use strict';

function loadEmailTemplate(cb) { setTimeout(cb, 50, null, 'emailmd'); }
function customizeEmail(user, emailHtml, cb) { return 'cust-'+user+emailHtml; }
function customizeEmail(user, emailHtml) { return 'cust-'+user+emailHtml; }
function deliverEmail(custEmailHtml, cb) { setTimeout(cb, 100, null, 'delivered-'+custEmailHtml); }

@@ -19,2 +19,3 @@

console.log('***Error: %s', err);
console.error(err.stack);
return;

@@ -27,11 +28,11 @@ }

// starts with name and in/out params, then the tasks
var loadAndSave = react('loadAndSave', 'fName, uid, outDir, cb -> err, html, user, bytes',
var loadAndSave = react('loadAndSave', 'filename, uid, outDir, cb -> err, html, user, bytes',
loadUser, 'uid, cb -> err, user', // calling async loadUser with uid, cb called with err and user
loadFile, 'filename, cb -> err, filedata',
markdown, 'filedata -> html', // using a sync function
prepareDirectory, 'outDirname, cb -> err, dircreated',
writeOutput, 'html, user, cb -> err, bytesWritten', { after: prepareDirectory }, // only after prepareDirectory done
prepareDirectory, 'outDir, cb -> err, dircreated',
writeOutput, 'html, user, cb -> err, bytes', { after: prepareDirectory }, // only after prepareDirectory done
loadEmailTemplate, 'cb -> err, emailmd',
markdown, 'emailmd -> emailHtml', // using a sync function
customizeEmail, 'user, emailHtml, cb -> custEmailHtml',
customizeEmail, 'user, emailHtml -> custEmailHtml', // sync function
deliverEmail, 'custEmailHtml, cb -> err, deliveredEmail', { after: writeOutput } // only after writeOutput is done

@@ -38,0 +39,0 @@ );

@@ -12,3 +12,4 @@ 'use strict';

function fName(fn) {
return (typeof(fn) === 'string') ? fn : fn.name;
if (!fn) return 'undefined';
return (fn && fn.name) ? fn.name : fn;
}

@@ -20,8 +21,17 @@

var task = err.meta.task;
return '\n\n' +
'Error occurs in Task function: ' + fName(task.f) + '(' + task.a.join(',') + ')\n\n' +
'Variable Context: \n' +
util.inspect(vcon) + '\n\n' +
'Task Source:\n\n' +
task.f.toString() + '\n\n'; //TODO need to pretty print function, gets collapsed
var errString = '\n\n';
if (task && task.f && task.a) {
errString += ('Error occurs in Task function: ' + fName(task.f) + '(' + task.a.join(',') + ')\n\n');
}
if (vcon) {
errString += 'Variable Context: \n';
errString += util.inspect(vcon);
errString += '\n\n';
}
if (task && task.f) {
errString += 'Task Source:\n\n';
errString += task.f.toString(); //TODO need to pretty print function, gets collapsed
errString += '\n\n';
}
return errString;
}

@@ -28,0 +38,0 @@

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

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

@@ -217,4 +217,32 @@ 'use strict';

test('long example', function (t) {
t.plan(4);
function loadUser(uid, cb){ setTimeout(cb, 100, null, "User"+uid); }
function loadFile(filename, cb){ setTimeout(cb, 100, null, 'Filedata'+filename); }
function markdown(filedata) { return 'html'+filedata; }
function prepareDirectory(outDirname, cb){ setTimeout(cb, 200, null, 'dircreated-'+outDirname); }
function writeOutput(html, user, cb){ setTimeout(cb, 300, null, html+'_bytesWritten'); }
function loadEmailTemplate(cb) { setTimeout(cb, 50, null, 'emailmd'); }
function customizeEmail(user, emailHtml) { return 'cust-'+user+emailHtml; }
function deliverEmail(custEmailHtml, cb) { setTimeout(cb, 100, null, 'delivered-'+custEmailHtml); }
var loadAndSave = react('loadAndSave', 'filename, uid, outDirname, cb -> err, html, user, bytesWritten', // name, in/out params
loadUser, 'uid, cb -> err, user', // calling async fn loadUser with uid, callback is called with err and user
loadFile, 'filename, cb -> err, filedata',
markdown, 'filedata -> html', // using a sync function
prepareDirectory, 'outDirname, cb -> err, dircreated',
writeOutput, 'html, user, cb -> err, bytesWritten', { after: prepareDirectory }, // only after prepareDirectory done
loadEmailTemplate, 'cb -> err, emailmd',
markdown, 'emailmd -> emailHtml', // using a sync function
customizeEmail, 'user, emailHtml -> custEmailHtml',
deliverEmail, 'custEmailHtml, cb -> err, deliveredEmail', { after: writeOutput } // only after writeOutput is done
);
loadAndSave('file.md', 100, '/tmp/foo', function (err, html, user, bytesWritten) { // executing the flow
t.equal(err, null);
t.equal(html, 'htmlFiledatafile.md');
t.equal(user, 'User100');
t.equal(bytesWritten, 'htmlFiledatafile.md_bytesWritten');
t.end();
});
});
// selectFirst

@@ -221,0 +249,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