UNPKG

394 BPlain TextView Raw
1import _ from './lodash'
2
3export 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
11function isSafeWithProxy (key) {
12 return key &&
13 key !== 'constructor' &&
14 (!key.toString || key.toString() !== 'Symbol(Symbol.toStringTag)')
15}