\begin{quote}
Resolve the path of a module like \href{https://nodejs.org/api/globals.html\#globals_require_resolve}{\texttt{ {\ttfamily require.\+resolve()}}} but from the current working directory \end{quote}
\hypertarget{md_sfcode_node_modules_resolve_cwd_readme_autotoc_md24377}{}\doxysection{Install}\label{md_sfcode_node_modules_resolve_cwd_readme_autotoc_md24377}

\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install -\/-\/save resolve-\/cwd }

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

\begin{DoxyCode}{0}
\DoxyCodeLine{const resolveCwd = require('resolve-\/cwd');}
\DoxyCodeLine{}
\DoxyCodeLine{console.log(\_\_dirname);}
\DoxyCodeLine{//=> '/Users/sindresorhus/rainbow'}
\DoxyCodeLine{}
\DoxyCodeLine{console.log(process.cwd());}
\DoxyCodeLine{//=> '/Users/sindresorhus/unicorn'}
\DoxyCodeLine{}
\DoxyCodeLine{resolveCwd('./foo');}
\DoxyCodeLine{//=> '/Users/sindresorhus/unicorn/foo.js' }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_resolve_cwd_readme_autotoc_md24379}{}\doxysection{API}\label{md_sfcode_node_modules_resolve_cwd_readme_autotoc_md24379}
\hypertarget{md_sfcode_node_modules_resolve_cwd_readme_autotoc_md24380}{}\doxysubsection{resolve\+Cwd(module\+Id)}\label{md_sfcode_node_modules_resolve_cwd_readme_autotoc_md24380}
Like {\ttfamily require()}, throws when the module can\textquotesingle{}t be found.\hypertarget{md_sfcode_node_modules_resolve_cwd_readme_autotoc_md24381}{}\doxysubsection{resolve\+Cwd.\+silent(module\+Id)}\label{md_sfcode_node_modules_resolve_cwd_readme_autotoc_md24381}
Returns {\ttfamily null} instead of throwing when the module can\textquotesingle{}t be found.\hypertarget{md_sfcode_node_modules_resolve_cwd_readme_autotoc_md24382}{}\doxysubsubsection{module\+Id}\label{md_sfcode_node_modules_resolve_cwd_readme_autotoc_md24382}
Type\+: {\ttfamily string}

What you would use in {\ttfamily require()}.\hypertarget{md_sfcode_node_modules_resolve_cwd_readme_autotoc_md24383}{}\doxysection{Related}\label{md_sfcode_node_modules_resolve_cwd_readme_autotoc_md24383}

\begin{DoxyItemize}
\item \href{https://github.com/sindresorhus/resolve-from}{\texttt{ resolve-\/from}} -\/ Resolve the path of a module from a given path
\item \href{https://github.com/sindresorhus/req-from}{\texttt{ req-\/from}} -\/ Require a module from a given path
\item \href{https://github.com/sindresorhus/req-cwd}{\texttt{ req-\/cwd}} -\/ Require a module from the current working directory
\item \href{https://github.com/sindresorhus/resolve-pkg}{\texttt{ resolve-\/pkg}} -\/ Resolve the path of a package regardless of it having an entry point
\item \href{https://github.com/sindresorhus/lazy-req}{\texttt{ lazy-\/req}} -\/ Require modules lazily
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_resolve_cwd_readme_autotoc_md24384}{}\doxysection{License}\label{md_sfcode_node_modules_resolve_cwd_readme_autotoc_md24384}
MIT © \href{https://sindresorhus.com}{\texttt{ Sindre Sorhus}} 