COLLECTED BY
Organization:
Internet Archive
Focused crawls are collections of frequently-updated webcrawl data from narrow (as opposed to broad or wide) web crawls, often focused on a single domain or subdomain.
The Wayback Machine - https://web.archive.org/web/20201220220352/https://github.com/lodash/lodash/blob/master/cloneWith.js
Permalink
Cannot retrieve contributors at this time
40 lines (37 sloc)
1.1 KB
import baseClone from './.internal/baseClone.js'
/** Used to compose bitmasks for cloning. */
const 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
* one argument (value).
*
* @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)
* }
* }
*
* const 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 )
}
export default cloneWith
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.
You signed out in another tab or window. Reload to refresh your session.