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

17 lines
392 B
Plaintext

const decimalRegex = /\d/
/**
* Configurable ways to encode characters as decimal references.
*
* @param {number} code
* @param {number} next
* @param {boolean|undefined} omit
* @returns {string}
*/
export function toDecimal(code, next, omit) {
const value = '&#' + String(code)
return omit && next && !decimalRegex.test(String.fromCharCode(next))
? value
: value + ';'
}