File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change 33const { EventEmitter } = require ( 'events' )
44const debug = require ( 'debug' ) ( 'bfx:ws2:manager' )
55const _isEqual = require ( 'lodash/isEqual' )
6+ const _isFinite = require ( 'lodash/isFinite' )
67const _includes = require ( 'lodash/includes' )
78const _pick = require ( 'lodash/pick' )
89const PromiseThrottle = require ( 'promise-throttle' )
@@ -116,19 +117,17 @@ class WS2Manager extends EventEmitter {
116117 * @param {Object? } args.calc - default 0
117118 * @param {Object? } args.dms - dead man switch, active 4
118119 */
119- auth ( { apiKey, apiSecret, calc = 0 , dms = 0 } = { } ) {
120+ auth ( { apiKey, apiSecret, calc, dms } = { } ) {
120121 if ( this . _socketArgs . apiKey || this . _socketArgs . apiSecret ) {
121122 debug ( 'error: auth credentials already provided! refusing auth' )
122123 return
123124 }
124125
125126 this . _socketArgs . apiKey = apiKey
126127 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
132131
133132 this . _sockets . forEach ( s => {
134133 if ( ! s . ws . isAuthenticated ( ) ) {
You can’t perform that action at this time.
0 commit comments