1.0.10 • Published 6 years ago

alga-async-process v1.0.10

Weekly downloads
4
License
GPL-3.0
Repository
github
Last release
6 years ago

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)

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago