1 | import _ from './lodash'
|
2 |
|
3 | export default function proxySafeCloneDeepWith (thing, callback) {
|
4 | return _.cloneDeepWith(thing, (val, key, obj, stack) => {
|
5 | if (isSafeWithProxy(key)) {
|
6 | return callback(val, key, obj, stack)
|
7 | }
|
8 | })
|
9 | }
|
10 |
|
11 | function isSafeWithProxy (key) {
|
12 | return key &&
|
13 | key !== 'constructor' &&
|
14 | (!key.toString || key.toString() !== 'Symbol(Symbol.toStringTag)')
|
15 | }
|