<commit_before>/**
 * Pretty prints a nested js object.
 * @param object
 * @param domElement {string}
 * @returns {string}
 */
export function printNestedObject (object, domElement) {
  let declaredParentElement = typeof domElement === 'undefined' ? '' : domElement

  let string = ''
  if ((typeof object === 'object') && (typeof object !== undefined) && (object !== null)) {
    for (let key of Object.keys(object)) {
      if (typeof object[key] === 'object') {
        string += `${key}:<${declaredParentElement}>${printNestedObject(object[key], declaredParentElement)}</${declaredParentElement}>`
      } else {
        string += `${key}: ` + `${object[key]}<br />`
      }
    }
    return string
  } else {
    return string
  }
}

/**
 * Returns true if given value is undefined, null or an empty string.
 * Also returns null if value is an empty array.
 * @param value
 * @returns {boolean}
 */
export function isEmpty (value) {
  if (Array.isArray(value)) {
    return value.length === 0
  } else {
    return (typeof value === 'undefined') || (value === '') || (value === null)
  }
}
<commit_msg>- update isEmpty<commit_after>/**
 * Pretty prints a nested js object.
 * @param object
 * @param domElement {string}
 * @returns {string}
 */
export function printNestedObject (object, domElement) {
  let declaredParentElement = typeof domElement === 'undefined' ? '' : domElement

  let string = ''
  if ((typeof object === 'object') && (typeof object !== undefined) && (object !== null)) {
    for (let key of Object.keys(object)) {
      if (typeof object[key] === 'object') {
        string += `${key}:<${declaredParentElement}>${printNestedObject(object[key], declaredParentElement)}</${declaredParentElement}>`
      } else {
        string += `${key}: ` + `${object[key]}<br />`
      }
    }
    return string
  } else {
    return string
  }
}

/**
 * Returns true if given value is
 * * undefined
 * * null
 * * empty string
 * * empty array
 * * empty object
 * @param value
 * @returns {boolean}
 */
export function isEmpty (value) {
  if (typeof value === 'object') {
    // array or object or null
    if (Array.isArray(value)) {
      // array
      return value.length === 0
    } else if (value === null) {
      // null
      return true
    } else {
      // object
      return Object.keys(value).length === 0
    }
  } else {
    return (typeof value === 'undefined') || (value === '')
  }
}

{'fraction_non_alphanumeric': 0.1680429397192403, 'fraction_numerical': 0.0012386457473162675, 'mean_word_length': 3.0182421227197347, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3266062', 'n_tokens_mistral': 712, 'n_tokens_neox': 713, 'n_words': 213}