stringzy
Version:
A versatile string manipulation library providing a range of text utilities for JavaScript and Node.js applications.
15 lines (14 loc) • 349 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.escapeHtml = escapeHtml;
function escapeHtml(str) {
const htmlEscapes = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": '''
};
return str.replace(/[&<>"']/g, (match) => htmlEscapes[match]);
}
;