/** * HTML·태그·엔티티를 제외한 보이는 텍스트(글자 수 제한용) * — sanitize-html 없이 사용해 서버 기동 시 모듈 누락으로 전체 앱이 죽는 것을 막습니다. * @param {string} html * @returns {string} */ function stripForCount(html) { if (!html) return ""; return String(html) .replace(//gi, " ") .replace(//gi, " ") .replace(/<[^>]+>/g, " ") .replace(/ /g, " ") .replace(/&#[0-9]+;/g, " ") .replace(/&[a-zA-Z0-9]+;/g, " ") .replace(/\s+/g, " ") .trim(); } module.exports = { stripForCount };