function extend (target, source) { if (!target || typeof target !== 'object') { return target; } Array.prototype.slice.call(arguments).forEach(function(source){ if (!source || typeof source !== 'object') { return; } util._extend(target, source); }); return target; }
/** * Start API server with common port and augmented request handler * * @param {function} handler - request handler * @param {function} callback - invoked after server has started */ function startApiServer(handler, callback) { var server = http.createServer(agnostic(handler)).listen(common.api.port, function() { // supply endpoint to the consumer var tailoredOptions = util._extend(common.fbbot, {apiUrl: 'http://localhost:' + common.api.port + '/?access_token='}); callback(tailoredOptions, server.close.bind(server)); }); }
? util._extend(defaultOptions, _options) : defaultOptions