Skip to main content
Module

x/pazza/mod.ts>map

Parser combinators library designed for Deno, but also works on browsers and Node.js.
Go to Latest
function map
Re-export
import { map } from "https://deno.land/x/pazza@v0.3.0/mod.ts";

Execute the embedded parser. If it succeeds, apply provided function on the output.

const parser = map(digit(), value => Number.parseInt(value));
parser("5").output === 5;

Type Parameters

T
U
E
I extends Input
CtxIn
CtxOut

Parameters

parser: IParser<T, E, I, CtxIn, CtxOut>

embededd parser

fn: (output: T) => U

function to be applied on successful output