<commit_before>Object.assign || (Object.assign = require('object-assign'));

var path = require('path'),
    tilde = require('os-homedir')(),
    findConfig = require('find-config');

function getConfigName(isGlobal) {
    return (isGlobal ? '.' : '') + 'bemconf';
}

module.exports = function(config) {
    var localConfig = {},
        cwd = process.cwd();

    do {
        Object.assign(localConfig,
            findConfig.require(getConfigName(), { cwd: cwd, home: false }));
            cwd = path.resolve(cwd, '..');
    } while(!localConfig.root && cwd !== '/');

    if (localConfig.root) localConfig.root = cwd;

    var globalConfig = {};
    try {
        globalConfig = require(path.join(tilde, getConfigName(true)));
    } catch(e) {}

    var extendedConfig = Object.assign({}, globalConfig, localConfig, config);

    return {
        global: globalConfig,
        local: localConfig,
        extended: extendedConfig
    };
};

module.exports.getConfigName = getConfigName;
<commit_msg>getConfigFile and getGlobalConfigPath methods added<commit_after>Object.assign || (Object.assign = require('object-assign'));

var path = require('path'),
    tilde = require('os-homedir')(),
    findConfig = require('find-config');

function getConfigName(isGlobal) {
    return (isGlobal ? '.' : '') + 'bemconf';
}

function getConfigFile(isGlobal) {
    return getConfigName(isGlobal) + '.json';
}

function getGlobalConfigPath() {
    return path.resolve(tilde, getConfigName(true));
}

module.exports = function(config) {
    var localConfig = {},
        cwd = process.cwd();

    do {
        Object.assign(localConfig,
            findConfig.require(getConfigName(), { cwd: cwd, home: false }));
            cwd = path.resolve(cwd, '..');
    } while(!localConfig.root && cwd !== '/');

    if (localConfig.root) localConfig.root = cwd;

    var globalConfig = {};
    try {
        globalConfig = require(path.join(tilde, getConfigName(true)));
    } catch(e) {}

    var extendedConfig = Object.assign({}, globalConfig, localConfig, config);

    return {
        global: globalConfig,
        local: localConfig,
        extended: extendedConfig
    };
};

module.exports.getConfigName = getConfigName;
module.exports.getConfigFile = getConfigFile;
module.exports.getGlobalConfigPath = getGlobalConfigPath;

{'fraction_non_alphanumeric': 0.15079707022834984, 'fraction_numerical': 0.0, 'mean_word_length': 3.284132841328413, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7597670', 'n_tokens_mistral': 697, 'n_tokens_neox': 688, 'n_words': 134}