Browse Source

fix(line-length): Extract helpers for DRY channel filtering

These were linted for excessive line length
renovate/lint-staged-8.x
Ben Woosley 7 years ago
parent
commit
0674065d18
  1. 23
      app/reducers/channels.js

23
app/reducers/channels.js

@ -423,15 +423,26 @@ const allChannels = createSelector(
pendingForceClosedChannelsSelector,
channelSearchQuerySelector,
(activeChannels, nonActiveChannels, pendingOpenChannels, pendingClosedChannels, pendingForcedClosedChannels, searchQuery) => {
const filteredActiveChannels = activeChannels.filter(channel => channel.remote_pubkey.includes(searchQuery) || channel.channel_point.includes(searchQuery))
const filteredNonActiveChannels = nonActiveChannels.filter(channel => channel.remote_pubkey.includes(searchQuery) || channel.channel_point.includes(searchQuery))
const filterChannel = channel =>
channel.remote_pubkey.includes(searchQuery) || channel.channel_point.includes(searchQuery)
const filteredPendingOpenChannels = pendingOpenChannels.filter(channel => channel.channel.remote_node_pub.includes(searchQuery) || channel.channel.channel_point.includes(searchQuery))
const filteredPendingClosedChannels = pendingClosedChannels.filter(channel => channel.channel.remote_node_pub.includes(searchQuery) || channel.channel.channel_point.includes(searchQuery))
const filteredPendingForcedClosedChannels = pendingForcedClosedChannels.filter(channel => channel.channel.remote_node_pub.includes(searchQuery) || channel.channel.channel_point.includes(searchQuery))
const filteredActiveChannels = activeChannels.filter(filterChannel)
const filteredNonActiveChannels = nonActiveChannels.filter(filterChannel)
const filterPendingChannel = channel =>
channel.channel.remote_node_pub.includes(searchQuery) || channel.channel.channel_point.includes(searchQuery)
return [...filteredActiveChannels, ...filteredPendingOpenChannels, ...filteredPendingClosedChannels, ...filteredPendingForcedClosedChannels, ...filteredNonActiveChannels]
const filteredPendingOpenChannels = pendingOpenChannels.filter(filterPendingChannel)
const filteredPendingClosedChannels = pendingClosedChannels.filter(filterPendingChannel)
const filteredPendingForcedClosedChannels = pendingForcedClosedChannels.filter(filterPendingChannel)
return [
...filteredActiveChannels,
...filteredPendingOpenChannels,
...filteredPendingClosedChannels,
...filteredPendingForcedClosedChannels,
...filteredNonActiveChannels
]
}
)

Loading…
Cancel
Save