astro-ghostcms/.pnpm-store/v3/files/f9/2aae8c7358d37d1e92f9a1b7a25...

15 lines
357 B
Plaintext

/**
* 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 && !/\d/.test(String.fromCharCode(next))
? value
: value + ';'
}