source: imaps-frontend/node_modules/lodash-es/cloneWith.js@ d565449

main
Last change on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 1.2 KB
RevLine 
[d565449]1import baseClone from './_baseClone.js';
2
3/** Used to compose bitmasks for cloning. */
4var CLONE_SYMBOLS_FLAG = 4;
5
6/**
7 * This method is like `_.clone` except that it accepts `customizer` which
8 * is invoked to produce the cloned value. If `customizer` returns `undefined`,
9 * cloning is handled by the method instead. The `customizer` is invoked with
10 * up to four arguments; (value [, index|key, object, stack]).
11 *
12 * @static
13 * @memberOf _
14 * @since 4.0.0
15 * @category Lang
16 * @param {*} value The value to clone.
17 * @param {Function} [customizer] The function to customize cloning.
18 * @returns {*} Returns the cloned value.
19 * @see _.cloneDeepWith
20 * @example
21 *
22 * function customizer(value) {
23 * if (_.isElement(value)) {
24 * return value.cloneNode(false);
25 * }
26 * }
27 *
28 * var el = _.cloneWith(document.body, customizer);
29 *
30 * console.log(el === document.body);
31 * // => false
32 * console.log(el.nodeName);
33 * // => 'BODY'
34 * console.log(el.childNodes.length);
35 * // => 0
36 */
37function cloneWith(value, customizer) {
38 customizer = typeof customizer == 'function' ? customizer : undefined;
39 return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
40}
41
42export default cloneWith;
Note: See TracBrowser for help on using the repository browser.