var cloneArray = function(arr){
  "use strict";
  var i, results,len=arr.length;
    results = new Array(len);
    for (i = 0; i < len; i++) {
        results[i]=clone(arr[i]);
    }
    return results;
};
var cloneProperties = function(newInstance,obj){
  "use strict";
  var key;
  for (key in obj) {
      newInstance[key] = clone(obj[key]);
  }
  return newInstance;
};
var clone = function(obj) {
  "use strict";
  var flags, key, newInstance;
    if (!obj || typeof obj !== 'object') {
        return obj;
    }
    if (typeof obj.clone === 'function') {
        return obj.clone();
    }
    if (obj instanceof Date) {
        return new Date(obj.getTime());
    }
    if (obj instanceof RegExp) {
        flags = '';
        if (obj.global) {
            flags += 'g';
        }
        if (obj.ignoreCase) {
            flags += 'i';
        }
        if (obj.multiline) {
            flags += 'm';
        }
        if (obj.sticky) {
            flags += 'y';
        }
        return new RegExp(obj.source, flags);
    }
    if (obj instanceof Array) {
        return cloneArray(obj);
    }
    newInstance = new obj.constructor();
    return cloneProperties(newInstance,obj);
};

module.exports = clone;

@@ -1103,44 +1103,147 @@
     
-newInstance = new obj.constructor();
+if (typeof obj.constructor === 'function') %7B%0A        newInstance = new obj.constructor();%0A    %7D else %7B%0A        newInstance = %7B%7D;%0A    %7D%0A    
 %0A   

fix empty plain object clone