New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ordination

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ordination - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

41

examples/completes.js

@@ -11,20 +11,37 @@ //==============================

var Possible = require('..').Possible;
var ordination = require('..');
function test (x, cb) {
function async (x, cb) {
cb && cb(null, 'test invoked with x = ', x);
}
var Sequencer = ordination.Sequencer;
setImmediate(async.bind(this, x, cb));
function firstIsSync (rqst, accum, next) {
console.log('firstIsSync:', 'rqst:', rqst);
accum.push("firstIsSync");
next();
}
var p = new Possible(test);
function secondIsAsync (rqst, accum, next) {
console.log('secondIsAsync:', 'rqst:', rqst);
accum.push("secondIsAsync");
p.on('complete', function (args, execution) {
console.log('main: on: complete:', args);
console.log('Invoked Args:', execution.getInvokedArgs());
});
setTimeout(next, 1000);
}
p.execute(3);
function thirdIsFinal (rqst, accum, next) {
console.log('thirdIsFinal:', 'accum:', accum);
// DON'T CALL next()
}
var steps = [firstIsSync, secondIsAsync, thirdIsFinal];
var seq = new Sequencer(steps);
var rqst = {'i am': 'tbd'};
var accum = [];
seq.run(rqst, accum);

@@ -11,3 +11,45 @@ //==============================

// to be written
var ordination = require('..');
var Sequencer = ordination.Sequencer;
function firstIsSync (rqst, accum, next) {
console.log('firstIsSync:', 'rqst:', rqst);
accum.push("firstIsSync");
next();
}
function secondHasAsyncError (rqst, accum, next) {
console.log('secondIsAsync:', 'rqst:', rqst);
accum.push("secondIsAsync");
function afterTimeout () {
next(new Error('Boom!'));
}
setTimeout(afterTimeout, 1000);
}
function thirdIsFinal (rqst, accum, next) {
console.log('thirdIsFinal:', 'accum:', accum);
// DON'T CALL next()
}
function ifError (rqst, accum, err) {
console.log('had an error:', err);
console.log('rqst:', rqst, 'accum:', accum);
}
var steps = [firstIsSync, secondHasAsyncError, thirdIsFinal];
var seq = new Sequencer(steps, ifError);
var rqst = {'i am': 'tbd'};
var accum = [];
seq.run(rqst, accum);

@@ -15,3 +15,3 @@ //==============================

exports = module.exports = Possible;
exports = module.exports = Sequencer;

@@ -30,3 +30,4 @@ //===========================

function Sequencer (steps) {
function Sequencer (steps, ifError) {
this.ifError = ifError;
this.numSteps = steps.length;

@@ -56,8 +57,20 @@ this.steps = steps;

Sequencer.prototype.next = function () {
Sequencer.prototype.next = function (nextArg) {
var applyArgs;
var steps = this.steps;
var thisStep;
if (nextArg instanceof Error) {
if (this.ifError) {
applyArgs = this.passArgs;
applyArgs.pop();
applyArgs.push(nextArg);
this.ifError.apply(null, applyArgs);
}
return;
}
if (this.stepIndex >= this.numSteps) {
cosnole.log("Sequencer: EGADS!!!", "this.stepIndex >= this.numSteps");
console.log("Sequencer: EGADS!!!", "this.stepIndex >= this.numSteps");
return;

@@ -64,0 +77,0 @@ }

{
"name": "ordination",
"version": "0.1.0",
"version": "0.1.1",
"title": "Ordination",
"description": "Mechanisms to organize and regulate the flow of execution.",
"description": "Organize and regulate the flow of execution.",
"keywords": [

@@ -7,0 +7,0 @@ "flow",

# Oridination
Mechanisms to organize and regulate the flow of execution.
Organize and regulate the flow of execution.

@@ -22,2 +22,3 @@ ## NOTE

* 2014-12-11 v0.1.0 Initial release.
* 2014-12-11 v0.1.1 Initial functionality for Sequencer.
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