All files / src/Ice MapUtil.js

79.16% Statements 19/24
91.66% Branches 11/12
100% Functions 1/1
79.16% Lines 19/24

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 2541x 41x 41x 41x 331x 285x 331x 4x 46x 42x 96x           96x 1x 1x 96x 41x 41x 331x 41x  
// Copyright (c) ZeroC, Inc.
 
export class MapUtil {
    static equals(m1, m2) {
        if (m1 === m2) {
            return true;
        } else if (m1.size != m2.size) {
            return false;
        } else {
            for (const [key, value] of m1) {
                if (value === undefined) {
                    if (!m2.has(key)) {
                        return false;
                    } else if (m2.get(key) !== value) {
                        return false;
                    }
                } else if (m2.get(key) !== value) {
                    return false;
                }
            }
        }
        return true;
    }
}