fetch-fic
Version:
Package up delicious, delicious fanfic from various sources into epub ebooks ready for reading in your ereader of choice.
22 lines (19 loc) • 492 B
JavaScript
module.exports = promisify
const util = require('util')
const Bluebird = require('bluebird')
function promisify (fn, bind) {
const raw = util.promisify(fn)
return function () {
const self = bind || this
return Bluebird.all(arguments).then(args => {
return raw.apply(self, args)
})
}
}
promisify.args = function (fn, bind) {
return function () {
const self = bind || this
return Bluebird.all(arguments).then(args => fn.apply(self, args))
}
}