Skip to content

Commit

Permalink
feat: add isNothing()
Browse files Browse the repository at this point in the history
  • Loading branch information
unional committed Oct 30, 2022
1 parent 5721bb7 commit 54f63e1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/utils/common.ts
Expand Up @@ -10,7 +10,9 @@ import {
ImmerState,
hasMap,
Archtype,
die
die,
NOTHING,
Nothing
} from "../internal"

/** Returns true if the given value is an Immer draft */
Expand Down Expand Up @@ -215,3 +217,7 @@ export function isFrozen(obj: any): boolean {
// See #600, IE dies on non-objects in Object.isFrozen
return Object.isFrozen(obj)
}

export function isNothing(value: unknown): value is Nothing {
return value === NOTHING
}

0 comments on commit 54f63e1

Please sign in to comment.