Decompose monolithic readme into docs/ directory structure
This commit is contained in:
20
docs/values/clean.md
Normal file
20
docs/values/clean.md
Normal file
@@ -0,0 +1,20 @@
|
||||
[Overview](../overview.md) | [Installation](../installation.md) | [Usage](../usage.md) | [Types](../types/) | **Values** | [Syntax](../syntax/) | [TypeRegistry](../type-registry.md) | [TypeCheck](../type-check.md)
|
||||
|
||||
# Clean
|
||||
|
||||
Use Clean to remove excess properties from a value. This function does not check the value and returns an unknown type. You should Check the result before use. Clean is a mutable operation. To avoid mutation, Clone the value first.
|
||||
|
||||
```typescript
|
||||
const T = Type.Object({
|
||||
x: Type.Number(),
|
||||
y: Type.Number(),
|
||||
});
|
||||
|
||||
const X = Value.Clean(T, null); // const 'X = null
|
||||
|
||||
const Y = Value.Clean(T, { x: 1 }); // const 'Y = { x: 1 }
|
||||
|
||||
const Z = Value.Clean(T, { x: 1, y: 2, z: 3 }); // const 'Z = { x: 1, y: 2 }
|
||||
```
|
||||
|
||||
Back to [Home](../../readme.md)
|
||||
Reference in New Issue
Block a user