Skip to main content

isDisjoint

Callable


  • Two sets of elements are disjoint when they have no members in common.

    The isDisjoint determines whether a given collection of sets are disjoint or not.

    This problem can be solved by checking if there is any member of the first set, that is also a member of the second set. If there exists such a member, then the sets are not mutually exclusive.

    Example

    isDisjoint([1, 2, 3], [2, 3, 4])
    // => false

    isDisjoint([1, 2, 3], [4, 5, 6])
    // => true

    Proposals


    Type parameters

    • T

      The element type.

    Parameters

    Returns boolean

    True if xs and ys are disjoint, false otherwise.