GitHub 6248★

Strip HTML from a given text

JavaScript version

const stripHtml = (html) => new DOMParser().parseFromString(html, 'text/html').body.textContent || '';

TypeScript version

const stripHtml = (html: string): string => new DOMParser().parseFromString(html, 'text/html').body.textContent || '';
Follow me on and to get more useful contents.