Files
TheGame/packages/web/utils/objectHelpers.ts
δυς 81883f940e Miscellaneous changes pulled from #1078 (#1115)
​#1078 is at about 4,000 lines changed and includes both code implementing features and unrelated functional and stylistic changes. This set of changes is about ⅓ of the total and should be largely independent.

These changes include:

* have Dependabot ignore `patch` version changes
* switch the cache invalidation Hasura action to asynchronous
* add a uniqueness constraint on the combination of player and skill ids
* print a comprehensible error message in the db seeding script on network errors
* add a mutex on the account creation process & allow it to happen only once *(subsequent runs were failing b/c of the uniqueness constraint on the ETH address & returning `null` (closes #1098))
* adds some more profile editing related types
* renames `HighLow7dType` to `HighLowType`
* refactors the `ColorBar` component to include links to a color explanation
* replaces `fake-tag`'s `gql` string identifier with the dependency-free `/* GraphQL */`
* rename `lib/hooks/useUserXp.ts` to `useUserXP.ts`
* fixed some typings to remove `any`s
* bumped some library versions & fixed the version numbers of some others
2022-02-08 06:01:06 -05:00

13 lines
266 B
TypeScript

export const isEmpty = (obj: unknown) => {
if (Array.isArray(obj) && obj.length === 0) {
return true;
}
if (obj === '') {
return true;
}
if (obj && typeof obj === 'object' && Object.keys(obj).length === 0) {
return true;
}
return false;
};