Fork me on GitHub

Sebastian

Simple Flow Control For Node.js and the browser

Sebastian is a tool for separating logic into small, manageable chunks of testable code. It builds on jQuery's awesome Deferred API.

Installation

Works as a node module, or in the browser as an AMD module or traditional jQuery plugin.

Simplify!

Take complex code like this example:

And turn it into something easy to read and test:

Now just test one step at a time!

Examples

Check out the examples here.

Anatomy of a step

A step is comprised of:

Keep it simple

A step should ideally do one or two things - it should not be complicated. Try to keep it short and sweet. This is especially useful if you write tests first.

Return Deferreds for Asynchronous Operations

If the step involves an asynchronous call, you can return a jQuery Deferred or Promise to make sure the next step in the flow doesn't execute. If you don't return a Deferred, execution of next step will begin immediately.

Argument Chains

Values returned from upstream step are passed as arguments to downstream step. If step "one" returns "blah", the first argument to step two will be "blah".

Anatomy of a flow

A flow is comprised of:

Flow API