News for hackers. Stuff that matters.
Re:You-Dont-Need-Lodash-Underscore by mcphage on Friday August 09, 2019 @03:03PM (#20657360)
> people should prefer using standard / built-in functions

I get that, but that's not what this list is: this list is re-implementing lodash / underscore using built-in functions. They're not a 1-for-1 replacement, they're complex implementations which may or may not be correct or efficient. If their solution for replacing _.chunk(...) was some built-in Array.chunk(...) or something, that would be fine. But instead, it's this:

> const chunk = (input, size) => {

> return input.reduce((arr, item, idx) => {

> return idx % size === 0

> ? [...arr, [item]]

> : [...arr.slice(0, -1), [...arr.slice(-1)[0], item]];

> }, []);

> };

That's definitely worse than using lodash.

Re:You-Dont-Need-Lodash-Underscore by tlrobinson on Friday August 09, 2019 @03:39PM (#20657642)
That's exactly what I said in my second paragraph...
Re:You-Dont-Need-Lodash-Underscore by mcphage on Friday August 09, 2019 @04:59PM (#20658218)
Ah, you did. Sorry about that, you’ve caught me running my mouth off before I finish reading.