Entity Array Sorter

Sorting functions sort the array in place and also return the sorted array.

Type Parameters

  • Entity extends Object

Constructors

Properties

Methods

Constructors

Properties

array: (Entity & {
    [k: string]: any;
})[]

Methods

  • Sort an array of entities hierarchically by a specified property's value.

    Entities will be placed immediately after their parents. The parentProperty property, if present, should hold either null, undefined, or the entity's parent.

    Parameters

    • property: string

      The name of the property to sort entities by.

    • parentProperty: string

      The name of the property which holds the parent of the entity.

    • __namedParameters: SortOptions<Entity> = {}

    Returns Entity[]

  • Sort an array of entities by parent and a specified property's value.

    Entities' will be sorted by their parents' properties, then the entities' properties.

    Parameters

    • property: string

      The name of the property to sort entities by.

    • parentProperty: string

      The name of the property which holds the parent of the entity.

    • __namedParameters: SortOptions<Entity> = {}

    Returns Entity[]

  • Sort an array of entities by a specified property's value.

    Parameters

    • property: string

      The name of the property to sort entities by.

    • identiticalResolver: SortOptions<Entity> = {}

      A function to resolve order of identical entities.

    Returns Entity[]