promise-break
Break out of a promise chain
This is an experiment. I personally wouldn't recommend this.
Feedback wanted on the issue tracker.
See "How do I break out of a promise chain?" for a better way.
Install
$ npm install --save promise-break
Usage
Here the onlyRunConditional
promises are skipped if conditional
is falsy:
const pBreak = ; ; //=> '🦄'
API
pBreak([value])
Starts the break. Any .then()
's between here and pBreak.end()
are skipped.
value
Value to pass down the chain after pBreak.end()
.
pBreak.end
Ends the break. Make sure not to have any other .catch()
handlers between pBreak()
and here.
Related
License
MIT © Sindre Sorhus