@litepos/autoquery 5.0.8 → 5.0.10
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/dist/index.js +0 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -90,20 +90,12 @@ let MonthValues = /* @__PURE__ */ function(MonthValues$1) {
|
|
|
90
90
|
MonthValues$1["Dec"] = "-12-";
|
|
91
91
|
return MonthValues$1;
|
|
92
92
|
}({});
|
|
93
|
-
const DATE_OPERATORS = [
|
|
94
|
-
"GreaterThan",
|
|
95
|
-
"GreaterThanOrEqualTo",
|
|
96
|
-
"LessThan",
|
|
97
|
-
"LessThanOrEqualTo"
|
|
98
|
-
];
|
|
99
|
-
const DATE_REGEX = /^\d{4}-\d{2}-\d{2}(?:[ T]\d{2}:\d{2}:\d{2})?$/;
|
|
100
93
|
var QueryBuilder = class {
|
|
101
94
|
params = {};
|
|
102
95
|
addParam(property, operator, value) {
|
|
103
96
|
const operatorStr = operator === "EqualTo" ? "" : operator;
|
|
104
97
|
const key = `${property.toString()}${operatorStr}`;
|
|
105
98
|
if (operator === "IsNull" || operator === "IsNotNull") this.params[key] = "";
|
|
106
|
-
else if (DATE_OPERATORS.includes(operator) && typeof value === "string" && DATE_REGEX.test(value)) this.params[key] = new Date(value).toISOString();
|
|
107
99
|
else this.params[key] = `${value}`;
|
|
108
100
|
return this;
|
|
109
101
|
}
|