a bunch more usability improvements

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2022-04-23 18:21:45 -07:00
parent 090385d3da
commit cb463c6da9
7 changed files with 89 additions and 22 deletions

View File

@@ -179,6 +179,20 @@ class NostrEvent: Codable, Identifiable, CustomStringConvertible {
return (ns, c)
}
public func count_ids() -> Int {
return count_refs("e")
}
public func count_refs(_ type: String) -> Int {
var count: Int = 0
for tag in tags {
if tag.count >= 2 && tag[0] == "e" {
count += 1
}
}
return count
}
public var referenced_pubkeys: [ReferencedId] {
return get_referenced_ids(key: "p")
}