Function parseNum

  • Converts a string to an integer or a floating value

    Example

    parseNum('64');
    => 64

    parseNum('2.14');
    => 2.14

    Type Parameters

    • ReturnType extends boolean = false

    Parameters

    • value: string | number

      The string to parse

    • Optional returnNull: ReturnType

      Whether to return null if the input cannot be parsed to a number

    Returns ReturnType extends false ? string | number : null | number

Generated using TypeDoc