Skip to content

Commit 60a85f1

Browse files
committed
fixed lints
1 parent 956154c commit 60a85f1

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

index.ts

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -813,35 +813,36 @@ TEST: addTests('isRepositoryActions', [
813813
]);
814814

815815
const 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+
};
823+
822824
TEST: addTests('isStars', [
823825
'https://github.com/stars',
824826
'https://github.com/stars/lstn',
825827
'https://github.com/stars/lstn/repositories',
826828
'https://github.com/stars/lstn/topics',
827-
'https://github.com/stars/lstn/lists/test'
829+
'https://github.com/stars/lstn/lists/test',
828830
]);
829831

830832
export 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-
);
833+
isStars(url)
834+
&& [['stars'], ['stars', getLoggedInUser()]].some(
835+
(needle => pathArray => pathArray.length === needle.length
836+
&& pathArray.every((v, i) => v === needle[i]))(getCleanPathname(url).split('/').slice(0, 2)),
837+
);
836838

837839
export const isStarsList = (url: URL | HTMLAnchorElement | Location = location): boolean => isStars(url) && getCleanPathname(url).split('/')[2] === 'lists';
838840
TEST: addTests('isStarsList', [
839-
'https://github.com/stars/lstn/lists/test'
841+
'https://github.com/stars/lstn/lists/test',
840842
]);
841843

842844
export const isOwnStarsList = (url: URL | HTMLAnchorElement | Location = location): boolean => isOwnStars(url) && getCleanPathname(url).split('/')[2] === 'lists';
843845

844-
845846
export const isUserTheOrganizationOwner = (): boolean => isOrganizationProfile() && exists('[aria-label="Organization"] [data-tab-item="org-header-settings-tab"]');
846847

847848
export const canUserAdminRepo = (): boolean => isRepo() && exists('.reponav-item[href$="/settings"], [data-tab-item$="settings-tab"]');

0 commit comments

Comments
 (0)