@metreeca/core - v0.13.0
    Preparing search index...

    Function locale

    • Creates a comparator that orders strings according to locale-sensitive collation rules.

      Null and undefined values are treated as less than any string and equal to each other, as in ascending.

      Parameters

      • Optionallocales: LocalesArgument

        Locales whose collation rules apply (defaults to the runtime locale)

      • Optionaloptions: CollatorOptions

        Collation options, such as case sensitivity or numeric ordering of digit sequences

      Returns Comparator<Nullable<string>>

      A comparator ordering strings by the collation rules of locales

      Each call prepares the collation rules anew, at a noticeable cost. The returned comparator is meant to be created once and reused: created inside another comparator or a loop, it pays that cost again at every comparison.