update snippets 0-All
This commit is contained in:
committed by
Agamemnon Zorbas
parent
6bedb8fba4
commit
0c129cdd02
@ -7,7 +7,9 @@ If the property does not exists returns `undefined`.
|
||||
```js
|
||||
const select = (from, selector) =>
|
||||
selector.split('.').reduce((prev, cur) => prev && prev[cur], from);
|
||||
|
||||
// const obj = {selector: {to: {val: 'val to select'}}};
|
||||
// select(obj, 'selector.to.val'); -> 'val to select'
|
||||
```
|
||||
|
||||
```js
|
||||
const obj = {selector: {to: {val: 'val to select'}}};
|
||||
select(obj, 'selector.to.val'); -> 'val to select'
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user