@xylabs/set 4.13.19 → 4.13.21

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 CHANGED
@@ -12,13 +12,113 @@
12
12
  [![snyk-badge][]][snyk-link]
13
13
  [![socket-badge][]][socket-link]
14
14
 
15
- Version: 4.13.15
16
15
 
17
16
  Base functionality used throughout XY Labs TypeScript/JavaScript libraries
18
17
 
19
- ## Documentation
18
+ ## API Documentation
19
+
20
+ **@xylabs/set**
21
+
22
+ ***
23
+
24
+ ## Functions
25
+
26
+ - [difference](#functions/difference)
27
+ - [intersection](#functions/intersection)
28
+ - [union](#functions/union)
29
+
30
+ ### functions
31
+
32
+ ### <a id="difference"></a>difference
33
+
34
+ [**@xylabs/set**](#../README)
35
+
36
+ ***
37
+
38
+ ```ts
39
+ function difference<TKey>(a, b): Set<TKey>;
40
+ ```
41
+
42
+ ## Type Parameters
43
+
44
+ ### TKey
45
+
46
+ `TKey`
47
+
48
+ ## Parameters
49
+
50
+ ### a
51
+
52
+ `Set`\<`TKey`\>
53
+
54
+ ### b
55
+
56
+ `Set`\<`TKey`\>
57
+
58
+ ## Returns
59
+
60
+ `Set`\<`TKey`\>
61
+
62
+ ### <a id="intersection"></a>intersection
63
+
64
+ [**@xylabs/set**](#../README)
65
+
66
+ ***
67
+
68
+ ```ts
69
+ function intersection<TKey>(a, b): Set<TKey>;
70
+ ```
71
+
72
+ ## Type Parameters
73
+
74
+ ### TKey
75
+
76
+ `TKey`
77
+
78
+ ## Parameters
79
+
80
+ ### a
81
+
82
+ `Set`\<`TKey`\>
83
+
84
+ ### b
85
+
86
+ `Set`\<`TKey`\>
87
+
88
+ ## Returns
89
+
90
+ `Set`\<`TKey`\>
91
+
92
+ ### <a id="union"></a>union
93
+
94
+ [**@xylabs/set**](#../README)
95
+
96
+ ***
97
+
98
+ ```ts
99
+ function union<TKey>(a, b): Set<TKey>;
100
+ ```
101
+
102
+ ## Type Parameters
103
+
104
+ ### TKey
105
+
106
+ `TKey`
107
+
108
+ ## Parameters
109
+
110
+ ### a
111
+
112
+ `Set`\<`TKey`\>
113
+
114
+ ### b
115
+
116
+ `Set`\<`TKey`\>
117
+
118
+ ## Returns
119
+
120
+ `Set`\<`TKey`\>
20
121
 
21
- Coming Soon!
22
122
 
23
123
  Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
24
124
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xylabs/set",
3
- "version": "4.13.19",
3
+ "version": "4.13.21",
4
4
  "description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
5
5
  "keywords": [
6
6
  "set",
@@ -29,18 +29,21 @@
29
29
  "exports": {
30
30
  ".": {
31
31
  "types": "./dist/neutral/index.d.ts",
32
+ "source": "./src/index.ts",
32
33
  "default": "./dist/neutral/index.mjs"
33
34
  },
34
35
  "./package.json": "./package.json"
35
36
  },
36
37
  "module": "./dist/neutral/index.mjs",
38
+ "source": "./src/index.ts",
37
39
  "types": "./dist/neutral/index.d.ts",
38
- "workspaces": [
39
- "packages/**/*"
40
+ "files": [
41
+ "dist",
42
+ "src"
40
43
  ],
41
44
  "devDependencies": {
42
- "@xylabs/ts-scripts-yarn3": "^7.0.0-rc.27",
43
- "@xylabs/tsconfig": "^7.0.0-rc.27",
45
+ "@xylabs/ts-scripts-yarn3": "^7.0.0",
46
+ "@xylabs/tsconfig": "^7.0.0",
44
47
  "typescript": "^5.8.3",
45
48
  "vitest": "^3.2.4"
46
49
  },
@@ -0,0 +1,19 @@
1
+ import {
2
+ describe, expect, test,
3
+ } from 'vitest'
4
+
5
+ import { difference } from '../difference.ts'
6
+
7
+ const cases = [
8
+ // Difference is non-commutative
9
+ [new Set([1, 2, 3]), new Set([2, 3, 4]), new Set([1])],
10
+ [new Set([2, 3, 4]), new Set([1, 2, 3]), new Set([4])],
11
+ // Difference of identical sets yields empty set
12
+ [new Set([1, 2, 3]), new Set([1, 2, 3]), new Set([])],
13
+ ]
14
+
15
+ describe('difference', () => {
16
+ test.each(cases)('calculates the difference of the two sets', (a, b, expected) => {
17
+ expect(difference(a, b)).toEqual(expected)
18
+ })
19
+ })
@@ -0,0 +1,19 @@
1
+ import {
2
+ describe, expect, test,
3
+ } from 'vitest'
4
+
5
+ import { intersection } from '../intersection.ts'
6
+
7
+ const cases = [
8
+ // Intersection is commutative
9
+ [new Set([1, 2, 3]), new Set([2, 3, 4]), new Set([2, 3])],
10
+ [new Set([2, 3, 4]), new Set([1, 2, 3]), new Set([2, 3])],
11
+ // Intersection of identical sets yields same set
12
+ [new Set([1, 2, 3]), new Set([1, 2, 3]), new Set([1, 2, 3])],
13
+ ]
14
+
15
+ describe('intersection', () => {
16
+ test.each(cases)('calculates the intersection of the two sets', (a, b, expected) => {
17
+ expect(intersection(a, b)).toEqual(expected)
18
+ })
19
+ })
@@ -0,0 +1,18 @@
1
+ import {
2
+ describe, expect, test,
3
+ } from 'vitest'
4
+
5
+ import { union } from '../union.ts'
6
+ const cases = [
7
+ // Union is commutative
8
+ [new Set([1, 2]), new Set([3, 4]), new Set([1, 2, 3, 4])],
9
+ [new Set([3, 4]), new Set([1, 2]), new Set([1, 2, 3, 4])],
10
+ // Union of identical sets yields same set
11
+ [new Set([1, 2, 3]), new Set([1, 2, 3]), new Set([1, 2, 3])],
12
+ ]
13
+
14
+ describe('union', () => {
15
+ test.each(cases)('calculates the union of the two sets', (a, b, expected) => {
16
+ expect(union(a, b)).toEqual(expected)
17
+ })
18
+ })
package/xy.config.ts DELETED
@@ -1,10 +0,0 @@
1
- import type { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
2
- const config: XyTsupConfig = {
3
- compile: {
4
- browser: {},
5
- neutral: { src: true },
6
- node: {},
7
- },
8
- }
9
-
10
- export default config