Urara-Blog/node_modules/.pnpm-store/v3/files/40/408dac19b880603759e7f22c3a82df814d93e124246db1512f0911f98f91faf51a33f7d7dbdd5480a3806c0298ceec1ccb2e4f6fbb9514f21aa016a756d456
2022-08-14 01:14:53 +08:00

18 lines
591 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import {characterEntities} from 'character-entities'
const own = {}.hasOwnProperty
/**
* Decode a single character reference (without the `&` or `;`).
* You probably only need this when youre building parsers yourself that follow
* different rules compared to HTML.
* This is optimized to be tiny in browsers.
*
* @param {string} value
* `notin` (named), `#123` (deci), `#x123` (hexa).
* @returns {string|false}
* Decoded reference.
*/
export function decodeNamedCharacterReference(value) {
return own.call(characterEntities, value) ? characterEntities[value] : false
}