function deepClone(original) {
  // Simple types
  if (typeof original !== 'object' || original === null) return original;

  // Arrays
  if (original instanceof Array) {
    return original.map(deepClone);
  }

  // Dates
  if (original instanceof Date) return new Date(original);

  // Other objects
  const clone = {};
  for (let k of Object.keys(original)) {
    clone[k] = deepClone(original[k]);
  }
  return clone;
}
/**
 * Quickly clone a simple piece of data, returning a copy which can be mutated safely.
 * Does not support Set, Map, or other advanced data types.
 * @param {*} original      Some sort of data
 * @return {*}              The clone of that data
 */
Quickly clone a simple piece of data, returning a copy which can be mutated safely.
Does not support Set, Map, or other advanced data types.
@param {*} original      Some sort of data
@return {*}              The clone of that data
Quickly clone a simple piece of data returning a copy which can be mutated safely . Does not support Set Map or other advanced data types . @param { * } original Some sort of data @return { * } The clone of that data
function deepClone(original) {
  if (typeof original !== 'object' || original === null) return original;
  if (original instanceof Array) {
    return original.map(deepClone);
  }
  if (original instanceof Date) return new Date(original);
  const clone = {};
  for (let k of Object.keys(original)) {
    clone[k] = deepClone(original[k]);
  }
  return clone;
}
function deepClone ( original ) { if ( typeof original !== 'object' || original === null ) return original ; if ( original instanceof Array ) { return original . map ( deepClone ) ; } if ( original instanceof Date ) return new Date ( original ) ; const clone = { } ; for ( let k of Object . keys ( original ) ) { clone [ k ] = deepClone ( original [ k ] ) ; } return clone ; }
Quickly clone a simple piece of data, returning a copy which can be mutated safely.
Quickly clone a simple piece of data returning a copy which can be mutated safely .
// Simple types // Arrays // Dates // Other objects