<commit_before>var kindOf        = require('./kindOf')
var isPlainObject = require('./isPlainObject')
var mixIn        = require('../object/mixIn')

function clone (value) {
  switch (kindOf(value)) {
    case 'object' : return cloneObject(value)
    case 'array'  : return cloneArray(value)
    case 'regexp' : return cloneRegExp(value)
    case 'date'   : return cloneDate(value)
    default       : return value
  }
}

function cloneObject (src) {
  if (isPlainObject(src)) return mixIn({}, src)
  else return src
}

function cloneRegExp (r) {
  var flags = ''
  flags += r.multiline ? 'm' : ''
  flags += r.global ? 'g' : ''
  flags += r.ignoreCase ? 'i' : ''
  return new RegExp(r.source, flags)
}
<commit_msg>update lang/clone -- use object/extend<commit_after>var kindOf        = require('./kindOf')
var isPlainObject = require('./isPlainObject')
var extend        = require('../object/extend')

function clone (value) {
  switch (kindOf(value)) {
    case 'object' : return cloneObject(value)
    case 'array'  : return cloneArray(value)
    case 'regexp' : return cloneRegExp(value)
    case 'date'   : return cloneDate(value)
    default       : return value
  }
}

function cloneObject (src) {
  if (isPlainObject(src)) return extend({}, src)
  else return src
}

function cloneRegExp (r) {
  var flags = ''
  flags += r.multiline ? 'm' : ''
  flags += r.global ? 'g' : ''
  flags += r.ignoreCase ? 'i' : ''
  return new RegExp(r.source, flags)
}

{'fraction_non_alphanumeric': 0.15089163237311384, 'fraction_numerical': 0.0, 'mean_word_length': 3.2289855072463767, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '870896', 'n_tokens_mistral': 486, 'n_tokens_neox': 483, 'n_words': 127}