Skip to content

Commit

Permalink
Simplify check in isDomainOrSubdomain (#1455)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinusU committed Jan 16, 2022
1 parent 36e47e8 commit 92dee09
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/utils/is.js
Expand Up @@ -69,7 +69,5 @@ export const isDomainOrSubdomain = (destination, original) => {
const orig = new URL(original).hostname;
const dest = new URL(destination).hostname;

return orig === dest || (
orig[orig.length - dest.length - 1] === '.' && orig.endsWith(dest)
);
return orig === dest || orig.endsWith(`.${dest}`);
};

0 comments on commit 92dee09

Please sign in to comment.