diff --git a/src/utils.ts b/src/utils.ts index a1c3b1d1..de826ad6 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -97,6 +97,13 @@ function isNumberFrom1To100(value: unknown): boolean { return z.coerce.number().int().gte(1).lte(100).safeParse(value).success; } +function isObjectEmpty(obj: object): boolean { + for (const prop in obj) { + if (Object.hasOwn(obj, prop)) return false; + } + return true; +} + export { bech32ToPubkey, dedupeEvents, @@ -104,6 +111,7 @@ export { findTag, isNostrId, isNumberFrom1To100, + isObjectEmpty, isURL, type Nip05, nostrDate,