unescapeHtml.js 409 B

123456789101112131415161718
  1. var toString = require('../lang/toString');
  2. /**
  3. * Unescapes HTML special chars
  4. */
  5. function unescapeHtml(str){
  6. str = toString(str)
  7. .replace(/&/g , '&')
  8. .replace(/&lt;/g , '<')
  9. .replace(/&gt;/g , '>')
  10. .replace(/&#0*39;/g , "'")
  11. .replace(/&quot;/g, '"');
  12. return str;
  13. }
  14. module.exports = unescapeHtml;