whole
whole parses a positive whole number without leading zeros, e.g. 0, 7, 420. Returns a decimal number obtained using parseInt with radix of 10.
Usage
ts
const Parser = whole()Success
ts
run(Parser).with('42')
{
isOk: true,
start: 0,
end: 2,
pos: 2,
value: 42
}Failure
ts
run(Parser).with('x')
{
isOk: false,
start: 0,
end: 0,
pos: 0,
expected: 'whole number'
}