es-toolkit
es-toolkit copied to clipboard
Promote min/max out of compat
In looking at replacing Lodash with es-toolkit in our codebase, I noticed that we make heavy use of Lodash's min and max, but those functions are flagged as compat in es-toolkit. ("This module is designed to facilitate a smooth transition and should be replaced with the original es-toolkit for optimal performance once the migration is complete.")
Could you please consider promoting min/max out of compat and making them fully supported? For many use cases, they have JS equivalents (e.g., _.max(values) is similar to Math.max(...values), but the Lodash versions have some advantages:
- They work with larger arrays.
- They tolerate null, undefined, and NaN. (E.g.,
Math.min(NaN, 1)returns NaN - which seems mathematically odd, becauseNaN < 1evaluates to false - while_.min([NaN, 1])returns 1.) - They return undefined instead of ±infinity if no valid values are found. (This is more debatable, but I'd argue it's better from a type safety perspective.)
- They work with anything comparable (so they accept strings). (This isn't a consideration for my use cases.)
If I can help by submitting a PR, please let me know.