Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ISorter<T, R>

Type parameters

  • T

  • R

Hierarchy

  • ISorter

Callable

  • __call(a: T, b: T): number
  • Parameters

    • a: T
    • b: T

    Returns number

Index

Methods

addFallback

  • addFallback<A>(fallback?: SortFallback<T, R, A>, ...args: A): this
  • Sets a fallback sorter for when two items are in the same position

    Type parameters

    • A: any[]

    Parameters

    Returns this

setMapper

  • setMapper<A>(mapper: EntryMapper<T, R, A>, ...args: A): this
  • Sets a custom entry mapper, which takes an item to sort and returns a string or number representing its "sort value", which is what is actually compared.

    These values are cached by the sorter

    Type parameters

    • A: any[]

    Parameters

    Returns this

setReverse

  • setReverse(): this
  • setReverse(reverse: boolean): this
  • Sets this sort to be reversed

    Returns this

  • Sets whether this sort should be reversed

    Parameters

    • reverse: boolean

    Returns this

setSorter

  • setSorter<A>(sorter?: SortFallback<T, R, A>, ...args: A): this
  • Sets a custom sorter to override the default sort functionality

    Note: When a custom sorter is used, fallbacks registered in setFallback will not be.

    Type parameters

    • A: any[]

    Parameters

    Returns this

Generated using TypeDoc