New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

flou

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flou

Simple construction of complex flows.

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

flou

Simple construction of complex flows.

Build Status Coverage Status

NPM

Installation

npm install flou --save

Example

var Flow = require('flou');

var saveOrderPromise = new Flow({ order: someOrder })

	.having('order')
	.run(findCountry, findRegionAndTimezone, findOperator, findOffer)
	
	.having('country', 'regionAndTimezone')
	.run(createClientRecord)

	.having('clientRecord', 'offer')
	.run(createOrderRecord)

	.having('country')
	.run(findShipmentMethod)

	.having('country', 'shipmentMethod', 'orderRecord')
	.run(createOrderShipmentRecord)

	.having('operator', 'orderRecord')
	.run(createOrderCallRecord)

	.having('orderShipmentRecord', 'orderCallRecord')
	.run(updateOrderRecord)
	.returning('updatedOrderRecord')

	.having('updatedOrderRecord')
	.finish();

saveOrderPromise.done(function (context) {
	console.log('Hooray! I have passed all steps of the specified flow! Id of order is', context.order.id);
}, function (error) {
	console.error('Oh no! Flow was interrupted due to', error && error.stack || error);
});

API

Flow(initialValues)

Creates flow object initialized with named values passed as hash.

having(name1, name2, name3, ...)

Starts flow step building by accepting names of flow variables which must be resolved (in terms of promises) before step can start.

run(fn1, fn2, fn3, ...)

Schedules execution of given functions once preconditions are met (see having).

Each function should (but not must!) accept one argument which is hash of named flow variables and should (but not must!) return any value.

Each function result will be saved as flow variable named after function or using value provided via returning (see next section for details). "Named after function" here means equals to function name without leading verb (for example, result of saveOrderRecord will be named orderRecord).

returning(name1, name2, name3, ...)

Explicitly specifies names for function execution results.

finish()

Finalizes flow and returns final promise.

License

BSD

Keywords

flow

FAQs

Package last updated on 29 Oct 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts