From 92dee097c6a99d47f06c03c8a9c10b83c68d5b81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20Unneb=C3=A4ck?= Date: Sun, 16 Jan 2022 16:08:23 +0100 Subject: [PATCH] Simplify check in isDomainOrSubdomain (#1455) --- src/utils/is.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/utils/is.js b/src/utils/is.js index 876ab47..00eb89b 100644 --- a/src/utils/is.js +++ b/src/utils/is.js @@ -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}`); };