template-project/node_modules/await-to-js/dist/await-to-js.es5.js
2025-05-30 18:13:30 +08:00

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