<commit_before>var subs = (function () {

var exports = {};

var stream_info = {}; // Maps lowercase stream name to stream properties object

var next_sub_id = 0;

function add_sub(stream_name, sub) {
    stream_info[stream_name.toLowerCase()] = sub;
}

function get_sub(stream_name) {
    return stream_info[stream_name.toLowerCase()];
}

exports.stream_info = function (new_stream_info) {
    if (new_stream_info !== undefined) {
        stream_info = new_stream_info;
    } else {
        return stream_info;
    }
};

exports.subscribed_streams = function () {
    return _.chain(stream_info)
        .values()
        .filter(function (sub) { return sub.subscribed; })
        .map(function (sub) { return sub.name; })
        .value();
};

function get_color() {
    var streams = _.values(stream_info);
    var subscribed_streams = _.where(streams, {subscribed: true});
    var used_colors = _.pluck(subscribed_streams, 'color');
    var color = stream_color.pick_color(used_colors);
    return color;
}

exports.update_all_messages_link = function () {
    // Show or hide the "All messages" link, depending on whether
    // the user has any subscriptions hidden from home view.
    var all_messages = $("#global_filters [data-name='all']")[0];

    if (_.every(stream_info, function (sub) { return sub.in_home_view; })) {
        $(all_messages).addClass('hidden-filter');<commit_msg>Use _.where and _.pluck in subs.subscribed_streams().<commit_after>var subs = (function () {

var exports = {};

var stream_info = {}; // Maps lowercase stream name to stream properties object

var next_sub_id = 0;

function add_sub(stream_name, sub) {
    stream_info[stream_name.toLowerCase()] = sub;
}

function get_sub(stream_name) {
    return stream_info[stream_name.toLowerCase()];
}

exports.stream_info = function (new_stream_info) {
    if (new_stream_info !== undefined) {
        stream_info = new_stream_info;
    } else {
        return stream_info;
    }
};

exports.subscribed_streams = function () {
    return _.chain(stream_info)
        .values()
        .where({subscribed: true})
        .pluck('name')
        .value();
};

function get_color() {
    var streams = _.values(stream_info);
    var subscribed_streams = _.where(streams, {subscribed: true});
    var used_colors = _.pluck(subscribed_streams, 'color');
    var color = stream_color.pick_color(used_colors);
    return color;
}

exports.update_all_messages_link = function () {
    // Show or hide the "All messages" link, depending on whether
    // the user has any subscriptions hidden from home view.
    var all_messages = $("#global_filters [data-name='all']")[0];

    if (_.every(stream_info, function (sub) { return sub.in_home_view; })) {
        $(all_messages).addClass('hidden-filter');
{'fraction_non_alphanumeric': 0.12927619733525386, 'fraction_numerical': 0.0014404033129276198, 'mean_word_length': 3.6069651741293534, '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': '5728562', 'n_tokens_mistral': 865, 'n_tokens_neox': 868, 'n_words': 205}