<commit_before>// adopted from: tiny-frontmatter <https://github.com/rjreed/tiny-frontmatter>
// Copyright (c) <NAME> (MIT)

// enhance this!!!

function matter (str) {
  var basePattern = /^---[\s]+([\s\S]*?)[\s]+---([\s\S]*?)$/
  var fmPattern   = /(.*?)\s*:\s*(?:(?:\[\s*(.*?)(?=\s*\]))|(.*))/g
  var arrPattern  =  /\s?,\s?/g

  var results = basePattern.exec(str) || [null, null, str]
  var temp
  var fm = {
    data: {},
    content: results[2].trim
  }

  while (temp = fmPattern.exec(results[1]), temp) {
    fm.data[temp[1]] = temp[2] ? temp[2].split(arrPattern) : temp[3]
  }

  return fm
}

module.exports = matter<commit_msg>update string/frontmatter.js<commit_after>// adopted from: tiny-frontmatter <https://github.com/rjreed/tiny-frontmatter>
// Copyright (c) <NAME> (MIT)

// enhance this!!!

function matter (str) {
  var basePattern = /^---$([\s\S]*)^---\s/m
  var fmPattern   = /(.*?)\s*:\s*(?:(?:\[\s*(.*?)(?=\s*\]))|(.*)|(\/.*\/[gimuy]+))/g
  var arrPattern  =  /\s?,\s?/g

  var results = basePattern.exec(str) || [null, null, str]
  var temp
  var fm = {
    data: {},
    content: str.replace(results[0], '') //results[2].trim
  }

  while (temp = fmPattern.exec(results[1]), temp) {
    fm.data[temp[1]] = temp[2] ? temp[2].split(arrPattern) : temp[3]
  }

  return fm
}

module.exports = matter
{'fraction_non_alphanumeric': 0.26419379258137776, 'fraction_numerical': 0.00984102952308857, 'mean_word_length': 3.0676923076923077, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, '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': '4119404', 'n_tokens_mistral': 550, 'n_tokens_neox': 525, 'n_words': 97}