@jdsalasc/solvejs-list 1.3.0 → 1.4.1
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 +24 -5
- package/package.json +9 -7
package/README.md
CHANGED
|
@@ -1,16 +1,35 @@
|
|
|
1
1
|
# @jdsalasc/solvejs-list
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@jdsalasc/solvejs-list)
|
|
4
|
+
[](https://www.npmjs.com/package/@jdsalasc/solvejs-list)
|
|
4
5
|
|
|
5
|
-
## Tools Included
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
Zero-dependency array/list utilities for JavaScript and TypeScript.
|
|
8
|
+
|
|
9
|
+
## Utilities
|
|
10
|
+
|
|
11
|
+
- `unique`, `uniqueBy`, `compact`, `chunk`
|
|
12
|
+
- `groupBy`, `keyBy`, `partition`
|
|
13
|
+
- `intersection`, `difference`
|
|
10
14
|
- `sortBy`
|
|
11
15
|
|
|
16
|
+
## When to use this package
|
|
17
|
+
|
|
18
|
+
Use it when you repeatedly write list transformation logic and want consistent, tested helpers for grouping, deduplication, and sorting.
|
|
19
|
+
|
|
12
20
|
## Install
|
|
13
21
|
|
|
14
22
|
```bash
|
|
15
23
|
npm i @jdsalasc/solvejs-list
|
|
16
24
|
```
|
|
25
|
+
|
|
26
|
+
## Quick example
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import { uniqueBy, groupBy, sortBy } from "@jdsalasc/solvejs-list";
|
|
30
|
+
|
|
31
|
+
const rows = [{ id: "a", team: "x", score: 2 }, { id: "a", team: "x", score: 2 }, { id: "b", team: "y", score: 1 }];
|
|
32
|
+
const uniqueRows = uniqueBy(rows, (r) => r.id);
|
|
33
|
+
const byTeam = groupBy(uniqueRows, (r) => r.team);
|
|
34
|
+
sortBy(byTeam.x, (r) => r.score, "desc");
|
|
35
|
+
```
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jdsalasc/solvejs-list",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Zero-dependency list
|
|
3
|
+
"version": "1.4.1",
|
|
4
|
+
"description": "Zero-dependency JavaScript/TypeScript list utilities for production: uniqueBy, groupBy, keyBy, partition, intersection, difference, chunk, and sortBy.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -43,12 +43,14 @@
|
|
|
43
43
|
"node": ">=18"
|
|
44
44
|
},
|
|
45
45
|
"keywords": [
|
|
46
|
-
"array
|
|
47
|
-
"typescript
|
|
48
|
-
"
|
|
49
|
-
"
|
|
46
|
+
"javascript array utilities",
|
|
47
|
+
"typescript array utilities",
|
|
48
|
+
"group by key",
|
|
49
|
+
"unique by",
|
|
50
|
+
"partition array",
|
|
50
51
|
"difference array",
|
|
51
|
-
"
|
|
52
|
+
"intersection array",
|
|
53
|
+
"sort by key",
|
|
52
54
|
"zero dependency",
|
|
53
55
|
"solvejs"
|
|
54
56
|
]
|