Function isNumberArray

  • Validate an array of numbers

    Parameters

    • input: unknown

      The raw input

    Returns Validated<number[]>

    Example

    isNumberArray([]) >>
    {
    valid: true,
    parsed: [],
    };

    isNumberArray([1]) >>
    {
    valid: true,
    parsed: [1],
    };

    isNumberArray("") >>
    {
    valid: false,
    error: 'Not an array: ""',
    };

    isNumberArray([""]) >>
    {
    valid: false,
    error: 'Not an array of numbers: [""]',
    };