Each step is isolated from the next to prevent intermingling of concerns and dependencies. Your approach or tooling to do a step may need to change and it should be relatively easy to do so.

CJS-Task helps with this in two ways.

First is an interface to call the next step. Steps are blissfully unaware of each other: they doesn’t need to know what happens when its done. Each runs its course and signals when the next step, whatever it may be, should run.

This independence means you can slot new steps in or replace the components of an existing one effortlessly.

task.step('validate user', function(){ // do validation task.next(); }); task.step('get all updates', function(){ // fetch all updates task.next(); }); task.step('apply user filters', function(){ // filter data task.next(); });