chore: lint related changes and packaging fixes (#6163)
* fix: lint related changes and packaging fixes * adding color validations
This commit is contained in:
parent
b1c340b199
commit
4b5a2bc4e5
71 changed files with 1025 additions and 896 deletions
15
packages/utils/src/string.ts
Normal file
15
packages/utils/src/string.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
import DOMPurify from "isomorphic-dompurify";
|
||||
|
||||
/**
|
||||
* @description: This function will remove all the HTML tags from the string
|
||||
* @param {string} html
|
||||
* @return {string}
|
||||
* @example:
|
||||
* const html = "<p>Some text</p>";
|
||||
* const text = stripHTML(html);
|
||||
* console.log(text); // Some text
|
||||
*/
|
||||
export const sanitizeHTML = (htmlString: string) => {
|
||||
const sanitizedText = DOMPurify.sanitize(htmlString, { ALLOWED_TAGS: [] }); // sanitize the string to remove all HTML tags
|
||||
return sanitizedText.trim(); // trim the string to remove leading and trailing whitespaces
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue