From 0ff3e7639c4c327e07daef2cd996ff8cadf0b95d Mon Sep 17 00:00:00 2001 From: Homa Wong Date: Sat, 29 Oct 2022 18:27:06 -0700 Subject: [PATCH] feat: add `isNothing()` --- src/immer.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/immer.ts b/src/immer.ts index 2ad2e56d..3133e833 100644 --- a/src/immer.ts +++ b/src/immer.ts @@ -3,7 +3,8 @@ import { IProduceWithPatches, Immer, Draft, - Immutable + Immutable, + NOTHING as nothing } from "./internal" export { @@ -17,13 +18,14 @@ export { current, isDraft, isDraftable, - NOTHING as nothing, DRAFTABLE as immerable, freeze, Objectish, StrictMode } from "./internal" +export {nothing} + const immer = new Immer() /** @@ -124,3 +126,7 @@ export {Immer} export {enablePatches} from "./plugins/patches" export {enableMapSet} from "./plugins/mapset" export {enableArrayMethods} from "./plugins/arrayMethods" + +export function isNothing(value: unknown): value is typeof nothing { + return value === nothing +}