UNPKG

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
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.escapeHtml = escapeHtml; function escapeHtml(str) { const htmlEscapes = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }; return str.replace(/[&<>"']/g, (match) => htmlEscapes[match]); } ;