Skip to content

Instantly share code, notes, and snippets.

@nguyentuan1696
Created November 26, 2021 05:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nguyentuan1696/972b71fc0716089dd3dc5f3a69e13ded to your computer and use it in GitHub Desktop.
Save nguyentuan1696/972b71fc0716089dd3dc5f3a69e13ded to your computer and use it in GitHub Desktop.
Check is external url
export function hasProtocol(url) {
return /^(\w*:|\/\/)/.test(url) === true
}
export default function isInternalUrl(url) {
return typeof url !== 'undefined' && !hasProtocol(url)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment