Skip to content

Commit

Permalink
add validPortfolioUrl util function to utils
Browse files Browse the repository at this point in the history
  • Loading branch information
TishG committed Dec 25, 2021
1 parent 8af0d16 commit 0208bdb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/libraries/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Our CMS does not validate urls,
// urls are entered in manually by the author,
// so this is to ensure a valid url to navigate to
const validPortfolioUrl = (url = "") => {
const https = "https://";

if (url.includes(https) || url.includes("http:https://")) {
return url;
}
return https + url;
};

0 comments on commit 0208bdb

Please sign in to comment.