\begin{quote}
Parse yes/no like values \end{quote}
Useful for validating answers of a CLI prompt.

\DoxyHorRuler{0}


The following case-\/insensitive values are recognized\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{'y', 'yes', 'true', true, '1', 1, 'n', 'no', 'false', false, '0', 0 }

\end{DoxyCode}


{\itshape Enable lenient mode to gracefully handle typos.}\hypertarget{md_sfcode_node_modules_yn_readme_autotoc_md34785}{}\doxysection{Install}\label{md_sfcode_node_modules_yn_readme_autotoc_md34785}

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

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

\begin{DoxyCode}{0}
\DoxyCodeLine{const yn = require('yn');}
\DoxyCodeLine{}
\DoxyCodeLine{yn('y');}
\DoxyCodeLine{//=> true}
\DoxyCodeLine{}
\DoxyCodeLine{yn('NO');}
\DoxyCodeLine{//=> false}
\DoxyCodeLine{}
\DoxyCodeLine{yn(true);}
\DoxyCodeLine{//=> true}
\DoxyCodeLine{}
\DoxyCodeLine{yn('abomasum');}
\DoxyCodeLine{//=> null}
\DoxyCodeLine{}
\DoxyCodeLine{yn('abomasum', \{default: false\});}
\DoxyCodeLine{//=> false}
\DoxyCodeLine{}
\DoxyCodeLine{yn('mo', \{lenient: true\});}
\DoxyCodeLine{//=> false }

\end{DoxyCode}


Unrecognized values return {\ttfamily null}.\hypertarget{md_sfcode_node_modules_yn_readme_autotoc_md34787}{}\doxysection{API}\label{md_sfcode_node_modules_yn_readme_autotoc_md34787}
\hypertarget{md_sfcode_node_modules_yn_readme_autotoc_md34788}{}\doxysubsection{yn(input, \mbox{[}options\mbox{]})}\label{md_sfcode_node_modules_yn_readme_autotoc_md34788}
\hypertarget{md_sfcode_node_modules_yn_readme_autotoc_md34789}{}\doxysubsubsection{input}\label{md_sfcode_node_modules_yn_readme_autotoc_md34789}
Type\+: {\ttfamily any}

Value that should be converted.\hypertarget{md_sfcode_node_modules_yn_readme_autotoc_md34790}{}\doxysubsubsection{options}\label{md_sfcode_node_modules_yn_readme_autotoc_md34790}
Type\+: {\ttfamily Object}\hypertarget{md_sfcode_node_modules_yn_readme_autotoc_md34791}{}\doxyparagraph{lenient}\label{md_sfcode_node_modules_yn_readme_autotoc_md34791}
Type\+: {\ttfamily boolean}~\newline
 Default\+: {\ttfamily false}

Use a key distance-\/based score to leniently accept typos of {\ttfamily yes} and {\ttfamily no}.\hypertarget{md_sfcode_node_modules_yn_readme_autotoc_md34792}{}\doxyparagraph{default}\label{md_sfcode_node_modules_yn_readme_autotoc_md34792}
Type\+: {\ttfamily boolean}~\newline
 Default\+: {\ttfamily null}

Default value if no match was found.\hypertarget{md_sfcode_node_modules_yn_readme_autotoc_md34793}{}\doxysection{License}\label{md_sfcode_node_modules_yn_readme_autotoc_md34793}
MIT © \href{https://sindresorhus.com}{\texttt{ Sindre Sorhus}} 