UNPKG

727 BJavaScriptView Raw
1var raw_connect = require('./lib/connect').connect;
2var CallbackModel = require('./lib/callback_model').CallbackModel;
3
4// Supports three shapes:
5// connect(url, options, callback)
6// connect(url, callback)
7// connect(callback)
8function connect(url, options, cb) {
9 if (typeof url === 'function')
10 cb = url, url = false, options = false;
11 else if (typeof options === 'function')
12 cb = options, options = false;
13
14 raw_connect(url, options, function(err, c) {
15 if (err === null) cb(null, new CallbackModel(c));
16 else cb(err);
17 });
18};
19
20module.exports.connect = connect;
21module.exports.credentials = require('./lib/credentials');
22module.exports.IllegalOperationError = require('./lib/error').IllegalOperationError;