3 A simple one level options merge utility
13 var defaults = require('defaults');
15 var handle = function(options, fn) {
16 options = defaults(options, {
20 setTimeout(function() {
25 handle({ timeout: 1000 }, function() {
26 // we're here 1000 ms later
29 handle({ timeout: 10000 }, function() {
30 // we're here 10s later
37 this module exports a function that takes 2 arguments: `options` and `defaults`. When called, it overrides all of `undefined` properties in `options` with the clones of properties defined in `defaults`
39 Sidecases: if called with a falsy `options` value, options will be initialized to a new object before being merged onto.