11# unknownutil
22
3- [ ![ jsr] ( https://img.shields. io/jsr/v/%40core/ unknownutil?logo=javascript&logoColor=white )] ( https://jsr.io/@core/unknownutil )
3+ [ ![ jsr] ( https://jsr. io/badges/@core/ unknownutil )] ( https://jsr.io/@core/unknownutil )
44[ ![ npm] ( https://img.shields.io/npm/v/unknownutil?logo=npm&logoColor=white )] ( https://www.npmjs.com/package/unknownutil )
5- [ ![ denoland] ( https://img.shields.io/github/v/release/jsr-core/unknownutil?logo=deno&label=denoland )] ( https://github.com/jsr-core /unknownutil/releases )
5+ [ ![ denoland] ( https://img.shields.io/github/v/release/jsr-core/unknownutil?logo=deno&label=denoland )] ( https://deno.land/x /unknownutil )
66[ ![ deno doc] ( https://doc.deno.land/badge.svg )] ( https://doc.deno.land/https/deno.land/x/unknownutil/mod.ts )
77[ ![ test] ( https://github.com/jsr-core/unknownutil/workflows/Test/badge.svg )] ( https://github.com/jsr-core/unknownutil/actions?query=workflow%3ATest )
88[ ![ codecov] ( https://codecov.io/github/jsr-core/unknownutil/graph/badge.svg?token=pfbLRGU5AM )] ( https://codecov.io/github/jsr-core/unknownutil )
@@ -23,7 +23,7 @@ expected type. For example, `isString` (or `is.String`) returns `true` if a
2323given 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
2828const a: unknown = " Hello" ;
2929if (is .String (a )) {
@@ -34,10 +34,7 @@ if (is.String(a)) {
3434For 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
4239const isArticle = is .ObjectOf ({
4340 title: is .String ,
@@ -83,7 +80,7 @@ Additionally, you can manipulate the predicate function returned from
8380similar 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
8885const isArticle = is .ObjectOf ({
8986 title: is .String ,
@@ -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
174171const isFoo = is .ObjectOf ({
175172 foo: is .String ,
@@ -192,10 +189,7 @@ The `assert` function does nothing if a given value is expected type. Otherwise,
192189it 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
200194const a: unknown = " Hello" ;
201195
@@ -213,10 +207,7 @@ The `ensure` function return the value as-is if a given value is expected type.
213207Otherwise, 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
221212const a: unknown = " Hello" ;
222213
@@ -235,10 +226,7 @@ Otherwise, it returns `undefined` that suites with
235226like:
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
243231const a: unknown = " Hello" ;
244232
0 commit comments