Skip to content

Instantly share code, notes, and snippets.

View why-unlimited's full-sized avatar
🎯
Focusing

why-unlimited

🎯
Focusing
View GitHub Profile
function deepClone(source) {
if (source instanceof Date) {
return new Date(source.getTime())
}
if (typeof source !== 'object' || source === null) {
return source
}
let cloned = Array.isArray(source) ? [] : {}
for (let key in source) {
let value = source[key]