• Sorts an array of objects based on a specified key and sort order. Handles date strings, strings, numbers, booleans, objects, and arrays. The sort order can be 'asc', 'desc', or 'noSort'. For dates, the dateFormatForSort can be 'YYYY/MM/DD', 'DD/MM/YYYY', 'MM/DD/YYYY', or 'none'.

    Type Parameters

    • T extends SortableObject

      The type of the objects in the array to be sorted. It should be a subtype of SortableObject, i.e., an object with string keys and values of any type.

    Parameters

    • data: T[]

      The array of objects to be sorted.

    • sortKey: undefined | keyof T

      The key to sort the objects by.

    • sortOrder: "asc" | "desc" | "noSort"

      The order to sort the array in.

    • dateFormatForSort: string

      The format of the date string for sorting purposes.

    Returns T[]

    • The sorted array of objects.

Generated using TypeDoc