{"size": 541, "ext": "js", "max_stars_repo_path": "scripts/lib/helpers/utils.js", "max_stars_repo_name": "lyra-ui/hexo-theme-mirages", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "scripts/lib/helpers/utils.js", "max_issues_repo_name": "lyra-ui/hexo-theme-mirages", "max_issues_repo_issues_event_min_datetime": "2021-09-08T02:20:09.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-08T02:46:28.000Z", "max_forks_repo_path": "scripts/lib/helpers/utils.js", "max_forks_repo_name": "lyra-ui/hexo-theme-mirages", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 4, "max_forks_count": null, "avg_line_length": 25.7619047619, "max_line_length": 59, "alphanum_fraction": 0.6451016636}
const crypto = require('crypto')

exports.randomValue = function (data) {
  if (data instanceof Array) {
    const index = Math.floor(Math.random() * data.length)
    return index > data.length ? data[0] : data[index]
  }
  return null
}

exports.generateUid = function (str) {
  return crypto.createHash('md5').update(str).digest('hex')
}
exports.filterHTMLCharacters = function (str) {
  // Removing all html tags
  // Removing all line breakers.
  return String(str)
    .replace(/(&nbsp;|<([^>]+)>)/gi, '')
    .replace('/\n/gm', ' ')
}
