ixfx
    Preparing search index...

    Function sortByNumericProperty

    • Sorts an array of objects in ascending order by the given property name, assuming it is a number.

      const data = [
      { size: 10, colour: `red` },
      { size: 20, colour: `blue` },
      { size: 5, colour: `pink` }
      ];
      const sorted = Arrays.sortByNumericProperty(data, `size`);

      Yields items ascending order:
      [ { size: 5, colour: `pink` }, { size: 10, colour: `red` }, { size: 20, colour: `blue` } ]

      Type Parameters

      • V
      • Kextendsstring | number | symbol

      Parameters

      • data: readonly V[] | V[]
      • propertyName: K

      Returns V[]