lib/stringify.js
/**
 * Replacer for `escapeRegex` that escapes unsafe characters
 * @param {string} char - Character to escape
 * @returns {string} Escaped character string
 */
Replacer for `escapeRegex` that escapes unsafe characters
@param {string} char - Character to escape
@returns {string} Escaped character string
Replacer for ` escapeRegex ` that escapes unsafe characters @param { string } char - Character to escape @returns { string } Escaped character string
function escapeReplacer(char) {
  var escaped = '\\';
  if (hasOwnProperty(escapeChars, char)) {
    escaped += escapeChars[char];
  } else {
    var code = char.charCodeAt();
    var codeHex = (code + 65536).toString(16); 
    var codeUnicode = code > 126;
    escaped += (codeUnicode ? 'u' : 'x') + codeHex.substr(codeUnicode ? -4 : -2);
  }
  return escaped;
}
function escapeReplacer ( char ) { var escaped = '\\' ; if ( hasOwnProperty ( escapeChars , char ) ) { escaped += escapeChars [ char ] ; } else { var code = char . charCodeAt ( ) ; var codeHex = ( code + 65536 ) . toString ( 16 ) ; var codeUnicode = code > 126 ; escaped += ( codeUnicode ? 'u' : 'x' ) + codeHex . substr ( codeUnicode ? - 4 : - 2 ) ; } return escaped ; }
Replacer for `escapeRegex` that escapes unsafe characters
 @param {string} char - Character to escape
 @returns {string} Escaped character string
Replacer for ` escapeRegex ` that escapes unsafe characters @param { string } char - Character to escape @returns { string } Escaped character string
// Add 0x10000 for zero-padding