123456789101112131415161718 |
- var toString = require('../lang/toString');
- /**
- * Escapes a string for insertion into HTML.
- */
- function escapeHtml(str){
- str = toString(str)
- .replace(/&/g, '&')
- .replace(/</g, '<')
- .replace(/>/g, '>')
- .replace(/'/g, ''')
- .replace(/"/g, '"');
- return str;
- }
- module.exports = escapeHtml;
|