Function parseIntX

  • There are a lot of ways to convert a string to a number in JavaScript. And they are all slightly different!

    I get rid of NaNs, infinities, numbers with a fraction, or integers that are too big to fit into JavaScript numbers. These are all converted into undefined.

    Parameters

    • source: undefined | null | string

      The input to parse

    Returns number | undefined

    A finite integer or undefined if the parse failed.