mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
feat(utils.ts): create isObjectEmpty function
This commit is contained in:
parent
cc6441d239
commit
c17db58448
1 changed files with 8 additions and 0 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue