<commit_before>((root, factory) ->
  # amd
  if ('function' is typeof define) and define.amd?
    define(['bluebird'], factory)
  # commonjs
  else if exports?
    module.exports = factory(require('bluebird'))
  # other
  else
    root.hinoki = factory(root.Promise)
)(this, (Promise) ->

  ###################################################################################
  # get

  # polymorphic
  hinoki = (oneOrManyLifetimes, nameOrNamesOrFunction) ->
    lifetimes = hinoki.coerceToArray oneOrManyLifetimes

    if lifetimes.length is 0
      throw new Error 'at least 1 lifetime is required'

    if 'function' is typeof nameOrNamesOrFunction
      return hinoki.many(
        lifetimes
        0
        hinoki.getNamesToInject(nameOrNamesOrFunction).map(hinoki.coerceToArray)
      ).spread(nameOrNamesOrFunction)

    if Array.isArray nameOrNamesOrFunction
      paths = hinoki.coerceToArray(nameOrNamesOrFunction).map(hinoki.coerceToArray)
      return hinoki.many lifetimes, 0, paths

    hinoki.one lifetimes, 0, hinoki.coerceToArray(nameOrNamesOrFunction)

  # getValues
  hinoki.many = (lifetimes, lifetimeIndex, paths) ->
      Promise.all paths.map (path) ->
        hinoki.one lifetimes, lifetimeIndex, path

  # getValue
  hinoki.one = (lifetimes, lifetimeIndex, path) ->
    # these may be set at the end of the following loop
    factorySource = undefined
    factory = undefined

    newLifetimeIndex = lifetimeIndex - 1
    lifetimeLength = lifetimes.length
    while ++newLifetimeIndex < lifetimeLength
      lifetime = lifetimes[newLifetimeIndex]
      value = lifetime.values?[path[0]]
      # null is allowed as a value
      unless hinoki.isUndefined value
        lifetime.debug? {
          event: 'valueWasResolved'
          path: path
          value: value
        }<commit_msg>fix indentation<commit_after>((root, factory) ->
  # amd
  if ('function' is typeof define) and define.amd?
    define(['bluebird'], factory)
  # commonjs
  else if exports?
    module.exports = factory(require('bluebird'))
  # other
  else
    root.hinoki = factory(root.Promise)
)(this, (Promise) ->

  ###################################################################################
  # get

  # polymorphic
  hinoki = (oneOrManyLifetimes, nameOrNamesOrFunction) ->
    lifetimes = hinoki.coerceToArray oneOrManyLifetimes

    if lifetimes.length is 0
      throw new Error 'at least 1 lifetime is required'

    if 'function' is typeof nameOrNamesOrFunction
      return hinoki.many(
        lifetimes
        0
        hinoki.getNamesToInject(nameOrNamesOrFunction).map(hinoki.coerceToArray)
      ).spread(nameOrNamesOrFunction)

    if Array.isArray nameOrNamesOrFunction
      paths = hinoki.coerceToArray(nameOrNamesOrFunction).map(hinoki.coerceToArray)
      return hinoki.many lifetimes, 0, paths

    hinoki.one lifetimes, 0, hinoki.coerceToArray(nameOrNamesOrFunction)

  # getValues
  hinoki.many = (lifetimes, lifetimeIndex, paths) ->
    Promise.all paths.map (path) ->
      hinoki.one lifetimes, lifetimeIndex, path

  # getValue
  hinoki.one = (lifetimes, lifetimeIndex, path) ->
    # these may be set at the end of the following loop
    factorySource = undefined
    factory = undefined

    newLifetimeIndex = lifetimeIndex - 1
    lifetimeLength = lifetimes.length
    while ++newLifetimeIndex < lifetimeLength
      lifetime = lifetimes[newLifetimeIndex]
      value = lifetime.values?[path[0]]
      # null is allowed as a value
      unless hinoki.isUndefined value
        lifetime.debug? {
          event: 'valueWasResolved'
          path: path
          value: value
        }
{'fraction_non_alphanumeric': 0.12858719646799116, 'fraction_numerical': 0.003863134657836645, 'mean_word_length': 3.254694835680751, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '1308993', 'n_tokens_mistral': 1117, 'n_tokens_neox': 1039, 'n_words': 261}