Hey HN!<p>After years of wrestling with Lodash's quirks and bundle size issues, I decided to build something better. SuperUtilsPlus is my attempt at creating the utility library I wish existed.<p>What makes it different?<p>TypeScript-first approach: Unlike Lodash's retrofitted types, I built this from the ground up with TypeScript. The type inference actually works the way you'd expect it to.<p>Sensible defaults: Some of Lodash's decisions always bugged me. Like isObject([]) returning true - arrays aren't objects in my mental model. Or isNumber(NaN) being true when NaN literally stands for "Not a Number". I fixed these footguns.<p>Modern JavaScript: Built for ES2020+ with proper ESM support. No more weird CommonJS/ESM dance.
Actually tree-shakable: You can import from specific modules (super-utils/array, super-utils/object) for optimal bundling. Your users will thank you.<p>The best parts IMO:<p>compactNil() - removes only null/undefined, leaves falsy values like 0 and false alone<p>differenceDeep() - array difference with deep equality (surprisingly useful)<p>Better random utilities with randomUUID() and randomString()<p>debounce() that actually works how you expect with proper leading/trailing options<p>Also genuinely curious - what are your biggest pain points with utility libraries? Did I miss any must-have functions?
> Like isObject([]) returning true - arrays aren't objects in my mental model.<p>Correct me if I am wrong, but Array factually are JS objects and "[] instanceof Object" is true.<p>Fair enough if that does not fit your mental model, but I would not use any library that treats facts like opinions.
What I’d like is a utility library like this, but instead of it being an actual library, be it some utility that generates a single file with exports of the few functions I need. Even just something that would make copy pasting them easier.<p>As in, I want actual zero dependencies, not even the library itself. The reason: I never want these to randomly update.
We use es-toolkit to replace Lodash - how would you compare your library?<p>We just migrated a React app with around 500k LOC and this worked quite well and flawless.
I don't think we've really seen many successors to LoDash other than Ramda because the platform now has many of Underscore's functions built in.
Nice work! Reminds me of <a href="https://github.com/angus-c/just">https://github.com/angus-c/just</a><p>Suggestion: add more tests and run some benchmarks
don't discount the value of a good docs site.
that was one of things i loved about lodash that made it so easy to use, and to discover all the functionality it offered. So if you looking to replace it, would be good to have similar docs.
About pain points / feature requests:<p>Is there an idiomatic way to duplicate a hash while replacing one of its values, preferably something that supports nesting?<p>Whenever I work with react and immutable structures, this comes up and I hack something simple.<p>I don’t do FE on a regular basis though so my perspective may be skewed.
I wonder why the authors decided to make `flatten` only go one level deep, and have `flattenDeep` that goes N levels. AFAIK most other implementations of Array.flatten do it recursively through however many levels exist.
The published version appears to be CommonJS only:<p><pre><code> $ node index.mjs
import { isString } from 'super-utils-plus'
^^^^^^^^
SyntaxError: Named export 'isString' not found. The requested module 'super-utils-plus' is
a CommonJS module, which may not support all module.exports as named exports.
</code></pre>
You might also need to update some of your type checks to handle wrapper objects like new String() - Object.prototype.toString.call(...) is your friend.
I recommend <a href="https://remedajs.com/" rel="nofollow">https://remedajs.com/</a> - they're always making the types more accurate too. Like groupby has nonempty lists.
We migrated to remeda from Lodash and are pretty happy.
<a href="https://remedajs.com/" rel="nofollow">https://remedajs.com/</a><p>What do you do differently?
I made twitter post 3 or 4 years ago making fun of Lodash team for _still_ not shipping loadash 5 and they didn't like it very much. They started working on Lodash 5 in like 2015 and it still hasn't shipped. Guess we make our own now