Pathfinder 1e for Foundry VTT
    Preparing search index...

    Function naturalSort

    • Sort an array in-place using a language-aware comparison function that can sort by a property key. If no property key is provided, the array is sorted directly.

      Type Parameters

      • T

      Parameters

      • arr: T[]

        The array to sort

      • OptionalpropertyKey: string = ""

        The property key to sort by, if any; can be a dot-separated path

      • OptionalsortOptions: { ascending?: boolean; ignorePunctuation: boolean; numeric: boolean } = {}

        Options affecting the sorting of elements

        • Optionalascending?: boolean

          Whether the sort should be ascending (true) or descending (false).

        • ignorePunctuation: boolean

          Whether punctuation should be ignored.

        • numeric: boolean

          Whether numeric collation should be used, such that "1" < "2" < "10".

      Returns T[]

      The sorted array