mirror of
https://github.com/randyjc/Rahoot.git
synced 2026-03-13 20:15:35 +01:00
Add concurrently
This commit is contained in:
20
socket/utils/deepClone.js
Normal file
20
socket/utils/deepClone.js
Normal file
@@ -0,0 +1,20 @@
|
||||
const deepClone = (obj) => {
|
||||
if (obj === null || typeof obj !== "object") {
|
||||
return obj
|
||||
}
|
||||
|
||||
if (Array.isArray(obj)) {
|
||||
return obj.map(deepClone)
|
||||
}
|
||||
|
||||
const clonedObj = {}
|
||||
for (const key in obj) {
|
||||
if (obj.hasOwnProperty(key)) {
|
||||
clonedObj[key] = deepClone(obj[key])
|
||||
}
|
||||
}
|
||||
|
||||
return clonedObj
|
||||
}
|
||||
|
||||
export default deepClone
|
||||
Reference in New Issue
Block a user