Function validate

  • Validate an input

    Type Parameters

    • T

      The validated type

    Parameters

    • input: unknown

      The raw input

    • parsed: unknown = input

      The parsed input

    Returns Validated<T>

    Example

    validate(1) >>
    {
    valid: true,
    input: 1,
    parsed: 1,
    error: null,
    };

    validate("1", 1) >>
    {
    valid: true,
    input: "1",
    parsed: 1,
    error: null,
    };