$ npm install exec-stack
const ExecStack = ;
const stack = ; stack; stack; stack;stack;
I'm specifically interested in cars
I'm generic. Hence interested in anything, also cars
I'm generic. Hence interested in anything, also bikes
Optional arguments are written in cursive.
Push a middleware to the stack. If event is omitted, the callback will be called for every execution of the stack.
Returns the position of the middleware in the stack.
Removes a specified middleware from the stack. The middleware is being referenced by a number representing its position in the stack.
Any other argument that is given to
.execute() will also be passed to the functions in the stack.
Returns a promise that is being resolved after everything has finished.
If any middleware calls next.throw() the promise will be rejected.
Set the context to be applied to middleware. When context is omitted it will be cleared to an empty object.
Breaking the loop
If you want to stop the execution of the stack use
next.throw(*error*) which also will reject the promise returned by .run()