Created
August 4, 2021 22:03
-
-
Save bradyclifford/02717b46a5445340a8a1db12bea8578b to your computer and use it in GitHub Desktop.
Javascript Utils
This file contains hidden or 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
const getDomainWithoutSubdomain = hostname => { | |
const parts = hostname.split('.') | |
return parts | |
.slice(0) | |
.slice(-(parts.length === 4 ? 3 : 2)) | |
.join('.') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment