Skip to content

Commit

Permalink
Merge pull request #77 from jsr-core/fit-jsr
Browse files Browse the repository at this point in the history
📝 Update docs for JSR
  • Loading branch information
lambdalisue authored Apr 14, 2024
2 parents d94d0c2 + 792a70d commit 3b10164
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 93 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ jobs:
timeout-minutes: 5
- run: |
deno task coverage --lcov > coverage.lcov
- uses: codecov/codecov-action@v3
- uses: codecov/codecov-action@v4
with:
os: ${{ runner.os }}
files: ./coverage.lcov
token: ${{ secrets.CODECOV_TOKEN }}

bench:
runs-on: ubuntu-latest
Expand Down
30 changes: 9 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# unknownutil

[![jsr](https://img.shields.io/jsr/v/%40core/unknownutil?logo=javascript&logoColor=white)](https://jsr.io/@core/unknownutil)
[![jsr](https://jsr.io/badges/@core/unknownutil)](https://jsr.io/@core/unknownutil)
[![npm](https://img.shields.io/npm/v/unknownutil?logo=npm&logoColor=white)](https://www.npmjs.com/package/unknownutil)
[![denoland](https://img.shields.io/github/v/release/jsr-core/unknownutil?logo=deno&label=denoland)](https://github.com/jsr-core/unknownutil/releases)
[![denoland](https://img.shields.io/github/v/release/jsr-core/unknownutil?logo=deno&label=denoland)](https://deno.land/x/unknownutil)
[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/unknownutil/mod.ts)
[![test](https://github.com/jsr-core/unknownutil/workflows/Test/badge.svg)](https://github.com/jsr-core/unknownutil/actions?query=workflow%3ATest)
[![codecov](https://codecov.io/github/jsr-core/unknownutil/graph/badge.svg?token=pfbLRGU5AM)](https://codecov.io/github/jsr-core/unknownutil)
Expand All @@ -23,7 +23,7 @@ expected type. For example, `isString` (or `is.String`) returns `true` if a
given value is `string`.

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

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

```typescript
import {
is,
PredicateType,
} from "https://deno.land/x/unknownutil@$MODULE_VERSION/mod.ts";
import { is, PredicateType } from "@core/unknownutil";

const isArticle = is.ObjectOf({
title: is.String,
Expand Down Expand Up @@ -83,7 +80,7 @@ Additionally, you can manipulate the predicate function returned from
similar to TypeScript's `Pick`, `Omit`, `Partial`, `Required` utility types.

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

const isArticle = is.ObjectOf({
title: is.String,
Expand Down Expand Up @@ -169,7 +166,7 @@ If you need an union type or an intersection type, use `isUnionOf` and
`isIntersectionOf` like:

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

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

```typescript
import {
assert,
is,
} from "https://deno.land/x/unknownutil@$MODULE_VERSION/mod.ts";
import { assert, is } from "@core/unknownutil";

const a: unknown = "Hello";

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

```typescript
import {
ensure,
is,
} from "https://deno.land/x/unknownutil@$MODULE_VERSION/mod.ts";
import { ensure, is } from "@core/unknownutil";

const a: unknown = "Hello";

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

```typescript
import {
is,
maybe,
} from "https://deno.land/x/unknownutil@$MODULE_VERSION/mod.ts";
import { is, maybe } from "@core/unknownutil";

const a: unknown = "Hello";

Expand Down
2 changes: 1 addition & 1 deletion deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"@deno/dnt": "jsr:@deno/dnt@^0.41.1",
"@std/assert": "jsr:@std/assert@^0.221.0",
"@std/testing": "jsr:@std/testing@^0.221.0",
"https://deno.land/x/unknownutil@$MODULE_VERSION/": "./"
"@core/unknownutil": "./mod.ts"
},
"tasks": {
"build-npm": "deno run -A scripts/build_npm.ts $(git describe --tags --always --dirty)",
Expand Down
Loading

0 comments on commit 3b10164

Please sign in to comment.