@typed/guard 1.0.0-beta.0 → 1.0.0-beta.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/README.md +10 -6
- package/package.json +16 -12
- package/src/index.ts +1 -1
- package/tsconfig.json +0 -5
package/README.md
CHANGED
|
@@ -85,12 +85,16 @@ const Positive = Schema.Number.pipe(Schema.positive());
|
|
|
85
85
|
const guardDecode = Guard.fromSchemaDecode(Positive);
|
|
86
86
|
|
|
87
87
|
// Inside Effect.gen(function* () { ... })
|
|
88
|
-
const result =
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
)
|
|
88
|
+
const result =
|
|
89
|
+
yield *
|
|
90
|
+
guardDecode(42).pipe(
|
|
91
|
+
Effect.map(
|
|
92
|
+
Option.match({
|
|
93
|
+
onNone: () => "invalid",
|
|
94
|
+
onSome: (n) => `ok: ${n}`,
|
|
95
|
+
}),
|
|
96
|
+
),
|
|
97
|
+
);
|
|
94
98
|
// result === "ok: 42"
|
|
95
99
|
|
|
96
100
|
const even = Guard.liftPredicate((n: number) => n % 2 === 0);
|
package/package.json
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typed/guard",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
4
|
-
"publishConfig": {
|
|
5
|
-
"access": "public"
|
|
6
|
-
},
|
|
3
|
+
"version": "1.0.0-beta.1",
|
|
7
4
|
"type": "module",
|
|
8
5
|
"exports": {
|
|
9
6
|
".": {
|
|
@@ -15,15 +12,22 @@
|
|
|
15
12
|
"import": "./dist/*.js"
|
|
16
13
|
}
|
|
17
14
|
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "[ -d dist ] || rm -f tsconfig.tsbuildinfo; tsc",
|
|
20
|
+
"test": "vitest run --passWithNoTests"
|
|
21
|
+
},
|
|
18
22
|
"dependencies": {
|
|
19
|
-
"effect": "
|
|
23
|
+
"effect": "catalog:"
|
|
20
24
|
},
|
|
21
25
|
"devDependencies": {
|
|
22
|
-
"typescript": "
|
|
23
|
-
"vitest": "
|
|
26
|
+
"typescript": "catalog:",
|
|
27
|
+
"vitest": "catalog:"
|
|
24
28
|
},
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
}
|
|
29
|
+
"files": [
|
|
30
|
+
"dist",
|
|
31
|
+
"src"
|
|
32
|
+
]
|
|
33
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -368,7 +368,7 @@ export const catchTag: {
|
|
|
368
368
|
R | R2
|
|
369
369
|
> {
|
|
370
370
|
const g = getGuard(guard);
|
|
371
|
-
return (i: I) => Effect.catchTag(g(i), tag as any, (e) => Effect.asSome(f(e)));
|
|
371
|
+
return (i: I) => Effect.catchTag(g(i), tag as any, (e) => Effect.asSome(f(e as any)));
|
|
372
372
|
});
|
|
373
373
|
|
|
374
374
|
/**
|