@cloakui/utils
Version:
Shared utilities for all CloakUI component packages.
8 lines (7 loc) • 337 B
JavaScript
// Strips HTML Tags from a string, which is helpful in certain cases such as when a headless CMS passes HTML over its API rather than raw text
export function stripHtml(htmlString) {
if (typeof htmlString == "string") {
return htmlString?.replace(/<[^>]*>?/gm, "")?.replaceAll("’", "'");
}
return htmlString;
}