Function setIsSuperset

  • Checks if a given set is a superset of another set. This function iterates over each element in the subset set and checks if it exists in the set set. If any element in the subset set does not exist in the set set, the function returns false. Otherwise, it returns true.

    Type Parameters

    • T

    Parameters

    • set: Set<T>

      The set to check if it is a superset.

    • subset: Set<T>

      The set to check if it is a subset.

    Returns boolean

    A boolean indicating whether the set is a superset of the subset.

    Remarks

    This function will return true if all elements of the subset are found in the set, otherwise it will return false.

    Typeparam

    T - The type of elements in the set.

    Example

    const set1 = new Set([1, 2, 3, 4]);
    const set2 = new Set([2, 4]);
    setIsSuperset(set1, set2);
    //=> true

Generated using TypeDoc