Skip to content

Commit

Permalink
fix: removed anchor creating (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
KostaD02 authored Jan 2, 2024
1 parent e1335b8 commit 6602011
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions src/modules/echo/echo.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class EchoService {
.elements h4,
.elements p {
margin: 0px;
line-break: anywhere;
}
h5, h6 {
text-align: center;
Expand All @@ -48,18 +49,8 @@ export class EchoService {
.map(
(e, i) => `
<div class="elements">
<h4>${array[i][0].toUpperCase() + array[i].slice(1)} : </h4>
<p>
${
/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/.test(
body[array[i]],
)
? `<a href="${this.appendHTTP(
body[array[i]],
)}" target="_blank">${body[array[i]]}</a>`
: body[array[i]]
}
</p>
<h4>${array[i]} : </h4>
<p>${body[array[i]]}</p>
</div>
`,
)
Expand Down Expand Up @@ -88,8 +79,4 @@ export class EchoService {
return acc;
}, {});
}

appendHTTP(link: string) {
return /^(http|https):\/\//.test(link) ? link : `https://${link}`;
}
}

0 comments on commit 6602011

Please sign in to comment.