unescapeHtmlChar.js 467 B

12345678910111213141516171819202122
  1. /** Used to map HTML entities to characters. */
  2. var htmlUnescapes = {
  3. '&': '&',
  4. '&lt;': '<',
  5. '&gt;': '>',
  6. '&quot;': '"',
  7. '&#39;': "'",
  8. '&#96;': '`'
  9. };
  10. /**
  11. * Used by `_.unescape` to convert HTML entities to characters.
  12. *
  13. * @private
  14. * @param {string} chr The matched character to unescape.
  15. * @returns {string} Returns the unescaped character.
  16. */
  17. function unescapeHtmlChar(chr) {
  18. return htmlUnescapes[chr];
  19. }
  20. module.exports = unescapeHtmlChar;