Belin.io Core
    Preparing search index...

    Class Sort

    Represents information relevant to the sorting of data items.

    Index

    Constructors

    Accessors

    Methods

    • Returns a new iterator that allows iterating the entries of this sort.

      Returns IterableIterator<SortEntry>

      An iterator over the attribute/order pairs.

    • Appends the specified attribute to this sort.

      Parameters

      • attribute: string

        The attribute name.

      • order: SortOrder

        The sort order.

      Returns this

      This instance.

    • Gets the attribute/order pair at the specified index.

      Parameters

      • index: number

        The position in this sort.

      Returns null | SortEntry

      The attribute/order pair at the specified index, or null if it doesn't exist.

    • Compares the specified objects, according to the current sort attributes.

      Parameters

      • x: object

        The first object to compare.

      • y: object

        The second object to compare.

      Returns number

      A value indicating the relationship between the two objects.

    • Removes the specified attribute from this sort.

      Parameters

      • attribute: string

        The attribute name.

      Returns void

    • Gets the order associated with the specified attribute.

      Parameters

      • attribute: string

        The attribute name.

      Returns null | SortOrder

      The order associated with the specified attribute, or null if the attribute doesn't exist.

    • Gets the icon corresponding to the specified attribute.

      Parameters

      • attribute: string

        The attribute name.

      Returns string

      The icon corresponding to the specified attribute.

    • Returns a value indicating whether the specified attribute exists in this sort.

      Parameters

      • attribute: string

        The attribute name.

      Returns boolean

      true if the specified attribute exists in this sort, otherwise false.

    • Gets the index of the specified attribute in the underlying list.

      Parameters

      • attribute: string

        The attribute name.

      Returns number

      The index of the specified attribute, or -1 if the attribute is not found.

    • Prepends the specified attribute to this sort.

      Parameters

      • attribute: string

        The attribute name.

      • order: SortOrder

        The sort order.

      Returns this

      This instance.

    • Returns a value indicating whether the current sort satisfies the specified conditions.

      Parameters

      • conditions: Partial<{ attributes: string[]; max: number; min: number }> = {}

        The conditions to satisfy.

      Returns boolean

      true if the current sort satisfies the specified conditions, otherwise false.

    • Sets the order of the specified attribute.

      Parameters

      • attribute: string

        The attribute name.

      • order: SortOrder

        The sort order.

      Returns this

      This instance.

    • Returns a JSON representation of this object.

      Returns string

      The JSON representation of this object.

    • Converts this sort to an SQL clause.

      Parameters

      • escape: (identifier: string) => string = ...

        A function used to escape the SQL identifiers.

      Returns string

      The SQL clause corresponding to this object.

    • Returns a string representation of this object.

      Returns string

      The string representation of this object.

    • Creates a new sort from the specified attribute and order.

      Parameters

      • attribute: string

        The sort attribute.

      • order: SortOrder = SortOrder.Ascending

        THe sort order.

      Returns Sort

      The sort corresponding to the attribute and order.

    • Creates a new sort from the specified string.

      Parameters

      • value: string

        A string representing a sort.

      Returns Sort

      The sort corresponding to the specified string.