Skip to main content
Module

x/pazza/mod.ts>escapedWith

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

Parse escaped characters and convert values according to provided "entries".

const parser = escapedWith("\\", [["n", "\n"], ["r", "\r"]]);
parser("\\n").output === "\n";
parser("\\b").ok === false;

Parameters

controlChar: string

Control char, like "\" in most programming languages.

entries: readonly (readonly [string, V])[]

Entries map to look up escaping.

Returns

IParser<V, ErrorKind.EscapedWith, string>