match
import { match } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/free.ts";Pattern match on a Free structure to extract values.
@example
import { match, node, link } from "./free.ts";
const matcher = match(
(value) => `Single value: ${value}`,
(first, second) => `Combined: ${first} and ${second}`
);
const single = node(42);
const combined = link(node(1), node(2));
console.log(matcher(single)); // "Single value: 42"
console.log(matcher(combined)); // "Combined: [object Object] and [object Object]"