Function isManyOf

  • Validate an input is an array of elements from a list of options

    Type Parameters

    • T

      The validated type

    Parameters

    • options: readonly T[]

      The valid options

    Returns ((input) => Validated<T[]>)

    Example

    isManyOf([1, 2, 3])([3, 1]) >>
    {
    valid: true,
    parsed: [3, 1],
    };

    isManyOf([1, 2, 3])([3, 1, 4]) >>
    {
    valid: false,
    error: "Not an array of [1, 2, 3]: [3, 1, 4]",
    };