(value: T)
| 13 | } |
| 14 | |
| 15 | const cloneValue = <T>(value: T): T => { |
| 16 | if (value instanceof Date) return new Date(value.getTime()) as T; |
| 17 | if (value instanceof Uint8Array) return new Uint8Array(value) as T; |
| 18 | if (Array.isArray(value)) return value.map((item) => cloneValue(item)) as T; |
| 19 | if (value && typeof value === "object") { |
| 20 | return Object.fromEntries( |
| 21 | Object.entries(value).map(([key, item]) => [key, cloneValue(item)]) |
| 22 | ) as T; |
| 23 | } |
| 24 | return value; |
| 25 | }; |
| 26 | |
| 27 | const comparable = (value: unknown): unknown => { |
| 28 | if (value instanceof Date) return value.getTime(); |
no outgoing calls
no test coverage detected