\href{https://travis-ci.org/zeit/ms}{\texttt{ }} \href{https://zeit.chat/}{\texttt{ }}

Use this package to easily convert various time formats to milliseconds.\hypertarget{md_sfcode_node_modules_serve_index_node_modules_ms_readme_autotoc_md26855}{}\doxysection{Examples}\label{md_sfcode_node_modules_serve_index_node_modules_ms_readme_autotoc_md26855}

\begin{DoxyCode}{0}
\DoxyCodeLine{ms('2 days')  // 172800000}
\DoxyCodeLine{ms('1d')      // 86400000}
\DoxyCodeLine{ms('10h')     // 36000000}
\DoxyCodeLine{ms('2.5 hrs') // 9000000}
\DoxyCodeLine{ms('2h')      // 7200000}
\DoxyCodeLine{ms('1m')      // 60000}
\DoxyCodeLine{ms('5s')      // 5000}
\DoxyCodeLine{ms('1y')      // 31557600000}
\DoxyCodeLine{ms('100')     // 100 }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_serve_index_node_modules_ms_readme_autotoc_md26856}{}\doxysubsection{Convert from milliseconds}\label{md_sfcode_node_modules_serve_index_node_modules_ms_readme_autotoc_md26856}

\begin{DoxyCode}{0}
\DoxyCodeLine{ms(60000)             // "{}1m"{}}
\DoxyCodeLine{ms(2 * 60000)         // "{}2m"{}}
\DoxyCodeLine{ms(ms('10 hours'))    // "{}10h"{} }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_serve_index_node_modules_ms_readme_autotoc_md26857}{}\doxysubsection{Time format written-\/out}\label{md_sfcode_node_modules_serve_index_node_modules_ms_readme_autotoc_md26857}

\begin{DoxyCode}{0}
\DoxyCodeLine{ms(60000, \{ long: true \})             // "{}1 minute"{}}
\DoxyCodeLine{ms(2 * 60000, \{ long: true \})         // "{}2 minutes"{}}
\DoxyCodeLine{ms(ms('10 hours'), \{ long: true \})    // "{}10 hours"{} }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_serve_index_node_modules_ms_readme_autotoc_md26858}{}\doxysection{Features}\label{md_sfcode_node_modules_serve_index_node_modules_ms_readme_autotoc_md26858}

\begin{DoxyItemize}
\item Works both in \href{https://nodejs.org}{\texttt{ node}} and in the browser.
\item If a number is supplied to {\ttfamily ms}, a string with a unit is returned.
\item If a string that contains the number is supplied, it returns it as a number (e.\+g.\+: it returns {\ttfamily 100} for `\textquotesingle{}100'\`{}).
\item If you pass a string with a number and a valid unit, the number of equivalent ms is returned.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_serve_index_node_modules_ms_readme_autotoc_md26859}{}\doxysection{Caught a bug?}\label{md_sfcode_node_modules_serve_index_node_modules_ms_readme_autotoc_md26859}

\begin{DoxyEnumerate}
\item \href{https://help.github.com/articles/fork-a-repo/}{\texttt{ Fork}} this repository to your own Git\+Hub account and then \href{https://help.github.com/articles/cloning-a-repository/}{\texttt{ clone}} it to your local device
\item Link the package to the global module directory\+: {\ttfamily npm link}
\item Within the module you want to test your local development instance of ms, just link it to the dependencies\+: {\ttfamily npm link ms}. Instead of the default one from npm, node will now use your clone of ms!
\end{DoxyEnumerate}

As always, you can run the tests using\+: {\ttfamily npm test} 