Skip to content

Conversation

EvgenBabenko
Copy link

No description provided.

@codecov-commenter
Copy link

Codecov Report

Merging #32 (4b1d87d) into main (9a1f2d2) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@ Coverage Diff @@ ## main #32 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 2 2 Lines 86 86 Branches 13 13 ========================================= Hits 86 86 
Impacted Files Coverage Δ
src/arrayToTree.ts 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9a1f2d2...4b1d87d. Read the comment docs.

@philipstanislaus
Copy link
Owner

Thanks for your PR. What is the usecase of this? Properties in objects are always strings, so a null id should have a special meaning, which is currently not implemented.

@EvgenBabenko
Copy link
Author

I thought that the reason the same as undefined.
We just have string | null | undefined in our types, so without null we have to override it outside arrayToTree, it's a bit painful to write smth like array.map(el => ({ ...el, id: el.id ?? ''})

@philipstanislaus
Copy link
Owner

Understood. I looked at the code again and realized that the typings on id and parentId are not really required. Removed them to make less assumptions about the items getting into the function.

Released these changes as v1.9.1 https://github.com/philipstanislaus/performant-array-to-tree/releases/tag/v1.9.1

Thanks for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants