Stak
Create re-usable stacks of code to run.
Status: beta
Example
var stack = Stak;stack;
Motivation
Similar to Step except you create a stack that can be re-used. This means you create the functions once and pass data in through the this context.
Documentation
link
Stak.make(...)Shortcut for Object.create(Stak).constructor(...)
Stak;
link
Stak.use(...)Add extra functions to the stack
var s = Stak;s;s; // it works
link
Stak.handle(context)This starts a stack. The first function in the stack will be called and the next function will be called once the first function calls this.next. The context object is passed in as this
.
var context = {};var s = Stak;s;
The context also has two special properties floor
and ceil
which form the floor and the ceiling of the stack of functions. This allows you to add a function before and after all the other functions
var stack = Stak;stack;
link
Stak.floorA default floor for this instance of the stack. If no floor is passed through handle then this floor will be used
link
Stak.ceilA default ceiling for this instance of the stack. If no ceil is passed through handle then this ceil will be used
Installation
npm install stak
Tests
make test
Contributors
- Raynos