MCPcopy Index your code
hub / github.com/gpujs/gpu.js / clone

Function clone

src/utils.js:94–108  ·  view source on GitHub ↗

* @desc Returns a clone * @param {Object} obj - Object to clone * @returns {Object|Array} Cloned object

(obj)

Source from the content-addressed store, hash-verified

92 * @returns {Object|Array} Cloned object
93 */
94 clone(obj) {
95 if (obj === null || typeof obj !== 'object' || obj.hasOwnProperty('isActiveClone')) return obj;
96
97 const temp = obj.constructor(); // changed
98
99 for (let key in obj) {
100 if (Object.prototype.hasOwnProperty.call(obj, key)) {
101 obj.isActiveClone = null;
102 temp[key] = utils.clone(obj[key]);
103 delete obj.isActiveClone;
104 }
105 }
106
107 return temp;
108 },
109
110 /**
111 * @desc Checks if is an array or Array-like object

Callers

nothing calls this directly

Calls 2

constructorMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…