Skip to main content
Module

x/ts_matches/src/parsers/shape-parser.ts>ShapeParser

Being able to pattern match in typescript
Latest
class ShapeParser
implements IParser<A, B>
import { ShapeParser } from "https://deno.land/x/ts_matches@v5.4.0/src/parsers/shape-parser.ts";

Given an object, we want to make sure the key exists and that the value on the key matches the parser

Constructors

new
ShapeParser(
parserMap: [key in keyof B]: Parser<unknown, B[key]>,
isPartial: boolean,
parserKeys?,
description?,
)

Type Parameters

A extends unknown
Key extends string | number | symbol
B

Methods

parse<C, D>(a: A, onParse: OnParse<A, B, C, D>): C | D