Sha256: a4c68b6d9d4fb0d204026f3208326ca309909b7db07052b52e140ba487221a86
Contents?: true
Size: 975 Bytes
Versions: 9
Compression:
Stored size: 975 Bytes
Contents
/*global define*/ define(['Core/defaultValue'], function( defaultValue) { "use strict"; /** * Clones an object, returning a new object containing the same properties. * * @exports clone * * @param {Object} object The object to clone. * @param {Boolean} [deep=false] If true, all properties will be deep cloned recursively. */ var clone = function(object, deep) { if (object === null || typeof object !== 'object') { return object; } deep = defaultValue(deep, false); var result = new object.constructor(); for ( var propertyName in object) { if (object.hasOwnProperty(propertyName)) { var value = object[propertyName]; if (deep) { value = clone(value, deep); } result[propertyName] = value; } } return result; }; return clone; });
Version data entries
9 entries across 9 versions & 1 rubygems