Converts JSON's '.' properties into complex objects.
npm install node-mappr
var mappr = require('node-mappr')
var car = { id: 1, name: 'Nissan Tiida' }
car['owner.id'] = 1
car['owner.name'] = 'Felipe Mendonça Marques Silva'
console.log(car);
### Output ###
{
id: 1,
name: 'Nissan Tiida',
"owner.id" : 1,
"owner.name" : 'Felipe Mendonça Marques Silva'
}
var newCar = mappr(car)
console.log(newCar)
### Output ###
{
id: 1,
name: 'Nissan Tiida',
owner: {
id: 1,
name: 'Felipe Mendonça Marques Silva'
}
}