protostate
Prototypal inheritance based states.
var State = ; var state = one:1;state = Statenextstate two:2;var two = state;state = Statenextstate three:3;state = Statenextstate four:4;state = Statenextstate five:5;var five = state; console;// [five, four, three]
API
new State({optional:'setup'})
or simplyState({...})
State.next(state, {optional:'setup'})
create a new state that inherits another oneState.prev(state)
return previously inherited state, if any, ornull
State.diff(prev, state)
orState.diff(state, prev)
return an array of keys representing current state differencesState.keys(state)
return all state keys, inherited or not (Object.keys(state)
to obtain only current list of keys)State.merge(state)
flattened new stateState.size(state)
inheritance chain dept (how many states in the chain)
ISC License