1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-16 21:36:41 +02:00

First search for rgx: then for other operators

This commit is contained in:
Maciej Sitarz 2017-12-06 21:51:36 +01:00
parent 4a6ae393a5
commit 75faca6e8d

View file

@ -1780,8 +1780,21 @@ export class TableFilter {
// first checks if there is any operator (<,>,<=,>=,!,*,=,{,},
// rgx:)
//regexp
if (hasRE) {
//in case regexp throws
try {
//operator is removed
let srchArg = term.replace(reRe, '');
let rgx = new RegExp(srchArg);
occurence = rgx.test(cellValue);
} catch (ex) {
occurence = false;
}
}
// lower equal
if (hasLE) {
else if (hasLE) {
occurence = numData <= parseNb(
term.replace(reLe, ''),
decimal
@ -1844,18 +1857,6 @@ export class TableFilter {
//non-empty
else if (hasNM) {
occurence = !isEmptyString(cellValue);
}
//regexp
else if (hasRE) {
//in case regexp throws
try {
//operator is removed
let srchArg = term.replace(reRe, '');
let rgx = new RegExp(srchArg);
occurence = rgx.test(cellValue);
} catch (ex) {
occurence = false;
}
} else {
// If numeric type data, perform a strict equality test and
// fallback to unformatted number string comparison