Higher-\/order functions for easier error handling.

{\ttfamily if (err) return cb(err);} be gone!\hypertarget{md_sfcode_node_modules_iferr_README_autotoc_md12603}{}\doxysection{Install}\label{md_sfcode_node_modules_iferr_README_autotoc_md12603}

\begin{DoxyCode}{0}
\DoxyCodeLine{npm install iferr }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_iferr_README_autotoc_md12604}{}\doxysection{Use}\label{md_sfcode_node_modules_iferr_README_autotoc_md12604}
\hypertarget{md_sfcode_node_modules_iferr_README_autotoc_md12605}{}\doxysubsection{Java\+Script example}\label{md_sfcode_node_modules_iferr_README_autotoc_md12605}

\begin{DoxyCode}{0}
\DoxyCodeLine{var iferr = require('iferr');}
\DoxyCodeLine{}
\DoxyCodeLine{function get\_friends\_count(id, cb) \{}
\DoxyCodeLine{  User.load\_user(id, iferr(cb, function(user) \{}
\DoxyCodeLine{    user.load\_friends(iferr(cb, function(friends) \{}
\DoxyCodeLine{      cb(null, friends.length);}
\DoxyCodeLine{    \}));}
\DoxyCodeLine{  \}));}
\DoxyCodeLine{\} }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_iferr_README_autotoc_md12606}{}\doxysubsection{Coffee\+Script example}\label{md_sfcode_node_modules_iferr_README_autotoc_md12606}

\begin{DoxyCode}{0}
\DoxyCodeLine{iferr = require 'iferr'}
\DoxyCodeLine{}
\DoxyCodeLine{get\_friends\_count = (id, cb) -\/>}
\DoxyCodeLine{  User.load\_user id, iferr cb, (user) -\/>}
\DoxyCodeLine{    user.load\_friends iferr cb, (friends) -\/>}
\DoxyCodeLine{      cb null, friends.length }

\end{DoxyCode}


(TODO\+: document tiferr, throwerr and printerr)\hypertarget{md_sfcode_node_modules_iferr_README_autotoc_md12607}{}\doxysection{License}\label{md_sfcode_node_modules_iferr_README_autotoc_md12607}
MIT 