\href{https://www.npmjs.com/package/levenary}{\texttt{ }} \href{https://github.com/tanhauhau/levenary/actions}{\texttt{ }}

\begin{quote}
Given a string, A and an array of strings XS, return the string X from XS whose Levenshtein distance from A is minimal. \end{quote}
\hypertarget{md_sfcode_node_modules_levenary_README_autotoc_md16000}{}\doxysection{Install}\label{md_sfcode_node_modules_levenary_README_autotoc_md16000}

\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install levenary }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_levenary_README_autotoc_md16001}{}\doxysection{Usage}\label{md_sfcode_node_modules_levenary_README_autotoc_md16001}

\begin{DoxyCode}{0}
\DoxyCodeLine{import levenary from 'levenary';}
\DoxyCodeLine{}
\DoxyCodeLine{levenary('cat', ['cow', 'dog', 'pig']);}
\DoxyCodeLine{//=> 'cow' }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_levenary_README_autotoc_md16002}{}\doxysection{Why $<$tt$>$levenary$<$/tt$>$?}\label{md_sfcode_node_modules_levenary_README_autotoc_md16002}

\begin{DoxyEnumerate}
\item Based on \href{https://github.com/sindresorhus/leven}{\texttt{ leven}}, the fastest JS implementation of the \href{https://en.wikipedia.org/wiki/Levenshtein_distance}{\texttt{ Levenshtein distance algorithm}}
\end{DoxyEnumerate}
\begin{DoxyEnumerate}
\item Only 1 API. Simple and clean. If you want more, please use \href{https://www.npmjs.com/package/didyoumean2}{\texttt{ didyoumean2}}.
\end{DoxyEnumerate}
\begin{DoxyEnumerate}
\item \href{http://flow.org/}{\texttt{ Flow}} and \href{http://typescriptlang.org/}{\texttt{ Type\+Script}} support.
\end{DoxyEnumerate}\hypertarget{md_sfcode_node_modules_levenary_README_autotoc_md16003}{}\doxysection{Benchmark}\label{md_sfcode_node_modules_levenary_README_autotoc_md16003}

\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm run bench }

\end{DoxyCode}



\begin{DoxyCode}{0}
\DoxyCodeLine{311,915 op/s » levenary}
\DoxyCodeLine{ 74,030 op/s » didyoumean}
\DoxyCodeLine{141,423 op/s » didyoumean2 }

\end{DoxyCode}
 