lib/util.js
function deepCopy(value) {
  let result;
  if (value instanceof Buffer) {
    // isPlainObject(buffer) returns true.
    return new Buffer(value);
  }

  if (isPlainObject(value) === true) {
    result = {};
    loopKeys(value, function(_value, key) {
      if (_value.hasOwnProperty(key)) {
        result[key] = deepCopy(_value[key]);
      }
    });
    return result;
  }

  if (Array.isArray(value)) {
    result = [];
    for (let i = 0, ii = value.length; i < ii; ++i) {
      result.push(deepCopy(value[i]));
    }
    return result;
  }

  return value;
}
function deepCopy(value) {
  let result;
  if (value instanceof Buffer) {
    // isPlainObject(buffer) returns true.
    return new Buffer(value);
  }

  if (isPlainObject(value) === true) {
    result = {};
    loopKeys(value, function(_value, key) {
      if (_value.hasOwnProperty(key)) {
        result[key] = deepCopy(_value[key]);
      }
    });
    return result;
  }

  if (Array.isArray(value)) {
    result = [];
    for (let i = 0, ii = value.length; i < ii; ++i) {
      result.push(deepCopy(value[i]));
    }
    return result;
  }

  return value;
}
function deepCopy ( value ) { let result ; if ( value instanceof Buffer ) { // isPlainObject(buffer) returns true. return new Buffer ( value ) ; } if ( isPlainObject ( value ) === true ) { result = { } ; loopKeys ( value , function ( _value , key ) { if ( _value . hasOwnProperty ( key ) ) { result [ key ] = deepCopy ( _value [ key ] ) ; } } ) ; return result ; } if ( Array . isArray ( value ) ) { result = [ ] ; for ( let i = 0 , ii = value . length ; i < ii ; ++ i ) { result . push ( deepCopy ( value [ i ] ) ) ; } return result ; } return value ; }
Make a "deep copy".
The prototype chain is not copied.
Make a deep copy . The prototype chain is not copied .