MCPcopy Index your code
hub / github.com/SocketCluster/socketcluster / cloneObjectDeep

Function cloneObjectDeep

app/public/socketcluster-client.js:6239–6251  ·  view source on GitHub ↗
(val, instanceClone)

Source from the content-addressed store, hash-verified

6237}
6238
6239function cloneObjectDeep(val, instanceClone) {
6240 if (typeof instanceClone === 'function') {
6241 return instanceClone(val);
6242 }
6243 if (instanceClone || isPlainObject(val)) {
6244 const res = new val.constructor();
6245 for (let key in val) {
6246 res[key] = cloneDeep(val[key], instanceClone);
6247 }
6248 return res;
6249 }
6250 return val;
6251}
6252
6253function cloneArrayDeep(val, instanceClone) {
6254 const res = new val.constructor(val.length);

Callers 1

cloneDeepFunction · 0.85

Calls 1

cloneDeepFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…