mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
18 lines
376 B
JavaScript
18 lines
376 B
JavaScript
module.exports = function (promiseFn) {
|
|
return function () {
|
|
var args = []
|
|
for (var i = 0; i < arguments.length - 1; i++) {
|
|
args.push(arguments[i])
|
|
}
|
|
var cb = arguments[arguments.length - 1]
|
|
|
|
return promiseFn.apply(this, args)
|
|
.then(function (result) {
|
|
cb(null, result)
|
|
})
|
|
.catch(function (reason) {
|
|
cb(reason)
|
|
})
|
|
}
|
|
}
|