Better type handling

This commit is contained in:
Matt Visnovsky 2024-06-06 10:04:20 -06:00
parent efb1642e3c
commit 36dc94b8f2

View file

@ -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) {