@thi.ng/arrays 2.9.6 → 2.9.7
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/CHANGELOG.md +8 -1
- package/README.md +2 -2
- package/levenshtein.js +3 -3
- package/package.json +12 -12
- package/swap.d.ts +2 -2
- package/swap.js +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-
|
|
3
|
+
- **Last updated**: 2024-06-21T19:34:38Z
|
|
4
4
|
- **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
|
|
5
5
|
|
|
6
6
|
All notable changes to this project will be documented in this file.
|
|
@@ -9,6 +9,13 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
|
|
|
9
9
|
**Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
|
|
10
10
|
and/or version bumps of transitive dependencies.
|
|
11
11
|
|
|
12
|
+
### [2.9.7](https://github.com/thi-ng/umbrella/tree/@thi.ng/arrays@2.9.7) (2024-06-21)
|
|
13
|
+
|
|
14
|
+
#### ♻️ Refactoring
|
|
15
|
+
|
|
16
|
+
- rename various rest args to be more semantically meaningful ([8088a56](https://github.com/thi-ng/umbrella/commit/8088a56))
|
|
17
|
+
- enforce uniform naming convention of internal functions ([56992b2](https://github.com/thi-ng/umbrella/commit/56992b2))
|
|
18
|
+
|
|
12
19
|
### [2.9.4](https://github.com/thi-ng/umbrella/tree/@thi.ng/arrays@2.9.4) (2024-04-20)
|
|
13
20
|
|
|
14
21
|
#### ♻️ Refactoring
|
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](https://mastodon.thi.ng/@toxi)
|
|
8
8
|
|
|
9
9
|
> [!NOTE]
|
|
10
|
-
> This is one of
|
|
10
|
+
> This is one of 193 standalone projects, maintained as part
|
|
11
11
|
> of the [@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo
|
|
12
12
|
> and anti-framework.
|
|
13
13
|
>
|
|
@@ -60,7 +60,7 @@ For Node.js REPL:
|
|
|
60
60
|
const arr = await import("@thi.ng/arrays");
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
-
Package sizes (brotli'd, pre-treeshake): ESM:
|
|
63
|
+
Package sizes (brotli'd, pre-treeshake): ESM: 3.00 KB
|
|
64
64
|
|
|
65
65
|
## Dependencies
|
|
66
66
|
|
package/levenshtein.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
const levenshtein = (a, b, maxDist = Infinity, equiv =
|
|
1
|
+
const __eqStrict = (a, b) => a === b;
|
|
2
|
+
const levenshtein = (a, b, maxDist = Infinity, equiv = __eqStrict) => {
|
|
3
3
|
if (a === b) {
|
|
4
4
|
return 0;
|
|
5
5
|
}
|
|
@@ -83,7 +83,7 @@ const levenshtein = (a, b, maxDist = Infinity, equiv = eqStrict) => {
|
|
|
83
83
|
}
|
|
84
84
|
return dd;
|
|
85
85
|
};
|
|
86
|
-
const normalizedLevenshtein = (a, b, maxDist = Infinity, equiv =
|
|
86
|
+
const normalizedLevenshtein = (a, b, maxDist = Infinity, equiv = __eqStrict) => {
|
|
87
87
|
const n = Math.max(a.length, b.length);
|
|
88
88
|
return n > 0 ? levenshtein(a, b, maxDist, equiv) / n : 0;
|
|
89
89
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/arrays",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.7",
|
|
4
4
|
"description": "Array / Arraylike utilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"type": "git",
|
|
11
11
|
"url": "https://github.com/thi-ng/umbrella.git"
|
|
12
12
|
},
|
|
13
|
-
"homepage": "https://
|
|
13
|
+
"homepage": "https://thi.ng/arrays",
|
|
14
14
|
"funding": [
|
|
15
15
|
{
|
|
16
16
|
"type": "github",
|
|
@@ -36,18 +36,18 @@
|
|
|
36
36
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@thi.ng/api": "^8.11.
|
|
40
|
-
"@thi.ng/checks": "^3.6.
|
|
41
|
-
"@thi.ng/compare": "^2.3.
|
|
42
|
-
"@thi.ng/equiv": "^2.1.
|
|
43
|
-
"@thi.ng/errors": "^2.5.
|
|
44
|
-
"@thi.ng/random": "^3.8.
|
|
39
|
+
"@thi.ng/api": "^8.11.3",
|
|
40
|
+
"@thi.ng/checks": "^3.6.5",
|
|
41
|
+
"@thi.ng/compare": "^2.3.6",
|
|
42
|
+
"@thi.ng/equiv": "^2.1.59",
|
|
43
|
+
"@thi.ng/errors": "^2.5.8",
|
|
44
|
+
"@thi.ng/random": "^3.8.1"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@microsoft/api-extractor": "^7.
|
|
48
|
-
"esbuild": "^0.21.
|
|
47
|
+
"@microsoft/api-extractor": "^7.47.0",
|
|
48
|
+
"esbuild": "^0.21.5",
|
|
49
49
|
"typedoc": "^0.25.13",
|
|
50
|
-
"typescript": "^5.
|
|
50
|
+
"typescript": "^5.5.2"
|
|
51
51
|
},
|
|
52
52
|
"keywords": [
|
|
53
53
|
"aos",
|
|
@@ -168,5 +168,5 @@
|
|
|
168
168
|
"thi.ng": {
|
|
169
169
|
"year": 2018
|
|
170
170
|
},
|
|
171
|
-
"gitHead": "
|
|
171
|
+
"gitHead": "154c95cf9d6bab32174498ec3b5b5d87e42be7f9\n"
|
|
172
172
|
}
|
package/swap.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export declare const swap: (arr: AnyArray, x: number, y: number) => void;
|
|
|
41
41
|
* // [30, 40]
|
|
42
42
|
* ```
|
|
43
43
|
*
|
|
44
|
-
* @param
|
|
44
|
+
* @param arrays - arrays to swap in later
|
|
45
45
|
*/
|
|
46
|
-
export declare const multiSwap: (...
|
|
46
|
+
export declare const multiSwap: (...arrays: AnyArray[]) => SwapFn;
|
|
47
47
|
//# sourceMappingURL=swap.d.ts.map
|
package/swap.js
CHANGED
|
@@ -3,9 +3,9 @@ const swap = (arr, x, y) => {
|
|
|
3
3
|
arr[x] = arr[y];
|
|
4
4
|
arr[y] = t;
|
|
5
5
|
};
|
|
6
|
-
const multiSwap = (...
|
|
7
|
-
const [b, c, d] =
|
|
8
|
-
const n =
|
|
6
|
+
const multiSwap = (...arrays) => {
|
|
7
|
+
const [b, c, d] = arrays;
|
|
8
|
+
const n = arrays.length;
|
|
9
9
|
switch (n) {
|
|
10
10
|
case 0:
|
|
11
11
|
return swap;
|
|
@@ -30,7 +30,7 @@ const multiSwap = (...xs) => {
|
|
|
30
30
|
default:
|
|
31
31
|
return (a, x, y) => {
|
|
32
32
|
swap(a, x, y);
|
|
33
|
-
for (let i = n; i-- > 0; ) swap(
|
|
33
|
+
for (let i = n; i-- > 0; ) swap(arrays[i], x, y);
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
};
|