vigour-io / unflatten

Opposite of flatten-obj
ISC License
2 stars 2 forks source link

Nested keys being lost #1

Closed jackdclark closed 3 years ago

jackdclark commented 4 years ago

Hello! I just ran into a bug with unflatten. If a key is passed in at the same time as a nested path that has the same top-level key, the nested path gets lost in the result, e.g:

> const unflatten = require('unflatten')
undefined
> unflatten({ 'a.b': 'c', a: 'b' })
{ a: 'b' }
miketheprogrammer commented 3 years ago

This is not a bug, it is bad data. You are telling it to overwrite the previous value of a with 'b' Closing.

miketheprogrammer commented 3 years ago

Hmm, guess I am only an npm contributor now.

jackdclark commented 3 years ago

You're completely right. This was a long time ago so I may have oversimplified my example for the issue that I was running into, but I can't remember exactly. Until then, let's close this @miketheprogrammer. Thank you.