@@ -263,7 +263,6 @@ function initSearch(rawSearchIndex) {
263
263
* @returns {integer }
264
264
*/
265
265
function buildTypeMapIndex ( name ) {
266
-
267
266
if ( name === "" || name === null ) {
268
267
return - 1 ;
269
268
}
@@ -1380,7 +1379,7 @@ function initSearch(rawSearchIndex) {
1380
1379
* @type Map<integer, QueryElement[]>
1381
1380
*/
1382
1381
const queryElemSet = new Map ( ) ;
1383
- const addQueryElemToQueryElemSet = function addQueryElemToQueryElemSet ( queryElem ) {
1382
+ const addQueryElemToQueryElemSet = queryElem => {
1384
1383
let currentQueryElemList ;
1385
1384
if ( queryElemSet . has ( queryElem . id ) ) {
1386
1385
currentQueryElemList = queryElemSet . get ( queryElem . id ) ;
@@ -1397,7 +1396,7 @@ function initSearch(rawSearchIndex) {
1397
1396
* @type Map<integer, FunctionType[]>
1398
1397
*/
1399
1398
const fnTypeSet = new Map ( ) ;
1400
- const addFnTypeToFnTypeSet = function addFnTypeToFnTypeSet ( fnType ) {
1399
+ const addFnTypeToFnTypeSet = fnType => {
1401
1400
// Pure generic, or an item that's not matched by any query elems.
1402
1401
// Try [unboxing] it.
1403
1402
//
@@ -2385,12 +2384,11 @@ ${item.displayPath}<span class="${type}">${name}</span>\
2385
2384
lowercasePaths
2386
2385
) ;
2387
2386
}
2387
+ // `0` is used as a sentinel because it's fewer bytes than `null`
2388
+ const item = pathIndex === 0 ? null : lowercasePaths [ pathIndex - 1 ] ;
2388
2389
return {
2389
- // `0` is used as a sentinel because it's fewer bytes than `null`
2390
- id : pathIndex === 0
2391
- ? - 1
2392
- : buildTypeMapIndex ( lowercasePaths [ pathIndex - 1 ] . name ) ,
2393
- ty : pathIndex === 0 ? null : lowercasePaths [ pathIndex - 1 ] . ty ,
2390
+ id : item === null ? - 1 : buildTypeMapIndex ( item . name ) ,
2391
+ ty : item === null ? null : item . ty ,
2394
2392
generics : generics ,
2395
2393
} ;
2396
2394
} ) ;
@@ -2419,14 +2417,13 @@ ${item.displayPath}<span class="${type}">${name}</span>\
2419
2417
if ( functionSearchType === 0 ) {
2420
2418
return null ;
2421
2419
}
2422
- let inputs , output ;
2420
+ let inputs , output , item ;
2423
2421
if ( typeof functionSearchType [ INPUTS_DATA ] === "number" ) {
2424
2422
const pathIndex = functionSearchType [ INPUTS_DATA ] ;
2423
+ item = pathIndex === 0 ? null : lowercasePaths [ pathIndex - 1 ] ;
2425
2424
inputs = [ {
2426
- id : pathIndex === 0
2427
- ? - 1
2428
- : buildTypeMapIndex ( lowercasePaths [ pathIndex - 1 ] . name ) ,
2429
- ty : pathIndex === 0 ? null : lowercasePaths [ pathIndex - 1 ] . ty ,
2425
+ id : item === null ? - 1 : buildTypeMapIndex ( item . name ) ,
2426
+ ty : item === null ? null : item . ty ,
2430
2427
generics : [ ] ,
2431
2428
} ] ;
2432
2429
} else {
@@ -2438,11 +2435,10 @@ ${item.displayPath}<span class="${type}">${name}</span>\
2438
2435
if ( functionSearchType . length > 1 ) {
2439
2436
if ( typeof functionSearchType [ OUTPUT_DATA ] === "number" ) {
2440
2437
const pathIndex = functionSearchType [ OUTPUT_DATA ] ;
2438
+ item = pathIndex === 0 ? null : lowercasePaths [ pathIndex - 1 ] ;
2441
2439
output = [ {
2442
- id : pathIndex === 0
2443
- ? - 1
2444
- : buildTypeMapIndex ( lowercasePaths [ pathIndex - 1 ] . name ) ,
2445
- ty : pathIndex === 0 ? null : lowercasePaths [ pathIndex - 1 ] . ty ,
2440
+ id : item === null ? - 1 : buildTypeMapIndex ( item . name ) ,
2441
+ ty : item === null ? null : item . ty ,
2446
2442
generics : [ ] ,
2447
2443
} ] ;
2448
2444
} else {
0 commit comments