TS-Scribe - v0.6.2
    Preparing search index...

    Function uniqueArray

    • Returns a new array with all duplicate values removed, preserving only unique values.

      This function only works with primitive types (string, number, boolean, null, undefined, symbol, bigint). For deduplicating objects or arrays, use uniqueBy instead.

      Type Parameters

      • T extends Primitive

        The primitive type of the array elements

      Parameters

      • array: T[]

        The array to remove duplicates from

      Returns T[]

      A new array containing only unique values from the input array

      uniqueArray([1, 2, 2, 3, 3, 3, 4])
      // => [1, 2, 3, 4]
      uniqueArray(['a', 'b', 'a', 'c'])
      // => ['a', 'b', 'c']