\begin{quote}
Make a function mimic another one \end{quote}
Useful when you wrap a function in another function and like to preserve the original name and other properties.\hypertarget{md_sfcode_node_modules_mimic_fn_readme_autotoc_md17412}{}\doxysection{Install}\label{md_sfcode_node_modules_mimic_fn_readme_autotoc_md17412}

\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install mimic-\/fn }

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

\begin{DoxyCode}{0}
\DoxyCodeLine{const mimicFn = require('mimic-\/fn');}
\DoxyCodeLine{}
\DoxyCodeLine{function foo() \{\}}
\DoxyCodeLine{foo.unicorn = '🦄';}
\DoxyCodeLine{}
\DoxyCodeLine{function wrapper() \{}
\DoxyCodeLine{    return foo();}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{console.log(wrapper.name);}
\DoxyCodeLine{//=> 'wrapper'}
\DoxyCodeLine{}
\DoxyCodeLine{mimicFn(wrapper, foo);}
\DoxyCodeLine{}
\DoxyCodeLine{console.log(wrapper.name);}
\DoxyCodeLine{//=> 'foo'}
\DoxyCodeLine{}
\DoxyCodeLine{console.log(wrapper.unicorn);}
\DoxyCodeLine{//=> '🦄' }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_mimic_fn_readme_autotoc_md17414}{}\doxysection{API}\label{md_sfcode_node_modules_mimic_fn_readme_autotoc_md17414}
It will copy over the properties {\ttfamily name}, {\ttfamily length}, {\ttfamily display\+Name}, and any custom properties you may have set.\hypertarget{md_sfcode_node_modules_mimic_fn_readme_autotoc_md17415}{}\doxysubsection{mimic\+Fn(to, from)}\label{md_sfcode_node_modules_mimic_fn_readme_autotoc_md17415}
Modifies the {\ttfamily to} function and returns it.\hypertarget{md_sfcode_node_modules_mimic_fn_readme_autotoc_md17416}{}\doxysubsubsection{to}\label{md_sfcode_node_modules_mimic_fn_readme_autotoc_md17416}
Type\+: {\ttfamily Function}

Mimicking function.\hypertarget{md_sfcode_node_modules_mimic_fn_readme_autotoc_md17417}{}\doxysubsubsection{from}\label{md_sfcode_node_modules_mimic_fn_readme_autotoc_md17417}
Type\+: {\ttfamily Function}

Function to mimic.\hypertarget{md_sfcode_node_modules_mimic_fn_readme_autotoc_md17418}{}\doxysection{Related}\label{md_sfcode_node_modules_mimic_fn_readme_autotoc_md17418}

\begin{DoxyItemize}
\item \href{https://github.com/sindresorhus/rename-fn}{\texttt{ rename-\/fn}} -\/ Rename a function
\item \href{https://github.com/ehmicky/keep-func-props}{\texttt{ keep-\/func-\/props}} -\/ Wrap a function without changing its name, length and other properties
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_mimic_fn_readme_autotoc_md17419}{}\doxysection{License}\label{md_sfcode_node_modules_mimic_fn_readme_autotoc_md17419}
MIT © \href{https://sindresorhus.com}{\texttt{ Sindre Sorhus}} 