All files / renderer areEquivalentValues.ts

41.18% Statements 7/17
50% Branches 11/22
100% Functions 1/1
43.75% Lines 7/16

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 523x   5x   3x           2x         2x   2x                         2x                                          
export default function areEquivalentValues(v1: any = null, v2: any = null): boolean {
 
    if (v1 === v2) {
 
        return true;
    }
 
    const {
        patcher: patcher1,
        values: values1
    } = v1 || {};
 
    const {
        patcher: patcher2,
        values: values2
    } = v2 || {};
 
    Iif (patcher1 !== undefined &&
        patcher2 !== undefined) {
 
        if (patcher1 === patcher2) {
 
            return areEquivalentValues(values1, values2);
        }
        else {
 
            return false;
        }
    }
 
    Iif (Array.isArray(v1) &&
        Array.isArray(v2)) {
 
        if (v1.length !== v2.length) {
 
            return false;
        }
        else {
 
            for (let i = 0; i < v1.length; ++i) {
 
                if (!areEquivalentValues(v1[i], v2[i])) {
 
                    return false;
                }
            }
 
            return true;
        }
    }
 
}