@xylabs/assert 5.0.95 → 5.0.96

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.
Files changed (2) hide show
  1. package/README.md +118 -92
  2. package/package.json +6 -9
package/README.md CHANGED
@@ -1,38 +1,52 @@
1
1
  # @xylabs/assert
2
2
 
3
- [![logo][]](https://xylabs.com)
3
+ [![npm][npm-badge]][npm-link]
4
+ [![license][license-badge]][license-link]
4
5
 
5
- [![main-build][]][main-build-link]
6
- [![npm-badge][]][npm-link]
7
- [![npm-downloads-badge][]][npm-link]
8
- [![jsdelivr-badge][]][jsdelivr-link]
9
- [![npm-license-badge][]](LICENSE)
10
- [![codacy-badge][]][codacy-link]
11
- [![codeclimate-badge][]][codeclimate-link]
12
- [![snyk-badge][]][snyk-link]
13
- [![socket-badge][]][socket-link]
6
+ > Base functionality used throughout XY Labs TypeScript/JavaScript libraries
14
7
 
8
+ ## Install
15
9
 
16
- Base functionality used throughout XY Labs TypeScript/JavaScript libraries
10
+ Using npm:
17
11
 
12
+ ```sh
13
+ npm install {{name}}
14
+ ```
18
15
 
16
+ Using yarn:
19
17
 
20
- ## Reference
18
+ ```sh
19
+ yarn add {{name}}
20
+ ```
21
21
 
22
- **@xylabs/assert**
22
+ Using pnpm:
23
23
 
24
- ***
24
+ ```sh
25
+ pnpm add {{name}}
26
+ ```
25
27
 
26
- ## Functions
28
+ Using bun:
29
+
30
+ ```sh
31
+ bun add {{name}}
32
+ ```
27
33
 
28
- | Function | Description |
29
- | ------ | ------ |
30
- | [assertDefinedEx](#functions/assertDefinedEx) | Implementation of assertDefinedEx that handles all overloads. |
31
- | [assertEx](#functions/assertEx) | Implementation of assertEx that handles all overloads. |
32
34
 
33
- ### functions
35
+ ## License
34
36
 
35
- ### <a id="assertDefinedEx"></a>assertDefinedEx
37
+ See the [LICENSE](LICENSE) file for license rights and limitations (LGPL-3.0-only).
38
+
39
+ ## Reference
40
+
41
+ ### packages
42
+
43
+ ### assert
44
+
45
+ ### .temp-typedoc
46
+
47
+ ### functions
48
+
49
+ ### <a id="assertDefinedEx"></a>assertDefinedEx
36
50
 
37
51
  [**@xylabs/assert**](#../README)
38
52
 
@@ -43,7 +57,7 @@ Implementation of assertDefinedEx that handles all overloads.
43
57
  ## Call Signature
44
58
 
45
59
  ```ts
46
- function assertDefinedEx<T>(expr: T | undefined, messageFunc?: AssertExMessageFunc<T>): T;
60
+ function assertDefinedEx<T>(expr, messageFunc?): T;
47
61
  ```
48
62
 
49
63
  Asserts that a value is defined (not undefined) and returns the value.
@@ -51,16 +65,25 @@ Throws an error if the value is undefined.
51
65
 
52
66
  ### Type Parameters
53
67
 
54
- | Type Parameter | Description |
55
- | ------ | ------ |
56
- | `T` | The type of value to check |
68
+ ### T
69
+
70
+ `T`
71
+
72
+ The type of value to check
57
73
 
58
74
  ### Parameters
59
75
 
60
- | Parameter | Type | Description |
61
- | ------ | ------ | ------ |
62
- | `expr` | `T` \| `undefined` | Expression to be evaluated for being defined |
63
- | `messageFunc?` | `AssertExMessageFunc`\<`T`\> | Function that returns a message for the error if expression is undefined |
76
+ ### expr
77
+
78
+ `T` \| `undefined`
79
+
80
+ Expression to be evaluated for being defined
81
+
82
+ ### messageFunc?
83
+
84
+ `AssertExMessageFunc`\<`T`\>
85
+
86
+ Function that returns a message for the error if expression is undefined
64
87
 
65
88
  ### Returns
66
89
 
@@ -87,7 +110,7 @@ const safeConfig = assertDefinedEx(config, () => 'Config failed to load')
87
110
  ## Call Signature
88
111
 
89
112
  ```ts
90
- function assertDefinedEx<T, R>(expr: T | undefined, errorFunc?: AssertExErrorFunc<T, R>): T;
113
+ function assertDefinedEx<T, R>(expr, errorFunc?): T;
91
114
  ```
92
115
 
93
116
  Asserts that a value is defined (not undefined) and returns the value.
@@ -95,17 +118,31 @@ Throws a custom error if the value is undefined.
95
118
 
96
119
  ### Type Parameters
97
120
 
98
- | Type Parameter | Description |
99
- | ------ | ------ |
100
- | `T` | The type of value to check |
101
- | `R` *extends* `Error` | The type of error to throw |
121
+ ### T
122
+
123
+ `T`
124
+
125
+ The type of value to check
126
+
127
+ ### R
128
+
129
+ `R` *extends* `Error`
130
+
131
+ The type of error to throw
102
132
 
103
133
  ### Parameters
104
134
 
105
- | Parameter | Type | Description |
106
- | ------ | ------ | ------ |
107
- | `expr` | `T` \| `undefined` | Expression to be evaluated for being defined |
108
- | `errorFunc?` | `AssertExErrorFunc`\<`T`, `R`\> | Function that returns a custom error instance if expression is undefined |
135
+ ### expr
136
+
137
+ `T` \| `undefined`
138
+
139
+ Expression to be evaluated for being defined
140
+
141
+ ### errorFunc?
142
+
143
+ `AssertExErrorFunc`\<`T`, `R`\>
144
+
145
+ Function that returns a custom error instance if expression is undefined
109
146
 
110
147
  ### Returns
111
148
 
@@ -124,7 +161,7 @@ Custom error returned by errorFunc
124
161
  const user = assertDefinedEx(getUser(), () => new UserNotFoundError('User not found'))
125
162
  ```
126
163
 
127
- ### <a id="assertEx"></a>assertEx
164
+ ### <a id="assertEx"></a>assertEx
128
165
 
129
166
  [**@xylabs/assert**](#../README)
130
167
 
@@ -135,7 +172,7 @@ Implementation of assertEx that handles all overloads.
135
172
  ## Call Signature
136
173
 
137
174
  ```ts
138
- function assertEx<T>(expr: T | null | undefined, messageFunc?: AssertExMessageFunc<T>): T;
175
+ function assertEx<T>(expr, messageFunc?): T;
139
176
  ```
140
177
 
141
178
  Asserts that an expression is truthy and returns the value.
@@ -143,16 +180,25 @@ Throws an error if the expression is falsy.
143
180
 
144
181
  ### Type Parameters
145
182
 
146
- | Type Parameter | Description |
147
- | ------ | ------ |
148
- | `T` | The type of value to check |
183
+ ### T
184
+
185
+ `T`
186
+
187
+ The type of value to check
149
188
 
150
189
  ### Parameters
151
190
 
152
- | Parameter | Type | Description |
153
- | ------ | ------ | ------ |
154
- | `expr` | `T` \| `null` \| `undefined` | Expression to be evaluated for truthiness |
155
- | `messageFunc?` | `AssertExMessageFunc`\<`T`\> | Function that returns a message for the error if expression is falsy |
191
+ ### expr
192
+
193
+ `T` \| `null` \| `undefined`
194
+
195
+ Expression to be evaluated for truthiness
196
+
197
+ ### messageFunc?
198
+
199
+ `AssertExMessageFunc`\<`T`\>
200
+
201
+ Function that returns a message for the error if expression is falsy
156
202
 
157
203
  ### Returns
158
204
 
@@ -179,7 +225,7 @@ const safeConfig = assertEx(config, () => 'Config failed to load')
179
225
  ## Call Signature
180
226
 
181
227
  ```ts
182
- function assertEx<T, R>(expr: T | null | undefined, errorFunc?: AssertExErrorFunc<T, R>): T;
228
+ function assertEx<T, R>(expr, errorFunc?): T;
183
229
  ```
184
230
 
185
231
  Asserts that an expression is truthy and returns the value.
@@ -187,17 +233,31 @@ Throws a custom error if the expression is falsy.
187
233
 
188
234
  ### Type Parameters
189
235
 
190
- | Type Parameter | Description |
191
- | ------ | ------ |
192
- | `T` | The type of value to check |
193
- | `R` *extends* `Error` | The type of error to throw |
236
+ ### T
237
+
238
+ `T`
239
+
240
+ The type of value to check
241
+
242
+ ### R
243
+
244
+ `R` *extends* `Error`
245
+
246
+ The type of error to throw
194
247
 
195
248
  ### Parameters
196
249
 
197
- | Parameter | Type | Description |
198
- | ------ | ------ | ------ |
199
- | `expr` | `T` \| `null` \| `undefined` | Expression to be evaluated for truthiness |
200
- | `errorFunc?` | `AssertExErrorFunc`\<`T`, `R`\> | Function that returns a custom error instance if expression is falsy |
250
+ ### expr
251
+
252
+ `T` \| `null` \| `undefined`
253
+
254
+ Expression to be evaluated for truthiness
255
+
256
+ ### errorFunc?
257
+
258
+ `AssertExErrorFunc`\<`T`, `R`\>
259
+
260
+ Function that returns a custom error instance if expression is falsy
201
261
 
202
262
  ### Returns
203
263
 
@@ -217,41 +277,7 @@ const user = assertEx(getUser(), () => new UserNotFoundError('User not found'))
217
277
  ```
218
278
 
219
279
 
220
- Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
221
-
222
- ## Maintainers
223
-
224
- - [Arie Trouw](https://github.com/arietrouw) ([arietrouw.com](https://arietrouw.com))
225
- - [Matt Jones](https://github.com/jonesmac)
226
- - [Joel Carter](https://github.com/JoelBCarter)
227
- - [Jordan Trouw](https://github.com/jordantrouw)
228
-
229
- ## License
230
-
231
- > See the [LICENSE](LICENSE) file for license details
232
-
233
- ## Credits
234
-
235
- [Made with 🔥 and ❄️ by XYLabs](https://xylabs.com)
236
-
237
- [logo]: https://cdn.xy.company/img/brand/XYPersistentCompany_Logo_Icon_Colored.svg
238
-
239
- [main-build]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml/badge.svg
240
- [main-build-link]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml
241
280
  [npm-badge]: https://img.shields.io/npm/v/@xylabs/assert.svg
242
281
  [npm-link]: https://www.npmjs.com/package/@xylabs/assert
243
- [codacy-badge]: https://app.codacy.com/project/badge/Grade/c8e15e14f37741c18cfb47ac7245c698
244
- [codacy-link]: https://www.codacy.com/gh/xylabs/sdk-js/dashboard?utm_source=github.com&utm_medium=referral&utm_content=xylabs/sdk-js&utm_campaign=Badge_Grade
245
- [codeclimate-badge]: https://api.codeclimate.com/v1/badges/c5eb068f806f0b047ea7/maintainability
246
- [codeclimate-link]: https://codeclimate.com/github/xylabs/sdk-js/maintainability
247
- [snyk-badge]: https://snyk.io/test/github/xylabs/sdk-js/badge.svg?targetFile=package.json
248
- [snyk-link]: https://snyk.io/test/github/xylabs/sdk-js?targetFile=package.json
249
-
250
- [npm-downloads-badge]: https://img.shields.io/npm/dw/@xylabs/assert
251
- [npm-license-badge]: https://img.shields.io/npm/l/@xylabs/assert
252
-
253
- [jsdelivr-badge]: https://data.jsdelivr.com/v1/package/npm/@xylabs/assert/badge
254
- [jsdelivr-link]: https://www.jsdelivr.com/package/npm/@xylabs/assert
255
-
256
- [socket-badge]: https://socket.dev/api/badge/npm/package/@xylabs/assert
257
- [socket-link]: https://socket.dev/npm/package/@xylabs/assert
282
+ [license-badge]: https://img.shields.io/npm/l/@xylabs/assert.svg
283
+ [license-link]: https://github.com/xylabs/sdk-js/blob/main/LICENSE
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xylabs/assert",
3
- "version": "5.0.95",
3
+ "version": "5.0.96",
4
4
  "description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
5
5
  "keywords": [
6
6
  "xylabs",
@@ -28,12 +28,10 @@
28
28
  "exports": {
29
29
  ".": {
30
30
  "types": "./dist/neutral/index.d.ts",
31
- "import": "./dist/neutral/index.mjs",
32
31
  "default": "./dist/neutral/index.mjs"
33
32
  },
34
33
  "./package.json": "./package.json"
35
34
  },
36
- "types": "./dist/neutral/index.d.ts",
37
35
  "files": [
38
36
  "dist",
39
37
  "!**/*.bench.*",
@@ -42,14 +40,13 @@
42
40
  "README.md"
43
41
  ],
44
42
  "devDependencies": {
45
- "@types/node": "^25.5.2",
46
- "@xylabs/ts-scripts-common": "~7.8.4",
47
- "@xylabs/ts-scripts-pnpm": "~7.8.4",
48
- "@xylabs/tsconfig": "~7.8.4",
43
+ "@types/node": "^25.6.0",
44
+ "@xylabs/toolchain": "~7.10.4",
45
+ "@xylabs/tsconfig": "~7.10.4",
49
46
  "esbuild": "^0.28.0",
50
47
  "typescript": "^5",
51
- "vite": "^8.0.5",
52
- "vitest": "^4.1.2"
48
+ "vite": "^8.0.8",
49
+ "vitest": "^4.1.4"
53
50
  },
54
51
  "engines": {
55
52
  "node": ">=18"