Sha256: 0ec8d7c82c7883cec0004e150dd23ce5f523bb379ecaf051b65e1b89ddaf6da1

Contents?: true

Size: 1.17 KB

Versions: 262

Compression:

Stored size: 1.17 KB

Contents

var baseClone = require('./_baseClone');

/** Used to compose bitmasks for cloning. */
var CLONE_SYMBOLS_FLAG = 4;

/**
 * This method is like `_.clone` except that it accepts `customizer` which
 * is invoked to produce the cloned value. If `customizer` returns `undefined`,
 * cloning is handled by the method instead. The `customizer` is invoked with
 * up to four arguments; (value [, index|key, object, stack]).
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Lang
 * @param {*} value The value to clone.
 * @param {Function} [customizer] The function to customize cloning.
 * @returns {*} Returns the cloned value.
 * @see _.cloneDeepWith
 * @example
 *
 * function customizer(value) {
 *   if (_.isElement(value)) {
 *     return value.cloneNode(false);
 *   }
 * }
 *
 * var el = _.cloneWith(document.body, customizer);
 *
 * console.log(el === document.body);
 * // => false
 * console.log(el.nodeName);
 * // => 'BODY'
 * console.log(el.childNodes.length);
 * // => 0
 */
function cloneWith(value, customizer) {
  customizer = typeof customizer == 'function' ? customizer : undefined;
  return baseClone(value, CLONE_SYMBOLS_FLAG, customizer);
}

module.exports = cloneWith;

Version data entries

262 entries across 261 versions & 28 rubygems

Version Path
sumomo-0.10.1 data/sumomo/api_modules/node_modules/lodash/cloneWith.js
sumomo-0.10.0 data/sumomo/api_modules/node_modules/lodash/cloneWith.js
reed_sdk-1.0.1 node_modules/lodash/cloneWith.js
reed_sdk-1.0.0 node_modules/lodash/cloneWith.js
boring_generators-0.12.0 tmp/templates/app_template/node_modules/lodash/cloneWith.js
sumomo-0.9.0 data/sumomo/api_modules/node_modules/lodash/cloneWith.js
sumomo-0.8.22 data/sumomo/api_modules/node_modules/lodash/cloneWith.js
sumomo-0.8.21 data/sumomo/api_modules/node_modules/lodash/cloneWith.js
sumomo-0.8.20 data/sumomo/api_modules/node_modules/lodash/cloneWith.js
sumomo-0.8.17 data/sumomo/api_modules/node_modules/lodash/cloneWith.js
sumomo-0.8.16 data/sumomo/api_modules/node_modules/lodash/cloneWith.js
disco_app-0.18.0 test/dummy/node_modules/lodash/cloneWith.js
disco_app-0.18.2 test/dummy/node_modules/lodash/cloneWith.js
sumomo-0.8.15 data/sumomo/api_modules/node_modules/lodash/cloneWith.js
trusty-cms-5.0.7 node_modules/lodash/cloneWith.js
appmap-0.72.2 ./node_modules/lodash/cloneWith.js
trusty-cms-5.0.6 node_modules/lodash/cloneWith.js
appmap-0.72.1 ./node_modules/lodash/cloneWith.js
appmap-0.72.0 ./node_modules/lodash/cloneWith.js
trusty-cms-5.0.5 node_modules/lodash/cloneWith.js