Node.js examples for String:Escape
Add escape for string
String.prototype.escape = function () { var entityMap = { "&": "&", "<": "<", ">": ">", '"': '"', "'": ''' };/*ww w .ja v a 2s . c o m*/ return this.replace(/[&<>"']/g, function (s) { return entityMap[s]; }); };