epubinator
Version:
NPM package to generate epub files out of url
24 lines (21 loc) • 436 B
text/typescript
/**
* stripNbsp
*
* @param {string} html
* @returns {string}
*/
function stripNbsp(html: string): string {
const nbspRegex = / /gi
return html.replace(nbspRegex, ' ')
}
/**
* stripSpan
*
* @param {string} html
* @returns {string}
*/
function stripHtmlAttributes(html: string): string {
const spanRegex = /<\s*[^>]*>|<\/\s*[^>]*>/gi
return html.replace(spanRegex, '')
}
export { stripNbsp, stripHtmlAttributes }