@xylabs/exists 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.
- package/README.md +46 -63
- package/package.json +6 -9
package/README.md
CHANGED
|
@@ -1,44 +1,59 @@
|
|
|
1
1
|
# @xylabs/exists
|
|
2
2
|
|
|
3
|
-
[![
|
|
3
|
+
[![npm][npm-badge]][npm-link]
|
|
4
|
+
[![license][license-badge]][license-link]
|
|
4
5
|
|
|
5
|
-
|
|
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
|
-
|
|
10
|
+
Using npm:
|
|
17
11
|
|
|
12
|
+
```sh
|
|
13
|
+
npm install {{name}}
|
|
14
|
+
```
|
|
18
15
|
|
|
16
|
+
Using yarn:
|
|
19
17
|
|
|
20
|
-
|
|
18
|
+
```sh
|
|
19
|
+
yarn add {{name}}
|
|
20
|
+
```
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
Using pnpm:
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
```sh
|
|
25
|
+
pnpm add {{name}}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Using bun:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
bun add {{name}}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
## License
|
|
36
|
+
|
|
37
|
+
See the [LICENSE](LICENSE) file for license rights and limitations (LGPL-3.0-only).
|
|
38
|
+
|
|
39
|
+
## Reference
|
|
40
|
+
|
|
41
|
+
### packages
|
|
25
42
|
|
|
26
|
-
|
|
43
|
+
### exists
|
|
27
44
|
|
|
28
|
-
|
|
29
|
-
| ------ | ------ |
|
|
30
|
-
| [exists](#functions/exists) | Used to type narrow an object which is possibly null or undefined. Works well with functional Array methods. For example: |
|
|
45
|
+
### .temp-typedoc
|
|
31
46
|
|
|
32
|
-
### functions
|
|
47
|
+
### functions
|
|
33
48
|
|
|
34
|
-
|
|
49
|
+
### <a id="exists"></a>exists
|
|
35
50
|
|
|
36
51
|
[**@xylabs/exists**](#../README)
|
|
37
52
|
|
|
38
53
|
***
|
|
39
54
|
|
|
40
55
|
```ts
|
|
41
|
-
function exists<T>(x
|
|
56
|
+
function exists<T>(x?): x is NonNullable<T>;
|
|
42
57
|
```
|
|
43
58
|
|
|
44
59
|
Used to type narrow an object which is possibly null or undefined. Works well
|
|
@@ -46,15 +61,17 @@ with functional Array methods. For example:
|
|
|
46
61
|
|
|
47
62
|
## Type Parameters
|
|
48
63
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
64
|
+
### T
|
|
65
|
+
|
|
66
|
+
`T`
|
|
52
67
|
|
|
53
68
|
## Parameters
|
|
54
69
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
70
|
+
### x?
|
|
71
|
+
|
|
72
|
+
`T` \| `null`
|
|
73
|
+
|
|
74
|
+
The object which is potentially undefined or null
|
|
58
75
|
|
|
59
76
|
## Returns
|
|
60
77
|
|
|
@@ -69,41 +86,7 @@ const payloads: XyoPayload[] = boundWitness._payloads?.filter(exists) || []
|
|
|
69
86
|
```
|
|
70
87
|
|
|
71
88
|
|
|
72
|
-
Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
|
|
73
|
-
|
|
74
|
-
## Maintainers
|
|
75
|
-
|
|
76
|
-
- [Arie Trouw](https://github.com/arietrouw) ([arietrouw.com](https://arietrouw.com))
|
|
77
|
-
- [Matt Jones](https://github.com/jonesmac)
|
|
78
|
-
- [Joel Carter](https://github.com/JoelBCarter)
|
|
79
|
-
- [Jordan Trouw](https://github.com/jordantrouw)
|
|
80
|
-
|
|
81
|
-
## License
|
|
82
|
-
|
|
83
|
-
> See the [LICENSE](LICENSE) file for license details
|
|
84
|
-
|
|
85
|
-
## Credits
|
|
86
|
-
|
|
87
|
-
[Made with 🔥 and ❄️ by XYLabs](https://xylabs.com)
|
|
88
|
-
|
|
89
|
-
[logo]: https://cdn.xy.company/img/brand/XYPersistentCompany_Logo_Icon_Colored.svg
|
|
90
|
-
|
|
91
|
-
[main-build]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml/badge.svg
|
|
92
|
-
[main-build-link]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml
|
|
93
89
|
[npm-badge]: https://img.shields.io/npm/v/@xylabs/exists.svg
|
|
94
90
|
[npm-link]: https://www.npmjs.com/package/@xylabs/exists
|
|
95
|
-
[
|
|
96
|
-
[
|
|
97
|
-
[codeclimate-badge]: https://api.codeclimate.com/v1/badges/c5eb068f806f0b047ea7/maintainability
|
|
98
|
-
[codeclimate-link]: https://codeclimate.com/github/xylabs/sdk-js/maintainability
|
|
99
|
-
[snyk-badge]: https://snyk.io/test/github/xylabs/sdk-js/badge.svg?targetFile=package.json
|
|
100
|
-
[snyk-link]: https://snyk.io/test/github/xylabs/sdk-js?targetFile=package.json
|
|
101
|
-
|
|
102
|
-
[npm-downloads-badge]: https://img.shields.io/npm/dw/@xylabs/exists
|
|
103
|
-
[npm-license-badge]: https://img.shields.io/npm/l/@xylabs/exists
|
|
104
|
-
|
|
105
|
-
[jsdelivr-badge]: https://data.jsdelivr.com/v1/package/npm/@xylabs/exists/badge
|
|
106
|
-
[jsdelivr-link]: https://www.jsdelivr.com/package/npm/@xylabs/exists
|
|
107
|
-
|
|
108
|
-
[socket-badge]: https://socket.dev/api/badge/npm/package/@xylabs/exists
|
|
109
|
-
[socket-link]: https://socket.dev/npm/package/@xylabs/exists
|
|
91
|
+
[license-badge]: https://img.shields.io/npm/l/@xylabs/exists.svg
|
|
92
|
+
[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/exists",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.96",
|
|
4
4
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"exists",
|
|
@@ -29,12 +29,10 @@
|
|
|
29
29
|
"exports": {
|
|
30
30
|
".": {
|
|
31
31
|
"types": "./dist/neutral/index.d.ts",
|
|
32
|
-
"import": "./dist/neutral/index.mjs",
|
|
33
32
|
"default": "./dist/neutral/index.mjs"
|
|
34
33
|
},
|
|
35
34
|
"./package.json": "./package.json"
|
|
36
35
|
},
|
|
37
|
-
"types": "./dist/neutral/index.d.ts",
|
|
38
36
|
"files": [
|
|
39
37
|
"dist",
|
|
40
38
|
"!**/*.bench.*",
|
|
@@ -43,14 +41,13 @@
|
|
|
43
41
|
"README.md"
|
|
44
42
|
],
|
|
45
43
|
"devDependencies": {
|
|
46
|
-
"@types/node": "^25.
|
|
47
|
-
"@xylabs/
|
|
48
|
-
"@xylabs/
|
|
49
|
-
"@xylabs/tsconfig": "~7.8.4",
|
|
44
|
+
"@types/node": "^25.6.0",
|
|
45
|
+
"@xylabs/toolchain": "~7.10.4",
|
|
46
|
+
"@xylabs/tsconfig": "~7.10.4",
|
|
50
47
|
"esbuild": "^0.28.0",
|
|
51
48
|
"typescript": "^5",
|
|
52
|
-
"vite": "^8.0.
|
|
53
|
-
"vitest": "^4.1.
|
|
49
|
+
"vite": "^8.0.8",
|
|
50
|
+
"vitest": "^4.1.4"
|
|
54
51
|
},
|
|
55
52
|
"engines": {
|
|
56
53
|
"node": ">=18"
|