unflatten
v1.0.4
Published
The opposite of `flatten`
Downloads
6,744
Readme
unflatten
var obj = unflatten(subject, [opts])
Opposite of flatten-obj
. Unflattens an object with delimited keys
subject (object) - Object that needs to be unflattened
[opts] (object|string|boolean) - Optional.
- Provide a string as a shortcut for
{ separator: opts }
- Provide a string as a shortcut for
- Provide a boolean as a shorcut for
{ objectMode: opts }
- Provide a boolean as a shorcut for
- Provide an object to set both options
{ separator: '/', objectMode: true }
- Provide an object to set both options
Available options:
separator (string) - defaults to
'.'
objectMode (boolean) - defaults to
false
- return (object) obj - Nested Javascript object
const unflatten = require('unflatten')
unflatten({
'a.b.c': 'd'
})
/*
{
a: {
b: {
c: 'd'
}
}
}
*/