ts-data-forge
    Preparing search index...
    • Creates a new ISet instance from an iterable of elements.

      This factory function accepts any iterable of elements, including arrays, JavaScript Sets, other ISets, or custom iterables. Duplicate elements in the input iterable will be automatically deduplicated in the resulting set.

      Performance: O(n) where n is the number of elements in the iterable.

      Type Parameters

      • K extends Primitive

        The type of the elements. Must extend MapSetKeyType.

      Parameters

      • iterable: Iterable<K>

        An iterable of elements (e.g., Array, Set, ISet, etc.)

      Returns ISet<K>

      A new ISet instance containing all unique elements from the iterable.

      const set = ISet.create(['a', 'a', 'b']);

      assert.deepStrictEqual(Array.from(set), ['a', 'b']);