<commit_before>exports.basic2string = function(nodes, tab) {
    var s = '', t = [];

    if (tab === null || tab === undefined) tab = '';

    nodes.forEach(function(node) {
        t = [];

        if (node.type === 'ruleset') {
            node.value.forEach(function(value) {
                t.push(value.join(''));
            });
            s += tab + t.join(', ');
        } else {
            s += tab + node.value.join('');
        }

        if (node.nodes.length) {
            s += ' {\n';
            s += exports.basic2string(node.nodes, tab + '    ');
        } else {
            if (node.content.length) {
                s += ' {\n    ' + tab;
                t = [];
                node.content.forEach(function(d) {
                    t.push(d.name + ': ' + d.value.join('') + (d.important ? ' !important' : ''));
                });
                s += t.join(';\n    ' + tab) + '\n';
            } else if (node.type === 'ruleset') s += ' {';
        }
        if (node.type === 'ruleset' || node.content.length || node.nodes.length) s += tab + '}\n';
        else s += ';\n';
    });

    return s.trim();
};

exports.min2string = function(nodes) {
    var s = '', t = [];

    nodes.forEach(function(node) {
        t = [];

        if (node.type === 'ruleset') {
            node.value.forEach(function(value) {
                t.push(value.join(''));
            });
            s += t.join(',');
        } else {
            s += node.value.join('');
        }

        if (node.nodes.length) {
            s += '{';
            s += exports.min2string(node.nodes);
        } else {
            if (node.content.length) {
                s += '{';
                t = [];
                node.content.forEach(function(d) {
                    t.push(d.name + ':' + d.value.join('') + (d.important ? ' !important' : ''));
                });
                s += t.join(';');
            } else if (node.type === 'ruleset') s += '{';
        }
        if (node.type === 'ruleset' || node.content.length || node.nodes.length) s += '}';
        else s += ';';
    });

    return s.trim();
};

exports.dump2string = function(nodes, tab) {
    var s = '', t = [];

    if (tab === null || tab === undefined) tab = '';

    nodes.forEach(function(node) {
        t = [];
        s += tab + 'type(' + node.type + ')\n';
        if (node.type === 'ruleset') {
            node.value.forEach(function(value) {
                t.push('value(' + value.toString() + ')');
            });
            s += tab + t.toString();
        } else {
            s += tab + 'value(' + node.value.toString() + ')';
        }

        if (node.nodes.length) {
            s += '\n' + tab + '{\n';
            s += exports.dump2string(node.nodes, tab + '    ');
        } else {
            if (node.content.length) {
                s += '\n' + tab + '{\n    ' + tab;
                t = [];
                node.content.forEach(function(d) {
                    t.push('name(' + d.name + '): value(' + d.value.join('') + (d.important ? ' !important' : '') + ')');
                });
                s += t.join(';\n    ' + tab);
            } else if (node.type === 'ruleset') s += ' {';
        }
        if (node.type === 'ruleset' || node.content.length || node.nodes.length) s += '\n' + tab + '}\n';
    });

    return s.trim();
};<commit_msg>client JS support<commit_after>var $cssoutils = {
    basic2string: function(nodes, tab) {
        var s = '', t = [];

        if (tab === null || tab === undefined) tab = '';

        nodes.forEach(function(node) {
            t = [];

            if (node.type === 'ruleset') {
                node.value.forEach(function(value) {
                    t.push(value.join(''));
                });
                s += tab + t.join(', ');
            } else {
                s += tab + node.value.join('');
            }

            if (node.nodes.length) {
                s += ' {\n';
                s += exports.basic2string(node.nodes, tab + '    ');
            } else {
                if (node.content.length) {
                    s += ' {\n    ' + tab;
                    t = [];
                    node.content.forEach(function(d) {
                        t.push(d.name + ': ' + d.value.join('') + (d.important ? ' !important' : ''));
                    });
                    s += t.join(';\n    ' + tab) + '\n';
                } else if (node.type === 'ruleset') s += ' {';
            }
            if (node.type === 'ruleset' || node.content.length || node.nodes.length) s += tab + '}\n';
            else s += ';\n';
        });

        return s.trim();
    },

    min2string: function(nodes) {
        var s = '', t = [];

        nodes.forEach(function(node) {
            t = [];

            if (node.type === 'ruleset') {
                node.value.forEach(function(value) {
                    t.push(value.join(''));
                });
                s += t.join(',');
            } else {
                s += node.value.join('');
            }

            if (node.nodes.length) {
                s += '{';
                s += exports.min2string(node.nodes);
            } else {
                if (node.content.length) {
                    s += '{';
                    t = [];
                    node.content.forEach(function(d) {
                        t.push(d.name + ':' + d.value.join('') + (d.important ? ' !important' : ''));
                    });
                    s += t.join(';');
                } else if (node.type === 'ruleset') s += '{';
            }
            if (node.type === 'ruleset' || node.content.length || node.nodes.length) s += '}';
            else s += ';';
        });

        return s.trim();
    },

    dump2string: function(nodes, tab) {
        var s = '', t = [];

        if (tab === null || tab === undefined) tab = '';

        nodes.forEach(function(node) {
            t = [];
            s += tab + 'type(' + node.type + ')\n';
            if (node.type === 'ruleset') {
                node.value.forEach(function(value) {
                    t.push('value(' + value.toString() + ')');
                });
                s += tab + t.toString();
            } else {
                s += tab + 'value(' + node.value.toString() + ')';
            }

            if (node.nodes.length) {
                s += '\n' + tab + '{\n';
                s += exports.dump2string(node.nodes, tab + '    ');
            } else {
                if (node.content.length) {
                    s += '\n' + tab + '{\n    ' + tab;
                    t = [];
                    node.content.forEach(function(d) {
                        t.push('name(' + d.name + '): value(' + d.value.join('') + (d.important ? ' !important' : '') + ')');
                    });
                    s += t.join(';\n    ' + tab);
                } else if (node.type === 'ruleset') s += ' {';
            }
            if (node.type === 'ruleset' || node.content.length || node.nodes.length) s += '\n' + tab + '}\n';
        });

        return s.trim();
    }
};

exports.basic2string = $cssoutils.basic2string;
exports.min2string = $cssoutils.min2string;
exports.dump2string = $cssoutils.dump2string;
{'fraction_non_alphanumeric': 0.19991693202270525, 'fraction_numerical': 0.002492039318842586, 'mean_word_length': 1.1997563946406822, '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': '7413696', 'n_tokens_mistral': 2210, 'n_tokens_neox': 2109, 'n_words': 396}