alga-async-process
v1.0.10
Published
Node.js: async process, a way to avoid huge try {} catch blocks in JS using GO approach
Downloads
2
Readme
AlgaAsyncProcess
Node.js: async process, a way to avoid huge try {} catch blocks in JS using GO approach
Get Started
npm i --save npm i alga-async-process
Example
import aap, {resolve, reject} from 'AlgaAsyncProcess';
(async()=>{
const [err, result] = await aap(__MyPromise__);
if(err) {
return reject(err);
}
if(!result) {
return reject('no results');
}
return result;
})();
IMPORTANT
fullReturn option
by default the returning array will be in one variable
const [err, entireArray] = await aap(
Promise.resolve([1,2,3])
);
NO fullReturn option
const [err, one, two, three] = await aap(
Promise.resolve([1,2,3]),
true // true
);
const [err, a, b] = await aap(
Promise.all([
__MyPromise__,
__MyPromise__
]),
true // true
);
Author
Alga Leal (4lg4)