Skip to content

TypeScript multimethods inspired by Clojure multimethods

License

Notifications You must be signed in to change notification settings

darky/ts-multimethod

Repository files navigation

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

About

TypeScript multimethods inspired by Clojure multimethods

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published