mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-27 08:44:04 +00:00
Better type handling
This commit is contained in:
parent
efb1642e3c
commit
36dc94b8f2
1 changed files with 4 additions and 3 deletions
|
@ -399,11 +399,12 @@ function intHash(str, length = 10) {
|
|||
exports.intHash = intHash;
|
||||
async function evaluateJsonQuery(data, jsonPath, jsonPathOperator, expectedValue) {
|
||||
const expected = isNaN(expectedValue) ? expectedValue.toString() : parseFloat(expectedValue);
|
||||
let response = isNaN(data) ? data.toString() : parseFloat(data);
|
||||
let response;
|
||||
try {
|
||||
response = JSON.parse(response);
|
||||
response = JSON.parse(data);
|
||||
}
|
||||
catch (_) {
|
||||
catch (_a) {
|
||||
response = typeof data === "number" || typeof data === "object" ? data : data.toString();
|
||||
}
|
||||
let jsonQueryExpression;
|
||||
switch (jsonPathOperator) {
|
||||
|
|
Loading…
Reference in a new issue