sibyl-ts 0.7.0 → 0.7.1
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/CHANGELOG.md +6 -0
- package/README.md +8 -12
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.7.1] - 2026-02-05
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- README.md for literal validation
|
|
13
|
+
|
|
8
14
|
## [0.7.0] - 2026-01-25
|
|
9
15
|
|
|
10
16
|
### Added
|
package/README.md
CHANGED
|
@@ -160,14 +160,10 @@ try {
|
|
|
160
160
|
### Union Types
|
|
161
161
|
|
|
162
162
|
```typescript
|
|
163
|
-
import { union, str, num,
|
|
163
|
+
import { union, str, num, lit } from 'sibyl-ts';
|
|
164
164
|
|
|
165
165
|
// Dominator mode can be lethal or non-lethal
|
|
166
|
-
const dominatorModeValidator = union([
|
|
167
|
-
literal('paralyzer'),
|
|
168
|
-
literal('eliminator'),
|
|
169
|
-
literal('decomposer'),
|
|
170
|
-
]);
|
|
166
|
+
const dominatorModeValidator = union([lit('paralyzer'), lit('eliminator'), lit('decomposer')]);
|
|
171
167
|
|
|
172
168
|
dominatorModeValidator.judge('paralyzer'); // OK
|
|
173
169
|
dominatorModeValidator.judge('eliminator'); // OK
|
|
@@ -587,7 +583,7 @@ personTupleValidator.judge(['Akane']); // ✗ Missing element
|
|
|
587
583
|
Union type validation (OR logic).
|
|
588
584
|
|
|
589
585
|
```typescript
|
|
590
|
-
import { union, str, num,
|
|
586
|
+
import { union, str, num, lit } from 'sibyl-ts';
|
|
591
587
|
|
|
592
588
|
// Can be string OR number
|
|
593
589
|
const idValidator = union([str(), num()]);
|
|
@@ -596,7 +592,7 @@ idValidator.judge(42); // ✓
|
|
|
596
592
|
idValidator.judge(true); // ✗ Not in union
|
|
597
593
|
|
|
598
594
|
// Dominator modes
|
|
599
|
-
const modeValidator = union([
|
|
595
|
+
const modeValidator = union([lit('paralyzer'), lit('eliminator')]);
|
|
600
596
|
modeValidator.judge('paralyzer'); // ✓
|
|
601
597
|
```
|
|
602
598
|
|
|
@@ -655,19 +651,19 @@ coefficientsValidator.judge({
|
|
|
655
651
|
|
|
656
652
|
### Literal & Enum Validators
|
|
657
653
|
|
|
658
|
-
#### `
|
|
654
|
+
#### `lit(value)`
|
|
659
655
|
|
|
660
656
|
Exact value validation.
|
|
661
657
|
|
|
662
658
|
```typescript
|
|
663
|
-
import {
|
|
659
|
+
import { lit } from 'sibyl-ts';
|
|
664
660
|
|
|
665
|
-
const roleValidator =
|
|
661
|
+
const roleValidator = lit('inspector');
|
|
666
662
|
roleValidator.judge('inspector'); // ✓
|
|
667
663
|
roleValidator.judge('enforcer'); // ✗ Not exact match
|
|
668
664
|
|
|
669
665
|
// Works with numbers, booleans too
|
|
670
|
-
const statusCodeValidator =
|
|
666
|
+
const statusCodeValidator = lit(200);
|
|
671
667
|
statusCodeValidator.judge(200); // ✓
|
|
672
668
|
statusCodeValidator.judge(404); // ✗
|
|
673
669
|
```
|