File tree Expand file tree Collapse file tree 3 files changed +6
-8
lines changed
Expand file tree Collapse file tree 3 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import { features as data } from 'web-features';
1111import { fuzzySearch } from '../../util/fuzzy-search.js' ;
1212import type { ProviderConfig } from './types.js' ;
1313import { createBaseConfig , getBaselineFeatures } from './utils.js' ;
14+ import { clampText } from '../../util/text.js' ;
1415
1516export type FeatureData = {
1617 name : string ;
@@ -72,11 +73,8 @@ export const baselineProvider: ProviderConfig<FeatureItem> = {
7273 . setMaxValues ( 1 )
7374 . addOptions (
7475 ...data . map ( ( feature ) => ( {
75- label : feature . name . length > 100 ? `${ feature . name . slice ( 0 , 97 ) } ...` : feature . name ,
76- description :
77- feature . description . length > 100
78- ? `${ feature . description . slice ( 0 , 97 ) } ...`
79- : feature . description ,
76+ label : clampText ( feature . name , 100 ) ,
77+ description : clampText ( feature . description , 100 ) ,
8078 value : feature . key ,
8179 } ) )
8280 )
Original file line number Diff line number Diff line change @@ -56,8 +56,8 @@ export const mdnProvider: ProviderConfig<SearchItem> = {
5656 . setMaxValues ( Math . min ( 5 , data . size ) )
5757 . addOptions (
5858 ...data . map ( ( doc ) => ( {
59- label : doc . title . length > 100 ? ` ${ doc . title . slice ( 0 , 97 ) } ...` : doc . title ,
60- description : doc . summary . length > 100 ? ` ${ doc . summary . slice ( 0 , 97 ) } ...` : doc . summary ,
59+ label : clampText ( doc . title , 100 ) ,
60+ description : clampText ( doc . summary , 100 ) ,
6161 value : doc . slug ,
6262 } ) )
6363 )
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ export const npmProvider: ProviderConfig<SearchItem> = {
6464 ...data . map ( ( pkg ) =>
6565 new StringSelectMenuOptionBuilder ( )
6666 . setLabel ( pkg . name )
67- . setDescription ( pkg . description )
67+ . setDescription ( clampText ( pkg . description , 100 ) )
6868 . setValue ( pkg . name )
6969 )
7070 )
You can’t perform that action at this time.
0 commit comments