1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | function buildFilterString(predicate, operation, values) {
|
8 | if (Array.isArray(values)) {
|
9 | throw new Error(
|
10 | `The filter implementation implementations is very naive and only support comparison for now.
|
11 | Please create an issue with the below output https://github.com/scanf/squidex-client-manager/issues/new
|
12 | ${JSON.stringify({ predicate, values, operation }, null, 2)}
|
13 | `,
|
14 | );
|
15 | }
|
16 |
|
17 | let check = `'${values}'`;
|
18 | if (typeof values === 'number') {
|
19 | check = values;
|
20 | } else if (values === null) {
|
21 | check = null;
|
22 | }
|
23 |
|
24 | return `${predicate} ${operation} ${check}`;
|
25 | }
|
26 |
|
27 | module.exports.buildFilterString = buildFilterString;
|