Function isProperSupersetOf

  • Implementation of the proper superset operation in set theory, which checks if set A is a superset of set B. A proper superset means a set A is a superset of B, but B is not equal to A.

    • Formal definition: A ⊃ B
    • This method runs in bilinear time, or O(n * m), where n = |A| (size of set A), and m = |B| (set of size B)

    Type Parameters

    • TElement

    Parameters

    • a: Set<TElement>

      Set A of type <TElement> elements

    • b: Set<TElement>

      Set B of type <B> elements

    Returns boolean

    Whether A ⊃ B is true

    Example

    // {2, 3, 9} ⊃ {3, 9}
    isProperSupersetOf(new Set([2, 3, 9]), new Set([3, 9])); // true

Generated using TypeDoc