mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-10 06:44:44 +00:00
34 lines
830 B
JavaScript
34 lines
830 B
JavaScript
(function() {
|
|
|
|
/**
|
|
* Copies all enumerable properties of one object to another
|
|
* @memberOf fabric.util.object
|
|
* @param {Object} destination Where to copy to
|
|
* @param {Object} source Where to copy from
|
|
* @return {Object}
|
|
*/
|
|
function extend(destination, source) {
|
|
// JScript DontEnum bug is not taken care of
|
|
for (var property in source) {
|
|
destination[property] = source[property];
|
|
}
|
|
return destination;
|
|
}
|
|
|
|
/**
|
|
* Creates an empty object and copies all enumerable properties of another object to it
|
|
* @memberOf fabric.util.object
|
|
* @param {Object} object Object to clone
|
|
* @return {Object}
|
|
*/
|
|
function clone(object) {
|
|
return extend({ }, object);
|
|
}
|
|
|
|
/** @namespace fabric.util.object */
|
|
fabric.util.object = {
|
|
extend: extend,
|
|
clone: clone
|
|
};
|
|
|
|
})();
|