Decompose monolithic readme into docs/ directory structure
This commit is contained in:
19
docs/values/mutate.md
Normal file
19
docs/values/mutate.md
Normal file
@@ -0,0 +1,19 @@
|
||||
[Overview](../overview.md) | [Installation](../installation.md) | [Usage](../usage.md) | [Types](../types/) | **Values** | [Syntax](../syntax/) | [TypeRegistry](../type-registry.md) | [TypeCheck](../type-check.md)
|
||||
|
||||
# Mutate
|
||||
|
||||
Use the Mutate function to perform a deep mutable value assignment while retaining internal references.
|
||||
|
||||
```typescript
|
||||
const Y = { z: 1 }; // const Y = { z: 1 }
|
||||
const X = { y: Y }; // const X = { y: { z: 1 } }
|
||||
const A = { x: X }; // const A = { x: { y: { z: 1 } } }
|
||||
|
||||
Value.Mutate(A, { x: { y: { z: 2 } } }); // A' = { x: { y: { z: 2 } } }
|
||||
|
||||
const R0 = A.x.y.z === 2; // const R0 = true
|
||||
const R1 = A.x.y === Y; // const R1 = true
|
||||
const R2 = A.x === X; // const R2 = true
|
||||
```
|
||||
|
||||
Back to [Home](../../readme.md)
|
||||
Reference in New Issue
Block a user