UNPKG

foxts

Version:

Opinionated collection of common TypeScript utils by @SukkaW

13 lines (11 loc) 587 B
/** * This is an alternative to `String.prototype.localeCompare`, but way more performant. * * `String#localeCompare` is slow because it supports internationalization (e.g. `Intl.Collator`). * But if you are only working with ASCII-only characters, this function will produce the same result * as `String#localeCompare` with en-US settings, but much faster. * * This function is expected to be used as a sorter callback for `Array#sort`, `Array#toSorted`, and similar functions. */ declare function fastStringCompare(a: string, b: string): number; export { fastStringCompare };