Skip to content

Commit

Permalink
Remove types from JSDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamWr committed Feb 20, 2024
1 parent a478c30 commit db038c2
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/scriptlets/href-sanitizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,18 @@ export function hrefSanitizer(
/**
* Extracts text from an element based on the specified attribute.
*
* @param {HTMLAnchorElement} anchor - The element from which to extract the text.
* @param {string} attr - The attribute indicating how to extract the text.
* @returns {string} The extracted text.
* @param anchor The element from which to extract the text.
* @param attr The attribute indicating how to extract the text.
* @returns The extracted text.
*/
const extractNewHref = (anchor: HTMLAnchorElement, attr: string): string => {
if (attr === 'text') {
if (!anchor.textContent) {
return '';
}
return anchor.textContent
? anchor.textContent.replace(regexpNotValidAtStart, '')
.replace(regexpNotValidAtEnd, '')
: '';
.replace(regexpNotValidAtStart, '')
.replace(regexpNotValidAtEnd, '');
}
if (attr.startsWith('?')) {
try {
Expand All @@ -146,8 +148,8 @@ export function hrefSanitizer(
* Validates a URL, if valid return URL,
* otherwise return null.
*
* @param {string} text - The URL to be validated
* @returns {string} - URL for valid URL, otherwise null.
* @param text The URL to be validated
* @returns URL for valid URL, otherwise null.
*/
const getValidURL = (text: string): string | null => {
if (!text) {
Expand All @@ -164,7 +166,7 @@ export function hrefSanitizer(
/**
* Sanitizes the href attribute of elements matching the given selector.
*
* @param {string} elem - The CSS selector to match the elements.
* @param elem The CSS selector to match the elements.
* @returns {void}
*/
const sanitize = (elem: string) => {
Expand Down

0 comments on commit db038c2

Please sign in to comment.