From 52b60392b6407c93eccba1df5d8f536d325cabb8 Mon Sep 17 00:00:00 2001 From: Jessica Lord Date: Thu, 16 Nov 2017 09:33:44 -0500 Subject: [PATCH] fix(url parser): add check for options as cb --- lib/url_parser.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/url_parser.js b/lib/url_parser.js index 5dd5645581..3e8c934e9a 100644 --- a/lib/url_parser.js +++ b/lib/url_parser.js @@ -8,6 +8,9 @@ var ReadPreference = require('./read_preference'), dns = require('dns'); module.exports = function(url, options, callback) { + if (typeof options === 'function') (callback = options), (options = {}); + options = options || {}; + var result = parser.parse(url, true); if (result.protocol !== 'mongodb:' && result.protocol !== 'mongodb+srv:') { return callback(new Error('invalid schema, expected mongodb or mongodb+srv'));