parse argument options

This module is the guts of optimist\textquotesingle{}s argument parser without all the fanciful decoration.\hypertarget{md_sfcode_node_modules_minimist_readme_autotoc_md17617}{}\doxysection{example}\label{md_sfcode_node_modules_minimist_readme_autotoc_md17617}

\begin{DoxyCode}{0}
\DoxyCodeLine{var argv = require('minimist')(process.argv.slice(2));}
\DoxyCodeLine{console.log(argv); }

\end{DoxyCode}



\begin{DoxyCode}{0}
\DoxyCodeLine{\$ node example/parse.js -\/a beep -\/b boop}
\DoxyCodeLine{\{ \_: [], a: 'beep', b: 'boop' \} }

\end{DoxyCode}



\begin{DoxyCode}{0}
\DoxyCodeLine{\$ node example/parse.js -\/x 3 -\/y 4 -\/n5 -\/abc -\/-\/beep=boop foo bar baz}
\DoxyCodeLine{\{ \_: [ 'foo', 'bar', 'baz' ],}
\DoxyCodeLine{  x: 3,}
\DoxyCodeLine{  y: 4,}
\DoxyCodeLine{  n: 5,}
\DoxyCodeLine{  a: true,}
\DoxyCodeLine{  b: true,}
\DoxyCodeLine{  c: true,}
\DoxyCodeLine{  beep: 'boop' \} }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_minimist_readme_autotoc_md17618}{}\doxysection{security}\label{md_sfcode_node_modules_minimist_readme_autotoc_md17618}
Previous versions had a prototype pollution bug that could cause privilege escalation in some circumstances when handling untrusted user input.

Please use version 1.\+2.\+3 or later\+: \href{https://snyk.io/vuln/SNYK-JS-MINIMIST-559764}{\texttt{ https\+://snyk.\+io/vuln/\+SNYK-\/\+JS-\/\+MINIMIST-\/559764}}\hypertarget{md_sfcode_node_modules_minimist_readme_autotoc_md17619}{}\doxysection{methods}\label{md_sfcode_node_modules_minimist_readme_autotoc_md17619}

\begin{DoxyCode}{0}
\DoxyCodeLine{var parseArgs = require('minimist') }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_minimist_readme_autotoc_md17620}{}\doxysubsection{var argv = parse\+Args(args, opts=\{\})}\label{md_sfcode_node_modules_minimist_readme_autotoc_md17620}
Return an argument object {\ttfamily argv} populated with the array arguments from {\ttfamily args}.

{\ttfamily argv.\+\_\+} contains all the arguments that didn\textquotesingle{}t have an option associated with them.

Numeric-\/looking arguments will be returned as numbers unless {\ttfamily opts.\+string} or {\ttfamily opts.\+boolean} is set for that argument name.

Any arguments after `'--\textquotesingle{}{\ttfamily will not be parsed and will end up in}argv.\+\_\+\`{}.

options can be\+:


\begin{DoxyItemize}
\item {\ttfamily opts.\+string} -\/ a string or array of strings argument names to always treat as strings
\item {\ttfamily opts.\+boolean} -\/ a boolean, string or array of strings to always treat as booleans. if {\ttfamily true} will treat all double hyphenated arguments without equal signs as boolean (e.\+g. affects {\ttfamily -\/-\/foo}, not {\ttfamily -\/f} or {\ttfamily -\/-\/foo=bar})
\item {\ttfamily opts.\+alias} -\/ an object mapping string names to strings or arrays of string argument names to use as aliases
\item {\ttfamily opts.\+default} -\/ an object mapping string argument names to default values
\item {\ttfamily opts.\+stop\+Early} -\/ when true, populate {\ttfamily argv.\+\_\+} with everything after the first non-\/option
\item `opts\mbox{[}'--\textquotesingle{}\mbox{]}{\ttfamily -\/ when true, populate}argv.\+\_\+$<$tt$>$with everything before the--{\ttfamily  and}argv\mbox{[}\textquotesingle{}--\textquotesingle{}\mbox{]}{\ttfamily with everything after the}--\`{}. Here\textquotesingle{}s an example\+:
\end{DoxyItemize}


\begin{DoxyCode}{0}
\DoxyCodeLine{> require('./')('one two three -\/-\/ four five -\/-\/six'.split(' '), \{ '-\/-\/': true \})}
\DoxyCodeLine{\{ \_: [ 'one', 'two', 'three' ],}
\DoxyCodeLine{  '-\/-\/': [ 'four', 'five', '-\/-\/six' ] \}}

\end{DoxyCode}


Note that with `opts\mbox{[}'--\textquotesingle{}\mbox{]}{\ttfamily set, parsing for arguments still stops after the }--\`{}.


\begin{DoxyItemize}
\item {\ttfamily opts.\+unknown} -\/ a function which is invoked with a command line parameter not defined in the {\ttfamily opts} configuration object. If the function returns {\ttfamily false}, the unknown option is not added to {\ttfamily argv}.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_minimist_readme_autotoc_md17621}{}\doxysection{install}\label{md_sfcode_node_modules_minimist_readme_autotoc_md17621}
With \href{https://npmjs.org}{\texttt{ npm}} do\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{npm install minimist }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_minimist_readme_autotoc_md17622}{}\doxysection{license}\label{md_sfcode_node_modules_minimist_readme_autotoc_md17622}
MIT 