import { encode } from 'html-entities'; /** * @name encodeEntities * @namespace shared.html * @type Function * @platform js * @platform node * @status stable * * This function allows you to encode some entities in a string like "<" to "<" * It supports all the * * @param {String} html The html to unescape * @return {String} The unescaped html * * @snippet __encodeEntities($1) * * @todo tests * * @example js * import { __encodeEntities } from '@lotsof/sugar/html'; * __encodeEntities(''); // => <s-code-example> * * @see https://www.npmjs.com/package/escape-html * @since 1.0.0 * @author Olivier Bossel (https://lotsof.dev) */ export default function _encodeEntities(html: string): string { // @ts-ignore return encode(html, { mode: 'extensive', }); }