games_app/backend/node_modules/injectpromise/index.js
2026-06-29 15:01:23 +02:00

16 lines
352 B
JavaScript

module.exports = function (scope) {
return (func, ...args) => {
return (function (func, ...args) {
return new Promise((resolve, reject) => {
func(...args, (err, res) => {
if (err) {
reject(err)
} else {
resolve(res)
}
})
})
})(func.bind(scope), ...args)
}
}