address selector: complete reverses by name as well

This commit is contained in:
Jannis R 2017-01-09 14:13:11 +01:00
parent 38734c92c2
commit f05ffd2e09
No known key found for this signature in database
GPG Key ID: 0FE83946296A88A5

View File

@ -31,18 +31,26 @@ export default class AddressSelectStore {
initValues = [];
regLookups = [
(address) => {
address = address.toLowerCase().trim();
if (address.length === 0 || address === '0x') {
(query) => {
query = query.toLowerCase().trim();
if (query.length === 0 || query === '0x') {
return null;
}
let name = this.reverse[address];
let address;
let name = this.reverse[query];
if (!name) {
const addr = Object
.keys(this.reverse)
.find((addr) => addr.toLowerCase().slice(0, address.length) === address);
.find((addr) => {
if (addr.toLowerCase().slice(0, query.length) === query) {
return true;
}
const name = this.reverse[addr];
return name.toLowerCase().slice(0, query.length) === query;
});
if (addr) {
address = addr;