ts-multimethod
v0.2.0
Published
TypeScript multimethods inspired by Clojure multimethods
Downloads
7
Maintainers
Readme
ts-multimethod
TypeScript multimethods inspired by Clojure multimethods
Example
const fn = multimethod(
(n: number) => n, // <- here predicate function
() => "notZeroOrOne", // <- here default function
[0, () => "zero"], // <- further tuples like [predicate, function]
[1, () => "one"]
);
fn(0) // zero