<gh_stars>0
\begin{quote}
Resolve the path of a module like \href{http://nodejs.org/api/globals.html#globals_require_resolve}{\tt {\ttfamily require.\+resolve()}} but from a given path \end{quote}


\subsection*{Install}


\begin{DoxyCode}
$ npm install --save resolve-from
\end{DoxyCode}


\subsection*{Usage}

\`{}\`{}`js const resolve\+From = require(\textquotesingle{}resolve-\/from');

// there\textquotesingle{}s a file at {\ttfamily ./foo/bar.js}

resolve\+From(\textquotesingle{}foo\textquotesingle{}, \textquotesingle{}./bar\textquotesingle{}); //=$>$ \textquotesingle{}/\+Users/sindresorhus/dev/test/foo/bar.js\textquotesingle{} \`{}\`{}\`{}

\subsection*{A\+PI}

\subsubsection*{resolve\+From(from\+Dir, module\+Id)}

\paragraph*{from\+Dir}

Type\+: {\ttfamily string}

The directory to resolve from.

\paragraph*{module\+Id}

Type\+: {\ttfamily string}

What you would use in {\ttfamily require()}.

\subsection*{Tip}

Create a partial using a bound function if you want to require from the same {\ttfamily from\+Dir} multiple times\+:


\begin{DoxyCode}
const resolveFromFoo = resolveFrom.bind(null, 'foo');

resolveFromFoo('./bar');
resolveFromFoo('./baz');
\end{DoxyCode}


\subsection*{License}

M\+IT © \href{http://sindresorhus.com}{\tt <NAME>} 