This repository has been archived on 2026-03-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
openclaw-extensions/wecom/node_modules/linkedom/esm/shared/text-escaper.js
T

23 lines
500 B
JavaScript

const {replace} = '';
// escape
const ca = /[<>&\xA0]/g;
const esca = {
'\xA0': '&#160;',
'&': '&amp;',
'<': '&lt;',
'>': '&gt;'
};
const pe = m => esca[m];
/**
* Safely escape HTML entities such as `&`, `<`, `>` only.
* @param {string} es the input to safely escape
* @returns {string} the escaped input, and it **throws** an error if
* the input type is unexpected, except for boolean and numbers,
* converted as string.
*/
export const escape = es => replace.call(es, ca, pe);