<commit_before>var path = require('path');
var fs = require('fs');

fs.readdirSync(path.resolve(__dirname, 'docs')).forEach(function(filename) {
    var name = path.parse(filename).name;
    var docsFilename = path.resolve(__dirname, '../docs', name + '.md');
    var updateFn = require('./docs/' + filename);

    console.log('Update ' + docsFilename);
    var currentContent = fs.readFileSync(docsFilename, 'utf8').replace(/\r\n/g, '\n');
    var newContent = updateFn(currentContent);

    if (typeof newContent === 'string' && newContent !== currentContent) {
        fs.writeFileSync(docsFilename, newContent, 'utf8');
        console.log('  Updated');
    } else {
        console.log('  No update');
    }
});<commit_msg>make update docs works on node 0.10<commit_after>var path = require('path');
var fs = require('fs');

fs.readdirSync(path.resolve(__dirname, 'docs')).forEach(function(filename) {
    var name = path.basename(filename);
    var docsFilename = path.resolve(__dirname, '../docs', name.replace(/\.js$/, '.md'));
    var updateFn = require('./docs/' + filename);

    console.log('Update ' + docsFilename);
    var currentContent = fs.readFileSync(docsFilename, 'utf8').replace(/\r\n/g, '\n');
    var newContent = updateFn(currentContent);

    if (typeof newContent === 'string' && newContent !== currentContent) {
        fs.writeFileSync(docsFilename, newContent, 'utf8');
        console.log('  Updated');
    } else {
        console.log('  No update');
    }
});
{'fraction_non_alphanumeric': 0.17962466487935658, 'fraction_numerical': 0.004691689008042895, 'mean_word_length': 3.6802507836990594, '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': '5966203', 'n_tokens_mistral': 454, 'n_tokens_neox': 444, 'n_words': 98}