sindresorhus / arrify

Convert a value to an array
MIT License
131 stars 28 forks source link

added flattening option #5

Closed harrysolovay closed 5 years ago

harrysolovay commented 5 years ago

Sorry my Prettier did a number on your semi-colons. I added an optional 2nd parameter that flattens deeply-nested arrays into 1D. If you don't like this as a feature, t'sall good :) that being said, I think this non-breaking feature would come in handy.

sindresorhus commented 5 years ago

I don't think this feature fits into this module. The goal of the module is to ensure a value is an array, not that it's a flat array. You can actually do this pretty easily now natively with [1, [2, [3]]].flat(Infinity).