hughsk / hughsk/flat

unflatten object with number as key replaces object with an array of n number length

Open
#103 2 comments 6 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.8k
Forks
197
PR merge metrics
No merged PRs in 30d

Description

I have a use case where i always have to unflatten a json object and i dont know if that object is already unflattened. If there is a number for an object key unflatten method create and array which replaces the original object and the array length matches the number plus one. With the last element being the element originally stored by the key. This happens only for nest objects not root level.

example:

flat.unflatten({ testing: { 12: 12 }}) => { testing: [,,,,,,,,,,,,12]}

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.