3 ms·
what are the arguments against moment/lodash being included in the "javascript stdlib" or the language itself? im sure there are good reasons, curious what they
by swyx 8y ago
what are the arguments against moment/lodash being included in the "javascript stdlib" or the language itself? im sure there are good reasons, curious what they are.
- mickael-kerjean 8y agoFor moment.js, it's already standard, we have very cool methods available from a date object (toLocaleString, toLocalDateString, ....) + the Intl global object
- outsidetheparty 8y agoI kinda have the opposite question: I've honestly never understood lodash's popularity. Even before ES6, so much of it seemed to be just slightly different syntax for things that already exist. I mean, clearly I'm missing something, lots of devs seem to love it and that can't be for no reason; but every time I've encountered it in code I'm maintaining it's been trivially replaceable with vanilla methods, which makes me wonder what the point of including it in the project in the first place was.
- plopz 8y agoI find myself frequently using it for debounce, throttle, isEmpty, cloneDeep and memoize.
- ggregoire 8y agoFunctions like unionBy, intersectionBy, differenceBy, groupBy, mergeWith, mapValues, flatten already exist in JavaScript? Not even listing all the basic functions not available before ES5/ES6 (find, filter, some, every, Object.keys, Object.values…). This lib is popular because nobody wants to rewrite these functions manually.
- Roboprog 8y agoYou might try replacing Lodash with Ramda. You have to get your head around “partial function application” (if you haven’t already), at which point all the bits for processing arrays and associative arrays via FP techniques really starts to gel. E.g. - https://ramdajs.com/docs/#find https://ramdajs.com/docs/#find Var find_default = R.find( R.prop( ‘default’ ) ) Var list = [ { name: ‘Abe’, default: false }, { name: ‘Bob’, default: true }, { name: ‘Chuck’ } ] Find_default( list ) //. -> { name: ‘Bob’, default: true } (Apologies for gratuitous caps and periods my iPad is forcing in)
- swyx 8y agoi'd say that lodash really did give a lot of great stuff pre es6. old habits die hard.