UNPKG

@empathyco/x-components

Version:
15 lines (13 loc) 375 B
const REPLACE_REGEX = /[<>&]/g; /** * Sanitize characters from a given string. * * @param str - The string to remove unwanted characters. * @returns The string without the unwanted characters. * @public */ const sanitize = (str) => { return str.replace(REPLACE_REGEX, key => `&#${key.charCodeAt(0)};`); }; export { sanitize }; //# sourceMappingURL=sanitize.js.map