File tree Expand file tree Collapse file tree 2 files changed +8
-11
lines changed Expand file tree Collapse file tree 2 files changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -10,10 +10,10 @@ A utility pack for handling `unknown` type.
1010
1111## Usage
1212
13- It provides ` is ` module for type predicate functions and ` assert ` , ` ensure ` , and
14- ` maybe ` helper functions.
13+ It provides ` is ` and ` as ` module for type predicate functions and ` assert ` ,
14+ ` ensure ` , and ` maybe ` helper functions.
1515
16- ### is\*
16+ ### is\* and as \*
1717
1818Type predicate function is a function which returns ` true ` if a given value is
1919expected type. For example, ` isString ` (or ` is.String ` ) returns ` true ` if a
@@ -28,7 +28,8 @@ if (is.String(a)) {
2828}
2929```
3030
31- For more complex types, you can use ` is*Of ` (or ` is.*Of ` ) functions like:
31+ For more complex types, you can use ` is*Of ` (or ` is.*Of ` ) functions and ` as* `
32+ (or ` as.* ` ) like:
3233
3334``` typescript
3435import { as , is , PredicateType } from " @core/unknownutil" ;
@@ -231,11 +232,6 @@ const a: unknown = "Hello";
231232const _: string = maybe (a , is .String ) ?? " default value" ;
232233```
233234
234- ## Migration
235-
236- See [ GitHub Wiki] ( https://github.com/jsr-core/unknownutil/wiki ) for migration to
237- v3 from v2 or v2 from v1.
238-
239235## License
240236
241237The code follows MIT license written in [ LICENSE] ( ./LICENSE ) . Contributors need
Original file line number Diff line number Diff line change 66 * It provides `is` module for type predicate functions and `assert`, `ensure`, and
77 * `maybe` helper functions.
88 *
9- * ### is\*
9+ * ### is\* and as\*
1010 *
1111 * Type predicate function is a function which returns `true` if a given value is
1212 * expected type. For example, `isString` (or `is.String`) returns `true` if a
2121 * }
2222 * ```
2323 *
24- * For more complex types, you can use `is*Of` (or `is.*Of`) functions like:
24+ * For more complex types, you can use `is*Of` (or `is.*Of`) functions and `as*`
25+ * (or `as.*`) functions like:
2526 *
2627 * ```typescript
2728 * import {
You can’t perform that action at this time.
0 commit comments