From 627a04f381f9ce31be7063ec8b6c5193e8a65081 Mon Sep 17 00:00:00 2001 From: jcbit <58643970+jcbit@users.noreply.github.com> Date: Sun, 21 Jun 2020 16:43:42 -0500 Subject: [PATCH 1/2] Fixed bug reported #546 _isEmpty only works for collections, here you are evaluating an individual item so something like checking for undefined would be best. This fixes my bug reported: https://github.com/bitfinexcom/bitfinex-api-node/issues/546 --- lib/transports/ws2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/transports/ws2.js b/lib/transports/ws2.js index facba4d0..3e85c0e8 100644 --- a/lib/transports/ws2.js +++ b/lib/transports/ws2.js @@ -1244,7 +1244,7 @@ class WSv2 extends EventEmitter { for (let k = 0; k < filterIndices.length; k++) { filterValue = filter[filterIndices[k]] - if (_isEmpty(filterValue) || filterValue === '*') { + if (filterValue === undefined || filterValue === '*') { continue } From ffc5dcbae3eaff4ebf83c49976217b359b3a0879 Mon Sep 17 00:00:00 2001 From: jcbit <58643970+jcbit@users.noreply.github.com> Date: Sat, 27 Jun 2020 21:38:10 -0500 Subject: [PATCH 2/2] Update ws2.js --- lib/transports/ws2.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/transports/ws2.js b/lib/transports/ws2.js index 3e85c0e8..659c6c77 100644 --- a/lib/transports/ws2.js +++ b/lib/transports/ws2.js @@ -8,6 +8,7 @@ const CbQ = require('cbq') const _Throttle = require('lodash.throttle') // eslint-disable-line const _isArray = require('lodash/isArray') const _isEmpty = require('lodash/isEmpty') +const _isUndefined = require('lodash/isUndefined') const _isString = require('lodash/isString') const _isNumber = require('lodash/isNumber') const _includes = require('lodash/includes') @@ -1244,7 +1245,7 @@ class WSv2 extends EventEmitter { for (let k = 0; k < filterIndices.length; k++) { filterValue = filter[filterIndices[k]] - if (filterValue === undefined || filterValue === '*') { + if (_isUndefined(filterValue) || filterValue === '*') { continue }