-
Notifications
You must be signed in to change notification settings - Fork 8
Extend
James edited this page May 30, 2017
·
4 revisions
Extend
🎼
easy extension, debugging, and decorating factories
.debug
is built into Extend
, it's a unique property
- available with
.get('debug')
, - settable by
.debug(boolean | string | any)
, -
is not in the .store so it will not affect
.entries
or other functions
chain.extendAlias(['eh'], 'canada')
chain.eh == chain.canada
chain.extendIncrement(['index']).index().index().index()
chain.get('index') === 3
with an object
chain.extendWith({thing1: 'dr', thing2: 'dr'})
const {thing1, thing2} = chain.thing1().thing2().entries()
thing1 === 'dr'
thing1 === thing2
with an array and a value
chain.extendWith(['thing1', 'thing2'], 'dr')
const {thing1, thing2} = chain.thing1().thing2().entries()
thing1 === 'dr'
thing1 === thing2
chain.extendWith(['truth'], true).truth().get('truth') === true
chain.extendWith(['lies'], false).lies().get('lies') === false