Last active
January 16, 2020 17:25
-
-
Save pinkhominid/903d3f9d33ca16d25e06eeb04f1700a9 to your computer and use it in GitHub Desktop.
areUrlsEqual()
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
// Handles root path slash and casing diffs correctly. For example: | |
// areUrlsEqual('http://example.com', 'http://Example.com/') => true | |
export default function areUrlsEqual(url1, url2) { | |
const u1 = new URL(url1); | |
const u2 = new URL(url2); | |
return u1.toString() === u2.toString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment