@webdeveric/utils
    Preparing search index...

    Function byProperty

    • Create a comparator that sorts by the value at the given object property, using compareFn to compare those values.

      Type Parameters

      • T extends object
      • K extends string | number | symbol = keyof T

      Parameters

      Returns CompareFn<T>

      [{ age: 30 }, { age: 20 }].sort(byProperty(bySubtraction, 'age')); // [{ age: 20 }, { age: 30 }]