File tree 1 file changed +5
-6
lines changed
1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 3
3
const { EventEmitter } = require ( 'events' )
4
4
const debug = require ( 'debug' ) ( 'bfx:ws2:manager' )
5
5
const _isEqual = require ( 'lodash/isEqual' )
6
+ const _isFinite = require ( 'lodash/isFinite' )
6
7
const _includes = require ( 'lodash/includes' )
7
8
const _pick = require ( 'lodash/pick' )
8
9
const PromiseThrottle = require ( 'promise-throttle' )
@@ -116,19 +117,17 @@ class WS2Manager extends EventEmitter {
116
117
* @param {Object? } args.calc - default 0
117
118
* @param {Object? } args.dms - dead man switch, active 4
118
119
*/
119
- auth ( { apiKey, apiSecret, calc = 0 , dms = 0 } = { } ) {
120
+ auth ( { apiKey, apiSecret, calc, dms } = { } ) {
120
121
if ( this . _socketArgs . apiKey || this . _socketArgs . apiSecret ) {
121
122
debug ( 'error: auth credentials already provided! refusing auth' )
122
123
return
123
124
}
124
125
125
126
this . _socketArgs . apiKey = apiKey
126
127
this . _socketArgs . apiSecret = apiSecret
127
- this . _authArgs = {
128
- ...this . _authArgs ,
129
- calc,
130
- dms,
131
- }
128
+
129
+ if ( _isFinite ( calc ) ) this . _authArgs . calc = calc
130
+ if ( _isFinite ( dms ) ) this . _authArgs . dms = dms
132
131
133
132
this . _sockets . forEach ( s => {
134
133
if ( ! s . ws . isAuthenticated ( ) ) {
You can’t perform that action at this time.
0 commit comments