Skip to content
/ parsea Public

parser combinator library for parsing array-like

License

Notifications You must be signed in to change notification settings

uzmoi/parsea

Repository files navigation

parsea

NPM Version JSR Version License npm bundle size Codecov

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

About

parser combinator library for parsing array-like

Topics

Resources

License

Stars

Watchers

Forks