\href{https://travis-ci.org/stoeffel/compose-function}{\texttt{ }} \href{https://www.npmjs.com/package/compose-function}{\texttt{ }} \href{https://david-dm.org/stoeffel/compose-function}{\texttt{ }} \href{https://coveralls.io/github/stoeffel/compose-function}{\texttt{ }}

\doxysection*{Compose-\/\+Function}



\href{\#installation}{\texttt{ Installation}} $\vert$ \href{\#usage}{\texttt{ Usage}} $\vert$ \href{\#related}{\texttt{ Related}} $\vert$ \href{\#license}{\texttt{ License}} ~\newline
~\newline
  ~\newline
 \textsubscript{logo by \href{http://justinmezzell.tumblr.com/}{\texttt{ Justin Mezzell}}} \begin{quote}
Compose a new function from smaller functions {\ttfamily f(g(x))}\end{quote}
\hypertarget{md_sfcode_node_modules_compose_function_README_autotoc_md5976}{}\doxysubsection{Installation}\label{md_sfcode_node_modules_compose_function_README_autotoc_md5976}
{\ttfamily npm install compose-\/function}\hypertarget{md_sfcode_node_modules_compose_function_README_autotoc_md5977}{}\doxysubsection{Usage}\label{md_sfcode_node_modules_compose_function_README_autotoc_md5977}
\hypertarget{md_sfcode_node_modules_compose_function_README_autotoc_md5978}{}\doxysubsection{Basic usage}\label{md_sfcode_node_modules_compose_function_README_autotoc_md5978}

\begin{DoxyCode}{0}
\DoxyCodeLine{import compose from 'compose-\/function';}
\DoxyCodeLine{}
\DoxyCodeLine{const composition = compose(sqr, add2); // sqr(add2(x))}
\DoxyCodeLine{}
\DoxyCodeLine{composition(2) // => 16}
\DoxyCodeLine{}
\DoxyCodeLine{compose(sqr, inc)(2); // => 9}
\DoxyCodeLine{compose(inc, sqr)(2); // => 5 }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_compose_function_README_autotoc_md5979}{}\doxysubsection{with curry}\label{md_sfcode_node_modules_compose_function_README_autotoc_md5979}

\begin{DoxyCode}{0}
\DoxyCodeLine{import compose from 'compose-\/function';}
\DoxyCodeLine{import \{ curry, \_ \} from 'curry-\/this';}
\DoxyCodeLine{}
\DoxyCodeLine{}
\DoxyCodeLine{const add = (x, y) => x + y;}
\DoxyCodeLine{}
\DoxyCodeLine{// add(6, sqr(add(2, x)))}
\DoxyCodeLine{compose(}
\DoxyCodeLine{  add::curry(6),}
\DoxyCodeLine{  sqr,}
\DoxyCodeLine{  add::curry(2),}
\DoxyCodeLine{);}
\DoxyCodeLine{}
\DoxyCodeLine{// map(filter(list, even), sqr)}
\DoxyCodeLine{compose(}
\DoxyCodeLine{  map::curry(\_, sqr),}
\DoxyCodeLine{  filter::curry(\_, even),}
\DoxyCodeLine{)([1,2,3,4,5,6,7,8]) // => [4, 16, 36, 64] }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_compose_function_README_autotoc_md5980}{}\doxysubsubsection{$<$tt$>$\+::$<$/tt$>$ huh?}\label{md_sfcode_node_modules_compose_function_README_autotoc_md5980}
If you’re wondering what the {\ttfamily \+::} thing means, you’d better read this excellent \href{https://github.com/jussi-kalliokoski/trine/blob/5b735cbfb6b28ae94bac0446d9ecd5ce51fb149b/README.md\#why}{\texttt{ overview}} by \href{https://github.com/jussi-kalliokoski}{\texttt{ @jussi-\/kalliokoski}} or have a look at the \href{https://github.com/zenparsing/es-function-bind}{\texttt{ function bind syntax proposal}}. Or checkout the \href{https://github.com/stoeffel/curry-this}{\texttt{ curry-\/this docs}}.\hypertarget{md_sfcode_node_modules_compose_function_README_autotoc_md5981}{}\doxysubsection{Related}\label{md_sfcode_node_modules_compose_function_README_autotoc_md5981}

\begin{DoxyItemize}
\item \href{https://github.com/stoeffel/curry-this}{\texttt{ curry-\/this}}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_compose_function_README_autotoc_md5982}{}\doxysubsection{License}\label{md_sfcode_node_modules_compose_function_README_autotoc_md5982}
MIT © \href{http://stoeffel.github.io}{\texttt{ Christoph Hermann}} 