> Like isObject([]) returning true - arrays aren't objects in my mental model. Correct me if I am wrong, but Array factually are JS objects and "[] instanceof Object" is true. Fair enough if that does not fit your mental model, but I would not use any library that treats facts like opinions.
I agree with the author that it’s almost never what you want. But I agree with you that it’s the reality of the platform, ignoring it will cause its own problems. I’d surface the footgun rather than trying to pretend it’s not there: isNonArrayObject and isObjectOrArray, or something like that
Show HN: SuperUtilsPlus – A Modern Alternative to Lodash
11–20 of 88 posts
Absolutely agree. I also hate that empty arrays are true, which is different from other languages. But I agree that it's better to face the reality of the language than create a function that evaluates [] to false. It trains you a bad habitnand some day that will cause you to introduce a bug.
Re: Show HN: SuperUtilsPlus – A Modern Alternative to Lodash
#12> Like isObject([]) returning true - arrays aren't objects in my mental model. Correct me if I am wrong, but Array factually are JS objects and "[] instanceof Object" is true. Fair enough if that does not fit your mental model, but I would not use any library that treats facts like opinions.
libraries of this sort, especially in JavaScript, often exist to enforce a more reasonable mental model rather than the model baked into the language.
I understand that. I just don't think that it is a good habit. Instead of just learning the languages and it's quirks now you form a bad habit and start to rely on one dependency for all your projects.
Re: Show HN: SuperUtilsPlus – A Modern Alternative to Lodash
#13[dead]
Re: Show HN: SuperUtilsPlus – A Modern Alternative to Lodash
#14We use es-toolkit to replace Lodash - how would you compare your library?
We just migrated a React app with around 500k LOC and this worked quite well and flawless.
Re: Show HN: SuperUtilsPlus – A Modern Alternative to Lodash
#15We migrated to remeda from Lodash and are pretty happy.
https://remedajs.com/
What do you do differently?
Re: Show HN: SuperUtilsPlus – A Modern Alternative to Lodash
#16[flagged]
Re: Show HN: SuperUtilsPlus – A Modern Alternative to Lodash
#17We migrated to remeda from Lodash and are pretty happy. https://remedajs.com/ What do you do differently?
[deleted]
Re: Show HN: SuperUtilsPlus – A Modern Alternative to Lodash
#18[flagged]
[deleted]
Re: Show HN: SuperUtilsPlus – A Modern Alternative to Lodash
#19I recommend https://remedajs.com/ - they're always making the types more accurate too. Like groupby has nonempty lists.
Re: Show HN: SuperUtilsPlus – A Modern Alternative to Lodash
#20[deleted]