ixfx
    Preparing search index...

    Function unique

    • Tracks unique values. Returns true if value is unique. Alternatively: uniqueInstances

      const t = unique();
      t(`hello`); // true
      t(`hello`); // false

      Uses JSON.stringify to compare anything which is not a string.

      Provide a custom function to convert to string to track uniqueness for more complicated objects.

      const t = unique(p => p.name);
      t({ name:`John`, level:2 }); // true

      // Since we're judging uniques by name only
      t({ name:`John`, level:3 }); // false

      Return function throws an error if value is null or undefined.

      Type Parameters

      • T

      Parameters

      Returns TrackUnique<T>