updated packages + expand regex support

This commit is contained in:
Daniel 2020-12-12 23:43:33 -05:00
parent fc70807e5d
commit fbea66e0ce
9 changed files with 1628 additions and 1769 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -11,21 +11,6 @@ object-assign
* MIT Licensed
*/
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use

3275
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -17,9 +17,9 @@
"license": "MIT",
"dependencies": {
"@loadable/component": "^5.14.1",
"@material-ui/core": "^4.11.0",
"@material-ui/icons": "^4.9.1",
"@material-ui/styles": "^4.10.0",
"@material-ui/core": "^4.11.2",
"@material-ui/icons": "^4.11.2",
"@material-ui/styles": "^4.11.2",
"lokijs": "^1.5.11",
"mobx": "^5.15.7",
"mobx-react": "^6.3.1",
@ -36,58 +36,59 @@
"react-router-dom": "^5.2.0",
"tone": "^14.7.58",
"universal-cookie": "^4.0.4",
"whatwg-fetch": "^3.4.1"
"whatwg-fetch": "^3.5.0"
},
"devDependencies": {
"@babel/cli": "^7.12.1",
"@babel/core": "^7.12.3",
"@babel/node": "^7.12.1",
"@babel/cli": "^7.12.10",
"@babel/core": "^7.12.10",
"@babel/node": "^7.12.10",
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-proposal-decorators": "^7.12.1",
"@babel/plugin-proposal-dynamic-import": "^7.12.1",
"@babel/plugin-proposal-object-rest-spread": "^7.12.1",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-transform-computed-properties": "^7.12.1",
"@babel/plugin-transform-runtime": "^7.12.1",
"@babel/plugin-transform-runtime": "^7.12.10",
"@babel/polyfill": "^7.12.1",
"@babel/preset-env": "^7.12.1",
"@babel/preset-react": "^7.12.1",
"@babel/preset-typescript": "^7.12.1",
"@babel/register": "^7.12.1",
"@babel/runtime": "^7.12.1",
"@babel/preset-env": "^7.12.10",
"@babel/preset-react": "^7.12.10",
"@babel/preset-typescript": "^7.12.7",
"@babel/register": "^7.12.10",
"@babel/runtime": "^7.12.5",
"@types/chai": "^4.2.14",
"@types/mocha": "^8.0.3",
"@types/react": "^16.9.55",
"@types/react-dom": "^16.9.9",
"@types/mocha": "^8.2.0",
"@types/react": "^16.14.2",
"@types/react-dom": "^16.9.10",
"@types/react-router-dom": "^5.1.6",
"@typescript-eslint/eslint-plugin": "^3.3.0",
"@typescript-eslint/parser": "^3.3.0",
"@typescript-eslint/eslint-plugin": "^4.9.1",
"@typescript-eslint/parser": "^4.9.1",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.1.0",
"babel-loader": "^8.2.2",
"chai": "^4.2.0",
"cross-env": "^7.0.2",
"css-loader": "^5.0.0",
"cross-env": "^7.0.3",
"css-loader": "^5.0.1",
"css-minimizer-webpack-plugin": "^1.1.5",
"eslint": "^6.8.0",
"eslint": "^7.15.0",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react": "^7.21.5",
"eslint-plugin-react-hooks": "^4.2.0",
"fsevents": "^2.2.1",
"ignore-styles": "^5.0.1",
"jsdom": "^16.4.0",
"jsdom-global": "^3.0.2",
"mini-css-extract-plugin": "^1.2.1",
"mocha": "^8.2.0",
"mini-css-extract-plugin": "^1.3.3",
"mocha": "^8.2.1",
"node-sass": "^4.14.1",
"postcss": "^8.1.4",
"sass-loader": "^10.0.4",
"postcss": "^8.2.1",
"sass-loader": "^10.1.0",
"style-loader": "^2.0.0",
"terser-webpack-plugin": "^5.0.3",
"ts-node": "^9.0.0",
"typescript": "^4.0.5",
"webpack": "^5.3.1",
"webpack-cli": "^4.1.0",
"ts-node": "^9.1.1",
"typescript": "^4.1.3",
"webpack": "^5.10.1",
"webpack-cli": "^4.2.0",
"webpack-dev-server": "^3.11.0"
},
"browser": {

View File

@ -1,14 +1,30 @@
import loki from 'lokijs';
import API from '../../SpreadsheetData';
function cleanInputRegex(input) {
function cleanInputRegex(input, check=true) {
input = input.replace(/\|\/g, "'");
if (check === true) {
const testRegex = /[\^$+*\[\]|]/g;
if (testRegex.test(input)) {
try {
const returnRegex = new RegExp(input, 'i');
console.log(returnRegex);
return returnRegex;
} catch (e) {/* */}
}
}
input = input
.replace(/\\/g, '')
.replace(/\|\/g, "'")
.replace(/\(|\)/g, (match) => ("\\"+match));
.replace(/[\^$+*\[\]\\]/g, '')
.replace(/[\(\)]/g, (match) => {
console.log(match);
return ("\\"+match);
});
// .replace(/~(\w+)/, (match) => (`\(?!${match}\)`));
return new RegExp(input.trim(), 'i');
const returnRegex = new RegExp(input, 'i');
console.log(returnRegex);
return returnRegex;
}
export default function search_api(input) {
@ -143,7 +159,7 @@ export default function search_api(input) {
// Subtypes / Initiative
if (input.subtypes.length > 0) {
const subtypesList = input.subtypes.split(",").filter(Boolean).map((item) => {
return ({ '$regex': cleanInputRegex(item) });
return ({ '$regex': cleanInputRegex(item, false) });
});
creatureResults = creatureResults.find({ 'gsx$types': { '$or': subtypesList }});

View File

@ -24,7 +24,7 @@ export default class Creature extends React.Component {
}
// <past> <tribe> <types>
const line = " " + (past ? "Past " : "") + (tribe == "Generic" ? "" : tribe + " ") + types;
const line = " " + (past ? "Past " : "") + types;
return <span><Tribe tribe={tribe} />{line}</span>;
};

View File

@ -45,11 +45,11 @@
"inlineSourceMap": true
},
"include": [
"./src/components"
"src/components"
],
"exclude": [
"./build",
"./node_modules",
"./src/**/*.spec.ts"
"build",
"node_modules",
"**/*.spec.ts"
]
}