<commit_before>/**
 * Filter that will query all existing domains
 */
angular.module('rcmRedirectEditor')
.filter('domainFilter', function () {

    var compareStr = function (stra, strb) {
        stra = ("" + stra).toLowerCase();
        strb = ("" + strb).toLowerCase();

        return stra.indexOf(strb) !== -1;
    };

    return function (input, query) {
        if (!query) {
            return input
        }
        var result = {};
        angular.forEach(
            input, function (site) {
                if (compareStr(site.domain, query)) {
                    result[site.siteId] = site;
                }
            }
        );

        return result;
    };
});


<commit_msg>speed up? maybe?<commit_after>/**
 * Filter that will query all existing domains
 */
angular.module('rcmRedirectEditor')
    .filter('domainFilter', function () {
        return function (input, query) {
            if (!query) {
                return input
            }
            var result = {};
            var regex = new RegExp(query, 'i');
            angular.forEach(
                input, function (site) {
                    if (site.domain && site.domain.search(regex) !== -1) {
                        result[site.siteId] = site;
                    }
                }
            );

            return result;
        };
    });



{'fraction_non_alphanumeric': 0.13101406365655072, 'fraction_numerical': 0.0014803849000740192, 'mean_word_length': 1.405693950177936, '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': '3792650', 'n_tokens_mistral': 363, 'n_tokens_neox': 349, 'n_words': 84}