mambax7/alumni-26x

View on GitHub
media/jquery/tablesorter-master/dist/js/extras/semver-mod.min.js

Summary

Maintainability
A
0 mins
Test Coverage
/*! Modified semver.js for node.js (v4.3.3, 3/27/2015) */
!function(){function r(r,e){if(r instanceof n)return r;if("string"!=typeof r)return null;if(r.length>L)return null;if(!(e?F[ur]:F[ar]).test(r))return null;try{return new n(r,e)}catch(r){return null}}function e(e,t){var n=r(e,t);return n?n.version:null}function t(e,t){var n=r(e.trim().replace(/^[=v]+/,""),t);return n?n.version:null}function n(r,e){if(r instanceof n){if(r.loose===e)return r;r=r.version}else if("string"!=typeof r)throw new TypeError("Invalid Version: "+r);if(r.length>L)throw new TypeError("version is longer than "+L+" characters");if(!(this instanceof n))return new n(r,e);q("SemVer",r,e),this.loose=e;var t=r.trim().match(e?F[ur]:F[ar]);if(!t)throw new TypeError("Invalid Version: "+r);if(this.raw=r,this.major=+t[1],this.minor=+t[2],this.patch=+t[3],this.major>U||this.major<0)throw new TypeError("Invalid major version");if(this.minor>U||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>U||this.patch<0)throw new TypeError("Invalid patch version");t[4]?this.prerelease=t[4].split(".").map(function(r){if(/^[0-9]+$/.test(r)){var e=+r;if(e>=0&&e<U)return e}return r}):this.prerelease=[],this.build=t[5]?t[5].split("."):[],this.format()}function i(r,e,t,i){"string"==typeof t&&(i=t,t=void 0);try{return new n(r,t).inc(e,i).version}catch(r){return null}}function o(e,t){if(y(e,t))return null;var n=r(e),i=r(t);if(n.prerelease.length||i.prerelease.length){for(var o in n)if(("major"===o||"minor"===o||"patch"===o)&&n[o]!==i[o])return"pre"+o;return"prerelease"}for(var o in n)if(("major"===o||"minor"===o||"patch"===o)&&n[o]!==i[o])return o}function s(r,e){var t=Nr.test(r),n=Nr.test(e);return t&&n&&(r=+r,e=+e),t&&!n?-1:n&&!t?1:r<e?-1:r>e?1:0}function a(r,e){return s(e,r)}function p(r,e){return new n(r,e).major}function c(r,e){return new n(r,e).minor}function u(r,e){return new n(r,e).patch}function h(r,e,t){return new n(r,t).compare(e)}function f(r,e){return h(r,e,!0)}function l(r,e,t){return h(e,r,t)}function v(r,e){return r.sort(function(r,t){return B.compare(r,t,e)})}function m(r,e){return r.sort(function(r,t){return B.rcompare(r,t,e)})}function g(r,e,t){return h(r,e,t)>0}function w(r,e,t){return h(r,e,t)<0}function y(r,e,t){return 0===h(r,e,t)}function d(r,e,t){return 0!==h(r,e,t)}function j(r,e,t){return h(r,e,t)>=0}function E(r,e,t){return h(r,e,t)<=0}function b(r,e,t,n){var i;switch(e){case"===":"object"==typeof r&&(r=r.version),"object"==typeof t&&(t=t.version),i=r===t;break;case"!==":"object"==typeof r&&(r=r.version),"object"==typeof t&&(t=t.version),i=r!==t;break;case"":case"=":case"==":i=y(r,t,n);break;case"!=":i=d(r,t,n);break;case">":i=g(r,t,n);break;case">=":i=j(r,t,n);break;case"<":i=w(r,t,n);break;case"<=":i=E(r,t,n);break;default:throw new TypeError("Invalid operator: "+e)}return i}function $(r,e){if(r instanceof $){if(r.loose===e)return r;r=r.value}if(!(this instanceof $))return new $(r,e);q("comparator",r,e),this.loose=e,this.parse(r),this.semver===Mr?this.value="":this.value=this.operator+this.semver.version,q("comp",this)}function k(r,e){if(r instanceof k&&r.loose===e)return r;if(!(this instanceof k))return new k(r,e);if(this.loose=e,this.raw=r,this.set=r.split(/\s*\|\|\s*/).map(function(r){return this.parseRange(r.trim())},this).filter(function(r){return r.length}),!this.set.length)throw new TypeError("Invalid SemVer Range: "+r);this.format()}function R(r,e){return new k(r,e).set.map(function(r){return r.map(function(r){return r.value}).join(" ").trim().split(" ")})}function S(r,e){return q("comp",r),r=V(r,e),q("caret",r),r=I(r,e),q("tildes",r),r=C(r,e),q("xrange",r),r=M(r,e),q("stars",r),r}function x(r){return!r||"x"===r.toLowerCase()||"*"===r}function I(r,e){return r.trim().split(/\s+/).map(function(r){return T(r,e)}).join(" ")}function T(r,e){var t=e?F[Er]:F[jr];return r.replace(t,function(e,t,n,i,o){q("tilde",r,e,t,n,i,o);var s;return x(t)?s="":x(n)?s=">="+t+".0.0 <"+(+t+1)+".0.0":x(i)?s=">="+t+"."+n+".0 <"+t+"."+(+n+1)+".0":o?(q("replaceTilde pr",o),"-"!==o.charAt(0)&&(o="-"+o),s=">="+t+"."+n+"."+i+o+" <"+t+"."+(+n+1)+".0"):s=">="+t+"."+n+"."+i+" <"+t+"."+(+n+1)+".0",q("tilde return",s),s})}function V(r,e){return r.trim().split(/\s+/).map(function(r){return A(r,e)}).join(" ")}function A(r,e){q("caret",r,e);var t=e?F[Rr]:F[kr];return r.replace(t,function(e,t,n,i,o){q("caret",r,e,t,n,i,o);var s;return x(t)?s="":x(n)?s=">="+t+".0.0 <"+(+t+1)+".0.0":x(i)?s="0"===t?">="+t+"."+n+".0 <"+t+"."+(+n+1)+".0":">="+t+"."+n+".0 <"+(+t+1)+".0.0":o?(q("replaceCaret pr",o),"-"!==o.charAt(0)&&(o="-"+o),s="0"===t?"0"===n?">="+t+"."+n+"."+i+o+" <"+t+"."+n+"."+(+i+1):">="+t+"."+n+"."+i+o+" <"+t+"."+(+n+1)+".0":">="+t+"."+n+"."+i+o+" <"+(+t+1)+".0.0"):(q("no pr"),s="0"===t?"0"===n?">="+t+"."+n+"."+i+" <"+t+"."+n+"."+(+i+1):">="+t+"."+n+"."+i+" <"+t+"."+(+n+1)+".0":">="+t+"."+n+"."+i+" <"+(+t+1)+".0.0"),q("caret return",s),s})}function C(r,e){return q("replaceXRanges",r,e),r.split(/\s+/).map(function(r){return N(r,e)}).join(" ")}function N(r,e){r=r.trim();var t=e?F[wr]:F[gr];return r.replace(t,function(e,t,n,i,o,s){q("xRange",r,e,t,n,i,o,s);var a=x(n),p=a||x(i),c=p||x(o),u=c;return"="===t&&u&&(t=""),a?e=">"===t||"<"===t?"<0.0.0":"*":t&&u?(p&&(i=0),c&&(o=0),">"===t?(t=">=",p?(n=+n+1,i=0,o=0):c&&(i=+i+1,o=0)):"<="===t&&(t="<",p?n=+n+1:i=+i+1),e=t+n+"."+i+"."+o):p?e=">="+n+".0.0 <"+(+n+1)+".0.0":c&&(e=">="+n+"."+i+".0 <"+n+"."+(+i+1)+".0"),q("xRange return",e),e})}function M(r,e){return q("replaceStars",r,e),r.trim().replace(F[Ar],"")}function _(r,e,t,n,i,o,s,a,p,c,u,h,f){return e=x(t)?"":x(n)?">="+t+".0.0":x(i)?">="+t+"."+n+".0":">="+e,a=x(p)?"":x(c)?"<"+(+p+1)+".0.0":x(u)?"<"+p+"."+(+c+1)+".0":h?"<="+p+"."+c+"."+u+"-"+h:"<="+a,(e+" "+a).trim()}function D(r,e){for(t=0;t<r.length;t++)if(!r[t].test(e))return!1;if(e.prerelease.length){for(var t=0;t<r.length;t++){if(q(r[t].semver),r[t].semver===Mr)return!0;if(r[t].semver.prerelease.length>0){var n=r[t].semver;if(n.major===e.major&&n.minor===e.minor&&n.patch===e.patch)return!0}}return!1}return!0}function X(r,e,t){try{e=new k(e,t)}catch(r){return!1}return e.test(r)}function z(r,e,t){return r.filter(function(r){return X(r,e,t)}).sort(function(r,e){return l(r,e,t)})[0]||null}function G(r,e){try{return new k(r,e).range||"*"}catch(r){return null}}function O(r,e,t){return Z(r,e,"<",t)}function P(r,e,t){return Z(r,e,">",t)}function Z(r,e,t,i){r=new n(r,i),e=new k(e,i);var o,s,a,p,c;switch(t){case">":o=g,s=E,a=w,p=">",c=">=";break;case"<":o=w,s=j,a=g,p="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(X(r,e,i))return!1;for(var u=0;u<e.set.length;++u){var h=null,f=null;if(e.set[u].forEach(function(r){h=h||r,f=f||r,o(r.semver,h.semver,i)?h=r:a(r.semver,f.semver,i)&&(f=r)}),h.operator===p||h.operator===c)return!1;if((!f.operator||f.operator===p)&&s(r,f.semver))return!1;if(f.operator===c&&a(r,f.semver))return!1}return!0}var q,B={exports:{}}.exports=n;q="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?function(){var r=Array.prototype.slice.call(arguments,0);r.unshift("SEMVER"),console.log.apply(console,r)}:function(){},B.SEMVER_SPEC_VERSION="2.0.0";var L=256,U=Number.MAX_SAFE_INTEGER||9007199254740991,F=B.re=[],H=B.src=[],J=0,K=J++;H[K]="0|[1-9]\\d*";var Q=J++;H[Q]="[0-9]+";var W=J++;H[W]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var Y=J++;H[Y]="("+H[K]+")\\.("+H[K]+")\\.("+H[K]+")";var rr=J++;H[rr]="("+H[Q]+")\\.("+H[Q]+")\\.("+H[Q]+")";var er=J++;H[er]="(?:"+H[K]+"|"+H[W]+")";var tr=J++;H[tr]="(?:"+H[Q]+"|"+H[W]+")";var nr=J++;H[nr]="(?:-("+H[er]+"(?:\\."+H[er]+")*))";var ir=J++;H[ir]="(?:-?("+H[tr]+"(?:\\."+H[tr]+")*))";var or=J++;H[or]="[0-9A-Za-z-]+";var sr=J++;H[sr]="(?:\\+("+H[or]+"(?:\\."+H[or]+")*))";var ar=J++,pr="v?"+H[Y]+H[nr]+"?"+H[sr]+"?";H[ar]="^"+pr+"$";var cr="[v=\\s]*"+H[rr]+H[ir]+"?"+H[sr]+"?",ur=J++;H[ur]="^"+cr+"$";var hr=J++;H[hr]="((?:<|>)?=?)";var fr=J++;H[fr]=H[Q]+"|x|X|\\*";var lr=J++;H[lr]=H[K]+"|x|X|\\*";var vr=J++;H[vr]="[v=\\s]*("+H[lr]+")(?:\\.("+H[lr]+")(?:\\.("+H[lr]+")(?:"+H[nr]+")?"+H[sr]+"?)?)?";var mr=J++;H[mr]="[v=\\s]*("+H[fr]+")(?:\\.("+H[fr]+")(?:\\.("+H[fr]+")(?:"+H[ir]+")?"+H[sr]+"?)?)?";var gr=J++;H[gr]="^"+H[hr]+"\\s*"+H[vr]+"$";var wr=J++;H[wr]="^"+H[hr]+"\\s*"+H[mr]+"$";var yr=J++;H[yr]="(?:~>?)";var dr=J++;H[dr]="(\\s*)"+H[yr]+"\\s+",F[dr]=new RegExp(H[dr],"g");var jr=J++;H[jr]="^"+H[yr]+H[vr]+"$";var Er=J++;H[Er]="^"+H[yr]+H[mr]+"$";var br=J++;H[br]="(?:\\^)";var $r=J++;H[$r]="(\\s*)"+H[br]+"\\s+",F[$r]=new RegExp(H[$r],"g");var kr=J++;H[kr]="^"+H[br]+H[vr]+"$";var Rr=J++;H[Rr]="^"+H[br]+H[mr]+"$";var Sr=J++;H[Sr]="^"+H[hr]+"\\s*("+cr+")$|^$";var xr=J++;H[xr]="^"+H[hr]+"\\s*("+pr+")$|^$";var Ir=J++;H[Ir]="(\\s*)"+H[hr]+"\\s*("+cr+"|"+H[vr]+")",F[Ir]=new RegExp(H[Ir],"g");var Tr=J++;H[Tr]="^\\s*("+H[vr]+")\\s+-\\s+("+H[vr]+")\\s*$";var Vr=J++;H[Vr]="^\\s*("+H[mr]+")\\s+-\\s+("+H[mr]+")\\s*$";var Ar=J++;H[Ar]="(<|>)?=?\\s*\\*";for(var Cr=0;Cr<J;Cr++)q(Cr,H[Cr]),F[Cr]||(F[Cr]=new RegExp(H[Cr]));B.parse=r,B.valid=e,B.clean=t,window.semver=B.SemVer=n,n.prototype.format=function(){return this.version=this.major+"."+this.minor+"."+this.patch,this.prerelease.length&&(this.version+="-"+this.prerelease.join(".")),this.version},n.prototype.inspect=function(){return'<SemVer "'+this+'">'},n.prototype.toString=function(){return this.version},n.prototype.compare=function(r){return q("SemVer.compare",this.version,this.loose,r),r instanceof n||(r=new n(r,this.loose)),this.compareMain(r)||this.comparePre(r)},n.prototype.compareMain=function(r){return r instanceof n||(r=new n(r,this.loose)),s(this.major,r.major)||s(this.minor,r.minor)||s(this.patch,r.patch)},n.prototype.comparePre=function(r){if(r instanceof n||(r=new n(r,this.loose)),this.prerelease.length&&!r.prerelease.length)return-1;if(!this.prerelease.length&&r.prerelease.length)return 1;if(!this.prerelease.length&&!r.prerelease.length)return 0;var e=0;do{var t=this.prerelease[e],i=r.prerelease[e];if(q("prerelease compare",e,t,i),void 0===t&&void 0===i)return 0;if(void 0===i)return 1;if(void 0===t)return-1;if(t!==i)return s(t,i)}while(++e)},n.prototype.inc=function(r,e){switch(r){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",e);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",e);break;case"prepatch":this.prerelease.length=0,this.inc("patch",e),this.inc("pre",e);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",e),this.inc("pre",e);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{for(var t=this.prerelease.length;--t>=0;)"number"==typeof this.prerelease[t]&&(this.prerelease[t]++,t=-2);-1===t&&this.prerelease.push(0)}e&&(this.prerelease[0]===e?isNaN(this.prerelease[1])&&(this.prerelease=[e,0]):this.prerelease=[e,0]);break;default:throw new Error("invalid increment argument: "+r)}return this.format(),this},B.inc=i,B.diff=o,B.compareIdentifiers=s;var Nr=/^[0-9]+$/;B.rcompareIdentifiers=a,B.major=p,B.minor=c,B.patch=u,B.compare=h,B.compareLoose=f,B.rcompare=l,B.sort=v,B.rsort=m,B.gt=g,B.lt=w,B.eq=y,B.neq=d,B.gte=j,B.lte=E,B.cmp=b,B.Comparator=$;var Mr={};$.prototype.parse=function(r){var e=this.loose?F[Sr]:F[xr],t=r.match(e);if(!t)throw new TypeError("Invalid comparator: "+r);this.operator=t[1],"="===this.operator&&(this.operator=""),t[2]?this.semver=new n(t[2],this.loose):this.semver=Mr},$.prototype.inspect=function(){return'<SemVer Comparator "'+this+'">'},$.prototype.toString=function(){return this.value},$.prototype.test=function(r){return q("Comparator.test",r,this.loose),this.semver===Mr||("string"==typeof r&&(r=new n(r,this.loose)),b(r,this.operator,this.semver,this.loose))},B.Range=k,k.prototype.inspect=function(){return'<SemVer Range "'+this.range+'">'},k.prototype.format=function(){return this.range=this.set.map(function(r){return r.join(" ").trim()}).join("||").trim(),this.range},k.prototype.toString=function(){return this.range},k.prototype.parseRange=function(r){var e=this.loose;r=r.trim(),q("range",r,e);var t=e?F[Vr]:F[Tr];r=r.replace(t,_),q("hyphen replace",r),r=r.replace(F[Ir],"$1$2$3"),q("comparator trim",r,F[Ir]),r=(r=(r=r.replace(F[dr],"$1~")).replace(F[$r],"$1^")).split(/\s+/).join(" ");var n=e?F[Sr]:F[xr],i=r.split(" ").map(function(r){return S(r,e)}).join(" ").split(/\s+/);return this.loose&&(i=i.filter(function(r){return!!r.match(n)})),i=i.map(function(r){return new $(r,e)})},B.toComparators=R,k.prototype.test=function(r){if(!r)return!1;"string"==typeof r&&(r=new n(r,this.loose));for(var e=0;e<this.set.length;e++)if(D(this.set[e],r))return!0;return!1},B.satisfies=X,B.maxSatisfying=z,B.validRange=G,B.ltr=O,B.gtr=P,B.outside=Z,"function"==typeof define&&define.amd&&define(B)}();