Created
October 26, 2016 06:45
-
-
Save justinvdm/12be93b61adc626746810b612b98bfc2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| !function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(n.flume=n.flume||{})}(this,function(n){"use strict";function t(n,t){return t={exports:{}},n(t,t.exports),t.exports}function e(n){return function(t,e){return[null,n(e)]}}function r(n,t){function e(n,e){var r=t(n,e);return[r,r]}return{init:n,process:e}}function u(n){return function(t,e){return[null,v([n(e),e]).then(i)]}}function i(n){return n[0]?n[1]:y}function o(n,t){function e(n,e){return[n,t(n,e)]}return{init:n,process:e}}var f="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},c=t(function(n,t){!function(n,e){"function"==typeof n.define&&n.define.amd?n.define(e):"object"==typeof t?e(!0):n.flume=e()}(f,function(t){function e(){return new h}function r(n){function t(n,t,r){var u=x(e.inputs,n),i=u.length,o=-1;for(r=k(i,r||j);++o<i;)u[o].handle(t,r);return e}var e={};return e.dispatch=t,e.inputs=g(e,n),e}function u(n,t){return new l(n,t)}function i(n){return new p(n.map(P))}function o(n){return f(s,n)}function f(n,t){return A(F(t),{type:n})}function c(){}function s(){}function a(){}function l(n,t){this.type=n,this.value=t}function p(n){this.messages=n}function h(){}function d(n){n=F(n),this.type=E(n.type,c),this.init=E(n.init,j),this.process=n.process}function y(n,t,e,r){this.graph=n,this.def=t,this.child=e,this.index=r,this.handle=v(this)}function g(n,t,e,r){var u=t.length-1;if(0>u)return[];for(u&&(e=new y(n,new d(t[u]),e,r));--u>0;)e=new y(n,new d(t[u]),e,0);return m(n,t[0],e)}function m(n,t,e){t=D(t);for(var r,u=[],i=-1,o=t.length;++i<o;)if(r=t[i],Array.isArray(r))u.push.apply(u,g(n,r,e,i));else{if(!(r instanceof h))throw Error("Expected input or array but got "+O(r));u.push(new y(n,r,e,i))}return u}function v(n){return{InputDef:w,ProcessorDef:b}[n.def.constructor.name](n)}function w(n){return function(t,e){n.child.handle(t,n,e)}}function b(n){function t(n){a.push(n),l||e()}function e(){p=a.shift(),p&&r()}function r(){return l=!0,d().then(C).then(f,c).then(o).then(null,J)}function i(){return n.def.type===p.msg.type?n.def.process(h,p.msg.value,p.parent.index,n.graph):[h,p.msg]}function o(t){var r=p.end;l=!1,p=null,n.child?n.child.handle(t,n,r):r(),e()}function f(n){return Array.isArray(n)?(h=n[0],n[1]):N}function c(t){if(!n.child)throw t;return u(s,t)}var a=[],l=!1,p=null,h=n.def.init(),d=I(i);return function(n,e,r){n=_(n).messages;for(var u=-1,i=n.length-1;++u<i;)t({msg:n[u],parent:e,end:j});i>-1&&t({msg:n[i],parent:e,end:r})}}function x(n,t){for(var e,r=[],u=n.length,i=-1;++i<u;)e=n[i],e.def===t&&r.push(e);return r}function A(){for(var n,t={},e=Array.prototype.slice.call(arguments),r=-1,u=e.length;++r<u;){n=e[r];for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i])}return t}function j(){return null}function E(n,t){return void 0===n?t:n}function q(n){return n}function S(n){throw n}function _(n){return n instanceof p?n:i([n])}function P(n){return n instanceof l?n:u(c,n)}function D(n){return Array.isArray(n)?n:[n]}function F(n){if("function"!=typeof n&&"function"!=typeof(n||0).process)throw Error("Expected function or object with 'process' function property but got "+O(n));return"function"==typeof n?{process:n}:n}function O(n){return null!==n?typeof n:"null"}function k(n,t){var e=0;return function(){++e>=n&&t.apply(null,arguments)}}function I(n){return function(){try{var t=n.apply(this,arguments);return M(t)}catch(e){if(e instanceof K)throw e.error;return B(e)}}}function M(n){return H(n)?n:z(n)}function z(n){return new L(n,!1)}function B(n){return new L(n,!0)}function C(n){return Array.isArray(n)&&n.filter(H).length>0?G(n):M(n)}function G(n){function t(){return M(n[++f]).then(e)}function e(n){u.push(n)}function r(){return u}for(var u=[],i=n.length,o=-1,f=-1,c=z(null);++o<i;)c=c.then(t);return c.then(r)}function H(n){return!!(n||0).then}function J(n){throw this instanceof L?new K(n):n}function K(n){this.error=n}function L(n,t){this.value=n,this.isFailure=t}var N=u(a,null);return L.prototype.then=I(function(n,t){return this.isFailure?(t||S).call(this,this.value):(n||q).call(this,this.value)}),t?void(n.exports={create:r,input:e,message:u,batch:i,except:o,trap:f,nil:N,conj:A,maybeAsync:I,resolveSeq:C}):{create:r,input:e,message:u,batch:i,except:o,trap:f,nil:N,conj:A,maybeAsync:I,resolveSeq:C}})}),s=c.create,a=c.input,l=c.message,p=c.batch,h=c.except,d=c.trap,y=c.nil,g=c.conj,m=c.maybeAsync,v=c.resolveSeq;n.map=e,n.reduce=r,n.filter=u,n.sink=o,n.__moduleExports=c,n.create=s,n.input=a,n.message=l,n.batch=p,n.except=h,n.trap=d,n.nil=y,n.conj=g,n.maybeAsync=m,n.resolveSeq=v,Object.defineProperty(n,"__esModule",{value:!0})}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment