@example
wysihtml5.lang.object({ foo: 1 }).clone();
// => { foo: 1 }

v0.4.14 adds options for deep clone : wysihtml5.lang.object({ foo: 1 }).clone(true);
163022
function(deep) {
      var newObj = {},
          i;

      if (obj === null || !wysihtml5.lang.object(obj).isPlainObject()) {
        return obj;
      }

      for (i in obj) {
        if(obj.hasOwnProperty(i)) {
          if (deep) {
            newObj[i] = wysihtml5.lang.object(obj[i]).clone(deep);
          } else {
            newObj[i] = obj[i];
          }
        }
      }
      return newObj;
    }
1360930
function clone(source) {
    return source != null ? JSON.parse(JSON.stringify(source)) : source;
}
420302
function _clone(src) {
  if (!src) {
    return src;
  }

  if (typeof src.clone === 'function') {
    return src.clone();
  } else if (_isPlainObject(src) || _isArray(src)) {
    let ret = new (src.constructor);

    Object.getOwnPropertyNames(src).forEach(function(key) {
      if (typeof src[key] !== 'function') {
        ret[key] = _clone(src[key]);
      }
    });

    return ret;
  } else {
    return JSON.parse(JSON.stringify(src));
  }
}
645680
function clone(source) {
            if (!source || typeof source !== 'object') {
                return source;
            }

            var cloned = source;

            if (isArray(source)) {
                cloned = source.slice().map(clone);
            }
            else if (isObject(source) && 'isPrototypeOf' in source) {
                cloned = {};
                for (var key in source) {
                    if (hasOwnProperty.call(source, key)) {
                        cloned[key] = clone(source[key]);
                    }
                }
            }

            return cloned;
        }
153151
function deepClone(val, instanceClone) {
        switch ( kindOf(val) ) {
            case 'Object':
                return cloneObject(val, instanceClone);
            case 'Array':
                return cloneArray(val, instanceClone);
            default:
                return clone(val);
        }
    }
1162190
function (options) {
                    var ret = {};
                    options = options || {};

                    for (var key in this.$) {
                        if (this.$.hasOwnProperty(key)) {
                            if (options.exclude) {
                                if (options.exclude instanceof Array) {
                                    if (_.include(options.exclude, key)) {
                                        ret[key] = this.$[key];
                                        continue;
                                    }
                                }
                            }
                            if (this.$bindings.hasOwnProperty(key) && this.factory.prototype.defaults.hasOwnProperty(key)) {
                                ret[key] = this.factory.prototype.defaults[key];
                            } else {
                                ret[key] = this._cloneAttribute(this.$[key], key);
                            }

                        }
                    }
                    var b = new this.factory(ret, true);
                    b._$source = this;
                    b.$injected = this.$injected;
                    return b;
                }
1182170
function clone(obj) {
    if (typeof obj !== 'object') {
        return obj;
    }
    var ret;
    if (util.isArray(obj)) {
        ret = [];
        obj.forEach(function (val) {
            ret.push(clone(val));
        });
        return ret;
    }
    ret = {};
    Object.keys(obj).forEach(function (key) {
        ret[key] = clone(obj[key]);
    });
    return ret;
}
104642
function(o) {
        var type = _.util.type(o);

        switch (type) {
          case 'Object':
            var clone = {};

            for (var key in o) {
              if (o.hasOwnProperty(key)) {
                clone[key] = _.util.clone(o[key]);
              }
            }

            return clone;

          case 'Array':
            return o.slice();
        }

        return o;
      }
650015
function(el, deep) {
    var sub = document.createElement(el.nodeName)
      , attr = el.attributes
      , i = attr.length;

    while (i--) {
      if (attr[i].nodeValue) {
        sub.setAttribute(attr[i].name, attr[i].value);
      }
    }

    if (el.namespaceURI) {
      sub.namespaceURI = el.namespaceURI;
    }

    if (el.baseURI) {
      sub.baseURI = el.baseURI;
    }

    if (deep) {
      DOM.setContent(sub, DOM.getContent(el));
    }

    return clone; 
  }
