(value: T)
| 59 | } |
| 60 | |
| 61 | export function clone<T>(value: T): T { |
| 62 | if (Array.isArray(value)) { |
| 63 | return value.map(clone) as any |
| 64 | } |
| 65 | |
| 66 | if (isObject(value)) { |
| 67 | const result: Record<PropertyKey, unknown> = {} |
| 68 | |
| 69 | for (const key in value) { |
| 70 | result[key] = clone(value[key]) |
| 71 | } |
| 72 | |
| 73 | for (const sym of Object.getOwnPropertySymbols(value)) { |
| 74 | result[sym] = clone(value[sym]) |
| 75 | } |
| 76 | |
| 77 | return result as any |
| 78 | } |
| 79 | |
| 80 | return value |
| 81 | } |
| 82 | |
| 83 | export function get(object: unknown, path: readonly PropertyKey[]): unknown { |
| 84 | let current: unknown = object |
no test coverage detected