html-dom-parser
Version:
HTML to DOM parser.
45 lines (44 loc) • 976 B
JavaScript
//#region node_modules/entities/dist/decode-codepoint.js
const decodeMap = /* @__PURE__ */ new Map([
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[],
[]
]);
/**
* Replace the given code point with a replacement character if it is a
* surrogate or is outside the valid range. Otherwise return the code
* point unchanged.
* @param codePoint Unicode code point to convert.
*/
function replaceCodePoint(codePoint) {
if (codePoint >= 55296 && codePoint <= 57343 || codePoint > 1114111) return 65533;
return decodeMap.get(codePoint) ?? codePoint;
}
//#endregion
exports.replaceCodePoint = replaceCodePoint;
//# sourceMappingURL=decode-codepoint.js.map