MCPcopy
hub / github.com/prisma/prisma / deepCloneArgs

Function deepCloneArgs

packages/client/src/runtime/utils/deepCloneArgs.ts:12–35  ·  view source on GitHub ↗
(args: JsArgs | RawQueryArgs)

Source from the content-addressed store, hash-verified

10import { isDecimalJsLike } from './decimalJsLike'
11
12export 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
37function cloneSql(rawParam: Sql): Sql {
38 return new Sql(rawParam.strings, rawParam.values)

Callers 2

Calls 4

isTypedSqlFunction · 0.90
cloneSqlFunction · 0.85
cloneTypedSqlFunction · 0.85
deepCloneValueFunction · 0.85

Tested by

no test coverage detected