src/librustdoc/html/static/main.js
/**
         * Validate performs the following boolean logic. For example: "File::open" will give
         * IF A PARENT EXISTS => ("file" && "open") exists in (name || path || parent)
         * OR => ("file" && "open") exists in (name || path )
         *
         * This could be written functionally, but I wanted to minimise functions on stack.
         * @param  {[string]} name   [The name of the result]
         * @param  {[string]} path   [The path of the result]
         * @param  {[string]} keys   [The keys to be used (["file", "open"])]
         * @param  {[object]} parent [The parent of the result]
         * @return {[boolean]}       [Whether the result is valid or not]
         */
Validate performs the following boolean logic.

This could be written functionally, but I wanted to minimise functions on stack.
Validate performs the following boolean logic . This could be written functionally but I wanted to minimise functions on stack .
function validateResult(name, path, keys, parent) {
            var validate = true;
            if (parent !== undefined) {
                for (var i = 0; i < keys.length; i++) {
                    if ((validate) && (name.toLowerCase().indexOf(keys[i]) > -1 || path.toLowerCase().indexOf(keys[i]) > -1 || parent.name.toLowerCase().indexOf(keys[i]) > -1)) {
                        validate = true;
                    } else {
                        validate = false;
                    }
                }
            } else {
                for (var i = 0; i < keys.length; i++) {
                    if ((validate) && (name.toLowerCase().indexOf(keys[i]) > -1 || path.toLowerCase().indexOf(keys[i]) > -1)) {
                        validate = true;
                    } else {
                        validate = false;
                    }
                }
            }
            return validate;
        }
function validateResult ( name , path , keys , parent ) { var validate = true ; if ( parent !== undefined ) { for ( var i = 0 ; i < keys . length ; i ++ ) { if ( ( validate ) && ( name . toLowerCase ( ) . indexOf ( keys [ i ] ) > - 1 || path . toLowerCase ( ) . indexOf ( keys [ i ] ) > - 1 || parent . name . toLowerCase ( ) . indexOf ( keys [ i ] ) > - 1 ) ) { validate = true ; } else { validate = false ; } } } else { for ( var i = 0 ; i < keys . length ; i ++ ) { if ( ( validate ) && ( name . toLowerCase ( ) . indexOf ( keys [ i ] ) > - 1 || path . toLowerCase ( ) . indexOf ( keys [ i ] ) > - 1 ) ) { validate = true ; } else { validate = false ; } } } return validate ; }
Validate performs the following boolean logic.
Validate performs the following boolean logic .
//initially valid //if there is a parent, then validate against parent // if previous keys are valid and current key is in the path, name or parent // if previous keys are valid and current key is in the path, name