js - unflattenObject: fails to correctly restore nested properties
tbasse opened this issue · comments
Thorsten Basse commented
The unflattenObject
function works fine with the provided example
unflattenObject({ 'a.b.c': 1, d: 1 }); // { a: { b: { c: 1 } }, d: 1 }
But it won't work as expected on { 'a.b': 1, 'a.c': 2, d: 3 }
, returns an object with a.b.
missing.
It also throws on nested values that are not numbers like { 'a.b': 'foo', d: 3 }
, results in Unexpected token in JSON
.
See https://runkit.com/tbasse/5f2a9929c9b5c9001a4d3a6e for some tests
sparky evangelista commented
I'll like to take a look at this issue.
Angelos Chalaris commented
@Sparkadelic177 Sure, go ahead! 👌
Gengiskhan Brasil commented
Hum..
sparky evangelista commented
@pachbrasil you can go for it if you want.
EternalCoders commented
sure
Taimoor Ali commented
@Sparkadelic177 can I please take this?
Taimoor Ali commented
@Chalarangelo I have opened a pull request for this.
Thankyou !