nest-to-object
v1.0.1
Published
nest flat object with key name splitter
Downloads
1
Readme
nest-to-object
npm install nest-to-object
> const { nestToObject } = require('nest-to-object');
> process.env
{
number: '3',
boolean: 'true',
parent1__child1: 'foo',
parent1__child2: 'bar',
parent2__child1: 'baz',
ignored: 'ignored'
}
> nestToObject(process.env)
{
number: 3,
boolean: true,
parent1: {
child1: 'foo',
child2: 'bar'
},
parent2: {
child1: 'baz'
},
ignored: 'ignored
}
> nestToObject(process.env, ['number', 'boolean', 'parent1', 'parent2'])
{
number: 3,
boolean: true,
parent1: {
child1: 'foo',
child2: 'bar'
},
parent2: {
child1: 'baz'
}
}