08e9744f2df73ed917e054fbf40ba8567034bb58
[yaffs-website] / node_modules / grunt-legacy-log-utils / node_modules / lodash / clone.js
1 var baseClone = require('./_baseClone');
2
3 /**
4  * Creates a shallow clone of `value`.
5  *
6  * **Note:** This method is loosely based on the
7  * [structured clone algorithm](https://mdn.io/Structured_clone_algorithm)
8  * and supports cloning arrays, array buffers, booleans, date objects, maps,
9  * numbers, `Object` objects, regexes, sets, strings, symbols, and typed
10  * arrays. The own enumerable properties of `arguments` objects are cloned
11  * as plain objects. An empty object is returned for uncloneable values such
12  * as error objects, functions, DOM nodes, and WeakMaps.
13  *
14  * @static
15  * @memberOf _
16  * @category Lang
17  * @param {*} value The value to clone.
18  * @returns {*} Returns the cloned value.
19  * @example
20  *
21  * var objects = [{ 'a': 1 }, { 'b': 2 }];
22  *
23  * var shallow = _.clone(objects);
24  * console.log(shallow[0] === objects[0]);
25  * // => true
26  */
27 function clone(value) {
28   return baseClone(value);
29 }
30
31 module.exports = clone;