<commit_before>function Rank(name, table) {
    this.name = name;
    this.table = table || name;
    this.members = {};
}

var rank = Rank.prototype;

rank.toEntry = function (name) {
    var user = SESSION.users(sys.id(name) || name);

    if (user && user.originalName) {
        name = user.originalName;
    }

    return name.toLowerCase();
};

rank.isMember = function (name) {
    var ip, aliases,
        alias,
        len, i;

    name = this.toEntry(name);

    ip = sys.dbIp(name);
    if (this.members.hasOwnProperty(name.toLowerCase())) {
        return true;
    }

    aliases = sys.aliases(ip);

    if (!aliases || (len = aliases.length) === 1) {
        return false;
    }

    for (i = 0; i < len; i += 1) {
        alias = aliases[i];
        if (this.members.hasOwnProperty(alias.toLowerCase())) {
            return true;
        }
    }

    return false;
};

rank.addMember = function (name) {
    this.members[this.toEntry(name)] = 1;
    return this;
};

rank.removeMember = function (name) {
    delete this.members[this.toEntry(name)];
    return this;
};

rank.toggleMember = function (name) {
    if (this.isMember(name)) {
        this.removeMember(name);
        return 'remove';
    } else {
        this.addMember(name);
        return 'add';
    }
};

rank.save = function () {
    Reg.save(this.table, JSON.stringify(this.members));
    return this;
};

rank.load = function () {
    this.members = Reg.get(this.table) || {};
    return this;
};

Rank.isMemberIncludingAuth = function (name) {
    var ip, aliases,
        alias,
        len, i;

    name = this.toEntry(name);

    ip = sys.dbIp(name);
    if (sys.maxAuth(ip) > 0 || Config.maintainers.indexOf(name) !== -1) {
        return true;
    }

    if (this.members.hasOwnProperty(name.toLowerCase())) {
        return true;
    }

    aliases = sys.aliases(ip);

    if (!aliases || (len = aliases.length) === 1) {
        return false;
    }

    for (i = 0; i < len; i += 1) {
        alias = aliases[i];
        if (Config.maintainers.indexOf(alias) !== -1) {
            return true;
        }
        if (this.members.hasOwnProperty(alias.toLowerCase())) {
            return true;
        }
    }

    return false;
};

exports.Rank = Rank;
exports.load = function () {
    var plus = new Rank("MF+", "plusmembers");
    plus.isMember = Rank.isMemberIncludingAuth;

    global.Ranks = {};
    Ranks.Rank = Rank;

    Ranks.plus = plus;
};

module.reload = function () {
    module.exports.load();
    return true;
};<commit_msg>Rename<commit_after>function Rank(name, table) {
    this.name = name;
    this.table = table || name;
    this.members = {};
}

var rank = Rank.prototype;

rank.toEntry = function (name) {
    var user = SESSION.users(sys.id(name) || name);

    if (user && user.originalName) {
        name = user.originalName;
    }

    return name.toLowerCase();
};

rank.hasMember = function (name) {
    var ip, aliases,
        alias,
        len, i;

    name = this.toEntry(name);

    ip = sys.dbIp(name);
    if (this.members.hasOwnProperty(name.toLowerCase())) {
        return true;
    }

    aliases = sys.aliases(ip);

    if (!aliases || (len = aliases.length) === 1) {
        return false;
    }

    for (i = 0; i < len; i += 1) {
        alias = aliases[i];
        if (this.members.hasOwnProperty(alias.toLowerCase())) {
            return true;
        }
    }

    return false;
};

rank.addMember = function (name) {
    this.members[this.toEntry(name)] = 1;
    return this;
};

rank.removeMember = function (name) {
    delete this.members[this.toEntry(name)];
    return this;
};

rank.toggleMember = function (name) {
    if (this.hasMember(name)) {
        this.removeMember(name);
        return 'remove';
    } else {
        this.addMember(name);
        return 'add';
    }
};

rank.save = function () {
    Reg.save(this.table, JSON.stringify(this.members));
    return this;
};

rank.load = function () {
    this.members = Reg.get(this.table) || {};
    return this;
};

Rank.hasMemberIncludingAuth = function (name) {
    var ip, aliases,
        alias,
        len, i;

    name = this.toEntry(name);

    ip = sys.dbIp(name);
    if (sys.maxAuth(ip) > 0 || Config.maintainers.indexOf(name) !== -1) {
        return true;
    }

    if (this.members.hasOwnProperty(name.toLowerCase())) {
        return true;
    }

    aliases = sys.aliases(ip);

    if (!aliases || (len = aliases.length) === 1) {
        return false;
    }

    for (i = 0; i < len; i += 1) {
        alias = aliases[i];
        if (Config.maintainers.indexOf(alias) !== -1) {
            return true;
        }
        if (this.members.hasOwnProperty(alias.toLowerCase())) {
            return true;
        }
    }

    return false;
};

exports.Rank = Rank;
exports.load = function () {
    var plus = new Rank("MF+", "plusmembers");
    plus.hasMember = Rank.hasMemberIncludingAuth;

    global.Ranks = {};
    Ranks.Rank = Rank;

    Ranks.plus = plus;
};

module.reload = function () {
    module.exports.load();
    return true;
};
{'fraction_non_alphanumeric': 0.15588003157063932, 'fraction_numerical': 0.003946329913180742, 'mean_word_length': 2.2102596580114, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '7010455', 'n_tokens_mistral': 1716, 'n_tokens_neox': 1683, 'n_words': 358}