UNPKG

async-to-sync

Version:

async-to-sync is help you for Javascript asynchronous function to synchronous function.

1 lines 173 B
const ats=(a, b)=>{const c=a=>new Promise(d=>a(d));(async()=>{try{for(const e of a)await c(e)}catch(e){if(typeof b!=='function')return console.error('Error:',e);b();}})();};