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;
|
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 {
|
export {
|
||||||
bech32ToPubkey,
|
bech32ToPubkey,
|
||||||
dedupeEvents,
|
dedupeEvents,
|
||||||
|
|
@ -104,6 +111,7 @@ export {
|
||||||
findTag,
|
findTag,
|
||||||
isNostrId,
|
isNostrId,
|
||||||
isNumberFrom1To100,
|
isNumberFrom1To100,
|
||||||
|
isObjectEmpty,
|
||||||
isURL,
|
isURL,
|
||||||
type Nip05,
|
type Nip05,
|
||||||
nostrDate,
|
nostrDate,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue