Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let val = filter_operand.value;
const type = this.getAttribute("type");
switch (type) {
case "float":
val = parseFloat(val);
break;
case "integer":
val = parseInt(val);
break;
case "boolean":
val = val.toLowerCase().indexOf("true") > -1;
break;
case "string":
default:
}
if (filter_operator.value === perspective.FILTER_OPERATORS.isIn || filter_operator.value === perspective.FILTER_OPERATORS.isNotIn) {
val = val.split(",").map(x => x.trim());
}
this.setAttribute("filter", JSON.stringify({operator: filter_operator.value, operand: val}));
this.dispatchEvent(new CustomEvent("filter-selected", {detail: event}));
}