@mirei/ts-collections
    Preparing search index...

    Function disjoint

    • Determines whether source and other share no equivalent elements.

      Type Parameters

      • TElement

        Type of elements within the source iterable.

      • TSecond

        Type of elements within the other iterable.

      Parameters

      Returns boolean

      true when the iterables are disjoint; otherwise, false.

      Re-throws any error encountered while iterating source, other, or executing the comparator.

      When the default comparator is used, the implementation buffers the source elements in a Set so it can short-circuit as soon as a shared element is detected. With a custom comparator, every pair of elements is compared, which may iterate each iterable multiple times; prefer the default comparator when possible for better performance.

      const first = [1, 2, 3];
      const second = [4, 5, 6];
      const areDisjoint = disjoint(first, second);
      console.log(areDisjoint); // true