Type alias Ow

Ow: {
    create: (<T>(predicate) => ReusableValidator<T>) & (<T>(label, predicate) => ReusableValidator<T>);
    isValid: (<T>(value, predicate) => value is T);
    <T>(value, predicate): asserts value is T;
    <T>(value, label, predicate): asserts value is T;
} & Modifiers & Predicates

Type declaration

    • <T>(value, predicate): asserts value is T
    • Test if the value matches the predicate. Throws an ArgumentError if the test fails.

      Type Parameters

      • T

      Parameters

      • value: unknown

        Value to test.

      • predicate: BasePredicate<T>

        Predicate to test against.

      Returns asserts value is T

    • <T>(value, label, predicate): asserts value is T
    • Test if value matches the provided predicate. Throws an ArgumentError with the specified label if the test fails.

      Type Parameters

      • T

      Parameters

      • value: unknown

        Value to test.

      • label: string

        Label which should be used in error messages.

      • predicate: BasePredicate<T>

        Predicate to test against.

      Returns asserts value is T

  • create: (<T>(predicate) => ReusableValidator<T>) & (<T>(label, predicate) => ReusableValidator<T>)

    Create a reusable validator.

    Param: predicate

    Predicate used in the validator function.

  • isValid: (<T>(value, predicate) => value is T)

    Returns true if the value matches the predicate, otherwise returns false.

      • <T>(value, predicate): value is T
      • Type Parameters

        • T

        Parameters

        • value: unknown

          Value to test.

        • predicate: BasePredicate<T>

          Predicate to test against.

        Returns value is T