Encode \& decode HTML \& XML entities with ease \& speed.\hypertarget{md_sfcode_node_modules_entities_readme_autotoc_md8744}{}\doxysection{How to…}\label{md_sfcode_node_modules_entities_readme_autotoc_md8744}
\hypertarget{md_sfcode_node_modules_entities_readme_autotoc_md8745}{}\doxysubsection{…install $<$tt$>$entities$<$/tt$>$}\label{md_sfcode_node_modules_entities_readme_autotoc_md8745}
\begin{DoxyVerb}npm install entities
\end{DoxyVerb}
 \hypertarget{md_sfcode_node_modules_entities_readme_autotoc_md8746}{}\doxysubsection{…use $<$tt$>$entities$<$/tt$>$}\label{md_sfcode_node_modules_entities_readme_autotoc_md8746}

\begin{DoxyCode}{0}
\DoxyCodeLine{const entities = require("{}entities"{});}
\DoxyCodeLine{}
\DoxyCodeLine{//encoding}
\DoxyCodeLine{entities.escape("{}\&\#38;"{}); // "{}\&\#x26;\#38;"{}}
\DoxyCodeLine{entities.encodeXML("{}\&\#38;"{}); // "{}\&amp;\#38;"{}}
\DoxyCodeLine{entities.encodeHTML("{}\&\#38;"{}); // "{}\&amp;\&num;38\&semi;"{}}
\DoxyCodeLine{}
\DoxyCodeLine{//decoding}
\DoxyCodeLine{entities.decodeXML("{}asdf \&amp; \&\#xFF; \&\#xFC; \&apos;"{}); // "{}asdf \& ÿ ü '"{}}
\DoxyCodeLine{entities.decodeHTML("{}asdf \&amp; \&yuml; \&uuml; \&apos;"{}); // "{}asdf \& ÿ ü '"{} }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_entities_readme_autotoc_md8747}{}\doxysection{Performance}\label{md_sfcode_node_modules_entities_readme_autotoc_md8747}
This is how {\ttfamily entities} compares to other libraries on a very basic benchmark (see {\ttfamily scripts/benchmark.\+ts}, for 10,000,000 iterations)\+:

\tabulinesep=1mm
\begin{longtabu}spread 0pt [c]{*{4}{|X[-1]}|}
\hline
\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ Library   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\ttfamily decode} performance   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\ttfamily encode} performance   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ Bundle size    }\\\cline{1-4}
\endfirsthead
\hline
\endfoot
\hline
\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ Library   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\ttfamily decode} performance   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ {\ttfamily encode} performance   }&\PBS\centering \cellcolor{\tableheadbgcolor}\textbf{ Bundle size    }\\\cline{1-4}
\endhead
entities   &10.\+809s   &17.\+683s   &    \\\cline{1-4}
html-\/entities   &14.\+029s   &22.\+670s   &    \\\cline{1-4}
he   &16.\+163s   &44.\+010s   &    \\\cline{1-4}
parse-\/entities   &28.\+507s   &N/A   &   \\\cline{1-4}
\end{longtabu}


\DoxyHorRuler{0}


License\+: BSD-\/2-\/\+Clause\hypertarget{md_sfcode_node_modules_entities_readme_autotoc_md8749}{}\doxysection{Security contact information}\label{md_sfcode_node_modules_entities_readme_autotoc_md8749}
To report a security vulnerability, please use the \href{https://tidelift.com/security}{\texttt{ Tidelift security contact}}. Tidelift will coordinate the fix and disclosure.\hypertarget{md_sfcode_node_modules_entities_readme_autotoc_md8750}{}\doxysection{$<$tt$>$entities$<$/tt$>$ for enterprise}\label{md_sfcode_node_modules_entities_readme_autotoc_md8750}
Available as part of the Tidelift Subscription

The maintainers of {\ttfamily entities} and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. \href{https://tidelift.com/subscription/pkg/npm-entities?utm_source=npm-entities&utm_medium=referral&utm_campaign=enterprise&utm_term=repo}{\texttt{ Learn more.}} 