summaryrefslogtreecommitdiffstats
path: root/client/lib
diff options
context:
space:
mode:
authorLauri Ojansivu <x@xet7.org>2018-08-12 14:36:37 +0300
committerLauri Ojansivu <x@xet7.org>2018-08-12 14:36:37 +0300
commitf5515cb95fc93882e5e1098d6043267b9260b9d7 (patch)
tree49a64093d37bb0c780b3a8fedec700a53db513ac /client/lib
parent32d9a2c10bf43f7e253e8dcca3cb972ce1a7210d (diff)
downloadwekan-f5515cb95fc93882e5e1098d6043267b9260b9d7.tar.gz
wekan-f5515cb95fc93882e5e1098d6043267b9260b9d7.tar.bz2
wekan-f5515cb95fc93882e5e1098d6043267b9260b9d7.zip
Fix lint errors.
Diffstat (limited to 'client/lib')
-rw-r--r--client/lib/filter.js248
1 files changed, 124 insertions, 124 deletions
diff --git a/client/lib/filter.js b/client/lib/filter.js
index 26140ca6..ccc0e16b 100644
--- a/client/lib/filter.js
+++ b/client/lib/filter.js
@@ -187,27 +187,27 @@ class AdvancedFilter {
if (commands[i].cmd) {
switch (commands[i].cmd) {
case '(':
- {
- level++;
- if (start === -1) start = i;
- continue;
- }
+ {
+ level++;
+ if (start === -1) start = i;
+ continue;
+ }
case ')':
- {
- level--;
+ {
+ level--;
+ commands.splice(i, 1);
+ i--;
+ continue;
+ }
+ default:
+ {
+ if (level > 0) {
+ subcommands.push(commands[i]);
commands.splice(i, 1);
i--;
continue;
}
- default:
- {
- if (level > 0) {
- subcommands.push(commands[i]);
- commands.splice(i, 1);
- i--;
- continue;
- }
- }
+ }
}
}
}
@@ -229,112 +229,112 @@ class AdvancedFilter {
case '=':
case '==':
case '===':
+ {
+ const field = commands[i - 1].cmd;
+ const str = commands[i + 1].cmd;
+ if (commands[i + 1].regex)
{
- const field = commands[i - 1].cmd;
- const str = commands[i + 1].cmd;
- if (commands[i + 1].regex)
- {
- const match = str.match(new RegExp('^/(.*?)/([gimy]*)$'));
- let regex = null;
- if (match.length > 2)
- regex = new RegExp(match[1], match[2]);
- else
- regex = new RegExp(match[1]);
- commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': regex };
- }
+ const match = str.match(new RegExp('^/(.*?)/([gimy]*)$'));
+ let regex = null;
+ if (match.length > 2)
+ regex = new RegExp(match[1], match[2]);
else
- {
- commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': {$in: [this._fieldValueToId(field, str), parseInt(str, 10)]} };
- }
- commands.splice(i - 1, 1);
- commands.splice(i, 1);
- //changed = true;
- i--;
- break;
+ regex = new RegExp(match[1]);
+ commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': regex };
}
+ else
+ {
+ commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': {$in: [this._fieldValueToId(field, str), parseInt(str, 10)]} };
+ }
+ commands.splice(i - 1, 1);
+ commands.splice(i, 1);
+ //changed = true;
+ i--;
+ break;
+ }
case '!=':
case '!==':
+ {
+ const field = commands[i - 1].cmd;
+ const str = commands[i + 1].cmd;
+ if (commands[i + 1].regex)
{
- const field = commands[i - 1].cmd;
- const str = commands[i + 1].cmd;
- if (commands[i + 1].regex)
- {
- const match = str.match(new RegExp('^/(.*?)/([gimy]*)$'));
- let regex = null;
- if (match.length > 2)
- regex = new RegExp(match[1], match[2]);
- else
- regex = new RegExp(match[1]);
- commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $not: regex } };
- }
+ const match = str.match(new RegExp('^/(.*?)/([gimy]*)$'));
+ let regex = null;
+ if (match.length > 2)
+ regex = new RegExp(match[1], match[2]);
else
- {
- commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $not: {$in: [this._fieldValueToId(field, str), parseInt(str, 10)]} } };
- }
- commands.splice(i - 1, 1);
- commands.splice(i, 1);
- //changed = true;
- i--;
- break;
+ regex = new RegExp(match[1]);
+ commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $not: regex } };
+ }
+ else
+ {
+ commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $not: {$in: [this._fieldValueToId(field, str), parseInt(str, 10)]} } };
}
+ commands.splice(i - 1, 1);
+ commands.splice(i, 1);
+ //changed = true;
+ i--;
+ break;
+ }
case '>':
case 'gt':
case 'Gt':
case 'GT':
- {
- const field = commands[i - 1].cmd;
- const str = commands[i + 1].cmd;
- commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $gt: parseInt(str, 10) } };
- commands.splice(i - 1, 1);
- commands.splice(i, 1);
- //changed = true;
- i--;
- break;
- }
+ {
+ const field = commands[i - 1].cmd;
+ const str = commands[i + 1].cmd;
+ commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $gt: parseInt(str, 10) } };
+ commands.splice(i - 1, 1);
+ commands.splice(i, 1);
+ //changed = true;
+ i--;
+ break;
+ }
case '>=':
case '>==':
case 'gte':
case 'Gte':
case 'GTE':
- {
- const field = commands[i - 1].cmd;
- const str = commands[i + 1].cmd;
- commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $gte: parseInt(str, 10) } };
- commands.splice(i - 1, 1);
- commands.splice(i, 1);
- //changed = true;
- i--;
- break;
- }
+ {
+ const field = commands[i - 1].cmd;
+ const str = commands[i + 1].cmd;
+ commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $gte: parseInt(str, 10) } };
+ commands.splice(i - 1, 1);
+ commands.splice(i, 1);
+ //changed = true;
+ i--;
+ break;
+ }
case '<':
case 'lt':
case 'Lt':
case 'LT':
- {
- const field = commands[i - 1].cmd;
- const str = commands[i + 1].cmd;
- commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $lt: parseInt(str, 10) } };
- commands.splice(i - 1, 1);
- commands.splice(i, 1);
- //changed = true;
- i--;
- break;
- }
+ {
+ const field = commands[i - 1].cmd;
+ const str = commands[i + 1].cmd;
+ commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $lt: parseInt(str, 10) } };
+ commands.splice(i - 1, 1);
+ commands.splice(i, 1);
+ //changed = true;
+ i--;
+ break;
+ }
case '<=':
case '<==':
case 'lte':
case 'Lte':
case 'LTE':
- {
- const field = commands[i - 1].cmd;
- const str = commands[i + 1].cmd;
- commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $lte: parseInt(str, 10) } };
- commands.splice(i - 1, 1);
- commands.splice(i, 1);
- //changed = true;
- i--;
- break;
- }
+ {
+ const field = commands[i - 1].cmd;
+ const str = commands[i + 1].cmd;
+ commands[i] = { 'customFields._id': this._fieldNameToId(field), 'customFields.value': { $lte: parseInt(str, 10) } };
+ commands.splice(i - 1, 1);
+ commands.splice(i, 1);
+ //changed = true;
+ i--;
+ break;
+ }
}
}
}
@@ -349,43 +349,43 @@ class AdvancedFilter {
case 'OR':
case '|':
case '||':
- {
- const op1 = commands[i - 1];
- const op2 = commands[i + 1];
- commands[i] = { $or: [op1, op2] };
- commands.splice(i - 1, 1);
- commands.splice(i, 1);
- //changed = true;
- i--;
- break;
- }
+ {
+ const op1 = commands[i - 1];
+ const op2 = commands[i + 1];
+ commands[i] = { $or: [op1, op2] };
+ commands.splice(i - 1, 1);
+ commands.splice(i, 1);
+ //changed = true;
+ i--;
+ break;
+ }
case 'and':
case 'And':
case 'AND':
case '&':
case '&&':
- {
- const op1 = commands[i - 1];
- const op2 = commands[i + 1];
- commands[i] = { $and: [op1, op2] };
- commands.splice(i - 1, 1);
- commands.splice(i, 1);
- //changed = true;
- i--;
- break;
- }
+ {
+ const op1 = commands[i - 1];
+ const op2 = commands[i + 1];
+ commands[i] = { $and: [op1, op2] };
+ commands.splice(i - 1, 1);
+ commands.splice(i, 1);
+ //changed = true;
+ i--;
+ break;
+ }
case 'not':
case 'Not':
case 'NOT':
case '!':
- {
- const op1 = commands[i + 1];
- commands[i] = { $not: op1 };
- commands.splice(i + 1, 1);
- //changed = true;
- i--;
- break;
- }
+ {
+ const op1 = commands[i + 1];
+ commands[i] = { $not: op1 };
+ commands.splice(i + 1, 1);
+ //changed = true;
+ i--;
+ break;
+ }
}
}
}