Parses value as an integer, returning it if it meets the range criteria. If not, defaultValue is returned.
value
range
defaultValue
const i = integerParse('10', 'positive'); // 10const i = integerParse('10.5', 'positive'); // 10const i = integerParse('0', 'nonZero', 100); // 100 Copy
const i = integerParse('10', 'positive'); // 10const i = integerParse('10.5', 'positive'); // 10const i = integerParse('0', 'nonZero', 100); // 100
NaN is returned if criteria does not match and no default is given
const i = integerParse('10', 'negative'); // NaN Copy
const i = integerParse('10', 'negative'); // NaN
Parses
value
as an integer, returning it if it meets therange
criteria. If not,defaultValue
is returned.NaN is returned if criteria does not match and no default is given