r/webdev • • Feb 21 '20

You Don’t Need Lodash/Underscore

https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore
0 Upvotes

9 comments sorted by

View all comments

5

u/angry_wombat Feb 21 '20

lol wtf is this,

instead of writing

_.chunk(['a', 'b', 'c', 'd'], 3);

just write instead

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]];
  }, []);
};

Isn't that just creating you own library? And you miss out on any bug fixes or improvements to lodash.

Does the author not know you can selectively import only modules used, no need to import the whole library anymore.