(a: any, b: any)
| 342 | */ |
| 343 | export function partialMatchKey(a: QueryKey, b: QueryKey): boolean |
| 344 | export function partialMatchKey(a: any, b: any): boolean { |
| 345 | if (a === b) { |
| 346 | return true |
| 347 | } |
| 348 | |
| 349 | if (typeof a !== typeof b) { |
| 350 | return false |
| 351 | } |
| 352 | |
| 353 | if (a && b && typeof a === 'object' && typeof b === 'object') { |
| 354 | if (Array.isArray(a) && Array.isArray(b)) { |
| 355 | if (b.length > a.length) return false |
| 356 | for (let i = 0; i < b.length; i++) { |
| 357 | if (!partialMatchKey(a[i], b[i])) { |
| 358 | return false |
| 359 | } |
| 360 | } |
| 361 | return true |
| 362 | } |
| 363 | |
| 364 | const bKeys = Object.keys(b) |
| 365 | for (const key of bKeys) { |
| 366 | if (!partialMatchKey(a[key], b[key])) { |
| 367 | return false |
| 368 | } |
| 369 | } |
| 370 | return true |
| 371 | } |
| 372 | |
| 373 | return false |
| 374 | } |
| 375 | |
| 376 | const hasOwn = Object.prototype.hasOwnProperty |
| 377 |
no outgoing calls
no test coverage detected