Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
params.forEach((p) => {
// Handle the null case first so we don't have to guard against it later
if (p.value == null) {
paramsObj[p.name] = null;
return;
}
switch (p.type) {
case 'boolean':
paramsObj[p.name] = p.value === 'true';
break;
case 'datetime':
paramsObj[p.name] = cql.DateTime.parse(p.value.str.slice(1));
break;
case 'decimal':
paramsObj[p.name] = p.value.decimal;
break;
case 'integer':
paramsObj[p.name] = p.value;
break;
case 'interval_of_datetime': {
let d1 = null;
let d2 = null;
if (p.value.firstDate) {
const str = p.value.firstTime ? `${p.value.firstDate}T${p.value.firstTime}` : p.value.firstDate;
d1 = cql.DateTime.parse(str);
}
if (p.value.secondDate) {
const str = p.value.secondTime ? `${p.value.secondDate}T${p.value.secondTime}` : p.value.secondDate;