315737
function clone (thing) {
  var copy = {};
  var value;

  for (var key in thing) {
    value = thing[key];

    if (!value) {
      copy[key] = value;
    } else if (momentum.isMoment(value)) {
      copy[key] = value.clone();
    } else if (value._isStylesConfiguration) {
      copy[key] = clone(value);
    } else {
      copy[key] = value;
    }
  }

  return copy;
}
761246
function (original) {
                var clone = {};
                var i, keys = Object.keys(original);

                for (i = 0; i < keys.length; i++) {
                    // copy each property into the clone
                    clone[keys[i]] = original[keys[i]];
                }

                return clone;
            }
1203985
function cloneDeep(value) {
  let obj = {};
  switch (typeOf(value)) {
    case 'object':
      for (let key of Object.keys(value)) {
        obj[key] = cloneDeep(value[key]);
      }
      return obj;
    case 'array':
      return value.map(ele => cloneDeep(ele));
    default: {
      return value;
    }
  }
}
15714
function clone(collection, deep = true) {
		const clones = new Jamon();

		collection.forEach(element => clones.push(element.cloneNode(deep)));

		return clones;
	}
791280
function () {
            var Clazz = this.constructor;
            var node = new Clazz(this.value, this.engine);

            /* eslint-disable no-redeclare */
            for (var i = 0, l = this.children.length; i < l; i++) {
                node.addChild(this.children[i].clone());
            }

            for (var i = 0, l = this.cloneProps.length; i < l; i++) {
                var prop = this.cloneProps[i];
                node[prop] = this[prop];
            }
            /* eslint-enable no-redeclare */

            return node;
        }
1092792
function deepClone (value, oldValue) {
  var type = typeOf(value);
  var clone;

  if (type.isPOJO) {
    var oldType = typeOf(oldValue);
    if (oldType.isPOJO) {
      // Return a merged clone of the old POJO and the new POJO
      clone = deepAssign({}, oldValue);
      return deepAssign(clone, value);
    }
    else {
      return deepAssign({}, value);
    }
  }
  else if (type.isArray) {
    clone = [];
    for (var i = 0; i < value.length; i++) {
      clone.push(deepClone(value[i]));
    }
  }
  else if (type.hasValue) {
    // string, boolean, number, function, Date, RegExp, etc.
    // Just return it as-is
    return value;
  }
}
320661
function cloner(deep, item) {
  if (!item ||
      typeof item !== 'object' ||
      item instanceof Error ||
      item instanceof MonkeyDefinition ||
      item instanceof Monkey ||
      ('ArrayBuffer' in global && item instanceof ArrayBuffer))
    return item;

  // Array
  if (type.array(item)) {
    if (deep) {
      const a = new Array(item.length);

      for (let i = 0, l = item.length; i < l; i++)
        a[i] = cloner(true, item[i]);
      return a;
    }

    return slice(item);
  }

  // Date
  if (item instanceof Date)
    return new Date(item.getTime());

  // RegExp
  if (item instanceof RegExp)
    return cloneRegexp(item);

  // Object
  if (type.object(item)) {
    const o = {};

    // NOTE: could be possible to erase computed properties through `null`.
    const props = Object.getOwnPropertyNames(item);
    for (let i = 0, l = props.length; i < l; i++) {
      const name = props[i];
      const k = Object.getOwnPropertyDescriptor(item, name);
      if (k.enumerable === true) {
        if (k.get && k.get.isLazyGetter) {
          Object.defineProperty(o, name, {
            get: k.get,
            enumerable: true,
            configurable: true
          });
        }
        else {
          o[name] = deep ? cloner(true, item[name]) : item[name];
        }
      }
      else if (k.enumerable === false) {
        Object.defineProperty(o, name, {
          value: deep ? cloner(true, k.value) : k.value,
          enumerable: false,
          writable: true,
          configurable: true
        });
      }
    }
    return o;
  }

  return item;
}
963467
function cloneObject(source)
{
	var clone,key,value;
	
	if (Array.isArray(source) === true)
	{
		clone = [];
	}
	else
	{
		// Only clone the prototype -- more efficient as it will not convert keys to prototype keys
		clone = Object.create( Object.getPrototypeOf(source) );
	}
	
	// Clone keys/indexes
	// TODO :: use Object.keys() for more speed
	for (key in source)
	{
		if (hasOwnProperty.call(source, key) === true)
		{
			value = source[key];
			
			if (value!==null && typeof value==="object")
			{
				clone[key] = cloneObject(value);
			}
			else
			{
				clone[key] = value;
			}
		}
	}
	
	return clone;
}