isguard-ts
    Preparing search index...

    Function isSet

    • Creates a SetTypeGuard that validates that the value is a Set and all its elements match the provided type guard.

      Can be shortened with TypeGuard.set.

      Type Parameters

      • T

        The type of elements in the set

      Parameters

      • isValue: TypeGuard<T>

        The type guard for individual set elements

      Returns SetTypeGuard<T>

      A type guard for Set<T>

      const isNumberSet = isSet(isNumber); // or isNumber.set()

      isNumberSet(new Set([1, 2, 3])); // true
      isNumberSet(new Set([1, "hello"])); // false