common-stuff
    Preparing search index...

    Function deduplicateBy

    • Removes duplicate values from the array by given callback.

      Type Parameters

      • T

      Parameters

      • array: T[]
      • key: (value: T) => unknown

      Returns T[]

      deduplicateBy([ { a: 1 }, { a: 1 } ], v => v.a)
      // [ { a: 1 } ]
    • Removes duplicate values from the array by given callback.

      Type Parameters

      • T

      Parameters

      • array: readonly T[]
      • key: (value: T) => unknown

      Returns readonly T[]

      deduplicateBy([ { a: 1 }, { a: 1 } ], v => v.a)
      // [ { a: 1 } ]