<commit_before>/**
 * @param  {String} n - number in range 0...999 in string
 * @return {String} number with leading zeros
 */
function zeropadTriad(n) {
    return (new Array(3 - n.length)).fill('0').join('') + n;
}

/**
 * @param  {Number} n_
 * @return {Number[]} 0..999
 */
function splitOntoTriads(n) {
    var res = [];
    var i = 0;
    var n = Math.floor(Math.abs(n));
    do {
        res.unshift(n % 1e3);
        if (++i > 50) throw new Error('formatNumber: overcycle on val: ' + n);
    } while (n = Math.floor(n / 1e3));
    return res;
}

/**
 * @param {String} n_ - number in string
 * @param {Function} triadTmpl_
 * @param {Function} numTmpl_
 */
function formatNumber (n_, triadTmpl_, numTmpl_) {
    if (n_.trim() === '') return '';
    var n = +n_;
    var tmpl = triadTmpl_ || function(n) { return '<span class="num__group">' + n + '</span>'; };<commit_msg>Add Number support 👻<commit_after>/**
 * @param  {String} n - number in range 0...999 in string
 * @return {String} number with leading zeros
 */
function zeropadTriad(n) {
    return (new Array(3 - n.length)).fill('0').join('') + n;
}

/**
 * @param  {Number} n
 * @return {Number[]} 0..999
 */
function splitOntoTriads(n) {
    var res = [];
    var i = 0;
    var n = Math.floor(Math.abs(n));
    do {
        res.unshift(n % 1e3);
        if (++i > 50) throw new Error('formatNumber: overcycle on val: ' + n);
    } while (n = Math.floor(n / 1e3));
    return res;
}

/**
 * @param {String|Number} ns - number or number in string
 * @param {Function} triadTmpl_ - e.g. triad => `<span>${triad}</span>`
 * @param {Function} numTmpl_ - e.g. num => `<div>${num}</div>`
 */
function formatNumber (ns, triadTmpl_, numTmpl_) {
    var n_ = typeof ns === 'string' ? ns : String(ns);
    if (n_.trim() === '') return '';
    var n = +n_;
    var tmpl = triadTmpl_ || function(n) { return '<span class="num__group">' + n + '</span>'; };
{'fraction_non_alphanumeric': 0.19842931937172775, 'fraction_numerical': 0.01780104712041885, 'mean_word_length': 2.8920570264765786, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, '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': '7158452', 'n_tokens_mistral': 741, 'n_tokens_neox': 700, 'n_words': 198}