Created
October 27, 2020 03:04
-
-
Save whizkydee/6fd8e08b53f8dcdcf750d883fe4448c1 to your computer and use it in GitHub Desktop.
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
export function isWithinOrigin(url: any, origin: string) { | |
try { | |
const {origin: derivedOrigin} = new URL(url); | |
if (derivedOrigin === origin) { | |
return true; | |
} | |
return false; | |
} catch { | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment