Skip to content

Commit 398c5a5

Browse files
committed
docs(api): update api docs
1 parent 7129237 commit 398c5a5

22 files changed

+88
-32
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ expect(state.simpleObject).not.toBe(baseState.simpleObject);
533533

534534
- `castDraft()`
535535
- `castImmutable()`
536+
- `castMutable()`
536537
- `Draft<T>`
537538
- `Immutable<T>`
538539
- `Patches`

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
- [apply](functions/apply.md)
2222
- [castDraft](functions/castDraft.md)
2323
- [castImmutable](functions/castImmutable.md)
24+
- [castMutable](functions/castMutable.md)
2425
- [create](functions/create.md)
2526
- [current](functions/current.md)
2627
- [isDraft](functions/isDraft.md)

docs/functions/apply.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ expect(state).toEqual(apply(baseState, patches));
4848

4949
## Defined in
5050

51-
[apply.ts:26](https://github.com/unadlib/mutative/blob/4e5a64df3bd670123a9179420fc5820dbbf11915/src/apply.ts#L26)
51+
[apply.ts:26](https://github.com/unadlib/mutative/blob/7129237bc42b8475743ffff427a1f8f85e8e1e51/src/apply.ts#L26)

docs/functions/castDraft.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ Cast a value to an Draft type value.
2424

2525
## Defined in
2626

27-
[utils/cast.ts:6](https://github.com/unadlib/mutative/blob/4e5a64df3bd670123a9179420fc5820dbbf11915/src/utils/cast.ts#L6)
27+
[utils/cast.ts:6](https://github.com/unadlib/mutative/blob/7129237bc42b8475743ffff427a1f8f85e8e1e51/src/utils/cast.ts#L6)

docs/functions/castImmutable.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ Cast a value to an Immutable type value.
2424

2525
## Defined in
2626

27-
[utils/cast.ts:13](https://github.com/unadlib/mutative/blob/4e5a64df3bd670123a9179420fc5820dbbf11915/src/utils/cast.ts#L13)
27+
[utils/cast.ts:13](https://github.com/unadlib/mutative/blob/7129237bc42b8475743ffff427a1f8f85e8e1e51/src/utils/cast.ts#L13)

docs/functions/castMutable.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[**mutative**](../README.md)**Docs**
2+
3+
***
4+
5+
[mutative](../README.md) / castMutable
6+
7+
# Function: castMutable()
8+
9+
> **castMutable**\<`T`\>(`draft`): `T`
10+
11+
Cast a value to an Mutable type value.
12+
13+
## Type Parameters
14+
15+
**T**
16+
17+
## Parameters
18+
19+
**draft**: [`Draft`](../type-aliases/Draft.md)\<`T`\>
20+
21+
## Returns
22+
23+
`T`
24+
25+
## Defined in
26+
27+
[utils/cast.ts:20](https://github.com/unadlib/mutative/blob/7129237bc42b8475743ffff427a1f8f85e8e1e51/src/utils/cast.ts#L20)

docs/functions/create.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ expect(state.arr).toBe(baseState.arr);
7676

7777
### Defined in
7878

79-
[create.ts:25](https://github.com/unadlib/mutative/blob/4e5a64df3bd670123a9179420fc5820dbbf11915/src/create.ts#L25)
79+
[create.ts:25](https://github.com/unadlib/mutative/blob/7129237bc42b8475743ffff427a1f8f85e8e1e51/src/create.ts#L25)
8080

8181
## create(base, mutate, options)
8282

@@ -127,7 +127,7 @@ expect(state.arr).toBe(baseState.arr);
127127

128128
### Defined in
129129

130-
[create.ts:25](https://github.com/unadlib/mutative/blob/4e5a64df3bd670123a9179420fc5820dbbf11915/src/create.ts#L25)
130+
[create.ts:25](https://github.com/unadlib/mutative/blob/7129237bc42b8475743ffff427a1f8f85e8e1e51/src/create.ts#L25)
131131

132132
## create(mutate, options)
133133

@@ -188,11 +188,11 @@ expect(state.arr).toBe(baseState.arr);
188188

189189
### Defined in
190190

191-
[create.ts:25](https://github.com/unadlib/mutative/blob/4e5a64df3bd670123a9179420fc5820dbbf11915/src/create.ts#L25)
191+
[create.ts:25](https://github.com/unadlib/mutative/blob/7129237bc42b8475743ffff427a1f8f85e8e1e51/src/create.ts#L25)
192192

193193
## create(base, options)
194194

195-
> **create**\<`T`, `O`, `F`\>(`base`, `options`?): [`T`, () => `Result`\<`T`, `O`, `F`\>]
195+
> **create**\<`T`, `O`, `F`\>(`base`, `options`?): [[`Draft`](../type-aliases/Draft.md)\<`T`\>, () => `Result`\<`T`, `O`, `F`\>]
196196
197197
`create(baseState, callback, options)` to create the next state
198198

@@ -231,8 +231,8 @@ expect(state.arr).toBe(baseState.arr);
231231

232232
### Returns
233233

234-
[`T`, () => `Result`\<`T`, `O`, `F`\>]
234+
[[`Draft`](../type-aliases/Draft.md)\<`T`\>, () => `Result`\<`T`, `O`, `F`\>]
235235

236236
### Defined in
237237

238-
[create.ts:25](https://github.com/unadlib/mutative/blob/4e5a64df3bd670123a9179420fc5820dbbf11915/src/create.ts#L25)
238+
[create.ts:25](https://github.com/unadlib/mutative/blob/7129237bc42b8475743ffff427a1f8f85e8e1e51/src/create.ts#L25)

docs/functions/current.md

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
# Function: current()
88

9+
## current(target)
10+
911
> **current**\<`T`\>(`target`): `T`
1012
1113
`current(draft)` to get current state in the draft mutation function.
@@ -25,18 +27,42 @@ const state = create(
2527
);
2628
```
2729

28-
## Type Parameters
30+
### Type Parameters
31+
32+
**T** *extends* `object`
33+
34+
### Parameters
35+
36+
**target**: [`Draft`](../type-aliases/Draft.md)\<`T`\>
37+
38+
### Returns
39+
40+
`T`
41+
42+
### Defined in
43+
44+
[current.ts:120](https://github.com/unadlib/mutative/blob/7129237bc42b8475743ffff427a1f8f85e8e1e51/src/current.ts#L120)
45+
46+
## current(target)
47+
48+
> **current**\<`T`\>(`target`): `T`
49+
50+
### Type Parameters
2951

3052
**T** *extends* `object`
3153

32-
## Parameters
54+
### Parameters
3355

3456
**target**: `T`
3557

36-
## Returns
58+
### Returns
3759

3860
`T`
3961

40-
## Defined in
62+
### Deprecated
63+
64+
You should call current only on `Draft<T>` types.
65+
66+
### Defined in
4167

42-
[current.ts:104](https://github.com/unadlib/mutative/blob/4e5a64df3bd670123a9179420fc5820dbbf11915/src/current.ts#L104)
68+
[current.ts:122](https://github.com/unadlib/mutative/blob/7129237bc42b8475743ffff427a1f8f85e8e1e51/src/current.ts#L122)

docs/functions/isDraft.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ Check if the value is a draft
2020

2121
## Defined in
2222

23-
[utils/draft.ts:11](https://github.com/unadlib/mutative/blob/4e5a64df3bd670123a9179420fc5820dbbf11915/src/utils/draft.ts#L11)
23+
[utils/draft.ts:12](https://github.com/unadlib/mutative/blob/7129237bc42b8475743ffff427a1f8f85e8e1e51/src/utils/draft.ts#L12)

docs/functions/isDraftable.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ Check if a value is draftable
2424

2525
## Defined in
2626

27-
[utils/draft.ts:28](https://github.com/unadlib/mutative/blob/4e5a64df3bd670123a9179420fc5820dbbf11915/src/utils/draft.ts#L28)
27+
[utils/draft.ts:29](https://github.com/unadlib/mutative/blob/7129237bc42b8475743ffff427a1f8f85e8e1e51/src/utils/draft.ts#L29)

0 commit comments

Comments
 (0)