<commit_before>(function( root, factory ){
    if( typeof exports === 'object' ){
        module.exports = factory( require( 'nestedtypes' ), require( 'react' ), require( 'backbone' ) );
    }
    else if( typeof define === 'function' && define.amd ){
        define( [ 'nestedtypes', 'react', 'backbone' ], factory );
    }
    else{
        root.React = factory( root.Nested, root.React, root.Backbone );
    }
}( this, function( Nested, React, Backbone ){
    // Wrapper for forceUpdate to be used in backbone events handlers
    function forceUpdate(){
        this.forceUpdate();
    }

    var UpdateOnProps = {
        componentDidMount : function(){
            var props    = this.props,
                updateOn = this.updateOnProps;

            for( var prop in updateOn ){
                this.listenTo( props[ prop ], updateOn[ prop ], forceUpdate );
            }
        },

        componentWillUnmount : function(){
            var props    = this.props,
                updateOn = this.updateOnProps;

            for( var prop in updateOn ){
                this.stopListening( props[ prop ] );
            }
        }
    };

    var UpdateOnModel = {
        componentWillMount : function(){
            this.model = new this.Model();
        },

        componentDidMount : function(){
            this.listenTo( this.model, 'change', forceUpdate );
        },

        componentWillUnmount : function(){
            this.stopListening( this.model );
            this.model = null;
        }
    };

    function getModelAttributes( spec ){
        var attributes = null;

        for( var i = spec.mixins.length - 1; i >= 0; i-- ){
            var mixin = spec.mixins[ i ];
            if( mixin.attributes ){
                attributes || ( attributes = {} );
                Object.assign( attributes, mixin.attributes );
            }
        }

        if( spec.attributes ){
            if( attributes ){
                Object.assign( attributes, spec.attributes );
            }
            else{
                attributes = spec.attributes;
            }
        }<commit_msg>added model update events customization<commit_after>(function( root, factory ){
    if( typeof exports === 'object' ){
        module.exports = factory( require( 'nestedtypes' ), require( 'react' ), require( 'backbone' ) );
    }
    else if( typeof define === 'function' && define.amd ){
        define( [ 'nestedtypes', 'react', 'backbone' ], factory );
    }
    else{
        root.React = factory( root.Nested, root.React, root.Backbone );
    }
}( this, function( Nested, React, Backbone ){
    // Wrapper for forceUpdate to be used in backbone events handlers
    function forceUpdate(){
        this.forceUpdate();
    }

    var UpdateOnProps = {
        componentDidMount : function(){
            var props    = this.props,
                updateOn = this.updateOnProps;

            for( var prop in updateOn ){
                this.listenTo( props[ prop ], updateOn[ prop ], forceUpdate );
            }
        },

        componentWillUnmount : function(){
            var props    = this.props,
                updateOn = this.updateOnProps;

            for( var prop in updateOn ){
                this.stopListening( props[ prop ] );
            }
        }
    };

    var UpdateOnModel = {
        updateOnModel : 'change',

        componentWillMount : function(){
            this.model = new this.Model();
        },

        componentDidMount : function(){
            var events = this.updateOnModel;
            events && this.listenTo( this.model, events, forceUpdate );
        },

        componentWillUnmount : function(){
            this.stopListening( this.model );
            this.model = null;
        }
    };

    function getModelAttributes( spec ){
        var attributes = null;

        for( var i = spec.mixins.length - 1; i >= 0; i-- ){
            var mixin = spec.mixins[ i ];
            if( mixin.attributes ){
                attributes || ( attributes = {} );
                Object.assign( attributes, mixin.attributes );
            }
        }

        if( spec.attributes ){
            if( attributes ){
                Object.assign( attributes, spec.attributes );
            }
            else{
                attributes = spec.attributes;
            }
        }
{'fraction_non_alphanumeric': 0.11703601108033242, 'fraction_numerical': 0.0009233610341643582, 'mean_word_length': 1.6197097944377268, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1405157', 'n_tokens_mistral': 1136, 'n_tokens_neox': 1093, 'n_words': 288}