1 /** 2 * Copies all enumerable properties of one object to another 3 * @memberOf fabric.util.object 4 * @method extend 5 * @param {Object} destination Where to copy to 6 * @param {Object} source Where to copy from 7 */ 8 function extend(destination, source) { 9 // JScript DontEnum bug is not taken care of 10 for (var property in source) { 11 destination[property] = source[property]; 12 } 13 return destination; 14 } 15 16 /** 17 * Creates an empty object and copies all enumerable properties of another object to it 18 * @method clone 19 * @memberOf fabric.util.object 20 * @param {Object} object Object to clone 21 */ 22 function clone(object) { 23 return extend({ }, object); 24 } 25 26 /** @namespace fabric.util.object */ 27 fabric.util.object = { 28 extend: extend, 29 clone: clone 30 };