Maths
isDisjointFrom

Returns a boolean indicating if this set has no elements in common with the given set.

The set can be either an Array or Set.

Venn Diagram

Related

Syntax

import { isDisjointFrom } from '@opentf/std';
 
isDisjointFrom(
  a: unknown[] | Set<unknown>,
  b: unknown[] | Set<unknown>
): boolean

Examples

isDisjointFrom([1, 3, 5], [2, 4]) //=> true
 
const primes = new Set([2, 3, 5, 7, 11, 13, 17, 19]);
const squares = new Set([1, 4, 9, 16]);
isDisjointFrom(primes, squares) //=> true
 
isDisjointFrom([1, 2, 3, 5], [2, 4]) //=> false
 
const composites = new Set([4, 6, 8, 9, 10, 12, 14, 15, 16, 18]);
const squares = new Set([1, 4, 9, 16]);
 
isDisjointFrom(composites, squares) //=> false

Try