angus-c / just

A library of dependency-free JavaScript utilities that do just one thing.
https://anguscroll.com/just
MIT License
6.06k stars 209 forks source link

flatten with depth=1 is not properly applied to the first element #564

Open bd82 opened 1 year ago

bd82 commented 1 year ago

image

Expected result would be [1, 2, 3] But the actual is [[1], 2, 3]

Code snippet:

const flatten = require('just-flatten-it')

flatten([[1], [2], 3], 1);
superhit0 commented 10 months ago

@angus-c I opened a PR for the fix, please let me know your thoughts on this - https://github.com/angus-c/just/pull/577