@@ -813,30 +813,31 @@ TEST: addTests('isRepositoryActions', [
813813] ) ;
814814
815815const isStars = ( url : URL | HTMLAnchorElement | Location = location ) : boolean => {
816- const patharr = getCleanPathname ( url ) . split ( '/' ) , [ stars , user , subpath , ...extra ] = patharr ;
817- return stars === 'stars'
818- && ( [ 1 , 2 , 4 ] . includes ( patharr . length )
819- || ( subpath === 'lists' && patharr . length !== 3 )
820- || ( [ 'repositories' , 'topics' ] . includes ( subpath ) && patharr . length == 3 ) ) ;
821- }
816+ const patharr = getCleanPathname ( url ) . split ( '/' ) ;
817+ const [ stars , user , subpath , ...extra ] = patharr ;
818+ return stars === 'stars'
819+ && ( [ 1 , 2 , 4 ] . includes ( patharr . length )
820+ || ( subpath === 'lists' && patharr . length !== 3 )
821+ || ( [ 'repositories' , 'topics' ] . includes ( subpath ) && patharr . length === 3 ) ) ;
822+ } ;
822823TEST: addTests ( 'isStars' , [
823824 'https://github.com/stars' ,
824825 'https://github.com/stars/lstn' ,
825826 'https://github.com/stars/lstn/repositories' ,
826827 'https://github.com/stars/lstn/topics' ,
827- 'https://github.com/stars/lstn/lists/test'
828+ 'https://github.com/stars/lstn/lists/test' ,
828829] ) ;
829830
830831export const isOwnStars = ( url : URL | HTMLAnchorElement | Location = location ) : boolean =>
831- isStars ( url )
832- && [ [ 'stars' ] , [ 'stars' , getLoggedInUser ( ) ] ] . some (
833- ( needle => arr => arr . length === needle . length
834- && arr . every ( ( v , i ) => v === needle [ i ] ) ) ( getCleanPathname ( url ) . split ( '/' ) . slice ( 0 , 2 ) )
835- ) ;
832+ isStars ( url )
833+ && [ [ 'stars' ] , [ 'stars' , getLoggedInUser ( ) ] ] . some (
834+ ( needle => arr => arr . length === needle . length
835+ && arr . every ( ( v , i ) => v === needle [ i ] ) ) ( getCleanPathname ( url ) . split ( '/' ) . slice ( 0 , 2 ) )
836+ ) ;
836837
837838export const isStarsList = ( url : URL | HTMLAnchorElement | Location = location ) : boolean => isStars ( url ) && getCleanPathname ( url ) . split ( '/' ) [ 2 ] === 'lists' ;
838839TEST: addTests ( 'isStarsList' , [
839- 'https://github.com/stars/lstn/lists/test'
840+ 'https://github.com/stars/lstn/lists/test' ,
840841] ) ;
841842
842843export const isOwnStarsList = ( url : URL | HTMLAnchorElement | Location = location ) : boolean => isOwnStars ( url ) && getCleanPathname ( url ) . split ( '/' ) [ 2 ] === 'lists' ;
0 commit comments