Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

  • compare(a: any, b: any, collator?: Collator): number
  • If the parameters are numbers or undefined, this function will return a simple comparison between them. If they are any other type, .toString() will be called on them, and passed on to numberAwareStringCompare.

    Parameters

    • a: any
    • b: any
    • collator: Collator = COLLATOR_DA

    Returns number

  • numberAwareStringCompare(s1: undefined | string, s2: undefined | string, collator?: Collator): number
  • Sorts strings, taking into account emebedded (integer) numbers, so e.g. "A2: Something" sorts before "A10: Other".

    Parameters

    • s1: undefined | string
    • s2: undefined | string
    • collator: Collator = COLLATOR_DA

      Can be given a Collator to sort according to language rules. By default uses a new Intl.Collator('da').

    Returns number