Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/huanghaiyang/whenable

case when then else
https://github.com/huanghaiyang/whenable

Last synced: 6 days ago
JSON representation

case when then else

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'))