Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/perky-dragons-scream.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@oviirup/utils": minor
---

🚚 rename `assertions` to `guards`
9 changes: 6 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,22 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: oviirup/actions/bun@v1
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- run: bun run typecheck
lint:
name: 🧪 lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: oviirup/actions/bun@v1
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- run: bun run lint
test:
name: 🧪 test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: oviirup/actions/bun@v1
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- run: bun run test
32 changes: 24 additions & 8 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ jobs:
- name: 🔷 Checkout
uses: actions/checkout@v7
- name: 🟢 Setup bun
uses: oviirup/actions/bun@v1
uses: oven-sh/setup-bun@v2
- name: 📦 Install dependencies
run: bun install --frozen-lockfile
- name: 🔧 Select changesets mode
id: changesets-mode
uses: changesets/action/select-mode@v2
Expand All @@ -35,7 +37,9 @@ jobs:
- name: 🔷 Checkout
uses: actions/checkout@v7
- name: 🟢 Setup bun
uses: oviirup/actions/bun@v1
uses: oven-sh/setup-bun@v2
- name: 📦 Install dependencies
run: bun install --frozen-lockfile
- name: 🏷️ Update version
id: version
uses: changesets/action/version@v2
Expand All @@ -58,9 +62,16 @@ jobs:
- name: 🔷 Checkout
uses: actions/checkout@v7
- name: 🟢 Setup bun
uses: oviirup/actions/bun@v1
- name: 📦 Build
run: bun run build
uses: oven-sh/setup-bun@v2
- name: 🟡 Setup node
uses: actions/setup-node@v5
with:
node-version: 24
package-manager-cache: false
- name: 📦 Install dependencies & build
run: |
bun install --frozen-lockfile
bun run build
- name: 📦 Pack artifacts
id: pack
uses: changesets/action/pack@v2
Expand All @@ -76,12 +87,17 @@ jobs:
- name: 🔷 Checkout
uses: actions/checkout@v7
- name: 🟢 Setup bun
uses: oviirup/actions/bun@v1
uses: oven-sh/setup-bun@v2
- name: 🟡 Setup node
uses: actions/setup-node@v5
with:
node-version: 24
registry-url: https://registry.npmjs.org/
- name: 📦 Build
run: bun run build
package-manager-cache: false
- name: 📦 Install dependencies & build
run: |
bun install --frozen-lockfile
bun run build
- name: ⚙️ Publish packages
id: publish
uses: changesets/action/publish@v2
Expand Down
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v24
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@ string.toKebabCase("Hello World");

## API

### Assertions
### Guards

Runtime type checks and a predicate helper. Available from `@oviirup/utils` and `@oviirup/utils/assertions`.
Runtime type checks and a predicate helper. Available from `@oviirup/utils` and `@oviirup/utils/guards`.

- **`isDefined`** - Non-null and non-undefined
- **`isString`**, **`isNumber`**, **`isInteger`**, **`isFloat`** - Primitive number and string checks
Expand Down
2 changes: 1 addition & 1 deletion src/array.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isEmptyArray, isInteger, isTruthy } from "./assertions";
import { isEmptyArray, isInteger, isTruthy } from "./guards";
import { Truthy } from "./types";

/**
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export * as array from "./array";
export * from "./assertions";
export * from "./guards";
export * from "./nanoid";
export * as number from "./number";
export * as object from "./object";
Expand Down
4 changes: 2 additions & 2 deletions src/number.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isNumber, isObject } from "@/assertions";
import { AbbreviateOptions, AbbreviationSymbols, Dictionary } from "@/types";
import { isNumber, isObject } from "./guards";
import { AbbreviateOptions, AbbreviationSymbols, Dictionary } from "./types";

/**
* Checks if a number is within a range
Expand Down
2 changes: 1 addition & 1 deletion src/object.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { toArray } from "./array";
import { isObject } from "./assertions";
import { isObject } from "./guards";
import { Dictionary } from "./types";

/**
Expand Down
4 changes: 2 additions & 2 deletions src/promise.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Awaitable } from "@/types";
import { isNumber } from "./assertions";
import { isNumber } from "./guards";
import { Awaitable } from "./types";

/**
* Delays execution for a specified number of milliseconds
Expand Down
2 changes: 1 addition & 1 deletion src/string.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isEmpty } from "@/assertions";
import { isEmpty } from "./guards";

/**
* Replace backslash to slash
Expand Down
2 changes: 1 addition & 1 deletion tests/array.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it, test } from "bun:test";
import * as array from "@/array";
import * as array from "../src/array";

describe("array", () => {
// biome-ignore format: off
Expand Down
2 changes: 1 addition & 1 deletion tests/assertions.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it, test } from "bun:test";
import * as ast from "@/assertions";
import * as ast from "../src/guards";

describe("assertions", () => {
describe("isNumber", () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/nanoid.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from "bun:test";
import { charset, nanoid } from "@/nanoid";
import { charset, nanoid } from "../src/nanoid";

describe("nanoid", () => {
it("should be ready for 0 size", () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/number.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from "bun:test";
import { AbbreviationSymbols, abbreviate } from "@/number";
import { AbbreviationSymbols, abbreviate } from "../src/number";

describe("abbreviate", () => {
it.each([
Expand Down
2 changes: 1 addition & 1 deletion tests/promise.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from "bun:test";
import { retry, sleep, tryCatch } from "@/promise";
import { retry, sleep, tryCatch } from "../src/promise";

describe("promise", () => {
describe("sleep", () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/string.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from "bun:test";
import * as string from "@/string";
import * as string from "../src/string";

describe("string", () => {
describe("truncate", () => {
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"moduleDetection": "force",
"moduleResolution": "bundler",
"noEmit": true,
"paths": { "@/*": ["./src/*"] },
"resolveJsonModule": true,
"skipLibCheck": true,
"strict": true,
Expand Down