@gkucmierz/utils 2.0.0 → 2.0.2
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 -14
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -13,15 +13,25 @@ A collection of useful utility functions and data structures for solving algorit
|
|
|
13
13
|
npm install @gkucmierz/utils
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
## 🚀
|
|
16
|
+
## 🚀 What's New in v2.0.0
|
|
17
|
+
- **Combinatorics Arsenal**: High-performance, memory-safe O(1) generators powered by native `BigInt`.
|
|
18
|
+
- **OOP Encapsulation**: `Heap` and `Trie` data structures were refactored into robust ES6 Classes (`new Heap()`, `new Trie()`).
|
|
19
|
+
|
|
20
|
+
## ✨ Features
|
|
17
21
|
|
|
18
22
|
This library provides a wide range of mathematical functions and data structures, including:
|
|
19
23
|
|
|
24
|
+
- **Combinatorics**:
|
|
25
|
+
- `combinations`, `combinationsIterator`: Fast base-k combinations builder via Lexicographic progressions.
|
|
26
|
+
- `permutations`, `permutationsIterator`: Pointer-optimized `yield*` permutations generator.
|
|
27
|
+
- `nChooseK`: Massive scale limit-breaker for combinatorial variation calculations (Newton's Symbol via `BigInt`).
|
|
28
|
+
- `bin2gray`, `gray2bin`: Pure array-cloning bit formatters for Gray code translations.
|
|
29
|
+
|
|
20
30
|
- **Data Structures**:
|
|
21
|
-
- `SetCnt`: A set-like structure with element counting.
|
|
22
|
-
- `Trie`: Efficient prefix tree implementation.
|
|
23
|
-
- `Heap`: Min-heap priority queue.
|
|
24
|
-
- `ListNode`: Linked list node implementation.
|
|
31
|
+
- `SetCnt`: A set-like structure with element counting (`class`).
|
|
32
|
+
- `Trie`: Efficient prefix tree implementation (`class`).
|
|
33
|
+
- `Heap`: Min-heap priority queue (`class`).
|
|
34
|
+
- `ListNode`: Linked list node implementation (`class`).
|
|
25
35
|
- `matrixAsArray`: 2D matrix representation as a flat array.
|
|
26
36
|
|
|
27
37
|
- **Number Theory**:
|
|
@@ -37,27 +47,27 @@ This library provides a wide range of mathematical functions and data structures
|
|
|
37
47
|
- `heronsFormula`: Triangle area calculation.
|
|
38
48
|
- `squareRoot`: Integer square root using Newton's method.
|
|
39
49
|
|
|
40
|
-
- **String & Encoding**:
|
|
50
|
+
- **String & Encoding & Arrays**:
|
|
41
51
|
- `base64`: Base64 and Base64Url encoding/decoding.
|
|
42
52
|
- `copyCase`: Match case of a string to another.
|
|
53
|
+
- `arrayHistogram`: Creates Map mappings counting absolute frequencies across any `Iterable`.
|
|
43
54
|
- `bijectiveNumeration`: Bijective base-k numeration system.
|
|
44
55
|
|
|
45
|
-
- **Utilities**:
|
|
56
|
+
- **Developer Utilities**:
|
|
57
|
+
- `consumeIteratorNonBlocking`: Yield consumption macro-tasks queue resolver for heavy computations.
|
|
46
58
|
- `memoize`: Function memoization based on arguments.
|
|
47
59
|
- `binarySearch`: Various binary search implementations (exact, lower bound, upper bound).
|
|
48
60
|
- `range2array`, `array2range`: Convert between ranges and arrays.
|
|
49
|
-
- `getType`: Precise type checking.
|
|
61
|
+
- `getType`: Precise dynamic type checking.
|
|
50
62
|
|
|
51
63
|
## 📚 Documentation
|
|
52
64
|
|
|
53
|
-
Full documentation with examples is available at:
|
|
54
|
-
👉 **[https://
|
|
55
|
-
|
|
56
|
-
## 🔗 Links
|
|
65
|
+
Full API documentation with examples is available at:
|
|
66
|
+
👉 **[https://gitea.7u.pl/gkucmierz/utils/pages](https://gitea.7u.pl/gkucmierz/utils/pages)** *(or GitHub parity)*
|
|
57
67
|
|
|
68
|
+
## 🔗 Repository
|
|
69
|
+
- **Internal Gitea**: [https://gitea.7u.pl/gkucmierz/utils](https://gitea.7u.pl/gkucmierz/utils)
|
|
58
70
|
- **NPM Package**: [https://www.npmjs.com/package/@gkucmierz/utils](https://www.npmjs.com/package/@gkucmierz/utils)
|
|
59
|
-
- **GitHub Repository**: [https://github.com/gkucmierz/utils](https://github.com/gkucmierz/utils)
|
|
60
71
|
|
|
61
72
|
## 📄 License
|
|
62
|
-
|
|
63
73
|
MIT
|
package/package.json
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gkucmierz/utils",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Usefull functions for solving programming tasks",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"algorithms",
|
|
8
|
+
"array-histogram",
|
|
8
9
|
"base64",
|
|
9
10
|
"bijective",
|
|
10
11
|
"binary-search",
|
|
12
|
+
"combinations",
|
|
11
13
|
"competitive-programming",
|
|
12
14
|
"data-structures",
|
|
13
15
|
"factors",
|
|
14
16
|
"gcd",
|
|
17
|
+
"gray-code",
|
|
15
18
|
"heap",
|
|
16
19
|
"iterator",
|
|
17
20
|
"javascript",
|
|
@@ -19,9 +22,11 @@
|
|
|
19
22
|
"math",
|
|
20
23
|
"memoize",
|
|
21
24
|
"mod",
|
|
25
|
+
"n-choose-k",
|
|
22
26
|
"node",
|
|
23
27
|
"non-blocking",
|
|
24
28
|
"number-theory",
|
|
29
|
+
"permutations",
|
|
25
30
|
"phi",
|
|
26
31
|
"pow-mod",
|
|
27
32
|
"range-array",
|
|
@@ -40,7 +45,7 @@
|
|
|
40
45
|
"watch": "nodemon --exec 'npm test'",
|
|
41
46
|
"docs": "npm run docs:build; npm run docs:open",
|
|
42
47
|
"build:main": "node scripts/generate_main.mjs",
|
|
43
|
-
"docs:build": "jsdoc -c jsdoc.json
|
|
48
|
+
"docs:build": "jsdoc -c jsdoc.json && cp -r docs/@gkucmierz/utils/*/* docs/ && rm -rf docs/@gkucmierz",
|
|
44
49
|
"docs:open": "open docs/index.html",
|
|
45
50
|
"lint": "eslint .",
|
|
46
51
|
"prepare": "husky"
|