Skip to content

Commit

Permalink
Simply implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave committed May 26, 2023
1 parent 59c507f commit 4840dd1
Showing 1 changed file with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,10 @@ export default function isURLLike( val ) {
const mayBeTLD = hasPossibleTLD( val );

const isWWW = val?.startsWith( 'www.' );
const isHTTPProtocol = /^(http|https)/.test( val ) && protocolIsValid;
const isMailTo = val?.startsWith( 'mailto:' ) && protocolIsValid;
const isTel = val?.startsWith( 'tel:' ) && protocolIsValid;

const isInternal = val?.startsWith( '#' ) && isValidFragment( val );

return (
isHTTPProtocol || isWWW || isMailTo || isTel || isInternal || mayBeTLD
);
return protocolIsValid || isWWW || isInternal || mayBeTLD;
}

/**
Expand Down

0 comments on commit 4840dd1

Please sign in to comment.