UNPKG

@constantiner/fun-ctional

Version:

The library brings most of the familiar functional techniques (like functional composition) to asynchronous world with shining Promises

3 lines (2 loc) 1.52 kB
!function(r,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(r=r||self).funCtional=n()}(this,function(){"use strict";function a(r,n,t,e,o,i,u){try{var f=r[i](u),a=f.value}catch(r){return void t(r)}f.done?n(a):Promise.resolve(a).then(e,o)}function n(r){return function(r){if(Array.isArray(r)){for(var n=0,t=new Array(r.length);n<r.length;n++)t[n]=r[n];return t}}(r)||function(r){if(Symbol.iterator in Object(r)||"[object Arguments]"===Object.prototype.toString.call(r))return Array.from(r)}(r)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function e(r){return r?1===r.length&&function(r){return Array.isArray(r)||(r||""===r)&&"function"==typeof r[Symbol.iterator]}(r[0])?n(r[0]):r:[]}var o=Symbol.for("Custom Promise Handling Support");return function(){for(var r=arguments.length,t=new Array(r),n=0;n<r;n++)t[n]=arguments[n];return function(){var n=function(f){return function(){var r=this,u=arguments;return new Promise(function(n,t){var e=f.apply(r,u);function o(r){a(e,n,t,o,i,"next",r)}function i(r){a(e,n,t,o,i,"throw",r)}o(void 0)})}}(regeneratorRuntime.mark(function r(n){return regeneratorRuntime.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",e(t).reduce(function(r,n){var t=n[o];return t?t(r):r.then(n)},Promise.resolve(n)));case 1:case"end":return r.stop()}},r)}));return function(r){return n.apply(this,arguments)}}()}}); //# sourceMappingURL=apipe.min.js.map