Improvements

This commit is contained in:
Isaac
2024-04-09 15:11:53 +04:00
parent 7ae4c0159a
commit 834089efa5
12 changed files with 395 additions and 44 deletions

View File

@@ -70,6 +70,25 @@ extension PeerIndexNameRepresentation {
return foundAtLeastOne
}
public func matchesByTokens(_ other: [ValueBoxKey]) -> Bool {
var foundAtLeastOne = false
for searchToken in other {
var found = false
for token in self.indexTokens {
if searchToken.isPrefix(to: token) {
found = true
break
}
}
if !found {
return false
}
foundAtLeastOne = true
break
}
return foundAtLeastOne
}
public var indexTokens: [ValueBoxKey] {
switch self {
case let .title(title, addressNames):