construct
Builds an object from key paths and values
693 bytes
Usage
The opposite of crush, given an object that was crushed into key paths and values will return the original object reconstructed.
import * as _ from 'radashi'
const flat = { name: 'ra', power: 100, 'friend.name': 'loki', 'friend.power': 80, 'enemies.0.name': 'hathor', 'enemies.0.power': 12,}
_.construct(flat)// {// name: 'ra',// power: 100,// friend: {// name: 'loki',// power: 80// },// enemies: [// {// name: 'hathor',// power: 12// }// ]// }