npkill icon indicating copy to clipboard operation
npkill copied to clipboard

excludeDirs.flat() is not a function

Open ladmerc opened this issue 6 years ago • 3 comments

Is your feature request related to a problem? Please describe. Using the exclude option logs an error excludeDirs.flat is not a function. This is because the .flat method user here only exists from node 11.0.0.

Describe the solution you'd like I'm not sure if other similar newer methods are used elsewhere in the code, but it'd be nice to document the node versions required. Ideally though, it'll be nice to use alternative methods that exist in older versions, or a polyfill. This would make the library more portable

Describe alternatives you've considered It works without exclude. In my local node_modules/npkill, I added this polyfill from stackoverflow.

A more robust polyfill can be found here.

Additional context Add any other context or screenshots about the feature request here.

ladmerc avatar Oct 23 '19 12:10 ladmerc

Wow you are absolutely right. We launched very quickly to operate the exclude feature but forget to check compatibility precisely (big mistake).

Thank you very much for reporting the error!!

Of course, your PR will be more than welcome if you want to do it!

zaldih avatar Oct 23 '19 21:10 zaldih

Got it. What would be preferred: updating the docs to specify the node version required, or adding a polyfill for the .flat method

ladmerc avatar Oct 24 '19 16:10 ladmerc

I think the most interesting thing would be to make npkill as compatible as possible for everyone :) . So a good polyfill would be the most successful.

If you need more information don't hesitate to ask

zaldih avatar Oct 24 '19 16:10 zaldih

Closing due to the fact that node11 will no longer be compatible soon

zaldih avatar Oct 09 '22 13:10 zaldih