!function(n,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):n.promiseful=r()}(this,function(){"use strict";function n(n){function r(n,r){return new K.Promise(function(t,e){r().then(function(r){n.push(r),t(n)}).catch(e)})}return K.reduce(n,r,[])}function r(r){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=F.collection.arrayize(r);return t<=0||t>=e.length?K.all(e):n(F.collection.chunk(e,t).map(function(n){return function(){return K.all(n)}})).then(F.collection.flatten)}function t(n,r){function t(n,r){return new K.Promise(function(t,e){r(n).then(t).catch(e)})}return K.reduce(n,t,r)}function e(n){return K.loop(n,function(){return!1})}function u(n,r){for(var t=arguments.length,e=Array(t>2?t-2:0),u=2;u2?t-2:0),u=2;u1?r-1:0),e=1;e1?r-1:0),e=1;e1?r-1:0),e=1;e1?r-1:0),e=1;e2&&void 0!==arguments[2]?arguments[2]:1,e=F.collection.arrayize(n);return new K.Promise(function(n,u){function i(e){if(c-=1,!l)return r(e)&&(a+=1)===t?(l=!0,void n(e)):void(0===c&&(l=!0,n(!1)))}function o(n){c-=1,l||(l=!0,u(n))}var c=e.length,a=0,l=!1;e.forEach(function(n){return n().then(i,o)})})}function w(n,r){var t=F.collection.arrayize(n).map(function(n){return r.bind(null,n)});return new S.Functions(t).attachKernel(function(n){return n.some(function(n){return n})}).attachMethod("race",function(n){return g(n,function(n){return n})})}var k="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},A=function(n,r){if(!(n instanceof r))throw new TypeError("Cannot call a class as a function")},P=function(){function n(n,r){for(var t=0;t=e.length)return[e];for(var u=[],i=0;i0&&(this.Promise=arguments.length<=0?void 0:arguments[0]),this.Promise}},{key:"promisify",value:function(n){var r=this;return function(){for(var t=arguments.length,e=Array(t),u=0;u1?e-1:0),i=1;i=e.length)n(c);else{var a=u.fulfil(e[t]);r(c,a,t).then(o.bind(this,t+1)).catch(i)}}o(0,t)})}},{key:"reduceRejects",value:function(n,r,t){var e=F.collection.arrayize(n),u=this;return new this.Promise(function(n,i){function o(t,c){if(t>=e.length)i(c);else{var a=u.fulfil(e[t]);r(c,a,t).then(n).catch(o.bind(this,t+1))}}o(0,t)})}},{key:"loop",value:function(n,r){for(var t=arguments.length,e=Array(t>2?t-2:0),u=2;u0&&r.apply(void 0,e)?n.apply(void 0,e):u()})}}]),n}())("undefined"!=typeof Promise?Promise:null),j={all:K.all.bind(K),race:K.race.bind(K),series:n,parallel:K.all.bind(K),parallelLimit:r,relay:o},O=function(){function n(r){A(this,n),this.coll=r}return P(n,[{key:"attachMethod",value:function(n,r){for(var t=arguments.length,e=Array(t>2?t-2:0),u=2;u=r.length)return{done:!0};var t=r[n];return n+=1,{done:n>r.length,value:t}}}});var S={Functions:O},E={promisify:K.promisify.bind(K),all:K.all.bind(K),race:K.race.bind(K),reduce:K.reduce.bind(K),series:n,parallel:K.all.bind(K),parallelLimit:r,relay:o,waterfall:t,inject:K.reduce.bind(K),fold:K.reduce.bind(K),tryEach:o,each:s,eachOf:y,map:p,mapOf:v,filter:d,groupBy:m,every:b,some:w,mapValues:v,applyEach:c,applyEachOf:a,applyMap:l,applyMapOf:f,times:h,forever:e,until:u,whilst:i};return E.promise=function(n){return n?(K.promise(n),E):K.promise()},E}); //# sourceMappingURL=promiseful.min.js.map