parsea
v0.10.2
Published
parser combinator library for parsing ArrayLike.
Downloads
22
Readme
parsea
parsea is a parser combinator library for parsing ArrayLike with TypeScript.
import * as P from "parsea";
const parser = P.seq([
P.regex(/-?\d+(\.\d+)?/).map(Number.parseFloat),
P.regex(/[A-Z]+/i),
]).map(([value, unit]) => ({ value, unit }));
P.parseA(parser, "273.15K"); // => { value: 273.15, unit: "K" }
See also examples/ directory.
Inspired by