Contain async insanity so that the dark pony lord doesn\textquotesingle{}t eat souls

See \href{http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony}{\texttt{ this blog post}}.\hypertarget{md_sfcode_node_modules_dezalgo_README_autotoc_md8141}{}\doxysection{USAGE}\label{md_sfcode_node_modules_dezalgo_README_autotoc_md8141}
Pass a callback to {\ttfamily dezalgo} and it will ensure that it is {\itshape always} called in a future tick, and never in this tick.


\begin{DoxyCode}{0}
\DoxyCodeLine{var dz = require('dezalgo')}
\DoxyCodeLine{}
\DoxyCodeLine{var cache = \{\}}
\DoxyCodeLine{function maybeSync(arg, cb) \{}
\DoxyCodeLine{  cb = dz(cb)}
\DoxyCodeLine{}
\DoxyCodeLine{  // this will actually defer to nextTick}
\DoxyCodeLine{  if (cache[arg]) cb(null, cache[arg])}
\DoxyCodeLine{}
\DoxyCodeLine{  fs.readFile(arg, function (er, data) \{}
\DoxyCodeLine{    // since this is *already* defered, it will call immediately}
\DoxyCodeLine{    if (er) cb(er)}
\DoxyCodeLine{    cb(null, cache[arg] = data)}
\DoxyCodeLine{  \})}
\DoxyCodeLine{\} }

\end{DoxyCode}
 