@@ -146,23 +146,21 @@ window.initSearch = function(rawSearchIndex) {
146146
147147 removeEmptyStringsFromArray ( split ) ;
148148
149- function transformResults ( results , isType ) {
149+ function transformResults ( results ) {
150150 var out = [ ] ;
151151 for ( var i = 0 , len = results . length ; i < len ; ++ i ) {
152152 if ( results [ i ] . id > - 1 ) {
153153 var obj = searchIndex [ results [ i ] . id ] ;
154154 obj . lev = results [ i ] . lev ;
155- if ( isType !== true || obj . type ) {
156- var res = buildHrefAndPath ( obj ) ;
157- obj . displayPath = pathSplitter ( res [ 0 ] ) ;
158- obj . fullPath = obj . displayPath + obj . name ;
159- // To be sure than it some items aren't considered as duplicate.
160- obj . fullPath += "|" + obj . ty ;
161- obj . href = res [ 1 ] ;
162- out . push ( obj ) ;
163- if ( out . length >= MAX_RESULTS ) {
164- break ;
165- }
155+ var res = buildHrefAndPath ( obj ) ;
156+ obj . displayPath = pathSplitter ( res [ 0 ] ) ;
157+ obj . fullPath = obj . displayPath + obj . name ;
158+ // To be sure than it some items aren't considered as duplicate.
159+ obj . fullPath += "|" + obj . ty ;
160+ obj . href = res [ 1 ] ;
161+ out . push ( obj ) ;
162+ if ( out . length >= MAX_RESULTS ) {
163+ break ;
166164 }
167165 }
168166 }
@@ -266,9 +264,7 @@ window.initSearch = function(rawSearchIndex) {
266264 path = result . item . path . toLowerCase ( ) ,
267265 parent = result . item . parent ;
268266
269- if ( isType !== true &&
270- validateResult ( name , path , split , parent ) === false )
271- {
267+ if ( ! isType && ! validateResult ( name , path , split , parent ) ) {
272268 result . id = - 1 ;
273269 }
274270 }
@@ -352,7 +348,7 @@ window.initSearch = function(rawSearchIndex) {
352348 var lev_distance = MAX_LEV_DISTANCE + 1 ;
353349 var len , x , firstGeneric ;
354350 if ( obj [ NAME ] === val . name ) {
355- if ( literalSearch === true ) {
351+ if ( literalSearch ) {
356352 if ( val . generics && val . generics . length !== 0 ) {
357353 if ( obj . length > GENERICS_DATA &&
358354 obj [ GENERICS_DATA ] . length >= val . generics . length ) {
@@ -373,7 +369,7 @@ window.initSearch = function(rawSearchIndex) {
373369 break ;
374370 }
375371 }
376- if ( allFound === true ) {
372+ if ( allFound ) {
377373 return true ;
378374 }
379375 } else {
@@ -394,7 +390,7 @@ window.initSearch = function(rawSearchIndex) {
394390 }
395391 }
396392 // Names didn't match so let's check if one of the generic types could.
397- if ( literalSearch === true ) {
393+ if ( literalSearch ) {
398394 if ( obj . length > GENERICS_DATA && obj [ GENERICS_DATA ] . length > 0 ) {
399395 return obj [ GENERICS_DATA ] . some (
400396 function ( name ) {
@@ -429,12 +425,12 @@ window.initSearch = function(rawSearchIndex) {
429425 var length = obj . type [ INPUTS_DATA ] . length ;
430426 for ( var i = 0 ; i < length ; i ++ ) {
431427 var tmp = obj . type [ INPUTS_DATA ] [ i ] ;
432- if ( typePassesFilter ( typeFilter , tmp [ 1 ] ) === false ) {
428+ if ( ! typePassesFilter ( typeFilter , tmp [ 1 ] ) ) {
433429 continue ;
434430 }
435431 tmp = checkType ( tmp , val , literalSearch ) ;
436- if ( literalSearch === true ) {
437- if ( tmp === true ) {
432+ if ( literalSearch ) {
433+ if ( tmp ) {
438434 return true ;
439435 }
440436 continue ;
@@ -445,7 +441,7 @@ window.initSearch = function(rawSearchIndex) {
445441 }
446442 }
447443 }
448- return literalSearch === true ? false : lev_distance ;
444+ return literalSearch ? false : lev_distance ;
449445 }
450446
451447 function checkReturned ( obj , val , literalSearch , typeFilter ) {
@@ -458,12 +454,12 @@ window.initSearch = function(rawSearchIndex) {
458454 }
459455 for ( var x = 0 , len = ret . length ; x < len ; ++ x ) {
460456 var tmp = ret [ x ] ;
461- if ( typePassesFilter ( typeFilter , tmp [ 1 ] ) === false ) {
457+ if ( ! typePassesFilter ( typeFilter , tmp [ 1 ] ) ) {
462458 continue ;
463459 }
464460 tmp = checkType ( tmp , val , literalSearch ) ;
465- if ( literalSearch === true ) {
466- if ( tmp === true ) {
461+ if ( literalSearch ) {
462+ if ( tmp ) {
467463 return true ;
468464 }
469465 continue ;
@@ -474,7 +470,7 @@ window.initSearch = function(rawSearchIndex) {
474470 }
475471 }
476472 }
477- return literalSearch === true ? false : lev_distance ;
473+ return literalSearch ? false : lev_distance ;
478474 }
479475
480476 function checkPath ( contains , lastElem , ty ) {
@@ -507,7 +503,7 @@ window.initSearch = function(rawSearchIndex) {
507503 }
508504 lev_total += lev ;
509505 }
510- if ( aborted === false ) {
506+ if ( ! aborted ) {
511507 ret_lev = Math . min ( ret_lev , Math . round ( lev_total / clength ) ) ;
512508 }
513509 }
@@ -634,14 +630,14 @@ window.initSearch = function(rawSearchIndex) {
634630 dontValidate : true ,
635631 } ;
636632 }
637- if ( in_args === true && results_in_args [ fullId ] === undefined ) {
633+ if ( in_args && results_in_args [ fullId ] === undefined ) {
638634 results_in_args [ fullId ] = {
639635 id : i ,
640636 index : - 1 ,
641637 dontValidate : true ,
642638 } ;
643639 }
644- if ( returned === true && results_returned [ fullId ] === undefined ) {
640+ if ( returned && results_returned [ fullId ] === undefined ) {
645641 results_returned [ fullId ] = {
646642 id : i ,
647643 index : - 1 ,
@@ -676,34 +672,34 @@ window.initSearch = function(rawSearchIndex) {
676672 fullId = ty . id ;
677673
678674 returned = checkReturned ( ty , output , true , NO_TYPE_FILTER ) ;
679- if ( output . name === "*" || returned === true ) {
675+ if ( output . name === "*" || returned ) {
680676 in_args = false ;
681677 var is_module = false ;
682678
683679 if ( input === "*" ) {
684680 is_module = true ;
685681 } else {
686682 var allFound = true ;
687- for ( it = 0 , len = inputs . length ; allFound === true && it < len ; it ++ ) {
683+ for ( it = 0 , len = inputs . length ; allFound && it < len ; it ++ ) {
688684 allFound = checkType ( type , inputs [ it ] , true ) ;
689685 }
690686 in_args = allFound ;
691687 }
692- if ( in_args === true ) {
688+ if ( in_args ) {
693689 results_in_args [ fullId ] = {
694690 id : i ,
695691 index : - 1 ,
696692 dontValidate : true ,
697693 } ;
698694 }
699- if ( returned === true ) {
695+ if ( returned ) {
700696 results_returned [ fullId ] = {
701697 id : i ,
702698 index : - 1 ,
703699 dontValidate : true ,
704700 } ;
705701 }
706- if ( is_module === true ) {
702+ if ( is_module ) {
707703 results [ fullId ] = {
708704 id : i ,
709705 index : - 1 ,
@@ -763,10 +759,10 @@ window.initSearch = function(rawSearchIndex) {
763759 }
764760 }
765761 if ( ( lev = levenshtein ( searchWords [ j ] , val ) ) <= MAX_LEV_DISTANCE ) {
766- if ( typePassesFilter ( typeFilter , ty . ty ) === false ) {
767- lev = MAX_LEV_DISTANCE + 1 ;
768- } else {
762+ if ( typePassesFilter ( typeFilter , ty . ty ) ) {
769763 lev += 1 ;
764+ } else {
765+ lev = MAX_LEV_DISTANCE + 1 ;
770766 }
771767 }
772768 in_args = findArg ( ty , valGenerics , false , typeFilter ) ;
@@ -821,7 +817,7 @@ window.initSearch = function(rawSearchIndex) {
821817 var ret = {
822818 "in_args" : sortResults ( results_in_args , true ) ,
823819 "returned" : sortResults ( results_returned , true ) ,
824- "others" : sortResults ( results ) ,
820+ "others" : sortResults ( results , false ) ,
825821 } ;
826822 handleAliases ( ret , query , filterCrates ) ;
827823 return ret ;
@@ -1263,7 +1259,7 @@ window.initSearch = function(rawSearchIndex) {
12631259 if ( query . query . length === 0 ) {
12641260 return ;
12651261 }
1266- if ( forced !== true && query . id === currentResults ) {
1262+ if ( ! forced && query . id === currentResults ) {
12671263 if ( query . query . length > 0 ) {
12681264 searchState . putBackSearch ( searchState . input ) ;
12691265 }
0 commit comments