An open API service indexing awesome lists of open source software.

https://github.com/zhanba/simplematch

simple type-safe pattern match
https://github.com/zhanba/simplematch

Last synced: about 1 year ago
JSON representation

simple type-safe pattern match

Awesome Lists containing this project

README

          

# simplematch

simple pattern match for typescript

## Install

```
npm i simplematch
```

## example

```typesript
type DemoType = 'cat' | 'dog' | 'bird';

const result = match({
cat: () => 'return a string',
dog: () => 'return another string',
bird: () => 'oh',
});

const result2 = match({
cat: () => true,
dog: () => false,
bird: () => true,
});
```