( obj: MaybeRefDeep<T>, unrefGetters = false, )
| 68 | } |
| 69 | |
| 70 | export function cloneDeepUnref<T>( |
| 71 | obj: MaybeRefDeep<T>, |
| 72 | unrefGetters = false, |
| 73 | ): T { |
| 74 | return cloneDeep(obj, (val, key, level) => { |
| 75 | // Check if we're at the top level and the key is 'queryKey' |
| 76 | // |
| 77 | // If so, take the recursive descent where we resolve |
| 78 | // getters to values as well as refs. |
| 79 | if (level === 1 && key === 'queryKey') { |
| 80 | return cloneDeepUnref(val, true) |
| 81 | } |
| 82 | |
| 83 | // Resolve getters to values if specified. |
| 84 | if (unrefGetters && isFunction(val)) { |
| 85 | // Cast due to older TS versions not allowing calling |
| 86 | // on certain intersection types. |
| 87 | return cloneDeepUnref((val as Function)(), unrefGetters) |
| 88 | } |
| 89 | |
| 90 | // Unref refs and continue to recurse into the value. |
| 91 | if (isRef(val)) { |
| 92 | return cloneDeepUnref(unref(val), unrefGetters) |
| 93 | } |
| 94 | |
| 95 | return undefined |
| 96 | }) |
| 97 | } |
| 98 | |
| 99 | // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types |
| 100 | function isPlainObject(value: unknown): value is Object { |
no test coverage detected
searching dependent graphs…