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

https://github.com/didierfranc/sweetch

Switch as a function
https://github.com/didierfranc/sweetch

functional-programming javascript reactjs switch typescript

Last synced: 2 months ago
JSON representation

Switch as a function

Awesome Lists containing this project

README

        

# sweetch 🎛

Switch as a function, you will be able to use it everywhere, mostly when native switch will produce syntax errors.

```js
import sweetch from "sweetch";

const result = sweetch(
key,
["a", 1],
["b", 2],
["c", 3],
["d", 4],
["e", 5],
"default"
);

// if key === "a" result will be 1
```