@laserware/arcade
    Preparing search index...

    Function toSorted

    • Creates a copy of the specified array of items sorted by the optional compareFunc. This is done because the native sort function mutates the array.

      Type Parameters

      • T

        Type of item in the specified items array.

      Parameters

      • items: T[]

        Array to sort.

      • OptionalcompareFunc: (a: T, z: T) => number

        Optional compare function to use for sorting.

      Returns T[]

      Array of items sorted naturally or by the specified compareFunc.

      Use the toSorted built-in method on arrays.