query-layers-expression 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/index.d.ts CHANGED
@@ -3,16 +3,16 @@ interface queryExpressionType {
3
3
  qFields?: [any?, any?, any?];
4
4
  chartCategory?: any;
5
5
  chartCategoryField?: any;
6
- status?: number;
6
+ status?: number | null;
7
7
  statusField?: any;
8
8
  qExpression?: any;
9
9
  }
10
- declare class QueryExpressionLayers implements queryExpressionType {
10
+ declare class QueryExpressionLayers {
11
11
  qValues?: [any?, any?, any?] | any;
12
12
  qFields?: [any?, any?, any?] | any;
13
13
  chartCategory?: any;
14
14
  chartCategoryField?: any;
15
- status?: number;
15
+ status?: number | null;
16
16
  statusField?: any;
17
17
  qExpression?: any;
18
18
  constructor(qValues: any, qFields: any, chartCategory: any, chartCategoryField: any, status: number, statusField: any, qExpression: any);
package/build/index.js CHANGED
@@ -6,9 +6,15 @@ class QueryExpressionLayers {
6
6
  //--- Query Expression
7
7
  this.queryExpression = ({ qValues, qFields, chartCategory, chartCategoryField, status, statusField, qExpression, }) => {
8
8
  //--- Basic query expression
9
- const query1 = `${qFields?.[0]} = '${qValues?.[0]}'`;
10
- const query2 = `${qFields?.[1]} = '${qValues?.[1]}'`;
11
- const query3 = `${qFields?.[2]} = '${qValues?.[2]}'`;
9
+ const query1 = typeof qValues?.[0] === "number"
10
+ ? `${qFields?.[0]} = ${qValues?.[0]}`
11
+ : `${qFields?.[0]} = '${qValues?.[0]}'`;
12
+ const query2 = typeof qValues?.[1] === "number"
13
+ ? `${qFields?.[1]} = ${qValues?.[1]}`
14
+ : `${qFields?.[1]} = '${qValues?.[1]}'`;
15
+ const query3 = typeof qValues?.[2] === "number"
16
+ ? `${qFields?.[2]} = ${qValues?.[2]}`
17
+ : `${qFields?.[2]} = '${qValues?.[2]}'`;
12
18
  const query12 = `${query1} AND ${query2}`;
13
19
  const query123 = `${query1} AND ${query2} AND ${query3}`;
14
20
  const q_status = `${statusField} = ${status}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "query-layers-expression",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "",
5
5
  "license": "ISC",
6
6
  "author": "Eiji Matsuzaki",
package/src/index.ts CHANGED
@@ -5,17 +5,17 @@ interface queryExpressionType {
5
5
  qFields?: [any?, any?, any?];
6
6
  chartCategory?: any;
7
7
  chartCategoryField?: any;
8
- status?: number;
8
+ status?: number | null;
9
9
  statusField?: any;
10
10
  qExpression?: any;
11
11
  }
12
12
 
13
- class QueryExpressionLayers implements queryExpressionType {
13
+ class QueryExpressionLayers {
14
14
  qValues?: [any?, any?, any?] | any;
15
15
  qFields?: [any?, any?, any?] | any;
16
16
  chartCategory?: any;
17
17
  chartCategoryField?: any;
18
- status?: number;
18
+ status?: number | null;
19
19
  statusField?: any;
20
20
  qExpression?: any;
21
21
 
@@ -49,9 +49,18 @@ class QueryExpressionLayers implements queryExpressionType {
49
49
  qExpression,
50
50
  }: queryExpressionType) => {
51
51
  //--- Basic query expression
52
- const query1 = `${qFields?.[0]} = '${qValues?.[0]}'`;
53
- const query2 = `${qFields?.[1]} = '${qValues?.[1]}'`;
54
- const query3 = `${qFields?.[2]} = '${qValues?.[2]}'`;
52
+ const query1 =
53
+ typeof qValues?.[0] === "number"
54
+ ? `${qFields?.[0]} = ${qValues?.[0]}`
55
+ : `${qFields?.[0]} = '${qValues?.[0]}'`;
56
+ const query2 =
57
+ typeof qValues?.[1] === "number"
58
+ ? `${qFields?.[1]} = ${qValues?.[1]}`
59
+ : `${qFields?.[1]} = '${qValues?.[1]}'`;
60
+ const query3 =
61
+ typeof qValues?.[2] === "number"
62
+ ? `${qFields?.[2]} = ${qValues?.[2]}`
63
+ : `${qFields?.[2]} = '${qValues?.[2]}'`;
55
64
  const query12 = `${query1} AND ${query2}`;
56
65
  const query123 = `${query1} AND ${query2} AND ${query3}`;
57
66
  const q_status = `${statusField} = ${status}`;