type-guardians 1.2.4 → 1.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/defined.ts ADDED
@@ -0,0 +1,10 @@
1
+ export function isDefined<Value>(value: Value): value is NonNullable<Value> {
2
+ return value !== undefined && value !== null;
3
+ }
4
+
5
+ export function assertDefined<Value>(
6
+ value: Value,
7
+ message = "Expected a defined value, received undefined or null",
8
+ ): asserts value is NonNullable<Value> {
9
+ if (!isDefined(value)) throw new TypeError(message);
10
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "type-guardians",
3
- "version": "1.2.4",
3
+ "version": "1.2.5",
4
4
  "description": "A lightweight, zero-dependency TypeScript library providing type guards and assertions for safer and more readable code",
5
5
  "keywords": [
6
6
  "typescript",
@@ -13,7 +13,10 @@
13
13
  "guards",
14
14
  "validation"
15
15
  ],
16
- "repository": "https://github.com/pchalupa/type-guardians",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/pchalupa/type-guardians.git"
19
+ },
17
20
  "homepage": "https://github.com/pchalupa/type-guardians#readme",
18
21
  "bugs": {
19
22
  "url": "https://github.com/pchalupa/type-guardians/issues"
package/.autorc DELETED
@@ -1,12 +0,0 @@
1
- {
2
- "noVersionPrefix": true,
3
- "plugins": [
4
- "npm",
5
- [
6
- "conventional-commits",
7
- {
8
- "preset": "angular"
9
- }
10
- ]
11
- ]
12
- }
@@ -1,46 +0,0 @@
1
- name: Code Quality
2
- on: push
3
- jobs:
4
- code-quality:
5
- runs-on: ubuntu-latest
6
- timeout-minutes: 2
7
- steps:
8
- - uses: actions/checkout@v5
9
- - uses: pnpm/action-setup@v4
10
- - uses: biomejs/setup-biome@v2
11
- - uses: actions/setup-node@v4
12
- with:
13
- node-version: 22
14
- cache: 'pnpm'
15
- - run: pnpm install
16
- - run: biome ci .
17
- - run: pnpm ts:check
18
- - run: pnpm test
19
-
20
- publish:
21
- runs-on: ubuntu-latest
22
- timeout-minutes: 10
23
- permissions:
24
- pull-requests: write
25
- contents: read
26
- id-token: write
27
- environment:
28
- name: npm
29
- url: https://www.npmjs.com/package/type-guardians
30
- if: ${{ !contains(github.event.head_commit.message, 'skip ci') }}
31
- needs: code-quality
32
- steps:
33
- - uses: actions/checkout@v5
34
- with:
35
- fetch-depth: 0
36
- ssh-key: ${{ secrets.SSH_KEY }}
37
- - uses: pnpm/action-setup@v4
38
- - uses: actions/setup-node@v4
39
- with:
40
- node-version: 22
41
- cache: 'pnpm'
42
- - run: pnpm install
43
- - run: pnpm release
44
- env:
45
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
package/CHANGELOG.md DELETED
@@ -1,67 +0,0 @@
1
- # 1.2.1 (Thu Aug 21 2025)
2
-
3
- #### 🐛 Bug Fix
4
-
5
- - feat: add error type guard [#5](https://github.com/pchalupa/type-guardians/pull/5) ([@pchalupa](https://github.com/pchalupa))
6
- - chore: setup auto release [#4](https://github.com/pchalupa/type-guardians/pull/4) ([@pchalupa](https://github.com/pchalupa))
7
-
8
- #### ⚠️ Pushed to `main`
9
-
10
- - docs: add error ([@pchalupa](https://github.com/pchalupa))
11
- - ci: needs ([@pchalupa](https://github.com/pchalupa))
12
- - docs: add description and keywords ([@pchalupa](https://github.com/pchalupa))
13
-
14
- #### Authors: 1
15
-
16
- - Petr Chalupa ([@pchalupa](https://github.com/pchalupa))
17
-
18
- ---
19
-
20
- # 1.2.1 (Wed Aug 20 2025)
21
-
22
- #### 🐛 Bug Fix
23
-
24
- - feat: add error type guard [#5](https://github.com/pchalupa/type-guardians/pull/5) ([@pchalupa](https://github.com/pchalupa))
25
- - chore: setup auto release [#4](https://github.com/pchalupa/type-guardians/pull/4) ([@pchalupa](https://github.com/pchalupa))
26
-
27
- #### ⚠️ Pushed to `main`
28
-
29
- - ci: needs ([@pchalupa](https://github.com/pchalupa))
30
- - docs: add description and keywords ([@pchalupa](https://github.com/pchalupa))
31
-
32
- #### Authors: 1
33
-
34
- - Petr Chalupa ([@pchalupa](https://github.com/pchalupa))
35
-
36
- ---
37
-
38
- # 1.2.1 (Wed Aug 20 2025)
39
-
40
- #### 🐛 Bug Fix
41
-
42
- - feat: add error type guard [#5](https://github.com/pchalupa/type-guardians/pull/5) ([@pchalupa](https://github.com/pchalupa))
43
- - chore: setup auto release [#4](https://github.com/pchalupa/type-guardians/pull/4) ([@pchalupa](https://github.com/pchalupa))
44
-
45
- #### ⚠️ Pushed to `main`
46
-
47
- - docs: add description and keywords ([@pchalupa](https://github.com/pchalupa))
48
-
49
- #### Authors: 1
50
-
51
- - Petr Chalupa ([@pchalupa](https://github.com/pchalupa))
52
-
53
- ---
54
-
55
- # 1.2.1 (Tue Aug 19 2025)
56
-
57
- #### 🐛 Bug Fix
58
-
59
- - chore: setup auto release [#4](https://github.com/pchalupa/type-guardians/pull/4) ([@pchalupa](https://github.com/pchalupa))
60
-
61
- #### ⚠️ Pushed to `main`
62
-
63
- - docs: add description and keywords ([@pchalupa](https://github.com/pchalupa))
64
-
65
- #### Authors: 1
66
-
67
- - Petr Chalupa ([@pchalupa](https://github.com/pchalupa))