MCPcopy
hub / github.com/immerjs/immer / current

Function current

src/core/current.ts:16–19  ·  view source on GitHub ↗
(value: Draft<any>)

Source from the content-addressed store, hash-verified

14/** Takes a snapshot of the current state of a draft and finalizes it (but without freezing). This is a great utility to print the current state during debugging (no Proxies in the way). The output of current can also be safely leaked outside the producer. */
15export function current<T>(value: Draft<T>): T
16export function current(value: Draft<any>): any {
17 if (!isDraft(value)) die(10, value)
18 return currentImpl(value)
19}
20
21function currentImpl(value: any): any {
22 if (!isDraftable(value) || isFrozen(value)) return value

Callers 3

createDraftMethod · 0.85
runTestsFunction · 0.85
type-external.tsFile · 0.85

Calls 3

isDraftFunction · 0.85
dieFunction · 0.85
currentImplFunction · 0.85

Tested by 1

runTestsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…