<commit_before>/**
 * https://github.com/Aequiternus/node-jsin
 * v 0.1.5
 *
 * Copyright © 2014 <NAME> <<EMAIL>>
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

var compiled = {};
var directory = '';

exports.compile = compile;
exports.compiled = compiled;
exports.setDirectory = setDirectory;

var fs = require('fs');

function setDirectory(dir) {
    directory = dir;
}

function compile(template, callback) {
    template = template.replace(/\.jsin$/, '');

    if (compiled[template]) {
        callback();
    } else {
        var templatePath = template + '.jsin';
        if (directory) {
            templatePath = directory + '/' + templatePath;
        }
        fs.readFile(templatePath, function(err, res) {
            try {
                if (err) throw err;
                compiled[template] = compileCode(res.toString());
                callback();
            } catch (err) {
                compiled[template] = err;
                callback(err);
            }
        });
    }<commit_msg>ignore directory if path starts from / or ./<commit_after>/**
 * https://github.com/Aequiternus/node-jsin
 * v 0.1.5
 *
 * Copyright © 2014 <NAME> <<EMAIL>>
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

var compiled = {};
var directory = '';

exports.compile = compile;
exports.compiled = compiled;
exports.setDirectory = setDirectory;

var fs = require('fs');

function setDirectory(dir) {
    directory = dir;
}

function compile(template, callback) {
    template = template.replace(/\.jsin$/, '');

    if (compiled[template]) {
        callback();
    } else {
        var templatePath = template + '.jsin';
        if (directory && !template.match(/^\.?\//)) {
            templatePath = directory + '/' + templatePath;
        }
        fs.readFile(templatePath, function(err, res) {
            try {
                if (err) throw err;
                compiled[template] = compileCode(res.toString());
                callback();
            } catch (err) {
                compiled[template] = err;
                callback(err);
            }
        });
    }
{'fraction_non_alphanumeric': 0.13817427385892117, 'fraction_numerical': 0.009128630705394191, 'mean_word_length': 2.087067861715749, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 2, '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': '1813965', 'n_tokens_mistral': 716, 'n_tokens_neox': 679, 'n_words': 196}