Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private safeValue(value: any): any {
if (isNull(value)) {
return 'NULL';
}
if (isString(value)) {
value = value.replace("'", "''");
return `'${value}'`;
}
if (isDate(value)) {
value = value.toISOString();
return `'${value}'`;
}
if (isBoolean(value)) {
return value ? 1 : 0;
}
return value;
}
function safeValue(value: any): any {
if (isString(value)) {
value = value.replace("'", "''");
return `'${value}'`;
}
if (isDate(value)) {
value = value.toISOString();
return `'${value}'`;
}
if (isBoolean(value)) {
return value ? 1 : 0;
}
return value;
}