Interface WithOrderedMethods<T>

interface WithOrderedMethods<T> {
    thenBy(keySelector: ((arg: T) => string | number)): OrderedSequence<T>;
    thenBy<TKey>(keySelector: ((arg: T) => TKey), comparer: ICompare<TKey>): OrderedSequence<T>;
    thenByDescending(keySelector: ((arg: T) => string | number)): OrderedSequence<T>;
    thenByDescending<TKey>(keySelector: ((arg: T) => TKey), comparer: ICompare<TKey>): OrderedSequence<T>;
}

Type Parameters

  • T

Methods

  • Order the sequence by another key, ascending.

    // Sort by length of the string, then alphabetical order
    from(['two', 'one', 'thirteen', 'five']).orderBy(x => x.length).thenBy(x => x)
    // => ['one', 'two', 'five', 'thirteen']

    Parameters

    • keySelector: ((arg: T) => string | number)
        • (arg): string | number
        • Parameters

          • arg: T

          Returns string | number

    Returns OrderedSequence<T>

  • Order the sequence by another key, ascending, with a custom comparer.

    See orderBy for an example.

    Type Parameters

    • TKey

    Parameters

    Returns OrderedSequence<T>

  • Order the sequence by another key, descending.

    // Sort by length of the string, then reverse alphabetical order
    from(['one', 'two', 'thirteen', 'five']).orderBy(x => x.length).thenByDescending(x => x)
    // => ['two', 'one', 'five', 'thirteen']

    Parameters

    • keySelector: ((arg: T) => string | number)
        • (arg): string | number
        • Parameters

          • arg: T

          Returns string | number

    Returns OrderedSequence<T>

  • Order the sequence by another key, descending, with a custom comparer.

    See orderBy for an example.

    Type Parameters

    • TKey

    Parameters

    Returns OrderedSequence<T>