Loading problem…
Convert a flat object with dot-separated paths into a nested object.
Implement:
function unflattenObject(flatObj) {}Behavior:
{"a.b": 1} => { a: { b: 1 } }){} for invalid non-object inputunflattenObject({
'user.name': 'Sam',
'user.age': 20,
});
// { user: { name: 'Sam', age: 20 } }
unflattenObject({
a: 1,
'config.theme.color': 'blue',
});
// { a: 1, config: { theme: { color: 'blue' } } }