File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -661,6 +661,16 @@ TEST: addTests('isGistRevision', [
661661 'https://gist.github.com/kidonng/0d16c7f17045f486751fad1b602204a0/revisions' ,
662662] ) ;
663663
664+ export const isGistFile = ( url : URL | HTMLAnchorElement | Location = location ) : boolean => {
665+ const pathname = getCleanGistPathname ( url ) ;
666+ return pathname ?. replace ( / [ ^ / ] / g, '' ) . length === 1 ;
667+ } ;
668+
669+ TEST: addTests ( 'isGistFile' , [
670+ 'https://gist.github.com/fregante/2205329b71218fa2c1d3' ,
671+ 'https://gist.github.com/sindresorhus/0ea3c2845718a0a0f0beb579ff14f064' ,
672+ ] ) ;
673+
664674export const isTrending = ( url : URL | HTMLAnchorElement | Location = location ) : boolean => url . pathname === '/trending' || url . pathname . startsWith ( '/trending/' ) ;
665675TEST: addTests ( 'isTrending' , [
666676 'https://github.com/trending' ,
You can’t perform that action at this time.
0 commit comments