<commit_before>/**
 * Tag
 * Uniquely tag a function. This is used to identify actions
 */

let uid = 0

module.exports = function tag (fn) {
  let name = fn.name || 'microcosm_action'
  let mark = uid++

  if (!fn.hasOwnProperty('toString')) {
    fn.toString = () => `${ name }_${ mark }`
  }

  return fn
}<commit_msg>Add developer warning in tag when not a function<commit_after>/**
 * Tag
 * Uniquely tag a function. This is used to identify actions
 */

let uid = 0

module.exports = function tag (fn) {
  if (process.env.NODE_ENV !== 'production' && (typeof fn !== 'function')) {
    throw TypeError('Attempted to tag an action, but the provided value is not a function. Instead got ' + typeof fn)
  }

  let name = fn.name || 'microcosm_action'
  let mark = uid++

  if (!fn.hasOwnProperty('toString')) {
    fn.toString = () => `${ name }_${ mark }`
  }

  return fn
}
{'fraction_non_alphanumeric': 0.14709236031927023, 'fraction_numerical': 0.002280501710376283, 'mean_word_length': 3.2211538461538463, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '442110', 'n_tokens_mistral': 289, 'n_tokens_neox': 279, 'n_words': 98}