Function isProperSubsetOf

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

    • 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 <TElement> elements

    Returns boolean

    Whether A ⊂ B is true

    Example

    // {1} ⊂ {1, 3}
    isProperSubsetOf(new Set([1]), new Set([1, 3])); // true

Generated using TypeDoc