nodescore/node_modules/errorhandler/node_modules/escape-html/index.js

17 lines
329 B
JavaScript
Executable File

/**
* Escape special characters in the given string of html.
*
* @param {String} html
* @return {String}
* @api private
*/
module.exports = function(html) {
return String(html)
.replace(/&/g, '&')
.replace(/"/g, '"')
.replace(/'/g, ''')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
}