ts-data-forge
    Preparing search index...
    • Checks if two ISet instances are structurally equal.

      Two ISets are considered equal if they have the same size and contain exactly the same elements. The order of elements does not matter for equality comparison since sets are unordered collections. Elements are compared using JavaScript's === operator.

      Performance: O(n) where n is the size of the smaller set.

      Type Parameters

      • K extends Primitive

        The type of the elements.

      Parameters

      • a: ISet<K>

        The first ISet instance to compare.

      • b: ISet<K>

        The second ISet instance to compare.

      Returns boolean

      true if the sets contain exactly the same elements, false otherwise.

      const first = ISet.create<number>([1, 2]);
      const second = ISet.create<number>([2, 1]);
      const third = ISet.create<number>([1, 3]);

      assert.ok(ISet.equal(first, second));
      assert.notOk(ISet.equal(first, third));