creationix/step — pull request #43 by diogogmt (2012-10-24 00:40:25+00:00)
Title: Ability to exit a Step chain before finishing all registered steps

I started to convert all the asynchronous calls of a project I'm currently working on to use Step.
Everything worked perfectly. However we had some problems in the following use case:

We need to perform three asynchronous calls to a database before we did some calculations.

Sometimes, during the second async call, an error would occur and we needed to stop executing and send a message back to the client.

The problem was that if we returned from the function that caught the error, it would go on to execute the next Step call. We wanted to stop the execution completely and send a response back to the client indicating the error.

The proposed patch adds a new function to the |next| object.
The exitChain function clears the array with the registered Step calls, thus stopping the execution whenever exitChain is called.

I also added a unit test to check the new feature.