Skip to content
Browse files

fix noConflict

  • Loading branch information...
1 parent 5012cca commit 667bc648334d23f3c51d96604ebf9e5bd6be4507 @rjrodger committed
Showing with 6 additions and 28 deletions.
  1. +1 −1 gex-min.js
  2. +1 −1 gex-min.map
  3. +3 −23 gex.js
  4. +1 −1 package.json
  5. +0 −2 test/jasmine.html
View
2 gex-min.js
@@ -1,3 +1,3 @@
/* Copyright (c) 2011-2013 Richard Rodger, MIT License, https://github.com/rjrodger/patrun */
-"use strict";(function(){function e(e){function r(e){return u.isNull(e)||u.isNaN(e)||u.isUndefined(e)}function i(e){var r=""+e;return(u.isNull(e)||u.isNaN(e)||u.isUndefined(e))&&(r=""),r}function s(e){e=""+e;for(var r=!1,n=u.keys(c),t=0;t<n.length&&!r;t++)r=!!c[n[t]].exec(e);return r}var o=this;u.noConflict=function(){return n._=t,o},o.on=function(e){if(u.isString(e)||u.isNumber(e)||u.isBoolean(e)||u.isDate(e)||u.isRegExp(e))return s(e)?e:null;if(u.isArray(e)||u.isArguments(e)){for(var n=[],t=0;t<e.length;t++)!r(e[t])&&s(e[t])&&n.push(e[t]);return n}if(r(e))return null;if(u.isObject(e)){var n={};for(var i in e)e.hasOwnProperty(i)&&s(i)&&(n[i]=e[i]);return n}return null},o.esc=function(e){var r=i(e);return r=r.replace(/\*/g,"**"),r=r.replace(/\?/g,"*?")},o.re=function(e){if(""==e||e){var e=o.escregexp(e);return e=e.replace(/\\\*/g,"[\\s\\S]*"),e=e.replace(/\\\?/g,"[\\s\\S]"),e=e.replace(/\[\\s\\S\]\*\[\\s\\S\]\*/g,"\\*"),e=e.replace(/\[\\s\\S\]\*\[\\s\\S\]/g,"\\?"),e="^"+e+"$",new RegExp(e)}var r=u.keys(c);return 1==r.length?c[r[0]]:u.clone(c)},o.escregexp=function(e){return e?(""+e).replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"):""},o.toString=function(){return""+u.keys(c)};var f=null==e||u.isNaN(e)?[]:u.isArray(e)?e:[e],c={};u.each(f,function(e){var r=o.re(e);c[e]=r})}function r(r){var n=new e(r);return n}var n=this,t=n.gex,i="undefined"!=typeof require,u=n._;if("undefined"==typeof u){if(!i)throw new Error("gex requires underscore, see http://underscorejs.org");u=require("underscore")}r.Gex=e,"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=r),exports.gex=r):n.gex=r}).call(this);
+"use strict";(function(){function e(e){function r(e){return u.isNull(e)||u.isNaN(e)||u.isUndefined(e)}function i(e){var r=""+e;return(u.isNull(e)||u.isNaN(e)||u.isUndefined(e))&&(r=""),r}function s(e){e=""+e;for(var r=!1,n=u.keys(c),t=0;t<n.length&&!r;t++)r=!!c[n[t]].exec(e);return r}var o=this;o.noConflict=function(){return n.previous_gex=t,o},o.on=function(e){if(u.isString(e)||u.isNumber(e)||u.isBoolean(e)||u.isDate(e)||u.isRegExp(e))return s(e)?e:null;if(u.isArray(e)||u.isArguments(e)){for(var n=[],t=0;t<e.length;t++)!r(e[t])&&s(e[t])&&n.push(e[t]);return n}if(r(e))return null;if(u.isObject(e)){var n={};for(var i in e)e.hasOwnProperty(i)&&s(i)&&(n[i]=e[i]);return n}return null},o.esc=function(e){var r=i(e);return r=r.replace(/\*/g,"**"),r=r.replace(/\?/g,"*?")},o.re=function(e){if(""==e||e){var e=o.escregexp(e);return e=e.replace(/\\\*/g,"[\\s\\S]*"),e=e.replace(/\\\?/g,"[\\s\\S]"),e=e.replace(/\[\\s\\S\]\*\[\\s\\S\]\*/g,"\\*"),e=e.replace(/\[\\s\\S\]\*\[\\s\\S\]/g,"\\?"),e="^"+e+"$",new RegExp(e)}var r=u.keys(c);return 1==r.length?c[r[0]]:u.clone(c)},o.escregexp=function(e){return e?(""+e).replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"):""},o.toString=function(){return""+u.keys(c)};var f=null==e||u.isNaN(e)?[]:u.isArray(e)?e:[e],c={};u.each(f,function(e){var r=o.re(e);c[e]=r})}function r(r){var n=new e(r);return n}var n=this,t=n.gex,i="undefined"!=typeof require,u=n._;if("undefined"==typeof u){if(!i)throw new Error("gex requires underscore, see http://underscorejs.org");u=require("underscore")}r.Gex=e,"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=r),exports.gex=r):n.gex=r}).call(this);
//# sourceMappingURL=gex-min.map
View
2 gex-min.map
@@ -1 +1 @@
-{"version":3,"file":"gex-min.js","sources":["gex.js"],"names":["Gex","gexspec","dodgy","obj","_","isNull","isNaN","isUndefined","clean","gexexp","gexstr","match","str","hasmatch","gexstrs","keys","gexmap","i","length","exec","self","this","noConflict","root","previousGex","on","isString","isNumber","isBoolean","isDate","isRegExp","isArray","isArguments","out","push","isObject","p","hasOwnProperty","esc","replace","re","gs","escregexp","RegExp","clone","restr","toString","each","gex","has_require","require","Error","exports","module","call"],"mappings":";AACA,cAGA,WAgBE,QAASA,GAAIC,GAGX,QAASC,GAAMC,GACb,MAASC,GAAEC,OAAOF,IACNC,EAAEE,MAAMH,IACRC,EAAEG,YAAYJ,GAG5B,QAASK,GAAMC,GACb,GAAIC,GAAS,GAAGD,CAMhB,QALIL,EAAEC,OAAOI,IACNL,EAAEE,MAAMG,IACRL,EAAEG,YAAYE,MACnBC,EAAS,IAEJA,EAuBT,QAASC,GAAMC,GACbA,EAAM,GAAGA,CAIT,KAAI,GAHAC,IAAW,EACXC,EAAUV,EAAEW,KAAKC,GAEbC,EAAI,EAAGA,EAAIH,EAAQI,SAAWL,EAAUI,IAC9CJ,IAAaG,EAAOF,EAAQG,IAAIE,KAAKP,EAGvC,OAAOC,GA/CT,GAAIO,GAAOC,IAmDXjB,GAAEkB,WAAa,WAEb,MADAC,GAAKnB,EAAIoB,EACFJ,GAITA,EAAKK,GAAK,SAAStB,GACjB,GAAIC,EAAEsB,SAASvB,IACRC,EAAEuB,SAASxB,IACXC,EAAEwB,UAAUzB,IACZC,EAAEyB,OAAO1B,IACTC,EAAE0B,SAAS3B,GAIhB,MAAOQ,GAAMR,GAAOA,EAAM,I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,SAASF,GACxB,GAAI4B,GAAKpB,EAAKoB,GAAG5B,EACjBI,GAAOJ,GAAK4B,IAOhB,QAASQ,GAAI/C,GACX,GAAI+C,GAAM,GAAIhD,GAAIC,EAClB,OAAO+C,GAjLT,GAAIzB,GAAcF,KACdG,EAAcD,EAAKyB,IAEnBC,EAAiC,mBAAZC,SAErB9C,EAAImB,EAAKnB,CAEb,IAAiB,mBAANA,GAAoB,CAC7B,IAAI6C,EAGC,KAAM,IAAIE,OAAM,uDAFnB/C,GAAI8C,QAAQ,cA0KhBF,EAAIhD,IAAMA,EAIa,mBAAZoD,UACa,mBAAXC,SAA0BA,OAAOD,UAC1CA,QAAUC,OAAOD,QAAUJ,GAE7BI,QAAQJ,IAAMA,GAGdzB,EAAKyB,IAAMA,IAGZM,KAAKjC"}
+{"version":3,"file":"gex-min.js","sources":["gex.js"],"names":["Gex","gexspec","dodgy","obj","_","isNull","isNaN","isUndefined","clean","gexexp","gexstr","match","str","hasmatch","gexstrs","keys","gexmap","i","length","exec","self","this","noConflict","root","previous_gex","on","isString","isNumber","isBoolean","isDate","isRegExp","isArray","isArguments","out","push","isObject","p","hasOwnProperty","esc","replace","re","gs","escregexp","RegExp","clone","restr","toString","each","gex","has_require","require","Error","exports","module","call"],"mappings":";AACA,cAGA,WAgBE,QAASA,GAAIC,GAGX,QAASC,GAAMC,GACb,MAASC,GAAEC,OAAOF,IACNC,EAAEE,MAAMH,IACRC,EAAEG,YAAYJ,GAG5B,QAASK,GAAMC,GACb,GAAIC,GAAS,GAAGD,CAMhB,QALIL,EAAEC,OAAOI,IACNL,EAAEE,MAAMG,IACRL,EAAEG,YAAYE,MACnBC,EAAS,IAEJA,EAGT,QAASC,GAAMC,GACbA,EAAM,GAAGA,CAIT,KAAI,GAHAC,IAAW,EACXC,EAAUV,EAAEW,KAAKC,GAEbC,EAAI,EAAGA,EAAIH,EAAQI,SAAWL,EAAUI,IAC9CJ,IAAaG,EAAOF,EAAQG,IAAIE,KAAKP,EAGvC,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B,IAI9DI,EAAKsB,UAAY,SAASG,GACxB,MAAOA,IAAS,GAAGA,GAAON,QAAQ,2BAA4B,QAAU,IAG1EnB,EAAK0B,SAAW,WACd,MAAO,GAAG1C,EAAEW,KAAKC,GAInB,IAAIF,GAAW,MAAMb,GAASG,EAAEE,MAAML,MAAiBG,EAAE2B,QAAQ9B,GAAWA,GAAWA,GAGnFe,IAEJZ,GAAE2C,KAAMjC,EAAS,SAASF,GACxB,GAAI4B,GAAKpB,EAAKoB,GAAG5B,EACjBI,GAAOJ,GAAK4B,IAOhB,QAASQ,GAAI/C,GACX,GAAI+C,GAAM,GAAIhD,GAAIC,EAClB,OAAO+C,GA7JT,GAAIzB,GAAcF,KACdG,EAAeD,EAAKyB,IAEpBC,EAAiC,mBAAZC,SAErB9C,EAAImB,EAAKnB,CAEb,IAAiB,mBAANA,GAAoB,CAC7B,IAAI6C,EAGC,KAAM,IAAIE,OAAM,uDAFnB/C,GAAI8C,QAAQ,cAsJhBF,EAAIhD,IAAMA,EAIa,mBAAZoD,UACa,mBAAXC,SAA0BA,OAAOD,UAC1CA,QAAUC,OAAOD,QAAUJ,GAE7BI,QAAQJ,IAAMA,GAGdzB,EAAKyB,IAAMA,IAGZM,KAAKjC"}
View
26 gex.js
@@ -4,7 +4,7 @@
(function() {
var root = this
- var previousGex = root.gex
+ var previous_gex = root.gex
var has_require = typeof require !== 'undefined'
@@ -37,26 +37,6 @@
return gexstr
}
-/*
- function gexstr(gexexp) {
- var gs = []
- if( _.isArray(gexexp) || _.isArguments(gexexp) ) {
- for( var i = 0; i < gexexp.length; i++ ){
- var s = clean(gexexp[i])
- gexexp.push(
- ( '*' == s || '?' == s ) ? s
- : self.esc(s)
- )
- }
- gs = gs.join('')
- }
- else {
- gs = clean(gexexp)
- }
- return gs
- }
-*/
-
function match(str) {
str = ''+str
var hasmatch = false
@@ -70,8 +50,8 @@
}
- _.noConflict = function() {
- root._ = previousGex;
+ self.noConflict = function() {
+ root.previous_gex = previous_gex;
return self;
}
View
2 package.json
@@ -9,7 +9,7 @@
"expression",
"regular"
],
- "version": "0.1.2",
+ "version": "0.1.3",
"homepage": "https://github.com/rjrodger/gex",
"author": "Richard Rodger (http://richardrodger.com/)",
"contributors": [
View
2 test/jasmine.html
@@ -10,8 +10,6 @@
<script src="jasmine-1.3.1/jasmine.js"></script>
<script src="jasmine-1.3.1/jasmine-html.js"></script>
- <script>function require(){ return gex }</script>
-
<script src="gex.spec.js"></script>
<script type="text/javascript">

0 comments on commit 667bc64

Please sign in to comment.
Something went wrong with that request. Please try again.