bfx-api-node-core
Version:
Core Bitfinex Node API
18 lines (14 loc) • 440 B
JavaScript
const _includes = require('lodash/includes')
const dataChannelTypes = require('./data_types')
/**
* @param {Object} state
* @param {number} pendingUnsubCount
*/
module.exports = (state = {}) => {
const { channels = {}, pendingUnsubscriptions = [] } = state
return pendingUnsubscriptions.filter(chanId => {
const { channel } = (channels[chanId] || {})
return _includes(dataChannelTypes, channel)
}).length
}