20 lines
486 B
JavaScript
20 lines
486 B
JavaScript
/**
|
|
* @param { Promise } promise
|
|
* @param { Object= } errorExt - Additional Information you can pass to the err object
|
|
* @return { Promise }
|
|
*/
|
|
function to(promise, errorExt) {
|
|
return promise
|
|
.then(function (data) { return [null, data]; })
|
|
.catch(function (err) {
|
|
if (errorExt) {
|
|
Object.assign(err, errorExt);
|
|
}
|
|
return [err, undefined];
|
|
});
|
|
}
|
|
|
|
export { to };
|
|
export default to;
|
|
//# sourceMappingURL=await-to-js.es5.js.map
|