1 /** 2 * Hilo 3 * Copyright 2015 alibaba.com 4 * Licensed under the MIT License 5 */ 6 7 /** 8 * @class util method set 9 * @static 10 * @module hilo/util/util 11 */ 12 var util = { 13 /** 14 * Simple shallow copy objects. 15 * @param {Object} target Target object to copy to. 16 * @param {Object} source Source object to copy. 17 * @param {Boolean} strict Indicates whether replication is undefined property, default is false, i.e., undefined attributes are not copied. 18 * @returns {Object} Object after copying. 19 */ 20 copy: function(target, source, strict){ 21 for(var key in source){ 22 if(!strict || target.hasOwnProperty(key) || target[key] !== undefined){ 23 target[key] = source[key]; 24 } 25 } 26 return target; 27 } 28 };