Function alphaLocaleNullable

  • Returns a comparator function rather than being itself a comparator function. This is just a thin wrapper around the built-in String.prototype.localeCompare(), whose options are the same as Intl.Collator(), which is documented at MDN.

    Remarks

    As of this writing (January 3, 2023), some Android browsers do not support this function..

    Example

    import * as A from "flurp/array";
    import * as C from "flurp/comparator";

    const sortSv = A.sortWith(C.alphaLocaleNullable("sv", { sensitivity: "base" }));
    sortSv([null, "a", "ä"]); // ["a", "ä", null]

    Parameters

    • Optional locales: string | string[]
    • Optional options: CollatorOptions

    Returns ((a: undefined | null | string, b: undefined | null | string) => number)

      • (a: undefined | null | string, b: undefined | null | string): number
      • Parameters

        • a: undefined | null | string
        • b: undefined | null | string

        Returns number