(args: JsArgs | RawQueryArgs)
| 10 | import { isDecimalJsLike } from './decimalJsLike' |
| 11 | |
| 12 | export function deepCloneArgs(args: JsArgs | RawQueryArgs): JsArgs | RawQueryArgs { |
| 13 | if (args instanceof Sql) { |
| 14 | return cloneSql(args) |
| 15 | } |
| 16 | |
| 17 | if (isTypedSql(args)) { |
| 18 | return cloneTypedSql(args) |
| 19 | } |
| 20 | |
| 21 | if (Array.isArray(args)) { |
| 22 | const clone: RawQueryArgs = [args[0]] |
| 23 | |
| 24 | for (let i = 1; i < args.length; i++) { |
| 25 | clone[i] = deepCloneValue(args[i] as JsInputValue) |
| 26 | } |
| 27 | |
| 28 | return clone |
| 29 | } |
| 30 | const clone: JsArgs = {} |
| 31 | for (const k in args) { |
| 32 | clone[k] = deepCloneValue(args[k]) |
| 33 | } |
| 34 | return clone |
| 35 | } |
| 36 | |
| 37 | function cloneSql(rawParam: Sql): Sql { |
| 38 | return new Sql(rawParam.strings, rawParam.values) |
no test coverage detected