-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove isNotEmptyObject in favor of isEmptyObject
- Loading branch information
1 parent
86794fe
commit 490236f
Showing
6 changed files
with
40 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,10 @@ | ||
import type Falsy from './Falsy'; | ||
|
||
type EmptyObject = Record<string, never>; | ||
|
||
type EmptyValue = EmptyObject | null | undefined; | ||
|
||
// eslint-disable-next-line rulesdir/no-negated-variables | ||
function isNotEmptyObject<T extends Record<string, unknown> | Falsy>(arg: T | EmptyObject): arg is NonNullable<T> { | ||
return Object.keys(arg ?? {}).length > 0; | ||
} | ||
|
||
function isEmptyObject<T>(obj: T | EmptyValue): obj is EmptyValue { | ||
return Object.keys(obj ?? {}).length === 0; | ||
} | ||
|
||
export {isNotEmptyObject, isEmptyObject}; | ||
export {isEmptyObject}; | ||
export type {EmptyObject}; |