-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
da322d0
commit 82190f9
Showing
3 changed files
with
24 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
const HASH_PATTERN = /^#.*/ | ||
const isHashLink = (href: string): boolean => HASH_PATTERN.test(href) | ||
|
||
export const isExternal = (href: string): boolean => | ||
href.includes("http") || href.includes("mailto:") | ||
|
||
export const isHash = (href: string): boolean => isHashLink(href) | ||
|
||
export const isGlossary = (href: string): boolean => | ||
href.includes("glossary") && href.includes("#") | ||
|
||
export const isStatic = (href: string): boolean => href.includes("static") | ||
|
||
export const isPdf = (href: string): boolean => href.includes(".pdf") |