UNPKG

asyncro

Version:

Asynchronous Array Utilities (for await)

3 lines (2 loc) 1.31 kB
function n(n,r){return Promise.all(n.map(r))}function r(n){var r=Array.isArray(n)?[]:{};for(var t in n)n.hasOwnProperty(t)&&(r[t]=n[t]());return r}function t(n,r){return new Promise(function(t,i){return r().then(function(r){try{return n.push(r),t(n)}catch(n){return i(n)}}.bind(this),i)}.bind(this))}function i(r){var t=this;return function(i,e){return new Promise(function(t,u){var o;return n(i,e).then(function(n){try{return o=n,t(i[r](function(n,r){return o[r]}))}catch(n){return u(n)}}.bind(this),u)}.bind(t))}}function e(n,r,t){return new Promise(function(i,e){{var u,o=0;return(u=function(n){for(;n;){if(n.then)return void n.then(u,e);try{if(n.pop){if(n.length)return n.pop()?h.call(this):n;n=f}else n=n.call(this)}catch(n){return e(n)}}}.bind(this))(c);function c(){return o<n.length?r(t,n[o],o,n).then(function(n){try{return t=n,f}catch(n){return e(n)}}.bind(this),e):[1]}function f(){return o++,c}}function h(){return i(t)}}.bind(this))}var u=i("filter"),o=i("find"),c=i("every"),f=i("some");function h(n){return new Promise(function(t,i){return Promise.all(r(n)).then(t,i)}.bind(this))}function s(n){return new Promise(function(r,i){return r(e(n,t,[]))}.bind(this))}export{e as reduce,n as map,u as filter,o as find,c as every,f as some,h as parallel,s as series}; //# sourceMappingURL=asyncro.m.js.map