term-notify-server/notifysrv/utils/string.js

14 lines
279 B
JavaScript
Raw Normal View History

2016-02-11 16:16:42 +00:00
module.exports = {
encodeHtml: function ( str, br )
{
str = ( str + "" ).replace(/&/g, "&")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&apos;")
;
if( br ) str = str.replace( /\n/g, "<br/>" );
return str;
}
}