You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm not sure if this is possible with the threshold option but I'm looking to prioritize when l = false as the most important key to sort on. so results with l = false will be at the top of the results
Relevant code or config:
functiongetSuggestions(value,results){constinputValue=deburr(value.trim()).toLowerCase();constinputLength=inputValue.length;letcount=0;console.log(results);consttmp=[];for(letj=0;j<2;j++){for(letk=0;k<results.length;k++){if(results[k].l==(j==0 ? false : true)){tmp.push(results[k]);}}}results=tmp;constgetItems=value=>value
? matchSorter(results,value,{keys: ["i","n","nl_n","s","nl_s","c","nl_c"],})
: results;returninputLength===0
? []
: getItems(inputValue).filter(()=>{// put the city data here.constkeep=count<8;if(keep){count+=1;}// console.log(keep)returnkeep;});}
I can't figure out a way to put l as a key. I tried using different thresholds but I couldn't wrap my head around the threshold options
The text was updated successfully, but these errors were encountered:
I don't think that this is possible with match-sorter by itself. You may need to group the array into two unique arrays which have l = false and those which do not, then run match sorter for each and then combine them with the l = false group first.
I'm not sure if this is possible with the threshold option but I'm looking to prioritize when
l = false
as the most important key to sort on. so results withl = false
will be at the top of the resultsRelevant code or config:
I can't figure out a way to put
l
as a key. I tried using different thresholds but I couldn't wrap my head around the threshold optionsThe text was updated successfully, but these errors were encountered: