Hilo/build/cmd/hilo/util/util.js
2022-06-29 10:45:02 +08:00

37 lines
892 B
JavaScript

/**
* hilojs 2.0.3 for cmd
* Copyright 2016 alibaba.com
* Licensed under the MIT License
*/
define(function(require, exports, module){
/**
* @language=en
* @class util method set
* @static
* @module hilo/util/util
*/
var util = {
/**
* @language=en
* Simple shallow copy objects.
* @param {Object} target Target object to copy to.
* @param {Object} source Source object to copy.
* @param {Boolean} strict Indicates whether replication is undefined property, default is false, i.e., undefined attributes are not copied.
* @returns {Object} Object after copying.
*/
copy: function(target, source, strict){
for(var key in source){
if(!strict || target.hasOwnProperty(key) || target[key] !== undefined){
target[key] = source[key];
}
}
return target;
}
};
return util;
});