1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 18:00:18 +01:00

Optimize account name check (#15985)

This commit is contained in:
David Walsh 2022-09-27 08:09:29 -05:00 committed by GitHub
parent d9dda82678
commit 2a5922d774
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -47,9 +47,7 @@ export default class NewAccountCreateForm extends Component {
};
const accountNameExists = (allAccounts, accountName) => {
const accountsNames = allAccounts.map((item) => item.name);
return accountsNames.includes(accountName);
return Boolean(allAccounts.find((item) => item.name === accountName));
};
const existingAccountName = accountNameExists(accounts, newAccountName);