Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/darky/ts-multimethod
TypeScript multimethods inspired by Clojure multimethods
https://github.com/darky/ts-multimethod
clojure method multimethod typescript
Last synced: 3 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 (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-10-10T13:24:41.000Z (over 3 years ago)
- Last Synced: 2024-10-30T05:26:33.372Z (4 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
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
```