<commit_before>define([
    'dojo/_base/declare',
    'dojo/_base/lang',
    'dojo/Deferred',
    './Base'
],
function(
    declare,
    lang,
    Deferred,
    Base
){
    return declare(
        [Base],
        {
            constructor: function(){
                this.filters = [];
            },

            filter: function(value){
                return this._loop(value, 0);
            },

            _loop: function(value, index){
                //Summary:
                //    loops over all the filters in turn.
                //    This code is slightly insane, but it works.
                //    Most of the instanity comes from handling the possibility
                //    that a filter may return a Deferred. If a Deferred is
                //    returned from one or more filters, then a Deferred will
                //    be returned from the Group
                //

                if (this.filters.length <= index){
                    return value;
                }

                var filter = this.filters[index],
                    filteredValue = this._getFilteredValue(filter, value);

                if (filteredValue.then){

                    var resultDeferred = new Deferred;

                    filteredValue.then(lang.hitch(this, function(resolvedFilteredValue){
                        resultDeferred.resolve(this._loop(resolvedFilteredValue, index + 1));
                    }));<commit_msg>fix for filters to handle undefined values<commit_after>define([
    'dojo/_base/declare',
    'dojo/_base/lang',
    'dojo/Deferred',
    './Base'
],
function(
    declare,
    lang,
    Deferred,
    Base
){
    return declare(
        [Base],
        {
            constructor: function(){
                this.filters = [];
            },

            filter: function(value){
                return this._loop(value, 0);
            },

            _loop: function(value, index){
                //Summary:
                //    loops over all the filters in turn.
                //    This code is slightly insane, but it works.
                //    Most of the instanity comes from handling the possibility
                //    that a filter may return a Deferred. If a Deferred is
                //    returned from one or more filters, then a Deferred will
                //    be returned from the Group
                //

                if (this.filters.length <= index){
                    return value;
                }

                var filter = this.filters[index],
                    filteredValue = this._getFilteredValue(filter, value);

                if (filteredValue && filteredValue.then){

                    var resultDeferred = new Deferred;

                    filteredValue.then(lang.hitch(this, function(resolvedFilteredValue){
                        resultDeferred.resolve(this._loop(resolvedFilteredValue, index + 1));
                    }));
{'fraction_non_alphanumeric': 0.09059945504087194, 'fraction_numerical': 0.0013623978201634877, 'mean_word_length': 1.2820512820512822, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3986566', 'n_tokens_mistral': 738, 'n_tokens_neox': 681, 'n_words': 201}