| 513 | } |
| 514 | |
| 515 | export function findRandomPath(o: any): (string | number)[] { |
| 516 | if (!isObject(o) || randomBoolean(-0.6)) { |
| 517 | return []; |
| 518 | } |
| 519 | if (Array.isArray(o)) { |
| 520 | const randIndex = randomNumber(0, o.length - 1); |
| 521 | return !o.length ? [] : [randIndex, ...findRandomPath(o[randIndex])]; |
| 522 | } |
| 523 | const randKey = selectRandom(Object.keys(o)); |
| 524 | return randKey == null ? [] : [randKey, ...findRandomPath(o[randKey])]; |
| 525 | } |
| 526 | |
| 527 | export function findEqualitiesByReference(A: any, B: any): any[] { |
| 528 | if (A == null || B == null || typeof A !== 'object' || typeof B !== 'object') { |