Skip to content

Commit

Permalink
simplify getAddressBook
Browse files Browse the repository at this point in the history
  • Loading branch information
jennypollack authored and Gudahtt committed Sep 21, 2019
1 parent f582991 commit 0e46617
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions ui/app/selectors/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,10 @@ function conversionRateSelector (state) {

function getAddressBook (state) {
const network = state.metamask.network
let addressBookEntries = []
addressBookEntries = Object.keys(state.metamask.addressBook)
.filter(entry => entry && entry === network)
if (addressBookEntries.length !== 0) {

addressBookEntries = Object.values(addressBookEntries)
return Object.values(state.metamask.addressBook[addressBookEntries])
if (!state.metamask.addressBook[network]) {
return []
}
return addressBookEntries
return Object.values(state.metamask.addressBook[network])
}

function getAddressBookEntry (state, address) {
Expand Down

0 comments on commit 0e46617

Please sign in to comment.