Parses a string to a number with the given radix. Returns undefined instead of NaN if it fails.
string
number
radix
undefined
NaN
const parseDecimal = parseInteger(10);parseDecimal("101"); // 101parseDecimal("101.5"); // 101parseDecimal("invalid"); // undefined
Curried function with radix in context.
Radix to use for parsing (16 for hexadecimal, 10 for decimal, and so on).
16
10
Parses a
string
to anumber
with the givenradix
. Returnsundefined
instead ofNaN
if it fails.Example
Returns
Curried function with
radix
in context.