A simple one level options merge utility\hypertarget{md_sfcode_node_modules_defaults_README_autotoc_md7933}{}\doxysection{install}\label{md_sfcode_node_modules_defaults_README_autotoc_md7933}
{\ttfamily npm install defaults}\hypertarget{md_sfcode_node_modules_defaults_README_autotoc_md7934}{}\doxysection{use}\label{md_sfcode_node_modules_defaults_README_autotoc_md7934}

\begin{DoxyCode}{0}
\DoxyCodeLine{var defaults = require('defaults');}
\DoxyCodeLine{}
\DoxyCodeLine{var handle = function(options, fn) \{}
\DoxyCodeLine{  options = defaults(options, \{}
\DoxyCodeLine{    timeout: 100}
\DoxyCodeLine{  \});}
\DoxyCodeLine{}
\DoxyCodeLine{  setTimeout(function() \{}
\DoxyCodeLine{    fn(options);}
\DoxyCodeLine{  \}, options.timeout);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{handle(\{ timeout: 1000 \}, function() \{}
\DoxyCodeLine{  // we're here 1000 ms later}
\DoxyCodeLine{\});}
\DoxyCodeLine{}
\DoxyCodeLine{handle(\{ timeout: 10000 \}, function() \{}
\DoxyCodeLine{  // we're here 10s later}
\DoxyCodeLine{\});}

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_defaults_README_autotoc_md7935}{}\doxysection{summary}\label{md_sfcode_node_modules_defaults_README_autotoc_md7935}
this module exports a function that takes 2 arguments\+: {\ttfamily options} and {\ttfamily defaults}. When called, it overrides all of {\ttfamily undefined} properties in {\ttfamily options} with the clones of properties defined in {\ttfamily defaults}

Sidecases\+: if called with a falsy {\ttfamily options} value, options will be initialized to a new object before being merged onto.\hypertarget{md_sfcode_node_modules_defaults_README_autotoc_md7936}{}\doxysection{license}\label{md_sfcode_node_modules_defaults_README_autotoc_md7936}
\mbox{[}MIT\mbox{]}(LICENSE) 