You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

15 lines
282 B

var escape = module.exports = function escape(string) {
return string.replace(/([&"<>'])/g, function(str, item) {
return escape.map[item];
})
}
var map = escape.map = {
'>': '&gt;'
, '<': '&lt;'
, "'": '&apos;'
, '"': '&quot;'
, '&': '&amp;'
}