@grahlnn/matchable
v0.1.1
Published
Ergonomic matchable helpers for enums, unions, and objects.
Readme
matchable
Tiny, type-safe helpers for matching enums, unions, and objects.
Install
bun add @grahlnn/matchableUsage
import { me } from "@grahlnn/matchable";
const status = me<"idle" | "loading" | "error">("loading");
const label = status.match({
idle: () => "Idle",
loading: () => "Loading",
_: () => "Error",
});