<commit_before>'use strict'

# delete require-cache so it can be required from multible locations
delete require.cache[__filename];

require! {
    path
    './deep-require'
}

deepRequire = deepRequire (path.dirname module.parent.filename)

module.exports = (x, y) ->
    # switch args to support currying and single arg calls
    if (typeof x is 'string') and (typeof y is 'object')
        deepRequire y, x

    else if (typeof x is 'object') and (typeof y is 'string')
        deepRequire x, y

    else if (typeof x is 'string')
        deepRequire {}, x

    else if (typeof x is 'object')
        deepRequire x
<commit_msg>use nicer pattern matching for function input<commit_after>'use strict'

# delete require-cache so it can be required from multible locations
delete require.cache[__filename]

require! {
    path
    './deep-require'
}

deepRequire = deepRequire (path.dirname module.parent.filename)

module.exports = (x, y?) ->
    match (typeof! x), (typeof! y)
    | 'String', 'Object'    => deepRequire y, x
    | 'Object', 'String'    => deepRequire x, y
    | 'String', 'Undefined' => deepRequire {}, x
    | 'Object', 'Undefined' => deepRequire x
    | _                     => throw new Error 'Invalid arguments'
{'fraction_non_alphanumeric': 0.11588330632090761, 'fraction_numerical': 0.0, 'mean_word_length': 2.9967637540453076, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, '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': '5343054', 'n_tokens_mistral': 361, 'n_tokens_neox': 357, 'n_words': 134}