aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/nodeify.js
blob: 299bfe624362867d1ee465a4887bd54b2b57e741 (plain) (blame)
1
2
3
4
5
6
7
8
9
const promiseToCallback = require('promise-to-callback')

module.exports = function(fn, context) {
  return function(){
    const args = [].slice.call(arguments)
    const callback = args.pop()
    promiseToCallback(fn.apply(context, args))(callback)
  }
}