Skip to content

Instantly share code, notes, and snippets.

View korokd's full-sized avatar

Diogo Korok korokd

View GitHub Profile
@korokd
korokd / cloneDeep.js
Last active January 14, 2020 17:14 — forked from cassaram09/deepClone.js
JavaScript deep clone function
function cloneDeep(objSource) {
if (objSource instanceof Date) {
return new Date(objSource);
}
const plainObject = {};
if (!(objSource instanceof Object) || objSource instanceof String) {
return objSource;
}