1 var baseClone = require('./internal/baseClone');
4 * Creates a shallow clone of `value`.
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.
17 * @param {*} value The value to clone.
18 * @returns {*} Returns the cloned value.
21 * var objects = [{ 'a': 1 }, { 'b': 2 }];
23 * var shallow = _.clone(objects);
24 * console.log(shallow[0] === objects[0]);
27 function clone(value) {
28 return baseClone(value);
31 module.exports = clone;