UNPKG

451 BJavaScriptView Raw
1/** Used to map characters to HTML entities. */
2var htmlEscapes = {
3 '&': '&',
4 '<': '&lt;',
5 '>': '&gt;',
6 '"': '&quot;',
7 "'": '&#39;',
8 '`': '&#96;'
9};
10
11/**
12 * Used by `_.escape` to convert characters to HTML entities.
13 *
14 * @private
15 * @param {string} chr The matched character to escape.
16 * @returns {string} Returns the escaped character.
17 */
18function escapeHtmlChar(chr) {
19 return htmlEscapes[chr];
20}
21
22export default escapeHtmlChar;