@@ -585,18 +585,18 @@ function supports_svelte_versions(version_range: string): {
585585 return result ;
586586}
587587
588- function dont_end_by ( str : string , not_all_allowed : string [ ] ) : string {
589- for ( const nope of not_all_allowed ) {
590- if ( str . endsWith ( nope ) ) {
591- return str . slice ( 0 , - nope . length ) ;
588+ function remove_ending_by ( str : string , endings : string [ ] ) : string {
589+ for ( const ending of endings ) {
590+ if ( str . endsWith ( ending ) ) {
591+ return str . slice ( 0 , - ending . length ) ;
592592 }
593593 }
594594 return str ;
595595}
596596
597597function calculate_description ( pkg : PackageKey & PackageNpm ) : string {
598598 const found = FEATURED . flatMap ( ( f ) => f . packages ) . find ( ( p ) => p . name === pkg . name ) ;
599- if ( found && found . description ) return dont_end_by ( found . description , [ '.' ] ) ;
599+ if ( found && found . description ) return remove_ending_by ( found . description , [ '.' ] ) ;
600600
601601 let desc = pkg . npm_description ?? 'NO DESCRIPTION!' ;
602602 const replaces = [
@@ -606,14 +606,20 @@ function calculate_description(pkg: PackageKey & PackageNpm): string {
606606 for ( const { key, value } of replaces ) {
607607 desc = desc . replace ( key , value ) ;
608608 }
609- return dont_end_by ( desc , [ '.' ] ) ;
609+ return remove_ending_by ( desc , [ '.' ] ) ;
610+ }
611+
612+ function calculate_homepage ( pkg : PackageKey & PackageNpm ) : string {
613+ return remove_ending_by ( pkg . homepage ?? '' , [ '#readme' ] ) ;
610614}
611615
612616export const PACKAGES_META = {
613617 FEATURED ,
614618
619+ calculate_description,
620+ calculate_homepage,
621+
615622 is_official,
616623 is_outdated,
617- supports_svelte_versions,
618- calculate_description
624+ supports_svelte_versions
619625} ;
0 commit comments