Skip to main content

number

Tries to match a given number.

info

Available since: v1.0.0-alpha.1

Type declaration

const number: (searchString: number) => Parser;

Example

In this example we are going to parse the number 1337.

import { number } from "rudus";

const parser = number(1337);

const result = parser.run(`1337`);

The result of the parser above will be:

{
"input": "1337",
"isError": false,
"offset": 4,
"result": "1337"
}