sqlocal
Version:
SQLocal makes it easy to run SQLite3 in the browser, backed by the origin private file system.
18 lines (14 loc) • 416 B
text/typescript
import type { Statement } from '../types.js';
import { sqlTag } from './sql-tag.js';
export function normalizeSql(
maybeQueryTemplate: TemplateStringsArray | string,
params: unknown[]
): Statement {
let statement: Statement;
if (typeof maybeQueryTemplate === 'string') {
statement = { sql: maybeQueryTemplate, params };
} else {
statement = sqlTag(maybeQueryTemplate, ...params);
}
return statement;
}