Re:NPM package 'isarray' is downloaded 40M times a week
by hn_throwaway_99 on Sunday November 08, 2020 @10:39AM
(#25026400)
Did you actually read the function in this library. While yes it's a single line I'm convinced that anyone who thinks this is an "obvious" implementation hasn't actually read the code.
[ Parent
| on HN ]
Re:NPM package 'isarray' is downloaded 40M times a week
by gonzo41 on Sunday November 08, 2020 @10:44AM
(#25026435)
Actually I did read the function, and I thought about the cycles that toString.call(arr) == '[object Array]' costs.
Re:NPM package 'isarray' is downloaded 40M times a week
by seattle_spring on Sunday November 08, 2020 @11:02AM
(#25026588)
... which only gets called if the native implementation of `isArray` is not found.
Re:NPM package 'isarray' is downloaded 40M times a week
by karmakaze on Sunday November 08, 2020 @11:37AM
(#25026856)
ES5 is a low requirement. I'd rather use a lib that did a better job than one that returns true for the string '[object Array]' or have the app decide for itself what its own types are.
Re:NPM package 'isarray' is downloaded 40M times a week
by hn_throwaway_99 on Sunday November 08, 2020 @10:57AM
(#25026560)
Is there some other implementation you think would work?