Comparing version 1.14.0 to 1.14.1
{ | ||
"name": "oboe", | ||
"version": "1.14.0", | ||
"version": "1.14.1", | ||
"main": "dist/oboe-browser.js", | ||
@@ -5,0 +5,0 @@ "ignore": [ |
@@ -1,1 +0,1 @@ | ||
!function(a,b,c,d,e,f){function g(a,b){return function(){return a.call(this,b.apply(this,arguments))}}function h(a){return function(b){return b[a]}}function i(a,b){return b.apply(f,a)}function j(a){var b=a.length-1,d=c.prototype.slice;if(0==b)return function(){return a.call(this,d.call(arguments))};if(1==b)return function(){return a.call(this,arguments[0],d.call(arguments,1))};var e=c(a.length);return function(){for(var c=0;b>c;c++)e[c]=arguments[c];return e[b]=d.call(arguments,b),a.apply(this,e)}}function k(a){return function(b,c){return a(c,b)}}function l(a,b){return function(c){return a(c)&&b(c)}}function m(){}function n(){return!0}function o(a){return function(){return a}}function p(a,b){return b&&b.constructor===a}function q(a){return a!==f}function r(a,c){return c instanceof b&&y(function(a){return a in c},a)}function s(a,b){return[a,b]}function t(a){return A(a.reduce(k(s),U))}function u(a){return w(function(a,b){return a.unshift(b),a},[],a)}function v(a,b){return b?s(a(V(b)),v(a,W(b))):U}function w(a,b,c){return c?a(w(a,b,W(c)),V(c)):b}function x(a,b,c){function d(a,c){return a?b(V(a))?(c(V(a)),W(a)):s(V(a),d(W(a),c)):U}return d(a,c||m)}function y(a,b){return!b||a(V(b))&&y(a,W(b))}function z(a,b){a&&(V(a).apply(null,b),z(W(a),b))}function A(a){function b(a,c){return a?b(W(a),s(V(a),c)):c}return b(a,U)}function B(a,b){return b&&(a(V(b))?V(b):B(a,W(b)))}function C(a,b){var c;Y.EVENTS.forEach(function(d){var e=b[d];a["on"+d]=e&&function(a){c=e(c,a)}})}function D(a){var b={};return a&&a.split("\r\n").forEach(function(a){var c=a.indexOf(": ");b[a.substring(0,c)]=a.substring(c+2)}),b}function E(){return new XMLHttpRequest}function F(b,c,d,e,g,h,i){"use strict";function j(){var a=c.responseText,b=a.substr(m);b&&k(b),m=S(a)}var k=b(jb).emit,l=b(fb).emit,m=0,n=!0;b(lb).on(function(){c.onreadystatechange=null,c.abort()}),"onprogress"in c&&(c.onprogress=j),c.onreadystatechange=function(){function a(){try{n&&b(ib).emit(c.status,D(c.getAllResponseHeaders())),n=!1}catch(a){}}switch(c.readyState){case 2:case 3:return a();case 4:a();var d=2==String(c.status)[0];d?(j(),b(kb).emit()):l(K(c.status,c.responseText))}};try{c.open(d,e,!0);for(var o in h)c.setRequestHeader(o,h[o]);c.setRequestHeader("X-Requested-With","XMLHttpRequest"),c.withCredentials=i,c.send(g)}catch(p){a.setTimeout(Q(l,K(f,f,p)),0)}}function G(a,b){return{key:a,node:b}}function H(a){function b(a,b){var d=_(V(a));return p(c,d)?f(a,S(d),b):a}function d(a,c){if(!a)return k(c),f(a,ab,c);var d=b(a,c),g=W(d),h=$(V(d));return e(g,h,c),s(G(h,c),g)}function e(a,b,c){_(V(a))[b]=c}function f(a,b,c){a&&e(a,b,c);var d=s(G(b,c),a);return i(d),d}function h(a){return j(a),W(a)||l(_(V(a)))}var i=a(db).emit,j=a(eb).emit,k=a(hb).emit,l=a(gb).emit;return{openobject:function(a,b){var c=d(a,{});return q(b)?f(c,b):c},openarray:function(a){return d(a,[])},key:f,value:g(h,d),closeobject:h,closearray:h}}function I(a,b,c){function d(a){return function(b){return b.id==a}}var e,f;return{on:function(c,d){var g={listener:c,id:d||c};return b&&b.emit(a,c,g.id),e=s(g,e),f=s(c,f),this},emit:function(){z(f,arguments)},un:function(b){var g;e=x(e,d(b),function(a){g=a}),g&&(f=x(f,function(a){return a==g.listener}),c&&c.emit(a,g.listener,g.id))},listeners:function(){return f},hasListener:function(a){var b=a?d(a):n;return q(B(b,e))}}}function J(){function a(a){return c[a]=I(a,d,e)}function b(b){return c[b]||a(b)}var c={},d=a("newListener"),e=a("removeListener");return["emit","on","un"].forEach(function(a){b[a]=j(function(c,d){i(d,b(c)[a])})}),b}function K(a,b,c){try{var d=e.parse(b)}catch(f){}return{statusCode:a,body:b,jsonBody:d,thrown:c}}function L(a,b){function c(a,b,c){var d=A(c);a(b,u(W(v($,d))),u(v(_,d)))}function d(b,d,e){var f=a(b).emit;d.on(function(a){var b=e(a);b!==!1&&c(f,_(b),a)},b),a("removeListener").on(function(c){c==b&&(a(c).listeners()||d.un(b))})}var e={node:a(eb),path:a(db)};a("newListener").on(function(a){var c=/(node|path):(.*)/.exec(a);if(c){var f=e[c[1]];f.hasListener(a)||d(a,f,b(c[2]))}})}function M(a){function b(b,c){return a(b).on(d(c),c),k}function c(a,b){var c=d(b);return a.on(function(){var d=!1;k.forget=function(){d=!0},i(arguments,c),delete k.forget,d&&a.un(b)},b),k}function d(b){return function(){try{b.apply(k,arguments)}catch(c){a(fb).emit(K(f,f,c))}}}function e(b,c){return a(b+":"+c)}function g(a,b){for(var d in b)c(e(a,d),b[d])}function h(a,b,d){return T(b)?c(e(a,b),d):g(a,b),k}var k,l=/^(node|path):./,n=a(gb),p=j(function(b,d){if(k[b])i(d,k[b]);else{var e=a(b),f=d[0];l.test(b)?c(e,f):e.on(f)}return k}),q=function(b,c,d){if("done"==b)n.un(c);else if("node"==b||"path"==b)a.un(b+":"+c,d);else{var e=c;a(b).un(e)}return k};return a(hb).on(function(a){k.root=o(a)}),a(ib).on(function(a,b){k.header=function(a){return a?b[a]:b}}),k={on:p,addListener:p,removeListener:q,emit:a.emit,node:Q(h,"node"),path:Q(h,"path"),done:Q(c,n),start:Q(b,ib),fail:a(fb).on,abort:a(lb).emit,header:m,root:m}}function N(a,b,c){a(jb).on(b.write.bind(b)),a(kb).on(b.close.bind(b)),a(lb).on(function(){C(b,{})}),C(b,c),b.onerror=function(b){a(fb).emit(K(f,f,b))}}function O(a,b,c,d,f){var g=J();return d=d?e.parse(e.stringify(d)):{},c?T(c)||(c=e.stringify(c),d["Content-Type"]=d["Content-Type"]||"application/json"):c=null,b&&F(g,E(),a,b,c,d,f),N(g,Y.parser(),H(g)),L(g,bb),new M(g)}function P(a,b){function c(a,b){return b===!1&&(a+=-1==a.indexOf("?")?"?":"&",a+="_="+(new Date).getTime()),a}return a?a.url?O(a.method||"GET",c(a.url,a.cached),a.body,a.headers,a.withCredentials):O("GET",a,b):O()}var Q=j(function(a,b){var c=b.length;return j(function(d){for(var e=0;e<d.length;e++)b[c+e]=d[e];return b.length=c+d.length,a.apply(this,b)})}),R=(j(function(a){function b(a,b){return[i(a,b)]}var c=t(a);return j(function(a){return w(b,a,c)[0]})}),j(function(a){return j(function(b){for(var c,d=0;d<S(a);d++)if(c=i(b,a[d]))return c})})),S=h("length"),T=Q(p,String),U=null,V=h(0),W=h(1),X=j(t),Y=function(){function a(a){for(var b=0,c=0,d=m.length;d>c;c++){var e=a[m[c]].length;if(e>l)switch(m[c]){case"text":closeText(a);break;default:i(a,"Max buffer length exceeded: "+m[c])}b=Math.max(b,e)}a.bufferCheckPosition=l-b+a.position}function b(a){for(var b=0,c=m.length;c>b;b++)a[m[b]]=""}function c(){var a=this;b(a),a.bufferCheckPosition=l,a.q=a.c=a.p="",a.closed=a.closedRoot=a.sawRoot=!1,a.tag=a.error=null,a.state=p,a.stack=[],a.position=a.column=0,a.line=1,a.slashed=!1,a.unicodeI=0,a.unicodeS=null,a.depth=0,e(a,"onready")}function e(a,b,c){a[b]&&a[b](c)}function f(a,b,c){g(a),e(a,b,c)}function g(a,b){a.textNode&&e(a,b?b:"onvalue",a.textNode),a.textNode=""}function h(a){a.numberNode&&e(a,"onvalue",parseFloat(a.numberNode)),a.numberNode=""}function i(a,b){return g(a),b+="\nLn: "+a.line+"\nCol: "+a.column+"\nChr: "+a.c,b=new d(b),a.error=b,e(a,"onerror",b),a}function j(a){return(a.state!==q||0!==a.depth)&&i(a,"Unexpected end"),g(a),a.c="",a.closed=!0,e(a,"onend"),c.call(a),a}function k(b){var c=this;if(!this.error){if(c.closed)return i(c,"Cannot write after close. Assign an onready handler.");if(null===b)return j(c);for(var d=0,k=b[0],l=c.p;k&&(l=k,c.c=k=b.charAt(d++),l!==k?c.p=l:l=c.p,k);)switch(c.position++,"\n"===k?(c.line++,c.column=0):c.column++,c.state){case p:"{"===k?c.state=r:"["===k?c.state=t:"\r"!==k&&"\n"!==k&&" "!==k&&" "!==k&&i(c,"Non-whitespace before {[.");continue;case w:case r:if("\r"===k||"\n"===k||" "===k||" "===k)continue;if(c.state===w)c.stack.push(x);else{if("}"===k){e(c,"onopenobject"),this.depth++,e(c,"oncloseobject"),this.depth--,c.state=c.stack.pop()||q;continue}c.stack.push(s)}'"'===k?c.state=v:i(c,'Malformed object key should start with "');continue;case x:case s:if("\r"===k||"\n"===k||" "===k||" "===k)continue;":"===k?(c.state===s?(c.stack.push(s),g(c,"onopenobject"),this.depth++):g(c,"onkey"),c.state=q):"}"===k?(f(c,"oncloseobject"),this.depth--,c.state=c.stack.pop()||q):","===k?(c.state===s&&c.stack.push(s),g(c),c.state=w):i(c,"Bad object");continue;case t:case q:if("\r"===k||"\n"===k||" "===k||" "===k)continue;if(c.state===t){if(e(c,"onopenarray"),this.depth++,c.state=q,"]"===k){e(c,"onclosearray"),this.depth--,c.state=c.stack.pop()||q;continue}c.stack.push(u)}'"'===k?c.state=v:"{"===k?c.state=r:"["===k?c.state=t:"t"===k?c.state=y:"f"===k?c.state=B:"n"===k?c.state=F:"-"===k?c.numberNode+=k:"0"===k?(c.numberNode+=k,c.state=J):-1!=="123456789".indexOf(k)?(c.numberNode+=k,c.state=J):i(c,"Bad value");continue;case u:if(","===k)c.stack.push(u),g(c,"onvalue"),c.state=q;else if("]"===k)f(c,"onclosearray"),this.depth--,c.state=c.stack.pop()||q;else{if("\r"===k||"\n"===k||" "===k||" "===k)continue;i(c,"Bad array")}continue;case v:var m=d-1,n=c.slashed,K=c.unicodeI;a:for(;;){for(;K>0;)if(c.unicodeS+=k,k=b.charAt(d++),4===K?(c.textNode+=String.fromCharCode(parseInt(c.unicodeS,16)),K=0,m=d-1):K++,!k)break a;if('"'===k&&!n){c.state=c.stack.pop()||q,c.textNode+=b.substring(m,d-1),c.textNode||e(c,"onvalue","");break}if("\\"===k&&!n&&(n=!0,c.textNode+=b.substring(m,d-1),k=b.charAt(d++),!k))break;if(n){if(n=!1,"n"===k?c.textNode+="\n":"r"===k?c.textNode+="\r":"t"===k?c.textNode+=" ":"f"===k?c.textNode+="\f":"b"===k?c.textNode+="\b":"u"===k?(K=1,c.unicodeS=""):c.textNode+=k,k=b.charAt(d++),m=d-1,k)continue;break}o.lastIndex=d;var L=o.exec(b);if(null===L){d=b.length+1,c.textNode+=b.substring(m,d-1);break}if(d=L.index+1,k=b.charAt(L.index),!k){c.textNode+=b.substring(m,d-1);break}}c.slashed=n,c.unicodeI=K;continue;case y:if(""===k)continue;"r"===k?c.state=z:i(c,"Invalid true started with t"+k);continue;case z:if(""===k)continue;"u"===k?c.state=A:i(c,"Invalid true started with tr"+k);continue;case A:if(""===k)continue;"e"===k?(e(c,"onvalue",!0),c.state=c.stack.pop()||q):i(c,"Invalid true started with tru"+k);continue;case B:if(""===k)continue;"a"===k?c.state=C:i(c,"Invalid false started with f"+k);continue;case C:if(""===k)continue;"l"===k?c.state=D:i(c,"Invalid false started with fa"+k);continue;case D:if(""===k)continue;"s"===k?c.state=E:i(c,"Invalid false started with fal"+k);continue;case E:if(""===k)continue;"e"===k?(e(c,"onvalue",!1),c.state=c.stack.pop()||q):i(c,"Invalid false started with fals"+k);continue;case F:if(""===k)continue;"u"===k?c.state=G:i(c,"Invalid null started with n"+k);continue;case G:if(""===k)continue;"l"===k?c.state=H:i(c,"Invalid null started with nu"+k);continue;case H:if(""===k)continue;"l"===k?(e(c,"onvalue",null),c.state=c.stack.pop()||q):i(c,"Invalid null started with nul"+k);continue;case I:"."===k?(c.numberNode+=k,c.state=J):i(c,"Leading zero not followed by .");continue;case J:-1!=="0123456789".indexOf(k)?c.numberNode+=k:"."===k?(-1!==c.numberNode.indexOf(".")&&i(c,"Invalid number has two dots"),c.numberNode+=k):"e"===k||"E"===k?((-1!==c.numberNode.indexOf("e")||-1!==c.numberNode.indexOf("E"))&&i(c,"Invalid number has two exponential"),c.numberNode+=k):"+"===k||"-"===k?("e"!==l&&"E"!==l&&i(c,"Invalid symbol in number"),c.numberNode+=k):(h(c),d--,c.state=c.stack.pop()||q);continue;default:i(c,"Unknown state: "+c.state)}return c.position>=c.bufferCheckPosition&&a(c),c}}var l=65536,m=["textNode","numberNode"],n=0,o=/[\\"\n]/g,p=n++,q=n++,r=n++,s=n++,t=n++,u=n++,v=n++,w=n++,x=n++,y=n++,z=n++,A=n++,B=n++,C=n++,D=n++,E=n++,F=n++,G=n++,H=n++,I=n++,J=n;return c.prototype={end:function(){j(this)},write:k,close:function(){return this.write(null)}},{parser:function(){return new c},EVENTS:["value","string","key","openobject","closeobject","openarray","closearray","error","end","ready"]}}(),Z=function(){var a=function(a){return a.exec.bind(a)},b=j(function(b){return b.unshift(/^/),a(RegExp(b.map(h("source")).join("")))}),c=/(\$?)/,d=/([\w-_]+|\*)/,e=/()/,f=/\["([^"]+)"\]/,g=/\[(\d+|\*)\]/,i=/{([\w ]*?)}/,k=/(?:{([\w ]*?)})?/,l=b(c,d,k),m=b(c,f,k),n=b(c,g,k),o=b(c,e,i),p=b(/\.\./),q=b(/\./),r=b(c,/!/),s=b(/$/);return function(a){return a(R(l,m,n,o),p,q,r,s)}}(),$=h("key"),_=h("node"),ab={},bb=Z(function(a,b,c,e,f){function h(a,b){var c=b[z],d=c&&"*"!=c?function(a){return B(a)==c}:n;return l(d,a)}function i(a,b){var c=b[A];if(!c)return a;var d=Q(r,t(c.split(/\W+/))),e=g(d,C);return l(e,a)}function j(a,b){var c=!!b[y];return c?l(a,V):a}function k(a){function b(a){return B(a)!=ab}return a==n?n:l(b,g(a,W))}function m(a){function b(a){return a?f(a):!1}if(a==n)return n;var c=o(),d=a,e=k(b),f=R(c,d,e);return b}function o(){return function(a){return B(a)==ab}}function p(a){return function(b){var c=a(b);return c===!0?V(b):c}}function q(a,b,c){return w(function(a,b){return b(a,c)},b,a)}function s(a,b,c,d,e){var f=a(c);if(f){var g=q(b,d,f),h=c.substr(S(f[0]));return e(h,g)}}function u(a,b){return Q(s,a,b)}function v(a,b){return b}function x(a,b){var c=a?x:v;return D(a,b,c)}var y=1,z=2,A=3,B=g($,V),C=g(_,V),D=R(u(a,X(j,i,h,k)),u(b,X(m)),u(c,X()),u(e,X(j,o)),u(f,X(p)),function(a){throw d('"'+a+'" could not be tokenised')});return function(a){try{return x(a,n)}catch(b){throw d('Could not compile "'+a+'" because '+b.message)}}}),cb=1,db=cb++,eb=cb++,fb="fail",gb=cb++,hb=cb++,ib="start",jb="content",kb=cb++,lb=cb++;"function"==typeof define&&define.amd?define("oboe",[],function(){return P}):a.oboe=P}(window,Object,Array,Error,JSON); | ||
!function(a,b,c,d,e,f){function g(a,b){return function(){return a.call(this,b.apply(this,arguments))}}function h(a){return function(b){return b[a]}}function i(a,b){return b.apply(f,a)}function j(a){var b=a.length-1,d=c.prototype.slice;if(0==b)return function(){return a.call(this,d.call(arguments))};if(1==b)return function(){return a.call(this,arguments[0],d.call(arguments,1))};var e=c(a.length);return function(){for(var c=0;b>c;c++)e[c]=arguments[c];return e[b]=d.call(arguments,b),a.apply(this,e)}}function k(a){return function(b,c){return a(c,b)}}function l(a,b){return function(c){return a(c)&&b(c)}}function m(){}function n(){return!0}function o(a){return function(){return a}}function p(a,b){return b&&b.constructor===a}function q(a){return a!==f}function r(a,c){return c instanceof b&&y(function(a){return a in c},a)}function s(a,b){return[a,b]}function t(a){return A(a.reduce(k(s),U))}function u(a){return w(function(a,b){return a.unshift(b),a},[],a)}function v(a,b){return b?s(a(V(b)),v(a,W(b))):U}function w(a,b,c){return c?a(w(a,b,W(c)),V(c)):b}function x(a,b,c){function d(a,c){return a?b(V(a))?(c(V(a)),W(a)):s(V(a),d(W(a),c)):U}return d(a,c||m)}function y(a,b){return!b||a(V(b))&&y(a,W(b))}function z(a,b){a&&(V(a).apply(null,b),z(W(a),b))}function A(a){function b(a,c){return a?b(W(a),s(V(a),c)):c}return b(a,U)}function B(a,b){return b&&(a(V(b))?V(b):B(a,W(b)))}function C(a){"use strict";function b(){var a=0;R.length>r&&(c("Max buffer length exceeded: textNode"),a=Math.max(a,R.length)),S.length>r&&(c("Max buffer length exceeded: numberNode"),a=Math.max(a,S.length)),Q=r-a+$}function c(a){R&&(p(R),R=""),h=d(a+"\nLn: "+ab+"\nCol: "+_+"\nChr: "+i),q(L(f,f,h))}function e(){(V!==v||0!==Z)&&c("Unexpected end"),R&&(p(R),R=""),U=!0}function g(a){if(!h){if(U)return c("Cannot write after close");var d=0;for(i=a[0];i&&(j=i,i=a.charAt(d++));)switch($++,"\n"===i?(ab++,_=0):_++,V){case u:"{"===i?V=w:"["===i?V=y:"\r"!==i&&"\n"!==i&&" "!==i&&" "!==i&&c("Non-whitespace before {[.");continue;case B:case w:if("\r"===i||"\n"===i||" "===i||" "===i)continue;if(V===B)W.push(C);else{if("}"===i){k(),l(),V=W.pop()||v;continue}W.push(x)}'"'===i?V=A:c('Malformed object key should start with " ');continue;case C:case x:if("\r"===i||"\n"===i||" "===i||" "===i)continue;":"===i?(V===x?(W.push(x),R&&(k(),o(R),R=""),Z++):R&&(o(R),R=""),V=v):"}"===i?(R&&(p(R),R=""),l(),Z--,V=W.pop()||v):","===i?(V===x&&W.push(x),R&&(p(R),R=""),V=B):c("Bad object");continue;case y:case v:if("\r"===i||"\n"===i||" "===i||" "===i)continue;if(V===y){if(m(),Z++,V=v,"]"===i){n(),Z--,V=W.pop()||v;continue}W.push(z)}'"'===i?V=A:"{"===i?V=w:"["===i?V=y:"t"===i?V=D:"f"===i?V=G:"n"===i?V=K:"-"===i?S+=i:"0"===i?(S+=i,V=P):-1!=="123456789".indexOf(i)?(S+=i,V=P):c("Bad value");continue;case z:if(","===i)W.push(z),R&&(p(R),R=""),V=v;else if("]"===i)R&&(p(R),R=""),n(),Z--,V=W.pop()||v;else{if("\r"===i||"\n"===i||" "===i||" "===i)continue;c("Bad array")}continue;case A:var e=d-1;a:for(;;){for(;Y>0;)if(X+=i,i=a.charAt(d++),4===Y?(R+=String.fromCharCode(parseInt(X,16)),Y=0,e=d-1):Y++,!i)break a;if('"'===i&&!T){V=W.pop()||v,R+=a.substring(e,d-1),R||p("");break}if("\\"===i&&!T&&(T=!0,R+=a.substring(e,d-1),i=a.charAt(d++),!i))break;if(T){if(T=!1,"n"===i?R+="\n":"r"===i?R+="\r":"t"===i?R+=" ":"f"===i?R+="\f":"b"===i?R+="\b":"u"===i?(Y=1,X=""):R+=i,i=a.charAt(d++),e=d-1,i)continue;break}s.lastIndex=d;var f=s.exec(a);if(null===f){d=a.length+1,R+=a.substring(e,d-1);break}if(d=f.index+1,i=a.charAt(f.index),!i){R+=a.substring(e,d-1);break}}continue;case D:if(""===i)continue;"r"===i?V=E:c("Invalid true started with t"+i);continue;case E:if(""===i)continue;"u"===i?V=F:c("Invalid true started with tr"+i);continue;case F:if(""===i)continue;"e"===i?(p(!0),V=W.pop()||v):c("Invalid true started with tru"+i);continue;case G:if(""===i)continue;"a"===i?V=H:c("Invalid false started with f"+i);continue;case H:if(""===i)continue;"l"===i?V=I:c("Invalid false started with fa"+i);continue;case I:if(""===i)continue;"s"===i?V=J:c("Invalid false started with fal"+i);continue;case J:if(""===i)continue;"e"===i?(p(!1),V=W.pop()||v):c("Invalid false started with fals"+i);continue;case K:if(""===i)continue;"u"===i?V=M:c("Invalid null started with n"+i);continue;case M:if(""===i)continue;"l"===i?V=N:c("Invalid null started with nu"+i);continue;case N:if(""===i)continue;"l"===i?(p(null),V=W.pop()||v):c("Invalid null started with nul"+i);continue;case O:"."===i?(S+=i,V=P):c("Leading zero not followed by .");continue;case P:-1!=="0123456789".indexOf(i)?S+=i:"."===i?(-1!==S.indexOf(".")&&c("Invalid number has two dots"),S+=i):"e"===i||"E"===i?((-1!==S.indexOf("e")||-1!==S.indexOf("E"))&&c("Invalid number has two exponential"),S+=i):"+"===i||"-"===i?("e"!==j&&"E"!==j&&c("Invalid symbol in number"),S+=i):(S&&(p(parseFloat(S)),S=""),d--,V=W.pop()||v);continue;default:c("Unknown state: "+V)}$>=Q&&b()}}var h,i,j,k=a(nb).emit,l=a(ob).emit,m=a(pb).emit,n=a(qb).emit,o=a(mb).emit,p=a(lb).emit,q=a(eb).emit,r=65536,s=/[\\"\n]/g,t=0,u=t++,v=t++,w=t++,x=t++,y=t++,z=t++,A=t++,B=t++,C=t++,D=t++,E=t++,F=t++,G=t++,H=t++,I=t++,J=t++,K=t++,M=t++,N=t++,O=t++,P=t,Q=r,R="",S="",T=!1,U=!1,V=u,W=[],X=null,Y=0,Z=0,$=0,_=0,ab=1;a(ib).on(g),a(jb).on(e)}function D(a,b){"use strict";function c(a){return function(b){d=a(d,b)}}var d,e={};for(var f in b)a(f).on(c(b[f]),e);a(kb).on(function(){for(var c in b)a(c).un(e)})}function E(a){var b={};return a&&a.split("\r\n").forEach(function(a){var c=a.indexOf(": ");b[a.substring(0,c)]=a.substring(c+2)}),b}function F(){return new XMLHttpRequest}function G(b,c,d,e,g,h,i){"use strict";function j(){var a=c.responseText,b=a.substr(m);b&&k(b),m=S(a)}var k=b(ib).emit,l=b(eb).emit,m=0,n=!0;b(kb).on(function(){c.onreadystatechange=null,c.abort()}),"onprogress"in c&&(c.onprogress=j),c.onreadystatechange=function(){function a(){try{n&&b(hb).emit(c.status,E(c.getAllResponseHeaders())),n=!1}catch(a){}}switch(c.readyState){case 2:case 3:return a();case 4:a();var d=2==String(c.status)[0];d?(j(),b(jb).emit()):l(L(c.status,c.responseText))}};try{c.open(d,e,!0);for(var o in h)c.setRequestHeader(o,h[o]);c.setRequestHeader("X-Requested-With","XMLHttpRequest"),c.withCredentials=i,c.send(g)}catch(p){a.setTimeout(Q(l,L(f,f,p)),0)}}function H(a,b){return{key:a,node:b}}function I(a){function b(a,b){var d=$(V(a));return p(c,d)?f(a,S(d),b):a}function d(a,c){if(!a)return k(c),f(a,_,c);var d=b(a,c),g=W(d),h=Z(V(d));return e(g,h,c),s(H(h,c),g)}function e(a,b,c){$(V(a))[b]=c}function f(a,b,c){a&&e(a,b,c);var d=s(H(b,c),a);return i(d),d}function h(a){return j(a),W(a)||l($(V(a)))}var i=a(cb).emit,j=a(db).emit,k=a(gb).emit,l=a(fb).emit,m={};return m[nb]=function(a){return d(a,{})},m[pb]=function(a){return d(a,[])},m[mb]=f,m[lb]=g(h,d),m[ob]=h,m[qb]=h,m}function J(a,b,c){function d(a){return function(b){return b.id==a}}var e,f;return{on:function(c,d){var g={listener:c,id:d||c};return b&&b.emit(a,c,g.id),e=s(g,e),f=s(c,f),this},emit:function(){z(f,arguments)},un:function(b){var g;e=x(e,d(b),function(a){g=a}),g&&(f=x(f,function(a){return a==g.listener}),c&&c.emit(a,g.listener,g.id))},listeners:function(){return f},hasListener:function(a){var b=a?d(a):n;return q(B(b,e))}}}function K(){function a(a){return c[a]=J(a,d,e)}function b(b){return c[b]||a(b)}var c={},d=a("newListener"),e=a("removeListener");return["emit","on","un"].forEach(function(a){b[a]=j(function(c,d){i(d,b(c)[a])})}),b}function L(a,b,c){try{var d=e.parse(b)}catch(f){}return{statusCode:a,body:b,jsonBody:d,thrown:c}}function M(a,b){function c(a,b,c){var d=A(c);a(b,u(W(v(Z,d))),u(v($,d)))}function d(b,d,e){var f=a(b).emit;d.on(function(a){var b=e(a);b!==!1&&c(f,$(b),a)},b),a("removeListener").on(function(c){c==b&&(a(c).listeners()||d.un(b))})}var e={node:a(db),path:a(cb)};a("newListener").on(function(a){var c=/(node|path):(.*)/.exec(a);if(c){var f=e[c[1]];f.hasListener(a)||d(a,f,b(c[2]))}})}function N(a){function b(b,c){return a(b).on(d(c),c),k}function c(a,b){var c=d(b);return a.on(function(){var d=!1;k.forget=function(){d=!0},i(arguments,c),delete k.forget,d&&a.un(b)},b),k}function d(b){return function(){try{b.apply(k,arguments)}catch(c){a(eb).emit(L(f,f,c))}}}function e(b,c){return a(b+":"+c)}function g(a,b){for(var d in b)c(e(a,d),b[d])}function h(a,b,d){return T(b)?c(e(a,b),d):g(a,b),k}var k,l=/^(node|path):./,n=a(fb),p=j(function(b,d){if(k[b])i(d,k[b]);else{var e=a(b),f=d[0];l.test(b)?c(e,f):e.on(f)}return k}),q=function(b,c,d){if("done"==b)n.un(c);else if("node"==b||"path"==b)a.un(b+":"+c,d);else{var e=c;a(b).un(e)}return k};return a(gb).on(function(a){k.root=o(a)}),a(hb).on(function(a,b){k.header=function(a){return a?b[a]:b}}),k={on:p,addListener:p,removeListener:q,emit:a.emit,node:Q(h,"node"),path:Q(h,"path"),done:Q(c,n),start:Q(b,hb),fail:a(eb).on,abort:a(kb).emit,header:m,root:m}}function O(a,b,c,d,f){var g=K();return d=d?e.parse(e.stringify(d)):{},c?T(c)||(c=e.stringify(c),d["Content-Type"]=d["Content-Type"]||"application/json"):c=null,b&&G(g,F(),a,b,c,d,f),C(g),D(g,I(g)),M(g,ab),new N(g)}function P(a,b){function c(a,b){return b===!1&&(a+=-1==a.indexOf("?")?"?":"&",a+="_="+(new Date).getTime()),a}return a?a.url?O(a.method||"GET",c(a.url,a.cached),a.body,a.headers,a.withCredentials):O("GET",a,b):O()}var Q=j(function(a,b){var c=b.length;return j(function(d){for(var e=0;e<d.length;e++)b[c+e]=d[e];return b.length=c+d.length,a.apply(this,b)})}),R=(j(function(a){function b(a,b){return[i(a,b)]}var c=t(a);return j(function(a){return w(b,a,c)[0]})}),j(function(a){return j(function(b){for(var c,d=0;d<S(a);d++)if(c=i(b,a[d]))return c})})),S=h("length"),T=Q(p,String),U=null,V=h(0),W=h(1),X=j(t),Y=function(){var a=function(a){return a.exec.bind(a)},b=j(function(b){return b.unshift(/^/),a(RegExp(b.map(h("source")).join("")))}),c=/(\$?)/,d=/([\w-_]+|\*)/,e=/()/,f=/\["([^"]+)"\]/,g=/\[(\d+|\*)\]/,i=/{([\w ]*?)}/,k=/(?:{([\w ]*?)})?/,l=b(c,d,k),m=b(c,f,k),n=b(c,g,k),o=b(c,e,i),p=b(/\.\./),q=b(/\./),r=b(c,/!/),s=b(/$/);return function(a){return a(R(l,m,n,o),p,q,r,s)}}(),Z=h("key"),$=h("node"),_={},ab=Y(function(a,b,c,e,f){function h(a,b){var c=b[z],d=c&&"*"!=c?function(a){return B(a)==c}:n;return l(d,a)}function i(a,b){var c=b[A];if(!c)return a;var d=Q(r,t(c.split(/\W+/))),e=g(d,C);return l(e,a)}function j(a,b){var c=!!b[y];return c?l(a,V):a}function k(a){function b(a){return B(a)!=_}return a==n?n:l(b,g(a,W))}function m(a){function b(a){return a?f(a):!1}if(a==n)return n;var c=o(),d=a,e=k(b),f=R(c,d,e);return b}function o(){return function(a){return B(a)==_}}function p(a){return function(b){var c=a(b);return c===!0?V(b):c}}function q(a,b,c){return w(function(a,b){return b(a,c)},b,a)}function s(a,b,c,d,e){var f=a(c);if(f){var g=q(b,d,f),h=c.substr(S(f[0]));return e(h,g)}}function u(a,b){return Q(s,a,b)}function v(a,b){return b}function x(a,b){var c=a?x:v;return D(a,b,c)}var y=1,z=2,A=3,B=g(Z,V),C=g($,V),D=R(u(a,X(j,i,h,k)),u(b,X(m)),u(c,X()),u(e,X(j,o)),u(f,X(p)),function(a){throw d('"'+a+'" could not be tokenised')});return function(a){try{return x(a,n)}catch(b){throw d('Could not compile "'+a+'" because '+b.message)}}}),bb=1,cb=bb++,db=bb++,eb="fail",fb=bb++,gb=bb++,hb="start",ib="content",jb=bb++,kb=bb++,lb=bb++,mb=bb++,nb=bb++,ob=bb++,pb=bb++,qb=bb++;"function"==typeof define&&define.amd?define("oboe",[],function(){return P}):a.oboe=P}(window,Object,Array,Error,JSON); |
@@ -15,3 +15,3 @@ module.exports = function (grunt) { | ||
, 'src/libs/clarinet.js' | ||
, 'src/clarinetListenerAdaptor.js' | ||
, 'src/ascentManager.js' | ||
, 'src/parseResponseHeaders.browser.js' | ||
@@ -28,3 +28,2 @@ , 'src/streamingHttp.browser.js' | ||
, 'src/instanceApi.js' | ||
, 'src/instanceController.js' | ||
, 'src/wire.js' | ||
@@ -35,7 +34,9 @@ , 'src/publicApi.js' | ||
var OBOE_NODE_SOURCE_FILES = [ | ||
'build/version.js' | ||
'build/version.js' | ||
, 'src/LICENCE.js' | ||
, 'src/functional.js' | ||
, 'src/util.js' | ||
, 'src/lists.js' | ||
, 'src/clarinetListenerAdaptor.js' | ||
, 'src/lists.js' | ||
, 'src/libs/clarinet.js' | ||
, 'src/ascentManager.js' | ||
, 'src/streamingHttp.node.js' | ||
@@ -51,3 +52,2 @@ , 'src/jsonPathSyntax.js' | ||
, 'src/instanceApi.js' | ||
, 'src/instanceController.js' | ||
, 'src/wire.js' | ||
@@ -86,3 +86,3 @@ , 'src/publicApi.js' | ||
'// This file is the concatenation of many js files. \n' + | ||
'// See https://github.com/jimhigson/oboe.js for the raw source\n' + | ||
'// See http://github.com/jimhigson/oboe.js for the raw source\n' + | ||
// having a local undefined, window, Object etc allows slightly better minification: | ||
@@ -108,8 +108,6 @@ '(function (window, Object, Array, Error, JSON, undefined ) {\n' | ||
wrapper: [ | ||
'// this file is the concatenation of several js files. See https://github.com/jimhigson/oboe-browser.js/tree/master/src ' + | ||
'// this file is the concatenation of several js files. See http://github.com/jimhigson/oboe.js ' + | ||
'for the unconcatenated source\n' + | ||
'module.exports = (function () {\n' + | ||
'var clarinet = require("clarinet");\n' | ||
'module.exports = (function () {\n' | ||
// source code here | ||
@@ -116,0 +114,0 @@ |
{ | ||
"name": "oboe", | ||
"title": "Oboe.js", | ||
"version": "1.14.0", | ||
"version": "1.14.1", | ||
"description": "Oboe.js reads json, giving you the objects as they are found without waiting for the stream to finish", | ||
@@ -60,5 +60,3 @@ "main": "./dist/oboe-node.js", | ||
}, | ||
"dependencies": { | ||
"clarinet": "~0.8.0" | ||
}, | ||
"dependencies": {}, | ||
"jam": { | ||
@@ -65,0 +63,0 @@ "main": "dist/oboe-browser.js", |
@@ -8,4 +8,6 @@ function spiedPubSub() { | ||
var single = realPubSub(eventName); | ||
if( !single.emit.isSpy ) { | ||
var alreadySpied = !!single.emit.isSpy; | ||
if( !alreadySpied ) { | ||
spyOn( single, 'emit' ).andCallThrough(); | ||
@@ -78,2 +80,20 @@ spyOn( single, 'on' ).andCallThrough(); | ||
return bus; | ||
} | ||
} | ||
function eventBlackBox( pubsub, eventNames ) { | ||
var recording = []; | ||
eventNames.forEach(function(eventName){ | ||
pubsub(eventName).on(function(val, val2){ | ||
recording.push({ | ||
type: eventName, | ||
values: arguments, | ||
val: val, | ||
val2: val | ||
}); | ||
}); | ||
}); | ||
return recording; | ||
} |
@@ -14,19 +14,15 @@ describe("incremental content builder", function(){ | ||
this._clarinetStub = {}; | ||
this._eventBus = eventBus; | ||
var builderInstance = incrementalContentBuilder(eventBus, this._clarinetStub); | ||
var builderInstance = incrementalContentBuilder(eventBus); | ||
clarinetListenerAdaptor( this._clarinetStub, builderInstance); | ||
ascentManager( this._eventBus, builderInstance); | ||
} | ||
IncrementalContentBuilderAsserter.prototype.receivingParserEvent = function(fnName /* args */){ | ||
IncrementalContentBuilderAsserter.prototype.receivingEvent = function(eventName /* args */){ | ||
var args = Array.prototype.slice.call(arguments, 1); | ||
var handlerFn = this._clarinetStub[fnName]; | ||
// to match clarinet behaviour: do nothing if onFoo is falsey | ||
handlerFn && handlerFn.apply( undefined, args ); | ||
this._eventBus(eventName).emit.apply(undefined, args); | ||
return this; | ||
@@ -37,3 +33,3 @@ }; | ||
var builder = aContentBuilder().receivingParserEvent('onopenobject'); | ||
var builder = aContentBuilder().receivingEvent(SAX_OPEN_OBJECT); | ||
@@ -61,4 +57,4 @@ it('emits correct event', function(){ | ||
var builder = aContentBuilder() | ||
.receivingParserEvent('onopenobject') | ||
.receivingParserEvent('onkey', 'flavour'); | ||
.receivingEvent(SAX_OPEN_OBJECT) | ||
.receivingEvent(SAX_KEY, 'flavour'); | ||
@@ -88,3 +84,4 @@ it('emits correct event', function(){ | ||
var builder = aContentBuilder() | ||
.receivingParserEvent('onopenobject', 'flavour'); | ||
.receivingEvent(SAX_OPEN_OBJECT, undefined) | ||
.receivingEvent(SAX_KEY, 'flavour'); | ||
@@ -112,5 +109,5 @@ it('emits correct event', function(){ | ||
var builder = aContentBuilder() | ||
.receivingParserEvent('onopenobject') | ||
.receivingParserEvent('onkey' , 'flavour') | ||
.receivingParserEvent('onvalue' , 'strawberry'); | ||
.receivingEvent(SAX_OPEN_OBJECT) | ||
.receivingEvent(SAX_KEY , 'flavour') | ||
.receivingEvent(SAX_VALUE , 'strawberry'); | ||
@@ -137,6 +134,6 @@ it('emits correct event', function(){ | ||
var builder = aContentBuilder() | ||
.receivingParserEvent('onopenobject') | ||
.receivingParserEvent('onkey', 'flavour') | ||
.receivingParserEvent('onvalue', 'strawberry') | ||
.receivingParserEvent('oncloseobject'); | ||
.receivingEvent(SAX_OPEN_OBJECT) | ||
.receivingEvent(SAX_KEY, 'flavour') | ||
.receivingEvent(SAX_VALUE, 'strawberry') | ||
.receivingEvent(SAX_CLOSE_OBJECT); | ||
@@ -162,6 +159,6 @@ it('emits correct event', function(){ | ||
var builder = aContentBuilder() | ||
.receivingParserEvent('onopenobject') | ||
.receivingParserEvent('onkey', 'alphabet') | ||
.receivingParserEvent('onopenarray') | ||
.receivingParserEvent('onvalue', 'a'); | ||
.receivingEvent(SAX_OPEN_OBJECT) | ||
.receivingEvent(SAX_KEY, 'alphabet') | ||
.receivingEvent(SAX_OPEN_ARRAY) | ||
.receivingEvent(SAX_VALUE, 'a'); | ||
@@ -201,7 +198,7 @@ it('emits path event with numeric paths', function(){ | ||
var builder = aContentBuilder() | ||
.receivingParserEvent('onopenobject') | ||
.receivingParserEvent('onkey', 'alphabet') | ||
.receivingParserEvent('onopenarray') | ||
.receivingParserEvent('onvalue', 'a') | ||
.receivingParserEvent('onvalue', 'b'); | ||
.receivingEvent(SAX_OPEN_OBJECT) | ||
.receivingEvent(SAX_KEY, 'alphabet') | ||
.receivingEvent(SAX_OPEN_ARRAY) | ||
.receivingEvent(SAX_VALUE, 'a') | ||
.receivingEvent(SAX_VALUE, 'b'); | ||
@@ -241,5 +238,5 @@ it('emits events with numeric paths', function(){ | ||
var builder = aContentBuilder() | ||
.receivingParserEvent('onopenarray') | ||
.receivingParserEvent('onvalue', 'a') | ||
.receivingParserEvent('onvalue', 'b'); | ||
.receivingEvent(SAX_OPEN_ARRAY) | ||
.receivingEvent(SAX_VALUE, 'a') | ||
.receivingEvent(SAX_VALUE, 'b'); | ||
@@ -246,0 +243,0 @@ it('emits events with numeric paths', function(){ |
@@ -87,3 +87,3 @@ describe("oboe component (sXHR stubbed)", function(){ | ||
// clarinet doesn't notify of matches to objects (onopenobject) until the | ||
// clarinet doesn't notify of matches to objects (SAX_OPEN_OBJECT) until the | ||
// first key is found, that is why we don't just give '{' here as the partial | ||
@@ -103,3 +103,3 @@ // input. | ||
// clarinet doesn't notify of matches to objects (onopenobject) until the | ||
// clarinet doesn't notify of matches to objects (SAX_OPEN_OBJECT) until the | ||
// first key is found, that is why we don't just give '{' here as the partial | ||
@@ -111,3 +111,3 @@ // input. | ||
.whenGivenInput('[1') // the minimum string required for clarinet | ||
// to emit onopenarray. Won't emit with '['. | ||
// to emit SAX_OPEN_ARRAY. Won't emit with '['. | ||
.thenTheInstance( | ||
@@ -114,0 +114,0 @@ foundNMatches(1), |
@@ -89,4 +89,2 @@ | ||
runs(function(){ | ||
console.log('the root is', req.root()); | ||
expect( req.root().cookie ).toMatch('oboeIntegrationSend=123'); | ||
@@ -93,0 +91,0 @@ }) |
@@ -5,5 +5,2 @@ | ||
correctly. streamingXhr is a stub so no actual calls are made. | ||
Technically this tests some of instanceController.js as well as publicApi.js but the tests were | ||
written before the logic was split into two. | ||
*/ | ||
@@ -10,0 +7,0 @@ |
@@ -249,3 +249,2 @@ /* Tests the streaming xhr without stubbing anything. Really just a test that | ||
var parsedResult = JSON.parse(streamedContentPassedTo(oboeBus)); | ||
console.log(parsedResult); | ||
expect(parsedResult.cookie).toMatch('corsToken=123456'); | ||
@@ -449,12 +448,2 @@ }); | ||
function prettyPrintEvent(event){ | ||
switch(event) { | ||
case HTTP_START: return 'start'; | ||
case STREAM_DATA: return 'data'; | ||
case STREAM_END: return 'end'; | ||
default: return 'unknown(' + event + ')' | ||
} | ||
} | ||
this.addMatchers({ | ||
@@ -461,0 +450,0 @@ toHaveGivenStreamEventsInCorrectOrder: function(){ |
@@ -20,3 +20,3 @@ module.exports = function(config) { | ||
, 'src/libs/clarinet.js' | ||
, 'src/clarinetListenerAdaptor.js' | ||
, 'src/ascentManager.js' | ||
, 'src/parseResponseHeaders.browser.js' | ||
@@ -31,5 +31,4 @@ , 'src/streamingHttp.browser.js' | ||
, 'src/events.js' | ||
, 'src/patternAdapter.js' | ||
, 'src/instanceApi.js' | ||
, 'src/instanceController.js' | ||
, 'src/patternAdapter.js' | ||
, 'src/instanceApi.js' | ||
, 'src/wire.js' | ||
@@ -36,0 +35,0 @@ , 'src/publicApi.js' |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7452047
0
60
19322
- Removedclarinet@~0.8.0
- Removedclarinet@0.8.1(transitive)