<commit_before>(function() {
    'use strict';
    
    var fs              = require('fs'),
        path            = require('path'),
        
        exec            = require('execon'),
        tryRequire      = require('tryrequire'),
        beautify        = require('js-beautify'),
        
        DIR             = __dirname + '/../',
        HOME_WIN        = process.env.HOMEPATH,
        HOME_UNIX       = process.env.HOME,
        HOME            = (HOME_UNIX || HOME_WIN) + path.sep,
        
        EXT             = ['js', 'json', 'css', 'html'],
        ConfigPath      = DIR   + 'json/beautify',
        ConfigHome      = HOME  + '.beautify',
        
        config          =
            tryRequire(ConfigHome) ||
            tryRequire(ConfigPath, {log: true}) || {};
    
    module.exports  = function(name, callback) {
        var ext     = path
                .extname(name)
                .slice(1),
            
            is      = ~EXT.indexOf(ext);
        
        if (!is)
            callback(erorMsg(ext));
        else
            fs.readFile(name, 'utf8', function(error, data) {
                var result;
                
                if (!error)
                    error = exec.try(function() {
                        result = beautify[ext](data, config);
                    });
                    
                <commit_msg>feature(beautifile) add support of *rc files<commit_after>(function() {
    'use strict';
    
    var fs              = require('fs'),
        path            = require('path'),
        
        exec            = require('execon'),
        tryRequire      = require('tryrequire'),
        beautify        = require('js-beautify'),
        
        DIR             = __dirname + '/../',
        HOME_WIN        = process.env.HOMEPATH,
        HOME_UNIX       = process.env.HOME,
        HOME            = (HOME_UNIX || HOME_WIN) + path.sep,
        
        EXT             = ['js', 'json', 'css', 'html'],
        ConfigPath      = DIR   + 'json/beautify',
        ConfigHome      = HOME  + '.beautify',
        
        config          =
            tryRequire(ConfigHome) ||
            tryRequire(ConfigPath, {log: true}) || {};
    
    module.exports  = function(name, callback) {
        var is, ext;
        
        if (/rc$/.test(name))
            name += '.json';
        
        ext     = path
            .extname(name)
            .slice(1);
        
        is      = ~EXT.indexOf(ext);
        
        if (!is)
            callback(erorMsg(ext));
        else
            fs.readFile(name, 'utf8', function(error, data) {
                var result;
                
                if (!error)
                    error = exec.try(function() {
                        result = beautify[ext](data, config);
                    });
                    
                
{'fraction_non_alphanumeric': 0.12321116928446771, 'fraction_numerical': 0.0013961605584642235, 'mean_word_length': 1.0197322057787175, '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': '3466387', 'n_tokens_mistral': 781, 'n_tokens_neox': 754, 'n_words': 145}