1
0
mirror of https://github.com/uetchy/namae.git synced 2025-03-17 12:30:32 +09:00

fix: not to match exact tld

This commit is contained in:
uetchy 2020-02-09 09:07:28 +09:00
parent df998838f0
commit 73f39dd615

View File

@ -10,11 +10,13 @@ const DomainCard: React.FC<{query: string}> = ({query}) => {
const lowerCase = query.toLowerCase(); const lowerCase = query.toLowerCase();
const domainHackSuggestions = zones const domainHackSuggestions = zones
.map((zone) => new RegExp(`${zone}$`).exec(lowerCase)) .map((zone) => new RegExp(`${zone}$`).exec(lowerCase.slice(1)))
.filter((s): s is RegExpExecArray => s !== null) .filter((s): s is RegExpExecArray => s !== null)
.map( .map(
(m) => (m) =>
lowerCase.substring(0, m.index) + '.' + lowerCase.substring(m.index), lowerCase.substring(0, m.index + 1) +
'.' +
lowerCase.substring(m.index + 1),
); );
const names = [ const names = [