1.1.0 • Published 10 months ago
codec-builder v1.1.0
codec-builder
Helps you build type-safe codecs.
Installation
npm install codec-builderUsage
import { stringifier, parser } from "codec-builder";
type AllowedTypes = number | bigint;
const stringifyNumber = stringifier<AllowedTypes>((value) => value.toString());
const parseNumber = parser<AllowedTypes>((value) => BigInt(value));
const string = stringifyNumber(7777);
const number = parseNumber(string);