thenction
thenction is an abbreviation of thenable function.
Install
$ npm i -S thenction
Usage
const thenction = Promise// or: const thenction = require('thenction')(require('your-favorite-promise-lib')) const twiceLog = Promise//=> 4 //=> 4//=> 4 Promise//=> 4//=> 8 const twiceLogSleep = twiceLog Promise//=> 4// after 1s//=> 8 const twiceLogError = twiceLog Promise//=> 4//=> Error: wow
API
require('thenction')(Promise)
Returns a thenction(baseFn)
function.
Promise
Type: Fucntion
Your favorite Promise implementation
thenction(baseFn)
Returns a thenable function.
baseFn
Type: Function
Base function to be composed by then
and catch
.
thenableFunction.then(onFulfilled, [onRejected])
onFulfilled
Type: Function
onRejected
Type: Function
thenableFunction.catch(onRejected)
onRejected
Type: Function
License
MIT and 🍣 © TSUYUSATO "MakeNowJust" Kitsune <make.just.on@gmail.com> 2016