Skip to content

Commit ea8956e

Browse files
committed
📝 Update usage
1 parent e902b0a commit ea8956e

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

README.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff 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

1818
Type predicate function is a function which returns `true` if a given value is
1919
expected 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
3435
import { as, is, PredicateType } from "@core/unknownutil";
@@ -231,11 +232,6 @@ const a: unknown = "Hello";
231232
const _: 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

241237
The code follows MIT license written in [LICENSE](./LICENSE). Contributors need

mod.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
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
@@ -21,7 +21,8 @@
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 {

0 commit comments

Comments
 (0)