mirror of
https://github.com/aljazceru/ditto.git
synced 2026-01-23 15:24:22 +01:00
feat(utils.ts): create isObjectEmpty function
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user