Function isNumberString

  • Validate a number string

    Parameters

    • input: unknown

      The raw input

    Returns Validated<number>

    Example

    isNumberString("1") >>
    {
    valid: true,
    parsed: 1,
    };

    isNumberString("") >>
    {
    valid: false,
    error: 'Not a number: ""',
    };

    isNumberString("NaN") >>
    {
    valid: false,
    error: 'Not a number: "NaN"',
    };

    isNumberString("Infinity") >>
    {
    valid: false,
    error: 'Not a number: "Infinity"',
    };