https://github.com/darky/ts-multimethod
TypeScript multimethods inspired by Clojure multimethods
https://github.com/darky/ts-multimethod
clojure method multimethod typescript
Last synced: 7 months ago
JSON representation
TypeScript multimethods inspired by Clojure multimethods
- Host: GitHub
- URL: https://github.com/darky/ts-multimethod
- Owner: darky
- License: mit
- Created: 2021-10-09T16:09:44.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-10-10T13:24:41.000Z (about 4 years ago)
- Last Synced: 2025-04-25T21:52:21.279Z (7 months ago)
- Topics: clojure, method, multimethod, typescript
- Language: TypeScript
- Homepage:
- Size: 30.3 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-fp-js - ts-multimethod - TypeScript multimethods inspired by Clojure multimethods. +TS (Libraries)
- awesome-fp-js - ts-multimethod - TypeScript multimethods inspired by Clojure multimethods. +TS (Libraries)
README
# ts-multimethod
TypeScript multimethods inspired by Clojure multimethods
## Example
```typescript
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
```