fetch-fic
Version: 
Package up delicious, delicious fanfic from various sources into epub ebooks ready for reading in your ereader of choice.
23 lines (20 loc) • 510 B
JavaScript
module.exports = promisify
const Bluebird = require('bluebird')
function promisify (fn, bind) {
  const pfn = Bluebird.promisify(fn)
  return function () {
    const self = bind || this
    return Bluebird.all(arguments).spread(function () {
      return pfn.apply(self, arguments)
    })
  }
}
promisify.sync = function (fn, bind) {
  return function () {
    const self = bind || this
    return Bluebird.all(arguments).spread(function () {
      return fn.apply(self, arguments)
    })
  }
}