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
- Host: GitHub
- URL: https://github.com/didierfranc/sweetch
- Owner: didierfranc
- Created: 2018-12-11T09:45:33.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-09T11:33:28.000Z (over 2 years ago)
- Last Synced: 2025-01-22T02:17:11.440Z (4 months ago)
- Topics: functional-programming, javascript, reactjs, switch, typescript
- Language: TypeScript
- Size: 922 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
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
```