mirror of
https://github.com/meshcore-dev/meshcore.js.git
synced 2026-04-20 22:13:49 +00:00
add ability to find contact by name
This commit is contained in:
parent
db5e5bd76f
commit
cd5bebc973
2 changed files with 14 additions and 1 deletions
|
|
@ -760,6 +760,18 @@ class Connection extends EventEmitter {
|
|||
});
|
||||
}
|
||||
|
||||
async findContactByName(name) {
|
||||
|
||||
// get contacts
|
||||
const contacts = await this.getContacts();
|
||||
|
||||
// find first contact matching name exactly
|
||||
return contacts.find((contact) => {
|
||||
return contact.advName === name;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
async findContactByPublicKeyPrefix(pubKeyPrefix) {
|
||||
|
||||
// get contacts
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue