UNPKG

486 BJavaScriptView Raw
1/**
2 * @param { Promise } promise
3 * @param { Object= } errorExt - Additional Information you can pass to the err object
4 * @return { Promise }
5 */
6function to(promise, errorExt) {
7 return promise
8 .then(function (data) { return [null, data]; })
9 .catch(function (err) {
10 if (errorExt) {
11 Object.assign(err, errorExt);
12 }
13 return [err, undefined];
14 });
15}
16
17export { to };
18export default to;
19//# sourceMappingURL=await-to-js.es5.js.map