'use strict';

const index = require('../../../character-entities@2.0.2/node_modules/character-entities/index.cjs');

// To do: next major: use `Object.hasOwn`.
const own = {}.hasOwnProperty;

/**
 * Decode a single character reference (without the `&` or `;`).
 * You probably only need this when you’re 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.
 */
function decodeNamedCharacterReference(value) {
  return own.call(index.characterEntities, value) ? index.characterEntities[value] : false
}

exports.decodeNamedCharacterReference = decodeNamedCharacterReference;
