From 7182a2be4332e7802c8d2375b9380490aed7ca0b Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Fri, 10 Mar 2017 10:05:10 -0800 Subject: [PATCH] Improve duplicate checking in address book. --- app/scripts/controllers/address-book.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/scripts/controllers/address-book.js b/app/scripts/controllers/address-book.js index a75ef06ce..914fbded2 100644 --- a/app/scripts/controllers/address-book.js +++ b/app/scripts/controllers/address-book.js @@ -39,12 +39,12 @@ class AddressBookController { // upper limit to the number of addresses. _addToAddressBook (address, name) { let addressBook = this._getAddressBook() - let index = addressBook.findIndex((element) => { return element.address === address || element.name === name }) + let index = addressBook.findIndex((element) => { return element.address.toLowerCase() === address.toLowerCase() || element.name === name }) if (index !== -1) { addressBook.splice(index, 1) } addressBook.push({ - address, + address: address, name, }) return Promise.resolve(addressBook)