@xylabs/assert 4.13.15 → 4.13.16
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/README.md +23 -51
- package/dist/neutral/index.d.ts +4 -47
- package/package.json +3 -3
- package/build/neutral/index.d.ts +0 -4
- /package/{build → dist}/neutral/assertDefinedEx.d.ts +0 -0
- /package/{build → dist}/neutral/assertDefinedEx.d.ts.map +0 -0
- /package/{build → dist}/neutral/assertEx.d.ts +0 -0
- /package/{build → dist}/neutral/assertEx.d.ts.map +0 -0
- /package/{build → dist}/neutral/index.d.ts.map +0 -0
- /package/{build → dist}/neutral/types.d.ts +0 -0
- /package/{build → dist}/neutral/types.d.ts.map +0 -0
package/README.md
CHANGED
|
@@ -1,82 +1,54 @@
|
|
|
1
|
-
[![logo][]](https://xylabs.com)
|
|
2
|
-
|
|
3
1
|
# @xylabs/assert
|
|
4
2
|
|
|
3
|
+
[![logo][]](https://xylabs.com)
|
|
4
|
+
|
|
5
|
+
[![main-build][]][main-build-link]
|
|
5
6
|
[![npm-badge][]][npm-link]
|
|
6
7
|
[![npm-downloads-badge][]][npm-link]
|
|
7
8
|
[![jsdelivr-badge][]][jsdelivr-link]
|
|
8
9
|
[![npm-license-badge][]](LICENSE)
|
|
10
|
+
[![codacy-badge][]][codacy-link]
|
|
11
|
+
[![codeclimate-badge][]][codeclimate-link]
|
|
12
|
+
[![snyk-badge][]][snyk-link]
|
|
9
13
|
[![socket-badge][]][socket-link]
|
|
10
14
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
## Table of Contents
|
|
14
|
-
|
|
15
|
-
- [Description](#description)
|
|
16
|
-
- [Install](#install)
|
|
17
|
-
- [Maintainers](#maintainers)
|
|
18
|
-
- [License](#license)
|
|
19
|
-
- [Credits](#credits)
|
|
20
|
-
|
|
21
|
-
## Description
|
|
22
|
-
|
|
23
|
-
Common Javascript code that is used throughout XYO projects that use React.
|
|
24
|
-
|
|
25
|
-
## Install
|
|
26
|
-
|
|
27
|
-
Using npm:
|
|
28
|
-
|
|
29
|
-
```sh
|
|
30
|
-
npm i --save @xylabs/assert
|
|
31
|
-
```
|
|
15
|
+
Version: 4.13.15
|
|
32
16
|
|
|
33
|
-
|
|
17
|
+
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
|
|
34
18
|
|
|
35
|
-
|
|
36
|
-
yarn add @xylabs/assert
|
|
37
|
-
```
|
|
19
|
+
## Documentation
|
|
38
20
|
|
|
39
|
-
|
|
21
|
+
Coming Soon!
|
|
40
22
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
Here are some examples of how to use `assertEx` in different scenarios:
|
|
44
|
-
|
|
45
|
-
- Basic usage:
|
|
46
|
-
|
|
47
|
-
```javascript
|
|
48
|
-
import { assertEx } from '@xylabs/assert';
|
|
49
|
-
|
|
50
|
-
const value = getValue(); // This is a function that may return null or undefined
|
|
51
|
-
assertEx(value); // Throws an AssertExError with a default message if value is null or undefined
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
- Using with a custom error message:
|
|
55
|
-
|
|
56
|
-
```javascript
|
|
57
|
-
import { assertEx } from '@xylabs/assert';
|
|
58
|
-
|
|
59
|
-
const value = getValue(); // This function may return null or undefined
|
|
60
|
-
assertEx(value, () => 'Dynamic error message based on some conditions'); // Throws an AssertExError with a dynamic message if value is null or undefined
|
|
23
|
+
Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
|
|
61
24
|
|
|
62
25
|
## Maintainers
|
|
26
|
+
|
|
63
27
|
- [Arie Trouw](https://github.com/arietrouw) ([arietrouw.com](https://arietrouw.com))
|
|
64
|
-
- [Joel Carter](https://github.com/JoelBCarter)
|
|
65
28
|
- [Matt Jones](https://github.com/jonesmac)
|
|
29
|
+
- [Joel Carter](https://github.com/JoelBCarter)
|
|
66
30
|
- [Jordan Trouw](https://github.com/jordantrouw)
|
|
67
31
|
|
|
68
32
|
## License
|
|
69
33
|
|
|
70
|
-
See the [LICENSE](LICENSE) file for license details
|
|
34
|
+
> See the [LICENSE](LICENSE) file for license details
|
|
71
35
|
|
|
72
36
|
## Credits
|
|
73
37
|
|
|
74
|
-
[Made with 🔥and ❄️ by
|
|
38
|
+
[Made with 🔥 and ❄️ by XYLabs](https://xylabs.com)
|
|
75
39
|
|
|
76
40
|
[logo]: https://cdn.xy.company/img/brand/XYPersistentCompany_Logo_Icon_Colored.svg
|
|
77
41
|
|
|
42
|
+
[main-build]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml/badge.svg
|
|
43
|
+
[main-build-link]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml
|
|
78
44
|
[npm-badge]: https://img.shields.io/npm/v/@xylabs/assert.svg
|
|
79
45
|
[npm-link]: https://www.npmjs.com/package/@xylabs/assert
|
|
46
|
+
[codacy-badge]: https://app.codacy.com/project/badge/Grade/c8e15e14f37741c18cfb47ac7245c698
|
|
47
|
+
[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
|
|
48
|
+
[codeclimate-badge]: https://api.codeclimate.com/v1/badges/c5eb068f806f0b047ea7/maintainability
|
|
49
|
+
[codeclimate-link]: https://codeclimate.com/github/xylabs/sdk-js/maintainability
|
|
50
|
+
[snyk-badge]: https://snyk.io/test/github/xylabs/sdk-js/badge.svg?targetFile=package.json
|
|
51
|
+
[snyk-link]: https://snyk.io/test/github/xylabs/sdk-js?targetFile=package.json
|
|
80
52
|
|
|
81
53
|
[npm-downloads-badge]: https://img.shields.io/npm/dw/@xylabs/assert
|
|
82
54
|
[npm-license-badge]: https://img.shields.io/npm/l/@xylabs/assert
|
package/dist/neutral/index.d.ts
CHANGED
|
@@ -1,47 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*
|
|
6
|
-
* Intended for defined checks for variables
|
|
7
|
-
*
|
|
8
|
-
* @param expr - Expression to be evaluated for truthiness
|
|
9
|
-
* @param message - Message in Error if expression is false, may be a function that returns a string
|
|
10
|
-
* @throws AssertExError
|
|
11
|
-
* @returns Value of expression
|
|
12
|
-
*/
|
|
13
|
-
declare function assertDefinedEx<T>(expr: T | undefined, messageFunc?: AssertExMessageFunc<T>): T;
|
|
14
|
-
declare function assertDefinedEx<T, R extends Error>(expr: T | undefined, errorFunc?: AssertExErrorFunc<T, R>): T;
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated - passing a message will soon be required
|
|
17
|
-
*/
|
|
18
|
-
declare function assertDefinedEx<T>(expr: T | undefined): T;
|
|
19
|
-
/**
|
|
20
|
-
* @deprecated - replace string with () => string
|
|
21
|
-
*/
|
|
22
|
-
declare function assertDefinedEx<T>(expr: T | undefined, message?: string): T;
|
|
23
|
-
//# sourceMappingURL=assertDefinedEx.d.ts.map
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
27
|
-
* Intended for simple truthiness checks for variables
|
|
28
|
-
*
|
|
29
|
-
* @param expr - Expression to be evaluated for truthiness
|
|
30
|
-
* @param message - Message in Error if expression is false, may be a function that returns a string
|
|
31
|
-
* @throws AssertExError
|
|
32
|
-
* @returns Value of expression
|
|
33
|
-
*/
|
|
34
|
-
declare function assertEx<T>(expr: T | null | undefined, messageFunc?: AssertExMessageFunc<T>): T;
|
|
35
|
-
declare function assertEx<T, R extends Error>(expr: T | null | undefined, errorFunc?: AssertExErrorFunc<T, R>): T;
|
|
36
|
-
/**
|
|
37
|
-
* @deprecated - passing a message will soon be required
|
|
38
|
-
*/
|
|
39
|
-
declare function assertEx<T>(expr: T | null | undefined): T;
|
|
40
|
-
/**
|
|
41
|
-
* @deprecated - replace string with () => string
|
|
42
|
-
*/
|
|
43
|
-
declare function assertEx<T>(expr: T | null | undefined, message?: string): T;
|
|
44
|
-
//# sourceMappingURL=assertEx.d.ts.map
|
|
45
|
-
|
|
46
|
-
export { assertDefinedEx, assertEx };
|
|
47
|
-
export type { AssertExErrorFunc, AssertExMessageFunc };
|
|
1
|
+
export * from './assertDefinedEx.ts';
|
|
2
|
+
export * from './assertEx.ts';
|
|
3
|
+
export type * from './types.ts';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/assert",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.16",
|
|
4
4
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xylabs",
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"module": "./dist/neutral/index.mjs",
|
|
36
36
|
"types": "./dist/neutral/index.d.ts",
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@xylabs/ts-scripts-yarn3": "^7.0.0-rc.
|
|
39
|
-
"@xylabs/tsconfig": "^7.0.0-rc.
|
|
38
|
+
"@xylabs/ts-scripts-yarn3": "^7.0.0-rc.27",
|
|
39
|
+
"@xylabs/tsconfig": "^7.0.0-rc.27",
|
|
40
40
|
"typescript": "^5.8.3"
|
|
41
41
|
},
|
|
42
42
|
"engines": {
|
package/build/neutral/index.d.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|