@cobol-ts/validate 0.0.14 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
# @cobol-ts/validate
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Compose runtime validators for primitives, arrays, object shapes and dependent checks.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Validation returns structured errors rather than coercing untrusted data into TypeScript types.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Composition
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Use `mustBeString`, `mustBeNumber`, `mustBeArrayOf` and `mustBeObjectWithFields` for untrusted configuration. `combineValidators` combines independent checks; `validateMap` and `validateFlatMap` (and lazy counterparts) compose validation results without pretending that TypeScript annotations validate runtime input.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Validation returns `ErrorsOr`; consumers decide whether to collect diagnostics or use `valueOrThrow` at their boundary.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
## Source and tests
|
|
14
|
+
|
|
15
|
+
**Public entry points:** [validator.ts](./src/validator.ts), [validator.map.flatmap.ts](./src/validator.map.flatmap.ts).
|
|
16
|
+
|
|
17
|
+
**Tests:** [validator.map.flatmap.spec.ts](src/validator.map.flatmap.spec.ts), [validator.spec.ts](src/validator.spec.ts)
|
|
18
|
+
|
|
19
|
+
**Related:** [@cobol-ts/errors](../errors/README.md) · [@cobol-ts/file-catalogue](../../config/file-catalogue/README.md).
|