Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const q2 = p.value.secondQuantity != null ? new cql.Quantity({
value: p.value.secondQuantity,
unit: p.value.unit
}) : null;
paramsObj[p.name] = new cql.Interval(q1, q2);
break;
}
case 'string':
// Remove the leading and trailing single-quotes
paramsObj[p.name] = p.value.replace(/^'(.*)'$/, '$1');
break;
case 'system_code':
paramsObj[p.name] = new cql.Code(p.value.code, p.value.uri);
break;
case 'system_concept':
paramsObj[p.name] = new cql.Concept([new cql.Code(p.value.code, p.value.uri)]);
break;
case 'system_quantity':
paramsObj[p.name] = new cql.Quantity({
value: p.value.quantity,
unit: p.value.unit
});
break;
case 'time':
// CQL exec doesn't expose a Time class, so we must construct a DT and then get the Time
paramsObj[p.name] = cql.DateTime.parse(`@0000-01-01${p.value.slice(1)}`).getTime();
break;
default: // do nothing
}
});
return paramsObj;