Skip to content

DotProp

James edited this page Jun 24, 2017 · 2 revisions

DotProp 🎼

togglable dot.prop access

extends ChainedMap

definition

// overrides .set, .has, .get, .delete with dot.prop access
interface DotProp extends Composable, ChainedMap {
	dot(enabled: boolean): ChainAble
}
const chain = new Chain()

chain.set('moose.simple', 1)

chain.get('moose')        == {simple: 1}
chain.get('moose.simple') == 1

chain.set('moose.canada.eh', true)
chain.set('moose.canada.igloo', true)

// set, has, get, delete :-)
chain.delete('moose.canada.eh')

// also works with an array
isTrue(chain.get(['moose', 'canada', 'igloo']))

🔗 related

Clone this wiki locally