Consolidate escape and unescape modules.

This commit is contained in:
John-David Dalton
2017-01-10 17:09:40 -08:00
parent fc1a360212
commit c5d4bb8dcb
4 changed files with 20 additions and 46 deletions

View File

@@ -1,21 +0,0 @@
import basePropertyOf from './.internal/basePropertyOf.js';
/** Used to map characters to HTML entities. */
const htmlEscapes = {
'&': '&',
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
"'": '&#39;'
};
/**
* Used by `escape` to convert characters to HTML entities.
*
* @private
* @param {string} chr The matched character to escape.
* @returns {string} Returns the escaped character.
*/
const escapeHtmlChar = basePropertyOf(htmlEscapes);
export default escapeHtmlChar;

View File

@@ -1,21 +0,0 @@
import basePropertyOf from './.internal/basePropertyOf.js';
/** Used to map HTML entities to characters. */
const htmlUnescapes = {
'&amp;': '&',
'&lt;': '<',
'&gt;': '>',
'&quot;': '"',
'&#39;': "'"
};
/**
* Used by `unescape` to convert HTML entities to characters.
*
* @private
* @param {string} chr The matched character to unescape.
* @returns {string} Returns the unescaped character.
*/
const unescapeHtmlChar = basePropertyOf(htmlUnescapes);
export default unescapeHtmlChar;