-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjsont-min.js
1 lines (1 loc) · 1.44 KB
/
jsont-min.js
1
function jsonT(a,c){var b={output:false,init:function(){for(var d in c){if(d.substr(0,4)!=="self"){c["self."+d]=c[d];}}return this;},apply:function(g){var f=function(h){return h.replace(/\{([A-Za-z0-9_\$\.\[\]\'@\(\)]+)\}/g,function(j,i){return b.processArg(i,g);});},e=g.replace(/\[[0-9]+\]/g,"[*]"),d;if(e in c){if(typeof(c[e])==="string"){d=f(c[e]);}else{if(typeof(c[e])==="function"){d=f(c[e](b.fakeEval(g)).toString());}}}else{d=b.evaluate(g);}return d;},processArg:function(e,f){var g=function(h,i){return(i=h.replace(/^\$/,i)).substr(0,4)!=="self"?("self."+i):i;},d="";b.output=true;if(e.charAt(0)==="@"){d=e.replace(/@([A-za-z0-9_]+)\(([A-Za-z0-9_\$\.\[\]\']+)\)/,function(i,h,j){return c["self."+h](b.fakeEval(g(j,f)));});}else{if(e!=="$"){d=b.apply(g(e,f));}else{d=b.evaluate(f);}}b.output=false;return d;},evaluate:function(h){var g=b.fakeEval(h),e="";if(typeof(g)!=="undefined"){if(g instanceof Array){for(var f=0;f<g.length;f++){if(typeof(g[f])!=="undefined"){e+=b.apply(h+"["+f+"]");}}}else{if(typeof(g)==="object"){for(var d in g){if(typeof(g[d])!=="undefined"){e+=b.apply(h+"."+d);}}}else{if(b.output){e+=g;}}}}return e;},fakeEval:function(i){var e=a,h,j=function(l,k){h.push(k);return"";},g=function(m){var l;h=[];m=m.replace(/\[([0-9]+)\]/g,j);if(m==="self"){l=e;}else{l=e[m];}if(h.length>0){for(var k=0,n=h.length;k<n;k++){l=l[parseInt(h[k],10)];}}e=l;};i=i.split(".");for(var f=0,d=i.length;f<d;f++){g(i[f]);}return e;}};return b.init().apply("self");}