<commit_before>'use strict';

module.exports = {};

module.exports.formatDate = function formatDate(d, dateonly, floating) {
    var s;

    function pad(i) {
        return (i < 10 ? '0' : '') + i;
    }

    s = d.getUTCFullYear();
    s += pad(d.getUTCMonth() + 1);
    s += pad(d.getUTCDate());

    if(!dateonly) {
        s += 'T';
        s += pad(d.getUTCHours());
        s += pad(d.getUTCMinutes());
        s += pad(d.getUTCSeconds());

        if(!floating) {
            s += 'Z';
        }
    }

    return s;
};

module.exports.escape = function escape(str) {
    return str.replace(/[\\;,\n"]/g, function(match) {
        if(match === '\n') {
            return '\\n';
        }

        return '\\' + match;
    });
};

module.exports.duration = function duration(seconds) {
    var string = '';

    // < 0
    if(seconds < 0) {
        string = '-';
        seconds *= -1;
    }

    string += 'P';

    // DAYS
    if(seconds >= 86400) {
        string += Math.floor(seconds / 86400) + 'D';
        seconds %= 86400;
    }
    if(!seconds && string.length > 1) {
        return string;
    }

    string += 'T';<commit_msg>Normalise linebreaks before escaping them<commit_after>'use strict';

module.exports = {};

module.exports.formatDate = function formatDate(d, dateonly, floating) {
    var s;

    function pad(i) {
        return (i < 10 ? '0' : '') + i;
    }

    s = d.getUTCFullYear();
    s += pad(d.getUTCMonth() + 1);
    s += pad(d.getUTCDate());

    if(!dateonly) {
        s += 'T';
        s += pad(d.getUTCHours());
        s += pad(d.getUTCMinutes());
        s += pad(d.getUTCSeconds());

        if(!floating) {
            s += 'Z';
        }
    }

    return s;
};

module.exports.escape = function escape(str) {
    return str.replace(/[\\;,"]/g, function(match) {
        return '\\' + match;
    }).replace(/(?:\r\n|\r|\n)/g, '\\n');
};

module.exports.duration = function duration(seconds) {
    var string = '';

    // < 0
    if(seconds < 0) {
        string = '-';
        seconds *= -1;
    }

    string += 'P';

    // DAYS
    if(seconds >= 86400) {
        string += Math.floor(seconds / 86400) + 'D';
        seconds %= 86400;
    }
    if(!seconds && string.length > 1) {
        return string;
    }

    string += 'T';
{'fraction_non_alphanumeric': 0.19456617002629273, 'fraction_numerical': 0.020157756354075372, 'mean_word_length': 1.8150431565967942, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '2301732', 'n_tokens_mistral': 840, 'n_tokens_neox': 794, 'n_words': 159}