function deepCopy(value) {
  if (value == null) {
    return value;
  } else if (Array.isArray(value)) {
    return value.map(item => deepCopy(item));
  } else if (isRecord(value)) {
    const res = {};
    for (const key in value) {
      res[key] = deepCopy(value[key]);
    }
    return res;
  }

  const ctor = value.constructor;
  if (ctor) {
    switch (ctor.name.toLowerCase()) {
      case 'date':
        return new ctor(Number(value));
      case 'map':
        return new Map(value);
      case 'set':
        return new Set(value);
      case 'buffer':
        return Buffer.from(value);
    }
  }

  return value;
}
/**
 * Make a deep copy of an object
 *
 * NOTE: This is not meant to be the perfect implementation of a deep copy,
 * but instead something that is good enough for the purposes of
 * command monitoring.
 */
Make a deep copy of an object
NOTE: This is not meant to be the perfect implementation of a deep copy,
but instead something that is good enough for the purposes of
command monitoring.
Make a deep copy of an object NOTE : This is not meant to be the perfect implementation of a deep copy but instead something that is good enough for the purposes of command monitoring .
function deepCopy(value) {
  if (value == null) {
    return value;
  } else if (Array.isArray(value)) {
    return value.map(item => deepCopy(item));
  } else if (isRecord(value)) {
    const res = {};
    for (const key in value) {
      res[key] = deepCopy(value[key]);
    }
    return res;
  }
  const ctor = value.constructor;
  if (ctor) {
    switch (ctor.name.toLowerCase()) {
      case 'date':
        return new ctor(Number(value));
      case 'map':
        return new Map(value);
      case 'set':
        return new Set(value);
      case 'buffer':
        return Buffer.from(value);
    }
  }
  return value;
}
function deepCopy ( value ) { if ( value == null ) { return value ; } else if ( Array . isArray ( value ) ) { return value . map ( item => deepCopy ( item ) ) ; } else if ( isRecord ( value ) ) { const res = { } ; for ( const key in value ) { res [ key ] = deepCopy ( value [ key ] ) ; } return res ; } const ctor = value . constructor ; if ( ctor ) { switch ( ctor . name . toLowerCase ( ) ) { case 'date' : return new ctor ( Number ( value ) ) ; case 'map' : return new Map ( value ) ; case 'set' : return new Set ( value ) ; case 'buffer' : return Buffer . from ( value ) ; } } return value ; }
Make a deep copy of an object
 NOTE: This is not meant to be the perfect implementation of a deep copy,
 but instead something that is good enough for the purposes of
 command monitoring.
Make a deep copy of an object NOTE : This is not meant to be the perfect implementation of a deep copy but instead something that is good enough for the purposes of command monitoring .