// Loaded from https://deno.land/x/ramda@v0.27.2/source/clone.js import _clone from './internal/_clone.js'; import _curry1 from './internal/_curry1.js'; /** * Creates a deep copy of the source that can be used in place of the source * object without retaining any references to it. * The source object may contain (nested) `Array`s and `Object`s, * `Number`s, `String`s, `Boolean`s and `Date`s. * `Function`s are assigned by reference rather than copied. * * Dispatches to a `clone` method if present. * * Note that if the source object has multiple nodes that share a reference, * the returned object will have the same structure, but the references will * be pointed to the location within the cloned value. * * @func * @memberOf R * @since v0.1.0 * @category Object * @sig {*} -> {*} * @param {*} value The object or array to clone * @return {*} A deeply cloned copy of `val` * @example * * const objects = [{}, {}, {}]; * const objectsClone = R.clone(objects); * objects === objectsClone; //=> false * objects[0] === objectsClone[0]; //=> false */ var clone = _curry1(function clone(value) { return value != null && typeof value.clone === 'function' ? value.clone() : _clone(value, [], [], true); }); export default clone;