\begin{quote}
Let a globally installed package use a locally installed version of itself if available \end{quote}
Useful for CLI tools that want to defer to the user\textquotesingle{}s locally installed version when available, but still work if it\textquotesingle{}s not installed locally. For example, \href{http://ava.li}{\texttt{ AVA}} and \href{https://github.com/xojs/xo}{\texttt{ XO}} uses this method.\hypertarget{md_sfcode_node_modules_import_local_readme_autotoc_md12692}{}\doxysection{Install}\label{md_sfcode_node_modules_import_local_readme_autotoc_md12692}

\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install import-\/local }

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

\begin{DoxyCode}{0}
\DoxyCodeLine{const importLocal = require('import-\/local');}
\DoxyCodeLine{}
\DoxyCodeLine{if (importLocal(\_\_filename)) \{}
\DoxyCodeLine{    console.log('Using local version of this package');}
\DoxyCodeLine{\} else \{}
\DoxyCodeLine{    // Code for both global and local version here…}
\DoxyCodeLine{\} }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_import_local_readme_autotoc_md12694}{}\doxysection{License}\label{md_sfcode_node_modules_import_local_readme_autotoc_md12694}
MIT © \href{https://sindresorhus.com}{\texttt{ Sindre Sorhus}} 