lib/event/filter.js
function findMatch(filters, listener){
        var handlers = [],
            isMatch = true;

        if( !_.isUndefined(listener.filters.nodes) && listener.filters.nodes.length > 0 ) {
            isMatch = !_.isUndefined( _.find( listener.filters.nodes , function(node) {
                return (node === filters.node || node === '*');
            } ) );
        }

        if ( isMatch && !_.isUndefined(listener.filters.types) && listener.filters.types.length > 0 ) {
            isMatch = !_.isUndefined( _.find( listener.filters.types , function(type) {
                return (type === filters.type || type === '*');
            } ) );
        }

        if( isMatch && !_.isUndefined(listener.filters.contentids) && listener.filters.contentids.length > 0 ) {
            isMatch = !_.isUndefined( _.find( listener.filters.contentids , function(contentid) {
                return (contentid === filters.contentid || contentid === '*');
            } ) );
        }

        if( isMatch && !_.isUndefined(listener.filters.system) && listener.filters.system.length > 0 ) {
            isMatch = !_.isUndefined( _.find( listener.filters.system , function(val) {
                return (val === filters.system || val === '*');
            } ) );
        }

        // If we still have a match return handlers attached to the listener
        if( isMatch ) {
            handlers = listener.handlers;
        }

        return handlers;
    }
function findMatch(filters, listener){
        var handlers = [],
            isMatch = true;

        if( !_.isUndefined(listener.filters.nodes) && listener.filters.nodes.length > 0 ) {
            isMatch = !_.isUndefined( _.find( listener.filters.nodes , function(node) {
                return (node === filters.node || node === '*');
            } ) );
        }

        if ( isMatch && !_.isUndefined(listener.filters.types) && listener.filters.types.length > 0 ) {
            isMatch = !_.isUndefined( _.find( listener.filters.types , function(type) {
                return (type === filters.type || type === '*');
            } ) );
        }

        if( isMatch && !_.isUndefined(listener.filters.contentids) && listener.filters.contentids.length > 0 ) {
            isMatch = !_.isUndefined( _.find( listener.filters.contentids , function(contentid) {
                return (contentid === filters.contentid || contentid === '*');
            } ) );
        }

        if( isMatch && !_.isUndefined(listener.filters.system) && listener.filters.system.length > 0 ) {
            isMatch = !_.isUndefined( _.find( listener.filters.system , function(val) {
                return (val === filters.system || val === '*');
            } ) );
        }

        // If we still have a match return handlers attached to the listener
        if( isMatch ) {
            handlers = listener.handlers;
        }

        return handlers;
    }
function findMatch ( filters , listener ) { var handlers = [ ] , isMatch = true ; if ( ! _ . isUndefined ( listener . filters . nodes ) && listener . filters . nodes . length > 0 ) { isMatch = ! _ . isUndefined ( _ . find ( listener . filters . nodes , function ( node ) { return ( node === filters . node || node === '*' ) ; } ) ) ; } if ( isMatch && ! _ . isUndefined ( listener . filters . types ) && listener . filters . types . length > 0 ) { isMatch = ! _ . isUndefined ( _ . find ( listener . filters . types , function ( type ) { return ( type === filters . type || type === '*' ) ; } ) ) ; } if ( isMatch && ! _ . isUndefined ( listener . filters . contentids ) && listener . filters . contentids . length > 0 ) { isMatch = ! _ . isUndefined ( _ . find ( listener . filters . contentids , function ( contentid ) { return ( contentid === filters . contentid || contentid === '*' ) ; } ) ) ; } if ( isMatch && ! _ . isUndefined ( listener . filters . system ) && listener . filters . system . length > 0 ) { isMatch = ! _ . isUndefined ( _ . find ( listener . filters . system , function ( val ) { return ( val === filters . system || val === '*' ) ; } ) ) ; } // If we still have a match return handlers attached to the listener if ( isMatch ) { handlers = listener . handlers ; } return handlers ; }
Function will look at the filters that have been passed in to the module through an
emit call and compair them to the filters that are attached to all of the listeners.
If there are matches the function will return an array of event handlers that
match the criteria.

@param filters - Event filters that are passed in through emit
@param listener - Listener that has been registered in the application
@returns {Array} - Array of event handlers that match the filter criteria
Function will look at the filters that have been passed in to the module through an emit call and compair them to the filters that are attached to all of the listeners . If there are matches the function will return an array of event handlers that match the criteria .