(array, a, b, mode, memo)
| 775 | } |
| 776 | |
| 777 | function partialObjectMapEquiv(array, a, b, mode, memo) { |
| 778 | let aPos = 0; |
| 779 | let direction = 1; |
| 780 | let start = 0; |
| 781 | let end = array.length - 1; |
| 782 | for (const { 0: key1, 1: item1 } of a) { |
| 783 | aPos++; |
| 784 | if (typeof key1 === 'object' && key1 !== null) { |
| 785 | let innerStart = start; |
| 786 | if (direction === 1) { |
| 787 | const key2 = array[start]; |
| 788 | if (objectComparisonStart(key1, key2, mode, memo) && innerDeepEqual(item1, b.get(key2), mode, memo)) { |
| 789 | if (start === end) { |
| 790 | return true; |
| 791 | } |
| 792 | start += 1; |
| 793 | continue; |
| 794 | } |
| 795 | if (start === end) { |
| 796 | // The last element of map b might match a later element in map a. |
| 797 | continue; |
| 798 | } |
| 799 | direction = -1; |
| 800 | innerStart += 1; |
| 801 | } |
| 802 | let matched = true; |
| 803 | const key2 = array[end]; |
| 804 | if (!objectComparisonStart(key1, key2, mode, memo) || !innerDeepEqual(item1, b.get(key2), mode, memo)) { |
| 805 | direction = 1; |
| 806 | matched = arrayHasEqualMapElement(array, key1, item1, b, mode, memo, objectComparisonStart, innerStart, end); |
| 807 | } |
| 808 | if (matched) { |
| 809 | if (start === end) { |
| 810 | return true; |
| 811 | } |
| 812 | end -= 1; |
| 813 | } |
| 814 | } |
| 815 | if (a.size - aPos <= end - start) { |
| 816 | return false; |
| 817 | } |
| 818 | } |
| 819 | return false; |
| 820 | } |
| 821 | |
| 822 | function arrayHasEqualMapElement(array, key1, item1, b, mode, memo, comparator, start, end) { |
| 823 | for (let i = end - 1; i >= start; i--) { |
no test coverage detected
searching dependent graphs…