-
Notifications
You must be signed in to change notification settings - Fork 8
DotProp
James edited this page Jun 24, 2017
·
2 revisions
DotProp
🎼
togglable dot.prop access
// 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']))
- dot-prop (extends this!)
- lodash.get