'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var object_equal = require('./equal.js');

function compareTwoObj() {
  var originObj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  var newObj = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  var res = {
    ADDED: [],
    UPDATED: [],
    DELETED: [],
    originObj: originObj,
    newObj: newObj
  };
  Object.keys(originObj).map(function (key) {
    if (newObj[key] === undefined) {
      res.DELETED.push(key);
    } else if (!object_equal.isObjectEqual(newObj[key], originObj[key])) {
      res.UPDATED.push(key);
    }
  });
  Object.keys(newObj).map(function (key) {
    if (originObj[key] === undefined) {
      res.ADDED.push(key);
    }
  });
  return res;
}

exports.compareTwoObj = compareTwoObj;
