const escapeCodes = { '&': '&', '<': '<', '>': '>', "'": ''', '"': '"' }; let format = {}; format.escape = function (str) { return str.replaceAll( /[&<>'"]/g, tag => escapeCodes[tag] ) }; export default format;