'use strict';

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

var _underscore = require('underscore');

var _underscore2 = _interopRequireDefault(_underscore);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

//src, destination
//destination should be a sequzlize object
var updateObject = function updateObject(destination, source) {
  _underscore2.default.each(source, function (value, key) {
    if (key != 'id' && key != 'createdAt' && _underscore2.default.has(destination.dataValues, key)) {
      if (destination[key] != source[key]) destination[key] = source[key];
    }
  });
}; /*
    * *******************************************************************************
    *  * Copyright (c) 2018 Edgeworx, Inc.
    *  *
    *  * This program and the accompanying materials are made available under the
    *  * terms of the Eclipse Public License v. 2.0 which is available at
    *  * http://www.eclipse.org/legal/epl-2.0
    *  *
    *  * SPDX-License-Identifier: EPL-2.0
    *  *******************************************************************************
    *
    */

exports.default = {
  updateObject: updateObject
};