Skip to content

Commit 792a70d

Browse files
committed
📝 Use @core/unknownutil instead in examples
1 parent 4ce246f commit 792a70d

File tree

6 files changed

+80
-92
lines changed

6 files changed

+80
-92
lines changed

README.md

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ expected type. For example, `isString` (or `is.String`) returns `true` if a
2323
given value is `string`.
2424

2525
```typescript
26-
import { is } from "https://deno.land/x/unknownutil@$MODULE_VERSION/mod.ts";
26+
import { is } from "@core/unknownutil";
2727

2828
const a: unknown = "Hello";
2929
if (is.String(a)) {
@@ -34,10 +34,7 @@ if (is.String(a)) {
3434
For more complex types, you can use `is*Of` (or `is.*Of`) functions like:
3535

3636
```typescript
37-
import {
38-
is,
39-
PredicateType,
40-
} from "https://deno.land/x/unknownutil@$MODULE_VERSION/mod.ts";
37+
import { is, PredicateType } from "@core/unknownutil";
4138

4239
const isArticle = is.ObjectOf({
4340
title: is.String,
@@ -49,7 +46,7 @@ const isArticle = is.ObjectOf({
4946
name: is.String,
5047
url: is.String,
5148
}),
52-
])
49+
]),
5350
),
5451
createTime: is.OptionalOf(is.InstanceOf(Date)),
5552
updateTime: is.OptionalOf(is.InstanceOf(Date)),
@@ -83,7 +80,7 @@ Additionally, you can manipulate the predicate function returned from
8380
similar to TypeScript's `Pick`, `Omit`, `Partial`, `Required` utility types.
8481

8582
```typescript
86-
import { is } from "https://deno.land/x/unknownutil@$MODULE_VERSION/mod.ts";
83+
import { is } from "@core/unknownutil";
8784

8885
const isArticle = is.ObjectOf({
8986
title: is.String,
@@ -95,7 +92,7 @@ const isArticle = is.ObjectOf({
9592
name: is.String,
9693
url: is.String,
9794
}),
98-
])
95+
]),
9996
),
10097
createTime: is.OptionalOf(is.InstanceOf(Date)),
10198
updateTime: is.OptionalOf(is.InstanceOf(Date)),
@@ -169,7 +166,7 @@ If you need an union type or an intersection type, use `isUnionOf` and
169166
`isIntersectionOf` like:
170167

171168
```typescript
172-
import { is } from "https://deno.land/x/unknownutil@$MODULE_VERSION/mod.ts";
169+
import { is } from "@core/unknownutil";
173170

174171
const isFoo = is.ObjectOf({
175172
foo: is.String,
@@ -192,10 +189,7 @@ The `assert` function does nothing if a given value is expected type. Otherwise,
192189
it throws an `AssertError` exception like:
193190

194191
```typescript
195-
import {
196-
assert,
197-
is,
198-
} from "https://deno.land/x/unknownutil@$MODULE_VERSION/mod.ts";
192+
import { assert, is } from "@core/unknownutil";
199193

200194
const a: unknown = "Hello";
201195

@@ -213,10 +207,7 @@ The `ensure` function return the value as-is if a given value is expected type.
213207
Otherwise, it throws an `AssertError` exception like:
214208

215209
```typescript
216-
import {
217-
ensure,
218-
is,
219-
} from "https://deno.land/x/unknownutil@$MODULE_VERSION/mod.ts";
210+
import { ensure, is } from "@core/unknownutil";
220211

221212
const a: unknown = "Hello";
222213

@@ -235,10 +226,7 @@ Otherwise, it returns `undefined` that suites with
235226
like:
236227

237228
```typescript
238-
import {
239-
is,
240-
maybe,
241-
} from "https://deno.land/x/unknownutil@$MODULE_VERSION/mod.ts";
229+
import { is, maybe } from "@core/unknownutil";
242230

243231
const a: unknown = "Hello";
244232

deno.jsonc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"@deno/dnt": "jsr:@deno/dnt@^0.41.1",
77
"@std/assert": "jsr:@std/assert@^0.221.0",
88
"@std/testing": "jsr:@std/testing@^0.221.0",
9-
"https://deno.land/x/unknownutil@$MODULE_VERSION/": "./"
9+
"@core/unknownutil": "./mod.ts"
1010
},
1111
"tasks": {
1212
"build-npm": "deno run -A scripts/build_npm.ts $(git describe --tags --always --dirty)",

0 commit comments

Comments
 (0)