| [a762898] | 1 | 'use strict';
|
|---|
| 2 |
|
|---|
| 3 | Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|---|
| 4 |
|
|---|
| 5 | const cloneDeepWith$1 = require('../../object/cloneDeepWith.js');
|
|---|
| 6 | const getTag = require('../_internal/getTag.js');
|
|---|
| 7 | const tags = require('../_internal/tags.js');
|
|---|
| 8 |
|
|---|
| 9 | function cloneDeepWith(obj, customizer) {
|
|---|
| 10 | return cloneDeepWith$1.cloneDeepWith(obj, (value, key, object, stack) => {
|
|---|
| 11 | const cloned = customizer?.(value, key, object, stack);
|
|---|
| 12 | if (cloned !== undefined) {
|
|---|
| 13 | return cloned;
|
|---|
| 14 | }
|
|---|
| 15 | if (typeof obj !== 'object') {
|
|---|
| 16 | return undefined;
|
|---|
| 17 | }
|
|---|
| 18 | if (getTag.getTag(obj) === tags.objectTag && typeof obj.constructor !== 'function') {
|
|---|
| 19 | const result = {};
|
|---|
| 20 | stack.set(obj, result);
|
|---|
| 21 | cloneDeepWith$1.copyProperties(result, obj, object, stack);
|
|---|
| 22 | return result;
|
|---|
| 23 | }
|
|---|
| 24 | switch (Object.prototype.toString.call(obj)) {
|
|---|
| 25 | case tags.numberTag:
|
|---|
| 26 | case tags.stringTag:
|
|---|
| 27 | case tags.booleanTag: {
|
|---|
| 28 | const result = new obj.constructor(obj?.valueOf());
|
|---|
| 29 | cloneDeepWith$1.copyProperties(result, obj);
|
|---|
| 30 | return result;
|
|---|
| 31 | }
|
|---|
| 32 | case tags.argumentsTag: {
|
|---|
| 33 | const result = {};
|
|---|
| 34 | cloneDeepWith$1.copyProperties(result, obj);
|
|---|
| 35 | result.length = obj.length;
|
|---|
| 36 | result[Symbol.iterator] = obj[Symbol.iterator];
|
|---|
| 37 | return result;
|
|---|
| 38 | }
|
|---|
| 39 | default: {
|
|---|
| 40 | return undefined;
|
|---|
| 41 | }
|
|---|
| 42 | }
|
|---|
| 43 | });
|
|---|
| 44 | }
|
|---|
| 45 |
|
|---|
| 46 | exports.cloneDeepWith = cloneDeepWith;
|
|---|