Function binding utility.\hypertarget{md_sfcode_node_modules_component_bind_Readme_autotoc_md5943}{}\doxysection{Installation}\label{md_sfcode_node_modules_component_bind_Readme_autotoc_md5943}

\begin{DoxyCode}{0}
\DoxyCodeLine{\$ component install component/bind }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_component_bind_Readme_autotoc_md5944}{}\doxysection{API}\label{md_sfcode_node_modules_component_bind_Readme_autotoc_md5944}

\begin{DoxyItemize}
\item \href{\#bindobj-fn}{\texttt{ bind(obj, fn)}}
\item \href{\#bindobj-fn-}{\texttt{ bind(obj, fn, ...)}}
\item \href{\#bindobj-name}{\texttt{ bind(obj, name)}} 
\end{DoxyItemize}

\label{_bindobj-fn}%
 \hypertarget{md_sfcode_node_modules_component_bind_Readme_autotoc_md5945}{}\doxysubsection{bind(obj, fn)}\label{md_sfcode_node_modules_component_bind_Readme_autotoc_md5945}
should bind the function to the given object.


\begin{DoxyCode}{0}
\DoxyCodeLine{var tobi = \{ name: 'tobi' \};}
\DoxyCodeLine{}
\DoxyCodeLine{function name() \{}
\DoxyCodeLine{  return this.name;}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{var fn = bind(tobi, name);}
\DoxyCodeLine{fn().should.equal('tobi'); }

\end{DoxyCode}


\label{_bindobj-fn-}%
 \hypertarget{md_sfcode_node_modules_component_bind_Readme_autotoc_md5946}{}\doxysubsection{bind(obj, fn, ...)}\label{md_sfcode_node_modules_component_bind_Readme_autotoc_md5946}
should curry the remaining arguments.


\begin{DoxyCode}{0}
\DoxyCodeLine{function add(a, b) \{}
\DoxyCodeLine{  return a + b;}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{bind(null, add)(1, 2).should.equal(3);}
\DoxyCodeLine{bind(null, add, 1)(2).should.equal(3);}
\DoxyCodeLine{bind(null, add, 1, 2)().should.equal(3); }

\end{DoxyCode}


\label{_bindobj-name}%
 \hypertarget{md_sfcode_node_modules_component_bind_Readme_autotoc_md5947}{}\doxysubsection{bind(obj, name)}\label{md_sfcode_node_modules_component_bind_Readme_autotoc_md5947}
should bind the method of the given name.


\begin{DoxyCode}{0}
\DoxyCodeLine{var tobi = \{ name: 'tobi' \};}
\DoxyCodeLine{}
\DoxyCodeLine{tobi.getName = function() \{}
\DoxyCodeLine{  return this.name;}
\DoxyCodeLine{\};}
\DoxyCodeLine{}
\DoxyCodeLine{var fn = bind(tobi, 'getName');}
\DoxyCodeLine{fn().should.equal('tobi'); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_component_bind_Readme_autotoc_md5948}{}\doxysection{License}\label{md_sfcode_node_modules_component_bind_Readme_autotoc_md5948}
MIT 