@thi.ng/arrays 2.10.13 → 2.10.15
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 +1 -1
- package/README.md +1 -1
- package/binary-search.d.ts +3 -3
- package/bisect.d.ts +1 -1
- package/blit.d.ts +1 -1
- package/ends-with.d.ts +1 -1
- package/fill-range.d.ts +4 -4
- package/find.d.ts +5 -4
- package/floyd-rivest.d.ts +1 -1
- package/fuzzy-match.d.ts +2 -2
- package/insert.d.ts +1 -1
- package/is-sorted.d.ts +2 -2
- package/levenshtein.d.ts +1 -0
- package/package.json +11 -11
- package/quicksort.d.ts +1 -1
- package/starts-with.d.ts +1 -1
package/CHANGELOG.md
CHANGED
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 201 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
|
>
|
package/binary-search.d.ts
CHANGED
|
@@ -11,8 +11,8 @@ import type { Comparator, Fn, FnN, FnN2 } from "@thi.ng/api";
|
|
|
11
11
|
* and each array item (default: identity).
|
|
12
12
|
*
|
|
13
13
|
* The optional `cmp` comparator (default:
|
|
14
|
-
* [`compare
|
|
15
|
-
*
|
|
14
|
+
* [`compare`](https://docs.thi.ng/umbrella/compare/functions/compare.html)) is
|
|
15
|
+
* then used to identify the index of `x`. The sort order of `buf` MUST be
|
|
16
16
|
* compatible with that of `cmp`.
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
@@ -36,7 +36,7 @@ export declare const binarySearch: <A, B>(buf: ArrayLike<A>, x: A, key?: Fn<A, B
|
|
|
36
36
|
/**
|
|
37
37
|
* Similar to {@link binarySearch}, but optimized for numeric arrays and
|
|
38
38
|
* supporting custom comparators (default:
|
|
39
|
-
* [`compareNumAsc
|
|
39
|
+
* [`compareNumAsc`](https://docs.thi.ng/umbrella/compare/functions/compareNumAsc.html)).
|
|
40
40
|
*
|
|
41
41
|
* @param buf - array
|
|
42
42
|
* @param x - search value
|
package/bisect.d.ts
CHANGED
package/blit.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { Fn3, Maybe, TypedArray } from "@thi.ng/api";
|
|
|
6
6
|
* @remarks
|
|
7
7
|
* Where `src` values are the same as `mask`, the corresponding `dest` values
|
|
8
8
|
* will be left unchanged. Performs region clipping, i.e. `dx` can be outside
|
|
9
|
-
* the [0
|
|
9
|
+
* the `[0,dest.length)` interval.
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
12
|
* ```ts tangle:../export/blit1d.ts
|
package/ends-with.d.ts
CHANGED
package/fill-range.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { NumericArray } from "@thi.ng/api";
|
|
2
2
|
/**
|
|
3
|
-
* Fills given array with values in [start
|
|
4
|
-
*
|
|
3
|
+
* Fills given array with values in `[start,end)` interval from `index` and with
|
|
4
|
+
* optional `step` size.
|
|
5
5
|
*
|
|
6
6
|
* @remarks
|
|
7
|
-
* `start` and `end` default to 0 and array length, `step` defaults to 1
|
|
8
|
-
*
|
|
7
|
+
* `start` and `end` default to 0 and array length, `step` defaults to 1 or -1
|
|
8
|
+
* (depending on range). Returns array.
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
11
|
* ```ts tangle:../export/fill-range.ts
|
package/find.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Predicate2 } from "@thi.ng/api";
|
|
2
2
|
/**
|
|
3
|
-
* Similar to `Array.find()`, but uses
|
|
4
|
-
* default
|
|
3
|
+
* Similar to `Array.find()`, but uses
|
|
4
|
+
* [`equiv`](https://docs.thi.ng/umbrella/equiv/functions/equiv.html) as default
|
|
5
|
+
* predicate.
|
|
5
6
|
*
|
|
6
7
|
* @param buf - array
|
|
7
8
|
* @param x - search value
|
|
@@ -10,8 +11,8 @@ import type { Predicate2 } from "@thi.ng/api";
|
|
|
10
11
|
export declare const find: <T>(buf: ArrayLike<T>, x: T, equiv?: Predicate2<T>) => T | undefined;
|
|
11
12
|
/**
|
|
12
13
|
* Similar to `Array.findIndex()`, but uses
|
|
13
|
-
* [`equiv
|
|
14
|
-
*
|
|
14
|
+
* [`equiv`](https://docs.thi.ng/umbrella/equiv/functions/equiv.html) as default
|
|
15
|
+
* predicate.
|
|
15
16
|
*
|
|
16
17
|
* @param buf - array
|
|
17
18
|
* @param x - search value
|
package/floyd-rivest.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ import type { Comparator, TypedArray } from "@thi.ng/api";
|
|
|
22
22
|
* ```
|
|
23
23
|
*
|
|
24
24
|
* Based on pseudo-code from:
|
|
25
|
-
*
|
|
25
|
+
* https://en.wikipedia.org/wiki/Floyd%E2%80%93Rivest_algorithm
|
|
26
26
|
*
|
|
27
27
|
* @param buf
|
|
28
28
|
* @param k
|
package/fuzzy-match.d.ts
CHANGED
|
@@ -6,13 +6,13 @@ import type { Predicate2 } from "@thi.ng/api";
|
|
|
6
6
|
* @remarks
|
|
7
7
|
* The optional `equiv` predicate can be used to customize item equality
|
|
8
8
|
* checking. Uses
|
|
9
|
-
* [`equiv
|
|
9
|
+
* [`equiv`](https://docs.thi.ng/umbrella/equiv/functions/equiv.html) by
|
|
10
10
|
* default.
|
|
11
11
|
*
|
|
12
12
|
* Adapted and generalized from: https://github.com/bevacqua/fufuzzyzzysearch
|
|
13
13
|
* (MIT licensed)
|
|
14
14
|
*
|
|
15
|
-
* [`filterFuzzy
|
|
15
|
+
* [`filterFuzzy`](https://docs.thi.ng/umbrella/transducers/functions/filterFuzzy.html)
|
|
16
16
|
*
|
|
17
17
|
* @param domain - array
|
|
18
18
|
* @param query - search value
|
package/insert.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @remarks
|
|
6
6
|
* The function will have no effect iff `i<0` or `i>=k` or `k<1`. If
|
|
7
|
-
* `buf.length` is larger than `k`, only the index range [i
|
|
7
|
+
* `buf.length` is larger than `k`, only the index range `[i,k)` will be
|
|
8
8
|
* modified.
|
|
9
9
|
*
|
|
10
10
|
* In benchmarking with 4, 8, 16, 32, 64 element arrays, this function is
|
package/is-sorted.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type { Comparator } from "@thi.ng/api";
|
|
|
2
2
|
/**
|
|
3
3
|
* Returns true if the given array and its elements in the selected index range
|
|
4
4
|
* (entire array, by default) are in the order defined by the given comparator
|
|
5
|
-
* ([`compare
|
|
6
|
-
*
|
|
5
|
+
* ([`compare`](https://docs.thi.ng/umbrella/compare/functions/compare.html) by
|
|
6
|
+
* default).
|
|
7
7
|
*
|
|
8
8
|
* @remarks
|
|
9
9
|
* Always returns true, if effective index range (or array length) has less than
|
package/levenshtein.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import type { Predicate2 } from "@thi.ng/api";
|
|
|
8
8
|
* @remarks
|
|
9
9
|
*
|
|
10
10
|
* Based on:
|
|
11
|
+
*
|
|
11
12
|
* - https://en.wikipedia.org/wiki/Levenshtein_distance
|
|
12
13
|
* - https://en.wikipedia.org/wiki/Wagner%E2%80%93Fischer_algorithm
|
|
13
14
|
* - https://github.com/gustf/js-levenshtein/blob/develop/index.js
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thi.ng/arrays",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.15",
|
|
4
4
|
"description": "Array / Arraylike utilities",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -33,23 +33,22 @@
|
|
|
33
33
|
"build:esbuild": "esbuild --format=esm --platform=neutral --target=es2022 --tsconfig=tsconfig.json --outdir=. src/**/*.ts",
|
|
34
34
|
"clean": "bun ../../tools/src/clean-package.ts",
|
|
35
35
|
"doc": "typedoc --options ../../typedoc.json --out doc src/index.ts",
|
|
36
|
-
"doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
|
|
37
36
|
"doc:readme": "bun ../../tools/src/module-stats.ts && bun ../../tools/src/readme.ts",
|
|
38
37
|
"pub": "yarn npm publish --access public",
|
|
39
38
|
"test": "bun test",
|
|
40
39
|
"tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
|
|
41
40
|
},
|
|
42
41
|
"dependencies": {
|
|
43
|
-
"@thi.ng/api": "^8.11.
|
|
44
|
-
"@thi.ng/checks": "^3.6.
|
|
45
|
-
"@thi.ng/compare": "^2.4.
|
|
46
|
-
"@thi.ng/equiv": "^2.1.
|
|
47
|
-
"@thi.ng/errors": "^2.5.
|
|
48
|
-
"@thi.ng/random": "^4.1.
|
|
42
|
+
"@thi.ng/api": "^8.11.20",
|
|
43
|
+
"@thi.ng/checks": "^3.6.23",
|
|
44
|
+
"@thi.ng/compare": "^2.4.12",
|
|
45
|
+
"@thi.ng/equiv": "^2.1.76",
|
|
46
|
+
"@thi.ng/errors": "^2.5.26",
|
|
47
|
+
"@thi.ng/random": "^4.1.11"
|
|
49
48
|
},
|
|
50
49
|
"devDependencies": {
|
|
51
|
-
"esbuild": "^0.
|
|
52
|
-
"typedoc": "^0.27.
|
|
50
|
+
"esbuild": "^0.25.0",
|
|
51
|
+
"typedoc": "^0.27.7",
|
|
53
52
|
"typescript": "^5.7.3"
|
|
54
53
|
},
|
|
55
54
|
"keywords": [
|
|
@@ -169,7 +168,8 @@
|
|
|
169
168
|
}
|
|
170
169
|
},
|
|
171
170
|
"thi.ng": {
|
|
171
|
+
"tag": "array",
|
|
172
172
|
"year": 2018
|
|
173
173
|
},
|
|
174
|
-
"gitHead": "
|
|
174
|
+
"gitHead": "9a0b33253fef092aaf301decf6ecd54317874d4c\n"
|
|
175
175
|
}
|
package/quicksort.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type { Comparator, Fn3, TypedArray } from "@thi.ng/api";
|
|
|
9
9
|
* indices (both inclusive).
|
|
10
10
|
*
|
|
11
11
|
* Uses Hoare partitioning scheme.
|
|
12
|
-
* [`compare
|
|
12
|
+
* [`compare`](https://docs.thi.ng/umbrella/compare/functions/compare.html) is
|
|
13
13
|
* used as default comparator and {@link swap} from this package as default swap
|
|
14
14
|
* function. Also see {@link multiSwap}.
|
|
15
15
|
*
|
package/starts-with.d.ts
CHANGED