https://github.com/huanghaiyang/whenable
case when then else
https://github.com/huanghaiyang/whenable
Last synced: 5 months ago
JSON representation
case when then else
- Host: GitHub
- URL: https://github.com/huanghaiyang/whenable
- Owner: huanghaiyang
- License: mit
- Created: 2019-11-23T06:10:29.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T01:30:42.000Z (over 2 years ago)
- Last Synced: 2025-02-05T10:16:25.313Z (5 months ago)
- Language: JavaScript
- Size: 350 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# whenable
case when then else## no if else
when(true)
.then(() => console.log('the condition is true'))
.else(() => console.log('the condition is false'))
or
when(() => true)
.then(() => console.log('the condition is true'))
.else(() => console.log('the condition is false'))
or
when(() => {
return new Promise((resolve, reject) => {
resolve(true)
})
})
.then(() => console.log('the condition is true'))
.else(() => console.log('the condition is false'))