Skip to content

Commit

Permalink
fix(url parser): add check for options as cb
Browse files Browse the repository at this point in the history
  • Loading branch information
Jessica Lord committed Nov 20, 2017
1 parent 861761e commit 52b6039
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/url_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down

0 comments on commit 52b6039

Please sign in to comment.