1 |
function denodeify(fn, scope) { |
|
2 |
function _denodeify(...args) { |
|
3 |
return new Promise((resolve, reject) => { |
|
4 |
fn.apply(scope || this, [
|
|
5 |
...args, |
172✔ |
6 |
(err, result) => { |
|
7 |
if (err) {
|
|
8 |
return reject(err);
|
× |
9 |
} |
× |
10 |
return resolve(result);
|
172✔ |
11 |
}, |
172✔ |
12 |
]); |
172✔ |
13 |
}); |
172✔ |
14 |
} |
172✔ |
15 |
return _denodeify;
|
2✔ |
16 |
} |
2✔ |
17 | 1✔ | |
18 |
module.exports = { |
1✔ |
19 |
denodeify, |
1✔ |
20 |
}; |
1✔ |