<commit_before>'use strict';

function stripTableName(name) {
    return name.split('.').pop();
}

// This class is used to help generate the names of node query columns
module.exports = class ColumnNamer {
    constructor (columns) {
        this.columns = columns.map(name => stripTableName(name).toLowerCase());
    }

    uniqueName(baseName) {
        baseName = baseName.toLowerCase();
        var name = baseName;
        var ok = this.isUnique(name);
        if (!ok) {
            // try adding a numeric suffix
            var count = 1;
            while (!ok) {
                name = baseName + '_' + (++count);
                ok = this.isUnique(name);
            }
        }
        this.columns.push(name);
        return name;
    }

    isUnique(name) {
        return !this.columns.includes(name);
    }

};<commit_msg>Embrace ES6 features<commit_after>'use strict';

const stripTableName = name => name.split('.').pop();

// This class is used to help generate the names of node query columns
module.exports = class ColumnNamer {
    constructor (columns) {
        this.columns = columns.map(name => stripTableName(name).toLowerCase());
    }

    uniqueName(baseName) {
        baseName = baseName.toLowerCase();
        let name = baseName;
        let ok = this.isUnique(name);
        let count = 1;
        while (!ok) {
            name = baseName + '_' + (++count);
            ok = this.isUnique(name);
        }
        this.columns.push(name);
        return name;
    }

    isUnique(name) {
        return !this.columns.includes(name);
    }

};
{'fraction_non_alphanumeric': 0.1279290690310323, 'fraction_numerical': 0.0018999366687777073, 'mean_word_length': 2.0560928433268857, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '3361179', 'n_tokens_mistral': 456, 'n_tokens_neox': 454, 'n_words': 113}