Comparing version 3.1.0 to 4.0.1
@@ -18,2 +18,3 @@ declare class Gexer { | ||
declare function Gex(gexspec: string | string[]): Gexer; | ||
export default Gex; | ||
export { Gex }; |
@@ -9,6 +9,8 @@ "use strict"; | ||
this.gexmap = {}; | ||
let gexstrs = Array.isArray(gexspec) ? gexspec : [gexspec]; | ||
gexstrs.forEach((str) => { | ||
this.gexmap[str] = this.re(this.clean(str)); | ||
}); | ||
if (null != gexspec) { | ||
let gexstrs = Array.isArray(gexspec) ? gexspec : [gexspec]; | ||
gexstrs.forEach((str) => { | ||
this.gexmap[str] = this.re(this.clean(str)); | ||
}); | ||
} | ||
} | ||
@@ -102,2 +104,7 @@ dodgy(obj) { | ||
exports.Gex = Gex; | ||
if ('undefined' !== typeof module) { | ||
module.exports = Gex; | ||
module.exports.Gex = Gex; | ||
} | ||
exports.default = Gex; | ||
//# sourceMappingURL=gex.js.map |
@@ -1,1 +0,1 @@ | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Gex=e()}}((function(){var e={};Object.defineProperty(e,"__esModule",{value:!0}),e.Gex=void 0;class t{constructor(e){this.desc="",this.gexmap={},(Array.isArray(e)?e:[e]).forEach(e=>{this.gexmap[e]=this.re(this.clean(e))})}dodgy(e){return null==e||Number.isNaN(e)}clean(e){let t=""+e;return this.dodgy(e)?"":t}match(e){e=""+e;let t=!1,r=Object.keys(this.gexmap);for(let n=0;n<r.length&&!t;n++)t=!!this.gexmap[r[n]].exec(e);return t}on(e){if(null==e)return null;let t=typeof e;if("string"===t||"number"===t||"boolean"===t||e instanceof Date||e instanceof RegExp)return this.match(e)?e:null;if(Array.isArray(e)){let t=[];for(let r=0;r<e.length;r++)!this.dodgy(e[r])&&this.match(e[r])&&t.push(e[r]);return t}{let t={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.match(r)&&(t[r]=e[r]);return t}}esc(e){let t=this.clean(e);return(t=t.replace(/\*/g,"**")).replace(/\?/g,"*?")}escregexp(e){return e?(""+e).replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"):""}re(e){if(""===e||e)return e="^"+(e=(e=(e=(e=(e=this.escregexp(e)).replace(/\\\*/g,"[\\s\\S]*")).replace(/\\\?/g,"[\\s\\S]")).replace(/\[\\s\\S\]\*\[\\s\\S\]\*/g,"\\*")).replace(/\[\\s\\S\]\*\[\\s\\S\]/g,"\\?"))+"$",new RegExp(e);{let e=Object.keys(this.gexmap);return 1==e.length?this.gexmap[e[0]]:{...this.gexmap}}}toString(){let e=this.desc;return""!=e?e:this.desc="Gex["+Object.keys(this.gexmap)+"]"}inspect(){return this.toString()}}return e.Gex=function(e){return new t(e)},e})); | ||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Gex=e()}}((function(){var e={exports:{}};Object.defineProperty(e.exports,"__esModule",{value:!0}),e.exports.Gex=void 0;class t{constructor(e){this.desc="",this.gexmap={},null!=e&&(Array.isArray(e)?e:[e]).forEach(e=>{this.gexmap[e]=this.re(this.clean(e))})}dodgy(e){return null==e||Number.isNaN(e)}clean(e){let t=""+e;return this.dodgy(e)?"":t}match(e){e=""+e;let t=!1,r=Object.keys(this.gexmap);for(let s=0;s<r.length&&!t;s++)t=!!this.gexmap[r[s]].exec(e);return t}on(e){if(null==e)return null;let t=typeof e;if("string"===t||"number"===t||"boolean"===t||e instanceof Date||e instanceof RegExp)return this.match(e)?e:null;if(Array.isArray(e)){let t=[];for(let r=0;r<e.length;r++)!this.dodgy(e[r])&&this.match(e[r])&&t.push(e[r]);return t}{let t={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&this.match(r)&&(t[r]=e[r]);return t}}esc(e){let t=this.clean(e);return(t=t.replace(/\*/g,"**")).replace(/\?/g,"*?")}escregexp(e){return e?(""+e).replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"):""}re(e){if(""===e||e)return e="^"+(e=(e=(e=(e=(e=this.escregexp(e)).replace(/\\\*/g,"[\\s\\S]*")).replace(/\\\?/g,"[\\s\\S]")).replace(/\[\\s\\S\]\*\[\\s\\S\]\*/g,"\\*")).replace(/\[\\s\\S\]\*\[\\s\\S\]/g,"\\?"))+"$",new RegExp(e);{let e=Object.keys(this.gexmap);return 1==e.length?this.gexmap[e[0]]:{...this.gexmap}}}toString(){let e=this.desc;return""!=e?e:this.desc="Gex["+Object.keys(this.gexmap)+"]"}inspect(){return this.toString()}}function r(e){return new t(e)}return e.exports.Gex=r,e.exports=r,e.exports.Gex=r,e.exports.default=r,e=e.exports})); |
17
gex.ts
@@ -10,7 +10,9 @@ /* Copyright (c) 2011-2020 Richard Rodger, MIT License */ | ||
let gexstrs = Array.isArray(gexspec) ? gexspec : [gexspec] | ||
if (null != gexspec) { | ||
let gexstrs = Array.isArray(gexspec) ? gexspec : [gexspec] | ||
gexstrs.forEach((str) => { | ||
this.gexmap[str] = this.re(this.clean(str)) | ||
}) | ||
gexstrs.forEach((str) => { | ||
this.gexmap[str] = this.re(this.clean(str)) | ||
}) | ||
} | ||
} | ||
@@ -119,2 +121,9 @@ | ||
if ('undefined' !== typeof module) { | ||
module.exports = Gex | ||
module.exports.Gex = Gex | ||
} | ||
export default Gex | ||
export { Gex } |
{ | ||
"name": "gex", | ||
"version": "3.1.0", | ||
"version": "4.0.1", | ||
"main": "dist/gex.js", | ||
@@ -9,6 +9,11 @@ "browser": "dist/gex.min.js", | ||
"scripts": { | ||
"test": "jest --coverage", | ||
"test-pure": "jest --coverage --config jest.config.pure.js", | ||
"test-some": "jest -t", | ||
"test-some-pure": "jest --config jest.config.pure.js -t", | ||
"test-watch": "jest --coverage --watchAll", | ||
"test-web": "npm run build-web && browserify -i util -o test/jester-web.js -e test/jester.js -im && open test/jester.html", | ||
"watch": "tsc -w -d", | ||
"build": "tsc -d && cp dist/gex.js dist/gex.min.js && browserify -o dist/gex.min.js -e dist/gex.js -s Gex -im -i assert -p tinyify", | ||
"test": "lab -v -L -P test -t 90 --sourcemaps --transform node_modules/lab-transform-typescript -r console -o stdout -r html -o test/coverage.html -r lcov -o test/lcov.info", | ||
"test-web": "browserify -o test-web/test-web.js -e test/gex.test.js -s Gex -im -i assert -i @hapi/lab && open test-web/index.html", | ||
"build": "tsc -d", | ||
"build-web": "npm run build && cp dist/gex.js dist/gex.min.js && browserify -i util -o dist/gex.min.js -e dist/gex.js -s Gex -im -p tinyify", | ||
"prettier": "prettier --write --no-semi --single-quote gex.ts test/*.js", | ||
@@ -19,3 +24,3 @@ "clean": "rm -rf node_modules yarn.lock package-lock.json", | ||
"repo-publish": "npm run clean && npm i && npm run repo-publish-quick", | ||
"repo-publish-quick": "npm run prettier && npm run build && npm run test && npm run test-web && npm run repo-tag && npm publish --registry http://registry.npmjs.org " | ||
"repo-publish-quick": "npm run prettier && npm run build && npm run test && npm run test-web && npm run repo-tag && npm publish --registry https://registry.npmjs.org " | ||
}, | ||
@@ -45,13 +50,13 @@ "keywords": [ | ||
"devDependencies": { | ||
"@hapi/code": "^8.0.2", | ||
"@hapi/lab": "^24.1.0", | ||
"@types/jest": "^28.1.2", | ||
"@types/node": "^18.0.0", | ||
"browserify": "^17.0.0", | ||
"@types/node": "^14.14.14", | ||
"prettier": "^2.2.1", | ||
"esbuild": "^0.14.45", | ||
"esbuild-jest": "^0.5.0", | ||
"jest": "^28.1.1", | ||
"prettier": "^2.7.1", | ||
"tinyify": "^3.0.0", | ||
"typescript": "^4.1.3", | ||
"hapi-lab-shim": "0.0.2", | ||
"jsonic": "^1.0.1", | ||
"lab-transform-typescript": "^3.0.1" | ||
"ts-jest": "^28.0.5", | ||
"typescript": "^4.7.4" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
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
230
18938
8