Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / globule / 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  * @since 0.1.0
17  * @category Lang
18  * @param {*} value The value to clone.
19  * @returns {*} Returns the cloned value.
20  * @see _.cloneDeep
21  * @example
22  *
23  * var objects = [{ 'a': 1 }, { 'b': 2 }];
24  *
25  * var shallow = _.clone(objects);
26  * console.log(shallow[0] === objects[0]);
27  * // => true
28  */
29 function clone(value) {
30   return baseClone(value, false, true);
31 }
32
33 module.exports = clone;