CoolFace
Apppublic

AK-21/Graphite-Industrial-Intelligence

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
to-hexadecimal.js17 linesDownload Raw Back to util
1const hexadecimalRegex = /[\dA-Fa-f]/2 3/**4 * Configurable ways to encode characters as hexadecimal references.5 *6 * @param {number} code7 * @param {number} next8 * @param {boolean|undefined} omit9 * @returns {string}10 */11export function toHexadecimal(code, next, omit) {12  const value = '&#x' + code.toString(16).toUpperCase()13  return omit && next && !hexadecimalRegex.test(String.fromCharCode(next))14    ? value15    : value + ';'16}17