Files
NapCatQQ/.pnpm-store/v3/files/c0/bf69306ea5f7972db707a665ccdfc15b8ed251047db3fd55345f7e21295c5de0e081ea8865ad280046557a98611f6a628430f2b69a49955687b140c010f159
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

17 lines
436 B
Plaintext

const hexadecimalRegex = /[\dA-Fa-f]/
/**
* Configurable ways to encode characters as hexadecimal references.
*
* @param {number} code
* @param {number} next
* @param {boolean|undefined} omit
* @returns {string}
*/
export function toHexadecimal(code, next, omit) {
const value = '&#x' + code.toString(16).toUpperCase()
return omit && next && !hexadecimalRegex.test(String.fromCharCode(next))
? value
: value + ';'
}