0.1.0 • Published 4 years ago
simplematch v0.1.0
simplematch
simple pattern match for typescript
Install
npm i simplematch
example
type DemoType = 'cat' | 'dog' | 'bird';
const result = match<DemoType, string>({
cat: () => 'return a string',
dog: () => 'return another string',
bird: () => 'oh',
});
const result2 = match<DemoType, boolean>({
cat: () => true,
dog: () => false,
bird: () => true,
});
0.1.0
4 years ago