# all files / lib/utilities/ object.js

22.73% Statements 5/22
0% Branches 0/14
0% Functions 0/3
22.73% Lines 5/22

    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
    1×

    1×

    1×

    1×

    1×

     "use strict";
    function checkProperties(a, b) {
        for (var propName in a) {
            if (a.hasOwnProperty(propName)) {
                if (!b.hasOwnProperty(propName) || (b[propName] !== a[propName])) {
                    return false;
                }
            }
        }
        return true;
    }
    // Compare a to b and b to a
    function shallowCompare(a, b) {
        return checkProperties(a, b) && checkProperties(b, a);
    }
    exports.shallowCompare = shallowCompare;
    // Assign function.
    function assign(target) {
        var args = [];
        for (var _i = 1; _i < arguments.length; _i++) {
            args[_i - 1] = arguments[_i];
        }
        target = target || {};
        for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
            var sourceObject = args_1[_a];
            if (sourceObject) {
                for (var propName in sourceObject) {
                    if (sourceObject.hasOwnProperty(propName)) {
                        target[propName] = sourceObject[propName];
                    }
                }
            }
        }
        return target;
    }
    exports.assign = assign;

    //# sourceMappingURL=object.js.map