UNPKG

@faire/mjml-react

Version:

React component library to generate the HTML emails on the fly

17 lines (16 loc) 625 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.namedEntityToHexCode = namedEntityToHexCode; const html_entities_json_1 = __importDefault(require("./html-entities.json")); function namedEntityToHexCode(html) { return html.replace(/&([a-z0-9]{2,8});/gi, (match, p1) => { const anyEntities = html_entities_json_1.default; if (anyEntities[p1]) { return `&#${anyEntities[p1]};`; } return match; }); }