float
Note: It doesn't handle floats with exponent parts.
float parses a float number with an optional minus sign, e.g. 0.25, -7.90, 4.20. Returns a decimal number obtained using parseFloat.
Usage
ts
const Parser = float()Success
ts
run(Parser).with('-42.0')
{
isOk: true,
start: 0,
end: 5,
pos: 5,
value: -42
}Failure
ts
run(Parser).with('42')
{
isOk: false,
start: 0,
end: 0,
pos: 0,
expected: 'float number'
}