type-guardians 1.2.1--canary.4.fab7b79.0 → 1.2.2--canary.5.181a8ea.0
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/CHANGELOG.md +13 -0
- package/error.ts +10 -0
- package/number.ts +1 -1
- package/package.json +3 -2
- package/string.ts +1 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# 1.2.1 (Tue Aug 19 2025)
|
|
2
|
+
|
|
3
|
+
#### 🐛 Bug Fix
|
|
4
|
+
|
|
5
|
+
- chore: setup auto release [#4](https://github.com/pchalupa/type-guardians/pull/4) ([@pchalupa](https://github.com/pchalupa))
|
|
6
|
+
|
|
7
|
+
#### ⚠️ Pushed to `main`
|
|
8
|
+
|
|
9
|
+
- docs: add description and keywords ([@pchalupa](https://github.com/pchalupa))
|
|
10
|
+
|
|
11
|
+
#### Authors: 1
|
|
12
|
+
|
|
13
|
+
- Petr Chalupa ([@pchalupa](https://github.com/pchalupa))
|
package/error.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function isError(value: unknown): value is Error {
|
|
2
|
+
return value instanceof Error;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function assertError(
|
|
6
|
+
value: unknown,
|
|
7
|
+
message = `Expected an error, received ${typeof value}`,
|
|
8
|
+
): asserts value is string {
|
|
9
|
+
if (!isError(value)) throw new TypeError(message);
|
|
10
|
+
}
|
package/number.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "type-guardians",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2--canary.5.181a8ea.0",
|
|
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",
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"type": "module",
|
|
24
24
|
"exports": {
|
|
25
25
|
"./string": "./string.ts",
|
|
26
|
-
"./number": "./number.ts"
|
|
26
|
+
"./number": "./number.ts",
|
|
27
|
+
"./error": "./error.ts"
|
|
27
28
|
},
|
|
28
29
|
"scripts": {
|
|
29
30
|
"lint": "biome lint .",
|
package/string.ts
CHANGED