aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib/nodeify.js
blob: 4e111c8b2756edd10b0344637ceae11c38267d11 (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)
  }
}