Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

jTypes: Under the Hood

, 13 Jun 2013 Apache
A detailed look at how jTypes compiles C#-like object definitions into prototype-based instance matrices.
/*! ------------------------------------------------------------------------
//                               jTypes 2.1.0b
//  ------------------------------------------------------------------------
//
//                   Copyright 2013 Gaulinsoft Corporation
//
//       Licensed under the Apache License, Version 2.0 (the "License");
//      you may not use this file except in compliance with the License.
//                   You may obtain a copy of the License at
//
//                 http://www.apache.org/licenses/LICENSE-2.0
//
//     Unless required by applicable law or agreed to in writing, software
//      distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//     See the License for the specific language governing permissions and
//                       limitations under the License.
*/
(function(J,n){var c=Object,ja=c.prototype,P=c.create,Ua=c.defineProperties,k=c.defineProperty,y=c.freeze,Ha=c.getPrototypeOf,Va=c.keys,d=c.preventExtensions,Wa=c.seal,E=ja.hasOwnProperty,za=ja.toString,ka=Array,Aa=ka.prototype,ka=ka.isArray,Xa=Aa.forEach,Ia=Aa.indexOf,Q=String.prototype,Ya=Q.match,la=Q.replace,Q=Q.trim;if(!P||!k||!y||!Ha||!d||!Wa||!ka||!Xa||!Ia||!Q)throw"jTypes Error: A browser that supports JavaScript 1.8.5 (MSIE 9+) is required.";var v=function(a,b){a=a?"$$."+a:"$$";for(var c=
[],K=0,l=b.length;K<l;K++)c[K]=e.type(b[K]);return"jTypes Error: "+e.format('"{0}({1})" has some invalid arguments.',a,c.join(", "))},q=function(a){return"jTypes Error: "+e.format.apply(e,arguments)},ea="ABCDEFGHIJKLMNOPQRSTUVWXYZ",Ja=[],ea=ea+ea.toLowerCase(),d=function(a){a||(a=3);var b="";do for(var b="",c=0;c<a;c++)b+=ea.charAt(Math.floor(ea.length*Math.random()));while(0<=Ia.call(Ja,b));Ja.push(b);return"~"+b},Ka=d(3),La=d(3),sa=d(3),Za=d(3),Ma=d(3),$a=d(3),Na=d(3),Oa=d(3),xa=d(3),ya=d(3),Pa=
d(3),ta=d(3),ua=d(3),va=d(3),R=d(3),Qa=d(3),L=d(3),T=d(3),d=0,wa=d++,I=d++,B=d++,Y=d++,Z=d++,Ba=d++,$=function(){},d={constructor:$,toString:function(){return"[object Instance]"}};y.call(c,d);$.prototype=d;y.call(c,$);var ab=function(){return"[object Class]"},M=!0,ma=!1,Ra=function(a,b,s,e,l,d,q,m,j,w,p){var g={};g[ta]=!l[B]&&q;g[ua]=!l[B]&&j;g[va]=!l[B]&&(w||q||m);g[R]=l[I].substr(5);g[Qa]=p;g[L]=d;g[T]=l[Ba];y.call(c,g);l[wa]?l[B]?k.call(c,b,l[I],{enumerable:!0,value:g}):l[Y]?k.call(c,s,l[I],{enumerable:!0,
value:g}):l[Z]&&k.call(c,e,l[I],{enumerable:!0,value:g}):k.call(c,a,l[I],{enumerable:!0,value:g})},Sa=function(a,b,c){b=b[c];if(b[ta]&&(a=E.call(a,c)&&a[c]||null,!a||a[L]!==b[L]))throw q('Class must implement the inherited abstract {1} "{0}" with the override modifier.',b[R],b[L]);},Ca=function(a,b,c,e,l,k,d){c||(c=b);var m=null;k?m=e[xa][a]||null:d&&(m=e[ya][a]||null);if(l){if(!m||m[L]!==b||!m[va]||m[ua])throw q('"{0}" has no suitable {1} to override.',"~"===a.charAt(0)?a.substr(5):a,c);}else if(m&&
m[ta])throw q('"{0}" must implement the inherited abstract {1} with the override modifier.',"~"===a.charAt(0)?a.substr(5):a,b);},F=function(a,b,c){return"get"===c?{configurable:a.configurable,enumerable:a.enumerable,get:a.get,set:b.set}:"set"===c?{configurable:a.configurable,enumerable:a.enumerable,get:b.get,set:a.set}:a},Ta=function(a,b,c,e,l,k,d,m,q){a.configurable=b;a.enumerable=!0;b=function(){var a=e.apply(c,arguments);return a===k||d&&a===d||a===l?m:a};"get"===q?a.get=b:"set"===q?a.set=b:a.value=
b},Da=function(a,b,c,e){if(c[va])if(c[ua])e[b]=a;else return(c=e[b]||null)||(e[b]=a),c;else e[b]=null;return null},Ea=function(a,b,e,d,l,j,v,m,n,w,p,g,u){var z=b[a];switch(z[L]){case "field":b={};var h=z[R];a=b;var I=h,N=z[T],t=z[Pa]?j:null;a.configurable=!1;a.enumerable=!0;a.get=function(){return N};a.set=t?function(a){if(t())throw q('"{0}" cannot be set because it is a read-only field.',I);N=a===p||g&&a===g||a===w?u:a}:function(a){N=a===p||g&&a===g||a===w?u:a};m||n?(k.call(c,w,h,b),M?k.call(c,g,
h,b):(k.call(c,p,h,b),d[h]=b,l[h]=b),n&&k.call(c,u,h,b)):k.call(c,p,h,b);break;case "method":b={};h=z[R];j=p;m&&"~constructor"===h&&(M?(j=P.call(c,p),k.call(c,j,"__base",{get:function(){var a=p.__base;return a&&a["~constructor"]||null}}),y.call(c,j)):j=v);Ta(b,!1,j,z[T],w,p,g,u);m||n?(k.call(c,w,h,b),m=(m=Da(b,a,z,e))?m:b,M?k.call(c,g,h,m):(k.call(c,p,h,m),d[h]=m,l[h]=b),n&&k.call(c,u,h,m)):k.call(c,p,h,b);break;case "property":j=a.substr(1,3);var h=z[R],C=z[Qa];v=C&&E.call(w,h);var B=C&&E.call(p,
h),x=v||B;b={};Ta(b,C&&!x,p,z[T],w,p,g,u,j);!C||x?(C=C&&E.call(u,h),m||n?(k.call(c,w,h,v?F(b,w[h],j):b),m=(m=Da(b,a,z,e))?m:b,M?(k.call(c,g,h,v?F(m,g[h],j):m),B&&k.call(c,p,h,p[h])):(k.call(c,p,h,B?F(m,p[h],j):m),d[h]=x&&E.call(d,h)?F(m,d[h],j):m,l[h]=x&&E.call(l,h)?F(b,l[h],j):b),n?k.call(c,u,h,C?F(m,u[h],j):m):C&&k.call(c,u,h,u[h])):x?(k.call(c,p,h,B?F(b,p[h],j):b),v&&(k.call(c,w,h,w[h]),M&&k.call(c,g,h,g[h])),C&&k.call(c,u,h,u[h])):k.call(c,p,h,b)):m||n?(k.call(c,w,h,{configurable:!0,value:b}),
m=(m=Da(b,a,z,e))?m:b,M?k.call(c,g,h,{configurable:!0,value:m}):(k.call(c,p,h,{configurable:!0,value:m}),d[h]=m,l[h]=b),n&&k.call(c,u,h,{configurable:!0,value:m})):k.call(c,p,h,{configurable:!0,value:b})}},Fa=function(a,b,e){for(var d in a)if(!E.call(e,d)){var l=a[d];k.call(c,e,d,l);b[d]=l}},d=0;d++;d++;d++;d++;d++;var e=function(){var a=0,b=null,s=arguments[a++],d="",l=null;if(e.isSimpleObject(s))l=s,s=null;else if(l=arguments[a++],e.isFunction(s)||(e.isClass(s)?(b=s,e.isFunction(l)?(s=l,l=arguments[a++]):
s=null):(d=e.asString(s),e.isClass(l)?(b=l,s=arguments[a++]):s=l,e.isFunction(s)?l=arguments[a++]:(l=s,s=null))),!e.isSimpleObject(l))throw v(null,arguments);if(arguments.length!==a)throw v(null,arguments);var j=!1,n=a=!1,m=!1,J=!1,w=!1;if(d)for(var d=d.trim().split(" ")||[],p=0,g=d.length;p<g;p++){var u=d[p];if("abstract"===u)j=!0;else if("expando"===u)w=J=m=n=!0;else if("expando-private"===u||"private-expando"===u)m=!0;else if("expando-public"===u||"public-expando"===u)w=!0;else if("expando-prototype"===
u||"prototype-expando"===u)J=!0;else if("expando-static"===u||"static-expando"===u)n=!0;else if("sealed"===u)a=!0;else if(u)throw q('"{0}" is not a valid class modifier.',u);}if(j&&a)throw q("Classes cannot have the abstract and sealed modifiers.");var z={},h=b?P.call(c,b[xa]):{},p=new $,F=b?P.call(c,b[ya]):{},u={},d={},N;for(N in l)if(!("constructor"===N||"prototype"===N)){var t=z,C=h,Q=F,x=u,S=d,f=N,D=l[N],na=b,aa=j,U=a,g="field";e.isFunction(D)?g="method":e.isSimpleObject(D)&&(g="property");var oa=
e.asString(f).trim().split(" ")||[],f=e.asString(oa.pop());if(!f.trim())throw q('"" is not a valid {0} name.',g);if(!f.match(/^(_|\$|[a-z])[_\$a-z0-9]*$/i))throw q('"{1}" is not a valid {0} name.',g,f);for(var fa=!1,V=!1,r=!1,qa=!1,ba=!1,G=!1,ca=!1,W=!1,ga=!1,da=!1,O=0,ha=oa.length;O<ha;O++){var A=oa[O];if("field"!==g&&"abstract"===A)fa=!0;else if("field"!==g&&"override"===A)V=!0;else if("private"===A)G=!0;else if("protected"===A)ca=!0;else if("prototype"===A)ga=!0;else if("public"===A)W=!0;else if("field"===
g&&"readonly"===A)r=!0;else if("field"!==g&&"sealed"===A)qa=!0;else if("static"===A)da=!0;else if("field"!==g&&"virtual"===A)ba=!0;else if(A)throw q('"{1}" has an invalid {0} modifier "{2}".',g,f,A);}if("as"===f||"is"===f||"~constructor"===f||"constructor"===f||"prototype"===f||"__base"===f||"__self"===f||"__this"===f)throw q('"{1}" is not a valid {0} name.',"member",f);if(G&&ca||G&&W||ca&&W)throw q('"{0}" cannot have more than one access modifier.',f);if(ga||da){if(ga){if(da)throw q('"{0}" cannot have the {1} and {2} modifiers.',
f,"prototype","static");g="prototype";if(t[f]||C[f]||E.call(x,f)||Q[f])throw q('"{0}" cannot have more than one definition or hide an inherited non-prototype member.',f);}else if(da&&(g="static",E.call(S,f)))throw q('"{0}" cannot have more than one static definition.',f);if(fa||V||ba)throw q('"{0}" cannot have the abstract, virtual, or override modifiers because it is {1}.',f,g);if(G||ca||W)throw q('"{0}" cannot have the public, protected, or private modifiers because it is {1}.',f,g);if(r)throw q('"{0}" cannot have the readonly modifier because it is {1}.',
f,g);}else{if(E.call(t,f)||E.call(C,f)||E.call(x,f)||E.call(Q,f))throw q('"{0}" cannot have more than one definition.',f);!ca&&!W&&(G=!0)}if("method"===g||"property"===g){if(G&&(fa||V||ba))throw q('"{0}" cannot have the abstract, virtual, or override modifiers because it is {1}.',f,"private");if(fa){if(qa)throw q('"{0}" cannot have the {1} and {2} modifiers.',f,"abstract","sealed");if(ba)throw q('"{0}" cannot have the {1} and {2} modifiers.',f,"abstract","virtual");if(!aa)throw q('"{0}" cannot have the abstract modifier in a non-abstract class.',
f);}if(V){if(ba)throw q('"{0}" cannot have the {1} and {2} modifiers.',f,"override","virtual");if(!na)throw q('"{0}" has no suitable {1} to override.',f,g);}else if(qa)throw q('"{0}" cannot have the {1} modifier without the {2} modifier.',f,"sealed","override");if(U&&ba)throw q('"{0}" cannot have the virtual modifier in a sealed class.',f);}aa=null;G?aa=t:ca?aa=C:W&&(aa=Q);switch(g){case "field":e.isReferenceType(D)&&(D=null);t={};t[Pa]=r;t[R]=f;t[L]=g;t[T]=D;y.call(c,t);k.call(c,aa,f,{enumerable:!0,
value:t});break;case "method":na&&Ca(f,g,null,na,V,ca,W);t={};t[ta]=fa;t[ua]=qa;t[va]=ba||fa||V;t[R]=f;t[L]=g;t[T]=D;y.call(c,t);k.call(c,aa,f,{enumerable:!0,value:t});break;case "property":x=[];S=[];ga=void 0;for(ga in D){da=e.asString(ga).trim().split(" ")||[];U=e.asString(da.pop());if(!U.trim())throw q('"{0}" must have at least one property accessor.',f);r=null;if("get"!==U){if("set"!==U)throw q('"{0}" cannot have a "{1}" property accessor.',f,U);S[I]="~set_"+f;r=S}else x[I]="~get_"+f,r=x;r[Ba]=
D[ga];if(!e.isFunction(r[Ba]))throw q('"{0}" must have a function for the {1} accessor.',f,U);r[B]=!1;r[Y]=!1;r[Z]=!1;O=0;for(ha=da.length;O<ha;O++)if(oa=da[O],"private"===oa)r[B]=!0;else if("protected"===oa)r[Y]=!0;else if("public"===oa)r[Z]=!0;else if(A)throw q('"{0}" has an invalid modifier "{2}" on the {1} accessor.',f,U,A);r[wa]=r[B]||r[Y]||r[Z];if(r[wa]){if(r[B]&&r[Y]||r[B]&&r[Z]||r[Y]&&r[Z])throw q('"{0}" cannot have more than one access modifier.',U);if(r[Z]||r[Y]&&!W||r[B]&&G)throw q('"{0}" must have a more restrictive access modifier on the {1} accessor.',
f,U);}}D=!!x[I];G=!!S[I];O=x[wa];ha=S[wa];if(!D&&!G)throw q('"{0}" must have at least one property accessor.',f);if(O&&ha)throw q('"{0}" cannot have access modifiers on both property accessors.',f);if(D){if(!G&&O)throw q('"{0}" must have both accessors to have an access modifier on the {1} accessor.',f,"get");na&&Ca(x[I],g,"get accessor",na,V,O?x[Y]:ca,O?x[Z]:W);Ra(aa,t,C,Q,x,g,fa,V,qa,ba,D&&G)}if(G){if(!D&&ha)throw q('"{0}" must have both accessors to have an access modifier on the {1} accessor.',
f,"set");na&&Ca(S[I],g,"set accessor",na,V,ha?S[Y]:ca,ha?S[Z]:W);Ra(aa,t,C,Q,S,g,fa,V,qa,ba,D&&G)}break;case "prototype":case "static":r={},r[R]=f,r[L]=g,r[T]=D,y.call(c,r),ga?x[f]=r:da&&(S[f]=r)}}if(b){if(b[Oa])throw q("Classes cannot inherit from a sealed class.");if(b[Ka]){l=b[xa];N=b[ya];A=e.keys(l);f=e.keys(N);p=0;for(g=A.length;p<g;p++)Sa(h,l,A[p]);p=0;for(g=f.length;p<g;p++)Sa(F,N,f[p])}ma=!0;p=new b;ma=!1}s||(s=function(){if(this.__base)return this.__base.apply(this,arguments)});l={};l[ta]=
!1;l[ua]=!1;l[va]=!1;l[R]="~constructor";l[L]="method";l[T]=s;y.call(c,l);k.call(c,h,"~constructor",{enumerable:!0,value:l});for(var ra in u)s=u[ra],"prototype"===s[L]&&k.call(c,p,s[R],{enumerable:!0,value:s[T]});var ea=e.keys(z),ka=e.keys(h),la=e.keys(F),ja=function(a,b,e,d,l,f,s,g){if(this===$){var k=null,j=a[0],q=null,p=a[2];M?(k=a[3],q=a[1]):k=a[1];a=0;for(var r=ea.length;a<r;a++)Ea(ea[a],z,null,null,null,s,null,!1,!1,k,j,q,p);a=0;for(r=ka.length;a<r;a++)Ea(ka[a],h,l,e,b,s,g,!0,!1,k,j,q,p);a=
0;for(r=la.length;a<r;a++)Ea(la[a],F,f,d,b,s,null,!1,!0,k,j,q,p);M&&(y.call(c,k),y.call(c,q),m||y.call(c,j),w||y.call(c,p))}},pa=[];ra=b;for(var ia=1;e.isClass(ra);)pa.push(ra),ra=ra[La];var X=function(){if(!ma){if(j)throw q("Abstract classes cannot be instantiated.");var a=this,b=[],d=!1,l=this instanceof X;l||(ma=!0,a=new X,ma=!1);k.call(c,a,"as",{value:function(c){if(!e.isClass(c)||!(a instanceof c))return null;var f=0;do if(pa[f]===c)break;while(++f<ia);return b[f][2]}});k.call(c,a,"is",{value:function(b){return!b?
!1:!!(a instanceof b)}});var s=a,f=null,h=null,g=a,m=function(){return d},p={},r={};if(M){h=a;for(n=ia-1;0<=n;n--)s=P.call(c,s),h=P.call(c,h),g=P.call(c,g),f=P.call(c,h),k.call(c,f,"__self",{value:a}),k.call(c,f,"__this",{value:g}),n!==ia-1&&k.call(c,f,"__base",{value:b[n+1][3]}),b[n]=[f,h,g,s];for(n=0;n<ia;n++)(0===n?ja:pa[n][sa]).call($,b[n],null,null,null,p,r,m)}else{for(var h=[],u=[],n=0;n<ia;n++){var s=P.call(c,a),f={},g=P.call(c,a),t=P.call(c,f),v=[f,s,g],K={},w={},x={};(0===n?ja:pa[n][sa]).call($,
v,K,w,x,p,r,m,t);b.push(v);h.push(t);u.push([K,w,x])}r=p=m=null;for(n=ia-1;0<=n;n--)v=b[n],s=v[1],f=v[0],g=v[2],k.call(c,f,"__self",{value:a}),k.call(c,f,"__this",{value:g}),n!==ia-1?(K=b[n+1][1],k.call(c,f,"__base",{value:K}),t=h[n],k.call(c,t,"__base",{value:K["~constructor"]}),y.call(c,t),K=m,w=p,x=r,t=u[n],m=t[0],p=t[1],r=t[2],Fa(K,m,s),Fa(w,p,f),Fa(x,r,g)):(t=u[n],m=t[0],p=t[1],r=t[2]),y.call(c,s),pa[n][Ma]||y.call(c,f),pa[n][Na]||y.call(c,g)}l&&f["~constructor"].apply(f,arguments);d=!0;console.log("$$: ----- INSTANTIATOR -----");
console.log("$$: Instance Matrix");console.log(b);console.log("$$: Differential inheritance "+(M?"IS":"IS NOT")+" enabled...");return g}},ia=pa.unshift(X),H;for(H in d)s=d[H],"static"===s[L]&&k.call(c,X,s[R],{enumerable:!0,value:s[T]});H={};H[Ka]={value:j};H[La]={value:b};H[Za]={value:n};H[Ma]={value:m};H[$a]={value:J};H[Na]={value:w};H[Oa]={value:a};H[ya]={value:F};a||(H[sa]={value:ja},H[xa]={value:h});Ua.call(c,X,H);k.call(c,p,"constructor",{value:X});J||y.call(c,p);k.call(c,X,"prototype",{value:p});
X.toString=ab;n||y.call(c,X);console.log("$$: ----- COMPILER -----");console.log("$$: Private Definitions");console.log(z);console.log("$$: Protected Definitions");console.log(h);console.log("$$: Public Definitions");console.log(F);return X},j=function(a,b){return k.call(c,e,a,{configurable:!1,enumerable:!1,value:b,writable:!1})},d=function(a,b,d){return k.call(c,e,a,{configurable:!1,enumerable:!0,get:b||n,set:d||n})};j("toString",function(){return"[object jTypes]"});d("version",function(){return"2.1.0b"});
var Ga={};"Array Boolean Date Function Number RegExp String".split(" ").forEach(function(a){var b=a.toLowerCase();Ga["[object "+a+"]"]=b;j("is"+a,function(a){return e.type(a)===b})});["Window","window","Global","global"].forEach(function(a){Ga["[object "+a+"]"]="window"});j("type",function(a){return null===a||a===n?a+"":a===J?"window":"[object Function]"===za.call(a[sa])?"class":a instanceof $?"instance":Ga[za.call(a)]||"object"});j("isClass",function(a){return a&&"[object Function]"===za.call(a[sa])});
j("isFinite",function(a){return!(!e.isNumber(a)||!isFinite(a))});j("isInfinity",function(a){return e.isNumber(a)&&!isNaN(a)&&!isFinite(a)});j("isInstance",function(a){return a===n||null===a?!1:!!(a instanceof $)});j("isNaN",function(a){return!(!e.isNumber(a)||!isNaN(a))});j("isNegativeInfinity",function(a){return e.isNumber(a)&&!isNaN(a)&&!isFinite(a)&&0>a});j("isNull",function(a){return null===a});j("isPositiveInfinity",function(a){return e.isNumber(a)&&!isNaN(a)&&!isFinite(a)&&0<a});j("isReferenceType",
function(a){a=e.type(a);return"undefined"!==a&&"null"!==a&&"boolean"!==a&&"number"!==a&&"string"!==a});j("isSimpleObject",function(a){return!a||"object"!==e.type(a)?!1:Ha.call(c,a)===ja});j("isUndefined",function(a){return a===n});j("isValueType",function(a){a=e.type(a);return"boolean"===a||"number"===a||"string"===a});j("isWindow",function(a){return a===J?!0:"window"===e.type(a)});j("asArray",function(a){if(null===a||a===n)return[];var b=e.type(a);return"array"===b?a:"boolean"===b||"number"===b||
"string"===b?[]:Aa.slice.call(a,0)||[]});j("asBool",function(a){return!!a});j("asFloat",function(a){return parseFloat(a)});j("asInt",function(a){var b=parseInt(a,10);if(!isNaN(b))return b;b=parseFloat(a);return 9007199254740992<b?Infinity:-9007199254740992>b?-Infinity:NaN});j("asString",function(a){var b=e.type(a);return"string"===b?a:"boolean"===b||"number"===b?a+"":""});j("empty",function(){return function(){}});j("format",function(a){if(!e.isString(a))throw v("format",arguments);var b=arguments;
return la.call(a,/\{([0-9]{1,2})\}/g,function(a,c){var d=e.asInt(c)+1;return d>=b.length?a:e.asString(b[d])})});j("inherit",function(a){if(a===n||null===a||e.isValueType(a))throw v("inherit",arguments);var b=a.constructor,c=e.empty();c.prototype=a;if(e.isInstance(a))ma=!0,c=new c,ma=!1;else{var d=E.call(a,"constructor");a.constructor=c;c=new c;d?a.constructor=b:delete a.constructor}return c});j("keys",function(a){if(a===n||null===a)throw v("keys",arguments);return Va.call(c,a)||[]});j("match",function(a,
b){if(!e.isString(a))throw v("match",arguments);if(!e.isRegExp(b)&&!e.isString(b))throw v("match",arguments);return Ya.call(a,b)});j("property",function(a,b,d){if(!e.isReferenceType(a))throw v("property",arguments);if(e.isSimpleObject(b)){d=b;b=n;for(var j in d)e.property(a,e.asString(j),d[j])}else{if(!e.isString(b))throw v("property",arguments);if(!e.isSimpleObject(d))throw v("property",arguments);j={configurable:e.asBool(d.c),enumerable:e.asBool(d.e)};var l=e.isFunction(d.g),q=e.isFunction(d.s);
l||q?(j.get=l?d.g:n,j.set=q?d.s:n):(j.value=d.v,j.writable=e.asBool(d.w));k.call(c,a,b,j)}return a});j("regexp",function(a,b){if(!e.isString(a))throw v("regexp",arguments);if(!e.isString(b)&&b!==n&&null!==b)throw v("regexp",arguments);return RegExp(a,b)});j("regexpEscape",function(a){if(!e.isString(a))throw v("regexpEscape",arguments);return la.call(a,/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")});j("replace",function(a,b,c,d){if(!e.isString(a))throw v("replace",arguments);if(!e.isRegExp(b)&&!e.isString(b))throw v("replace",
arguments);var j=e.isString(c);if(!e.isFunction(c)&&!j)throw v("replace",arguments);d=e.asBool(d);!d&&j&&(c=la.call(c,/\$/g,"$$&"));return la.call(a,b,c)});d("lazy",function(){return M},function(a){M=e.asBool(a)});if(J.$$===n||J.$$===J.jTypes)J.$$=e;J.jTypes=e})(window);

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Apache License, Version 2.0

Share

About the Author

Nick Gaulin
CEO Gaulinsoft Corporation
United States United States
Nick is the founder of Gaulinsoft, a small software consulting company in Chicago, IL. He graduated from the Illinois Institute of Technology in 2011 with a B.S. in Aerospace Engineering.
Follow on   Google+

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141223.1 | Last Updated 14 Jun 2013
Article Copyright 2013 by Nick Gaulin
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid