ts-iterable-functions
    Preparing search index...

    Function orderByConst

    • Sorts the source iterable in ascending order based on a key selector.

      Curried version of _orderBy.

      Type Parameters

      • T

        Element type produced by the source iterable.

      • TCmp

        Key type produced by the selector.

      Parameters

      • selector: (x: T) => TCmp

        Selector receiving each element and returning the key used for ordering.

      Returns (src: Iterable) => OrderedIterable

      An OrderedIterable representing the ascending order and supporting chained thenBy calls.

      Error Rethrows any error thrown by selector.

      const words = ["pear", "banana", "fig", "apple"];
      const byLength = [..._orderBy(words, (word) => word.length)];
      console.log(byLength); // ["fig", "pear", "apple", "banana"]

      or using the curried version:

      const byLength = [
      ...pipeInto(
      ["pear", "banana", "fig", "apple"],
      orderBy((word) => word.length)
      ),
      ];
      console.log(byLength); // ["fig", "pear", "apple", "banana"]