@mirei/ts-collections
    Preparing search index...

    Function orderDescending

    • Sorts the elements of the sequence in descending order using the provided comparator.

      Type Parameters

      • TElement

        Type of elements within the source iterable.

      Parameters

      • source: Iterable<TElement>

        The source iterable.

      • Optionalcomparator: OrderComparator<TElement, TElement>

        Optional order comparator used to compare elements. Defaults to the library's standard order comparison when omitted.

      Returns IOrderedEnumerable<TElement>

      An ordered sequence sorted descending.

      Sorting is deferred; the sequence is ordered only when iterated. Use thenBy/thenByDescending on the returned sequence to specify secondary keys.

      const numbers = [3, 1, 5, 2, 4];
      const sorted = orderDescending(numbers).toArray();
      console.log(sorted); // [5, 4, 3, 2, 1]