<commit_before>behaviours = {}
options = {}

share.attach = attach = (behaviour, args...) ->
  if _.isString behaviour
    behaviour = behaviours[behaviour]
    opts = options[behaviour]

  if _.isFunction behaviour
    context =
      collection: @
      options: opts

    behaviour.apply context, args

  else
    console.warn 'Behaviour not found'

  return

class CollectionBehaviours

  @attach: (collection, args...) ->
    attach.apply collection, args

  @configure: (name, options) ->
    if name of behaviours
      options[name] = options

    else
      console.warn 'Configure failed, behaviour not found'

  @define: (name, behaviour, options) ->
    if name of behaviours and not options?.replace
      console.warn 'Behaviour already defined, use replace option to override'

    else
      behaviours[name] = behaviour
<commit_msg>options -> behaviourOptions<commit_after>behaviours = {}
behaviourOptions = {}

share.attach = attach = (behaviour, args...) ->
  if _.isString behaviour
    options = behaviourOptions[behaviour]
    behaviour = behaviours[behaviour]

  if _.isFunction behaviour
    context =
      collection: @
      options: options

    behaviour.apply context, args

  else
    console.warn 'Behaviour not found'

  return

class CollectionBehaviours

  @attach: (collection, args...) ->
    attach.apply collection, args

  @configure: (name, options) ->
    if name of behaviours
      behaviourOptions[name] = options

    else
      console.warn 'Configure failed, behaviour not found'

  @define: (name, behaviour, options) ->
    if name of behaviours and not options?.replace
      console.warn 'Behaviour already defined, use replace option to override'

    else
      behaviours[name] = behaviour

{'fraction_non_alphanumeric': 0.09283667621776505, 'fraction_numerical': 0.0, 'mean_word_length': 3.0794392523364484, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '2104348', 'n_tokens_mistral': 497, 'n_tokens_neox': 470, 'n_words': 153}