@thi.ng/arrays 2.9.2 → 2.9.4
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 +7 -1
- package/README.md +3 -3
- package/blit.d.ts +3 -3
- package/package.json +8 -8
- package/find-seq.d.ts +0 -3
- package/find-seq.js +0 -25
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
-
- **Last updated**: 2024-04-
|
|
3
|
+
- **Last updated**: 2024-04-20T14:42:45Z
|
|
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,12 @@ 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.4](https://github.com/thi-ng/umbrella/tree/@thi.ng/arrays@2.9.4) (2024-04-20)
|
|
13
|
+
|
|
14
|
+
#### ♻️ Refactoring
|
|
15
|
+
|
|
16
|
+
- update type usage ([35eddc8](https://github.com/thi-ng/umbrella/commit/35eddc8))
|
|
17
|
+
|
|
12
18
|
## [2.9.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/arrays@2.9.0) (2024-03-28)
|
|
13
19
|
|
|
14
20
|
#### 🚀 Features
|
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 192 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
|
>
|
|
@@ -49,10 +49,10 @@ import * as arr from "@thi.ng/arrays";
|
|
|
49
49
|
Browser ESM import:
|
|
50
50
|
|
|
51
51
|
```html
|
|
52
|
-
<script type="module" src="https://
|
|
52
|
+
<script type="module" src="https://esm.run/@thi.ng/arrays"></script>
|
|
53
53
|
```
|
|
54
54
|
|
|
55
|
-
[
|
|
55
|
+
[JSDelivr documentation](https://www.jsdelivr.com/)
|
|
56
56
|
|
|
57
57
|
For Node.js REPL:
|
|
58
58
|
|
package/blit.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Fn3, TypedArray } from "@thi.ng/api";
|
|
1
|
+
import type { Fn3, Maybe, TypedArray } from "@thi.ng/api";
|
|
2
2
|
/**
|
|
3
3
|
* Selectively copies all non-`mask` values from `src` into `dest` starting from
|
|
4
4
|
* destination position `dx`. Returns `dest`.
|
|
@@ -45,8 +45,8 @@ export declare function blit1d<T>(dest: T[], dx: number, src: ArrayLike<T>, mask
|
|
|
45
45
|
* @param src
|
|
46
46
|
* @param pred
|
|
47
47
|
*/
|
|
48
|
-
export declare function blitPred1d<T extends TypedArray>(dest: T, dx: number, src: ArrayLike<number>, pred: Fn3<number, number, number, number
|
|
49
|
-
export declare function blitPred1d<T>(dest: T[], dx: number, src: ArrayLike<T>, pred: Fn3<T, T, number, T
|
|
48
|
+
export declare function blitPred1d<T extends TypedArray>(dest: T, dx: number, src: ArrayLike<number>, pred: Fn3<number, number, number, Maybe<number>>): T;
|
|
49
|
+
export declare function blitPred1d<T>(dest: T[], dx: number, src: ArrayLike<T>, pred: Fn3<T, T, number, Maybe<T>>): T[];
|
|
50
50
|
/**
|
|
51
51
|
* 2D version of {@link blit1d} (also with region clipping). Positions and sizes
|
|
52
52
|
* are given as 2D vectors.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/arrays",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.4",
|
|
4
4
|
"description": "Array / Arraylike utilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@thi.ng/api": "^8.
|
|
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.7.
|
|
39
|
+
"@thi.ng/api": "^8.11.0",
|
|
40
|
+
"@thi.ng/checks": "^3.6.2",
|
|
41
|
+
"@thi.ng/compare": "^2.3.3",
|
|
42
|
+
"@thi.ng/equiv": "^2.1.56",
|
|
43
|
+
"@thi.ng/errors": "^2.5.5",
|
|
44
|
+
"@thi.ng/random": "^3.7.4"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@microsoft/api-extractor": "^7.43.0",
|
|
@@ -169,5 +169,5 @@
|
|
|
169
169
|
"thi.ng": {
|
|
170
170
|
"year": 2018
|
|
171
171
|
},
|
|
172
|
-
"gitHead": "
|
|
172
|
+
"gitHead": "8339d05ecc857e529c7325a9839c0063b89e728d\n"
|
|
173
173
|
}
|
package/find-seq.d.ts
DELETED
package/find-seq.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
const findSequence = (haystack, needle, i = 0) => {
|
|
2
|
-
const m = haystack.length;
|
|
3
|
-
const n = needle.length;
|
|
4
|
-
const max = m - n;
|
|
5
|
-
if (max < 0)
|
|
6
|
-
return -1;
|
|
7
|
-
while (i < m) {
|
|
8
|
-
const idx = haystack.indexOf(needle[0], i);
|
|
9
|
-
if (idx < 0 || idx > max)
|
|
10
|
-
return -1;
|
|
11
|
-
let j;
|
|
12
|
-
for (j = 1; j < n; j++) {
|
|
13
|
-
if (haystack[idx + j] !== needle[j]) {
|
|
14
|
-
i = idx + 1;
|
|
15
|
-
break;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
if (j >= n)
|
|
19
|
-
return idx;
|
|
20
|
-
}
|
|
21
|
-
return -1;
|
|
22
|
-
};
|
|
23
|
-
export {
|
|
24
|
-
findSequence
|
|
25
|
-
};
|