@@ -252,7 +252,7 @@ function initSearch(rawSearchIndex) {
252
252
253
253
/**
254
254
* Add an item to the type Name->ID map, or, if one already exists, use it.
255
- * Returns the number. If name is "" or null, return -1 (pure generic).
255
+ * Returns the number. If name is "" or null, return null (pure generic).
256
256
*
257
257
* This is effectively string interning, so that function matching can be
258
258
* done more quickly. Two types with the same name but different item kinds
@@ -264,7 +264,7 @@ function initSearch(rawSearchIndex) {
264
264
*/
265
265
function buildTypeMapIndex ( name ) {
266
266
if ( name === "" || name === null ) {
267
- return - 1 ;
267
+ return null ;
268
268
}
269
269
270
270
if ( typeNameIdMap . has ( name ) ) {
@@ -489,7 +489,7 @@ function initSearch(rawSearchIndex) {
489
489
}
490
490
return {
491
491
name : "never" ,
492
- id : - 1 ,
492
+ id : null ,
493
493
fullPath : [ "never" ] ,
494
494
pathWithoutLast : [ ] ,
495
495
pathLast : "never" ,
@@ -531,7 +531,7 @@ function initSearch(rawSearchIndex) {
531
531
}
532
532
return {
533
533
name : name . trim ( ) ,
534
- id : - 1 ,
534
+ id : null ,
535
535
fullPath : pathSegments ,
536
536
pathWithoutLast : pathSegments . slice ( 0 , pathSegments . length - 1 ) ,
537
537
pathLast : pathSegments [ pathSegments . length - 1 ] ,
@@ -660,7 +660,7 @@ function initSearch(rawSearchIndex) {
660
660
}
661
661
elems . push ( {
662
662
name : "[]" ,
663
- id : - 1 ,
663
+ id : null ,
664
664
fullPath : [ "[]" ] ,
665
665
pathWithoutLast : [ ] ,
666
666
pathLast : "[]" ,
@@ -1172,7 +1172,7 @@ function initSearch(rawSearchIndex) {
1172
1172
const out = [ ] ;
1173
1173
1174
1174
for ( const result of results ) {
1175
- if ( result . id > - 1 ) {
1175
+ if ( result . id !== - 1 ) {
1176
1176
const obj = searchIndex [ result . id ] ;
1177
1177
obj . dist = result . dist ;
1178
1178
const res = buildHrefAndPath ( obj ) ;
@@ -1403,7 +1403,7 @@ function initSearch(rawSearchIndex) {
1403
1403
// [unboxing]:
1404
1404
// http://ndmitchell.com/downloads/slides-hoogle_fast_type_searching-09_aug_2008.pdf
1405
1405
const queryContainsArrayOrSliceElem = queryElemSet . has ( typeNameIdOfArrayOrSlice ) ;
1406
- if ( fnType . id === - 1 || ! (
1406
+ if ( fnType . id === null || ! (
1407
1407
queryElemSet . has ( fnType . id ) ||
1408
1408
( fnType . id === typeNameIdOfSlice && queryContainsArrayOrSliceElem ) ||
1409
1409
( fnType . id === typeNameIdOfArray && queryContainsArrayOrSliceElem )
@@ -1564,7 +1564,7 @@ function initSearch(rawSearchIndex) {
1564
1564
* @return {boolean } - Returns true if the type matches, false otherwise.
1565
1565
*/
1566
1566
function checkType ( row , elem ) {
1567
- if ( row . id === - 1 ) {
1567
+ if ( row . id === null ) {
1568
1568
// This is a pure "generic" search, no need to run other checks.
1569
1569
return row . generics . length > 0 ? checkIfInList ( row . generics , elem ) : false ;
1570
1570
}
@@ -1891,7 +1891,7 @@ function initSearch(rawSearchIndex) {
1891
1891
if ( typeNameIdMap . has ( elem . pathLast ) ) {
1892
1892
elem . id = typeNameIdMap . get ( elem . pathLast ) ;
1893
1893
} else if ( ! parsedQuery . literalSearch ) {
1894
- let match = - 1 ;
1894
+ let match = null ;
1895
1895
let matchDist = maxEditDistance + 1 ;
1896
1896
let matchName = "" ;
1897
1897
for ( const [ name , id ] of typeNameIdMap ) {
@@ -1905,7 +1905,7 @@ function initSearch(rawSearchIndex) {
1905
1905
matchName = name ;
1906
1906
}
1907
1907
}
1908
- if ( match !== - 1 ) {
1908
+ if ( match !== null ) {
1909
1909
parsedQuery . correction = matchName ;
1910
1910
}
1911
1911
elem . id = match ;
@@ -2413,7 +2413,7 @@ ${item.displayPath}<span class="${type}">${name}</span>\
2413
2413
// `0` is used as a sentinel because it's fewer bytes than `null`
2414
2414
if ( pathIndex === 0 ) {
2415
2415
return {
2416
- id : - 1 ,
2416
+ id : null ,
2417
2417
ty : null ,
2418
2418
path : null ,
2419
2419
generics : generics ,
@@ -2457,7 +2457,7 @@ ${item.displayPath}<span class="${type}">${name}</span>\
2457
2457
const pathIndex = functionSearchType [ INPUTS_DATA ] ;
2458
2458
if ( pathIndex === 0 ) {
2459
2459
inputs = [ {
2460
- id : - 1 ,
2460
+ id : null ,
2461
2461
ty : null ,
2462
2462
path : null ,
2463
2463
generics : [ ] ,
@@ -2482,7 +2482,7 @@ ${item.displayPath}<span class="${type}">${name}</span>\
2482
2482
const pathIndex = functionSearchType [ OUTPUT_DATA ] ;
2483
2483
if ( pathIndex === 0 ) {
2484
2484
output = [ {
2485
- id : - 1 ,
2485
+ id : null ,
2486
2486
ty : null ,
2487
2487
path : null ,
2488
2488
generics : [ ] ,
0 commit comments