packages/shex-writer/shex-writer.js
// Replaces a character by its escaped version
Replaces a character by its escaped version
Replaces a character by its escaped version
function characterReplacer(character) {
  let result = ESCAPE_replacements[character];
  if (result === undefined) {
    if (character.length === 1) {
      result = character.charCodeAt(0).toString(16);
      result = '\\u0000'.substr(0, 6 - result.length) + result;
    }
    else {
      result = ((character.charCodeAt(0) - 0xD800) * 0x400 +
                 character.charCodeAt(1) + 0x2400).toString(16);
      result = '\\U00000000'.substr(0, 10 - result.length) + result;
    }
  }
  return result;
}
function characterReplacer ( character ) { let result = ESCAPE_replacements [ character ] ; if ( result === undefined ) { if ( character . length === 1 ) { result = character . charCodeAt ( 0 ) . toString ( 16 ) ; result = '\\u0000' . substr ( 0 , 6 - result . length ) + result ; } else { result = ( ( character . charCodeAt ( 0 ) - 0xD800 ) * 0x400 + character . charCodeAt ( 1 ) + 0x2400 ) . toString ( 16 ) ; result = '\\U00000000' . substr ( 0 , 10 - result . length ) + result ; } } return result ; }
Replaces a character by its escaped version
Replaces a character by its escaped version
// Replace a single character by its escaped version // Replace a single character with its 4-bit unicode escape sequence // Replace a surrogate pair with its 8-bit unicode escape sequence