Skip to content
James edited this page May 30, 2017 · 4 revisions

Extend 🎼

easy extension, debugging, and decorating factories

overview

.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

extendAlias

chain.extendAlias(['eh'], 'canada')
chain.eh == chain.canada

extendIncrement

chain.extendIncrement(['index']).index().index().index()
chain.get('index') === 3

extendWith

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
default true
chain.extendWith(['truth'], true).truth().get('truth') === true
default false
chain.extendWith(['lies'], false).lies().get('lies') === false

🔗 related

Clone this wiki locally