UNPKG

623 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.toSqlParams = void 0;
4/**
5 * Allows for using strings and `sql-template-strings`. Converts both to a
6 * format that's usable by the SQL methods
7 *
8 * @param sql A SQL string or `sql-template-strings` object
9 * @param params An array of parameters
10 */
11function toSqlParams(sql, params = []) {
12 if (typeof sql === 'string') {
13 return {
14 sql,
15 params
16 };
17 }
18 return {
19 sql: sql.sql,
20 params: sql.values
21 };
22}
23exports.toSqlParams = toSqlParams;
24//# sourceMappingURL=strings.js.map
\No newline at end of file