promise-handler-to
v1.0.5
Published
A simple package to handle promises more efficently
Downloads
352
Readme
Go style error handling for promises
Usage example:
const { to } = require("promise-handler-to");
async function test() {
const [error, value] = await to(someFunctionThatReturnsAPromise());
if (error) {
console.log(result.error);
}
console.log(value);
}