Skip to content

Latest commit

 

History

History
42 lines (26 loc) · 716 Bytes

current.md

File metadata and controls

42 lines (26 loc) · 716 Bytes

mutativeDocs


mutative / current

Function: current()

current<T>(target): T

current(draft) to get current state in the draft mutation function.

Example

import { create, current } from '../index';

const baseState = { foo: { bar: 'str' }, arr: [] };
const state = create(
  baseState,
  (draft) => {
    draft.foo.bar = 'str2';
    expect(current(draft.foo)).toEqual({ bar: 'str2' });
  },
);

Type Parameters

T extends object

Parameters

target: T

Returns

T

Defined in

current.ts:104