Handle string parameter in Xo constructor.
This commit is contained in:
parent
12b42854e4
commit
3dd0c44410
@ -6,6 +6,7 @@ var Bluebird = require('bluebird');
|
||||
Bluebird.longStackTraces();
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
var inherits = require('util').inherits;
|
||||
var isString = require('lodash.isstring');
|
||||
var jsonRpc = require('json-rpc');
|
||||
var makeError = require('make-error');
|
||||
var MethodNotFound = require('json-rpc/errors').MethodNotFound;
|
||||
@ -291,6 +292,14 @@ function signIn() {
|
||||
function Xo(opts) {
|
||||
var self = this;
|
||||
|
||||
if (!opts) {
|
||||
opts = {};
|
||||
} else if (isString(opts)) {
|
||||
opts = {
|
||||
url: opts,
|
||||
};
|
||||
}
|
||||
|
||||
this._api = new Api(opts.url);
|
||||
this._backOff = fibonacci(1e3);
|
||||
this.objects = createCollection(objectsOptions);
|
||||
|
@ -31,6 +31,7 @@
|
||||
"lodash.assign": "^3.0.0",
|
||||
"lodash.foreach": "^3.0.1",
|
||||
"lodash.indexof": "^3.0.0",
|
||||
"lodash.isstring": "^3.0.0",
|
||||
"make-error": "^0.3.0",
|
||||
"ws": "^0.7.1"
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user