mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-09 08:38:50 +00:00
getFilterLimit: empty tags return 0
This commit is contained in:
@@ -78,6 +78,10 @@ export function getFilterLimit(filter: Filter): number {
|
||||
if (filter.kinds && !filter.kinds.length) return 0
|
||||
if (filter.authors && !filter.authors.length) return 0
|
||||
|
||||
for (const [key, value] of Object.entries(filter)) {
|
||||
if (key[0] === '#' && Array.isArray(value) && !value.length) return 0
|
||||
}
|
||||
|
||||
return Math.min(
|
||||
Math.max(0, filter.limit ?? Infinity),
|
||||
filter.ids?.length ?? Infinity,
|
||||
|
||||
Reference in New Issue
Block a user