扩展对象的属性,设置对象的默认属性值
参考EXTJS
/** *example:Cooker.apply(A,{}); * * * @param object:扩展的目标参数 * @param config:扩展的参数 * @param defaults: * @return {Object} returns obj */ Cooker.apply = function(object, config, defaults) { if (defaults) { Cooker.apply(object, defaults); } if (object && config && typeof config == 'object') { var key; for (key in config) { object[key] = config[key]; } } return object; };