atomic-fns 1.2.0 → 2.0.0
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 +397 -91
- package/dist/array/index.d.ts +9 -0
- package/dist/array/index.js +9 -0
- package/dist/array/list.d.ts +99 -0
- package/dist/array/list.js +133 -0
- package/dist/array/sets.d.ts +130 -0
- package/dist/array/sets.js +213 -0
- package/dist/async/index.d.ts +6 -0
- package/dist/async/index.js +6 -0
- package/dist/async/retry.d.ts +38 -0
- package/dist/async/retry.js +56 -0
- package/dist/async/sleep.d.ts +42 -0
- package/dist/async/sleep.js +76 -0
- package/dist/collections/bisect.d.ts +103 -0
- package/dist/collections/bisect.js +157 -0
- package/dist/collections/deque.d.ts +67 -97
- package/dist/collections/deque.js +197 -256
- package/dist/collections/entries.d.ts +89 -0
- package/dist/collections/entries.js +131 -0
- package/dist/collections/frozen-set.d.ts +42 -0
- package/dist/collections/frozen-set.js +64 -0
- package/dist/collections/group.d.ts +141 -0
- package/dist/collections/group.js +241 -0
- package/dist/collections/heap.d.ts +64 -0
- package/dist/collections/heap.js +205 -0
- package/dist/collections/index.d.ts +15 -623
- package/dist/collections/index.js +14 -844
- package/dist/collections/internal/arrayKeys.d.ts +19 -0
- package/dist/collections/internal/arrayKeys.js +83 -0
- package/dist/collections/internal/invariants.d.ts +4 -0
- package/dist/collections/internal/invariants.js +12 -0
- package/dist/collections/internal/iterable.d.ts +25 -0
- package/dist/collections/internal/iterable.js +62 -0
- package/dist/collections/iterate.d.ts +162 -0
- package/dist/collections/iterate.js +188 -0
- package/dist/collections/lru-cache.d.ts +58 -0
- package/dist/collections/lru-cache.js +164 -0
- package/dist/collections/order.d.ts +19 -0
- package/dist/collections/order.js +38 -0
- package/dist/collections/shape.d.ts +32 -0
- package/dist/collections/shape.js +86 -0
- package/dist/collections/sorted-map.d.ts +171 -0
- package/dist/collections/sorted-map.js +845 -0
- package/dist/collections/sorted-set.d.ts +103 -0
- package/dist/collections/sorted-set.js +147 -0
- package/dist/collections/splay-tree.d.ts +82 -0
- package/dist/collections/splay-tree.js +354 -0
- package/dist/collections/trie.d.ts +58 -0
- package/dist/collections/trie.js +196 -0
- package/dist/decimal/currency.d.ts +211 -0
- package/dist/decimal/currency.js +321 -0
- package/dist/decimal/decimal.d.ts +299 -0
- package/dist/decimal/decimal.js +660 -0
- package/dist/decimal/index.d.ts +11 -148
- package/dist/decimal/index.js +10 -410
- package/dist/decimal/internal/bits.d.ts +2 -0
- package/dist/decimal/internal/bits.js +7 -0
- package/dist/decimal/internal/echo.d.ts +4 -0
- package/dist/decimal/internal/echo.js +6 -0
- package/dist/decimal/internal/isqrt.d.ts +9 -0
- package/dist/decimal/internal/isqrt.js +34 -0
- package/dist/decimal/internal/locale.d.ts +7 -0
- package/dist/decimal/internal/locale.js +24 -0
- package/dist/decimal/internal/minor-units.d.ts +2 -0
- package/dist/decimal/internal/minor-units.js +33 -0
- package/dist/decimal/internal/pow10.d.ts +24 -0
- package/dist/decimal/internal/pow10.js +96 -0
- package/dist/encoding/base64.d.ts +39 -0
- package/dist/encoding/base64.js +53 -0
- package/dist/encoding/hex.d.ts +23 -0
- package/dist/encoding/hex.js +34 -0
- package/dist/encoding/index.d.ts +6 -0
- package/dist/encoding/index.js +6 -0
- package/dist/function/debounce.d.ts +68 -0
- package/dist/function/debounce.js +203 -0
- package/dist/function/index.d.ts +6 -0
- package/dist/function/index.js +6 -0
- package/dist/function/shared.d.ts +2 -0
- package/dist/function/shared.js +5 -0
- package/dist/function/wrap.d.ts +130 -0
- package/dist/function/wrap.js +113 -0
- package/dist/hash/digest.d.ts +18 -0
- package/dist/hash/digest.js +26 -0
- package/dist/hash/hash.d.ts +22 -0
- package/dist/hash/hash.js +252 -0
- package/dist/hash/hashString.d.ts +13 -0
- package/dist/hash/hashString.js +53 -0
- package/dist/hash/index.d.ts +8 -0
- package/dist/hash/index.js +8 -0
- package/dist/hash/stableStringify.d.ts +19 -0
- package/dist/hash/stableStringify.js +102 -0
- package/dist/id/index.d.ts +7 -0
- package/dist/id/index.js +7 -0
- package/dist/id/nanoid.d.ts +16 -0
- package/dist/id/nanoid.js +65 -0
- package/dist/id/uniqueId.d.ts +14 -0
- package/dist/id/uniqueId.js +20 -0
- package/dist/id/uuid.d.ts +25 -0
- package/dist/id/uuid.js +64 -0
- package/dist/index.d.ts +15 -8
- package/dist/index.js +15 -8
- package/dist/internal/bytes.d.ts +11 -0
- package/dist/internal/bytes.js +33 -0
- package/dist/internal/codec.d.ts +11 -0
- package/dist/internal/codec.js +84 -0
- package/dist/internal/compare.d.ts +10 -0
- package/dist/internal/compare.js +26 -0
- package/dist/internal/crypto.d.ts +5 -0
- package/dist/internal/crypto.js +11 -0
- package/dist/internal/keys.d.ts +12 -0
- package/dist/internal/keys.js +23 -0
- package/dist/internal/kind.d.ts +44 -0
- package/dist/internal/kind.js +139 -0
- package/dist/internal/sparse.d.ts +51 -0
- package/dist/internal/sparse.js +104 -0
- package/dist/internal/text.d.ts +7 -0
- package/dist/internal/text.js +15 -0
- package/dist/internal/timer.d.ts +10 -0
- package/dist/internal/timer.js +17 -0
- package/dist/internal/truncate.d.ts +10 -0
- package/dist/internal/truncate.js +22 -0
- package/dist/internal/walk.d.ts +47 -0
- package/dist/internal/walk.js +100 -0
- package/dist/is/index.d.ts +8 -0
- package/dist/is/index.js +8 -0
- package/dist/is/isArrayLike.d.ts +18 -0
- package/dist/is/isArrayLike.js +25 -0
- package/dist/is/isError.d.ts +13 -0
- package/dist/is/isError.js +18 -0
- package/dist/is/isNil.d.ts +12 -0
- package/dist/is/isNil.js +14 -0
- package/dist/is/isPlainObject.d.ts +15 -0
- package/dist/is/isPlainObject.js +34 -0
- package/dist/number/index.d.ts +7 -0
- package/dist/number/index.js +7 -0
- package/dist/number/round.d.ts +86 -0
- package/dist/number/round.js +130 -0
- package/dist/number/stats.d.ts +52 -0
- package/dist/number/stats.js +115 -0
- package/dist/object/cloneDeep.d.ts +28 -0
- package/dist/object/cloneDeep.js +200 -0
- package/dist/object/index.d.ts +14 -0
- package/dist/object/index.js +13 -0
- package/dist/object/isEqual.d.ts +64 -0
- package/dist/object/isEqual.js +289 -0
- package/dist/object/matches.d.ts +40 -0
- package/dist/object/matches.js +284 -0
- package/dist/object/merge.d.ts +66 -0
- package/dist/object/merge.js +272 -0
- package/dist/object/parsePath.d.ts +22 -0
- package/dist/object/parsePath.js +111 -0
- package/dist/object/path.d.ts +85 -0
- package/dist/object/path.js +208 -0
- package/dist/object/pick.d.ts +91 -0
- package/dist/object/pick.js +180 -0
- package/dist/object/reshape.d.ts +73 -0
- package/dist/object/reshape.js +144 -0
- package/dist/random/index.d.ts +96 -32
- package/dist/random/index.js +215 -53
- package/dist/string/case.d.ts +71 -0
- package/dist/string/case.js +152 -0
- package/dist/string/fold.d.ts +35 -0
- package/dist/string/fold.js +100 -0
- package/dist/string/index.d.ts +6 -187
- package/dist/string/index.js +6 -224
- package/dist/string/truncate.d.ts +25 -0
- package/dist/string/truncate.js +44 -0
- package/dist/string/words.d.ts +27 -0
- package/dist/string/words.js +241 -0
- package/package.json +99 -51
- package/dist/collections/BTree.d.ts +0 -230
- package/dist/collections/BTree.js +0 -1143
- package/dist/collections/Heap.d.ts +0 -69
- package/dist/collections/Heap.js +0 -181
- package/dist/collections/LRUCache.d.ts +0 -83
- package/dist/collections/LRUCache.js +0 -139
- package/dist/collections/SortedMap.d.ts +0 -92
- package/dist/collections/SortedMap.js +0 -131
- package/dist/collections/SortedSet.d.ts +0 -69
- package/dist/collections/SortedSet.js +0 -99
- package/dist/collections/SortedTree.d.ts +0 -103
- package/dist/collections/SortedTree.js +0 -142
- package/dist/collections/SplayTree.d.ts +0 -107
- package/dist/collections/SplayTree.js +0 -351
- package/dist/collections/Trie.d.ts +0 -42
- package/dist/collections/Trie.js +0 -104
- package/dist/collections/abc.d.ts +0 -152
- package/dist/collections/abc.js +0 -39
- package/dist/collections/frozenset.d.ts +0 -19
- package/dist/collections/frozenset.js +0 -33
- package/dist/functools/index.d.ts +0 -106
- package/dist/functools/index.js +0 -203
- package/dist/globals/index.d.ts +0 -268
- package/dist/globals/index.js +0 -447
- package/dist/i18n/currency.d.ts +0 -27
- package/dist/i18n/currency.js +0 -100
- package/dist/i18n/date/index.d.ts +0 -210
- package/dist/i18n/date/index.js +0 -552
- package/dist/i18n/date/utils.d.ts +0 -64
- package/dist/i18n/date/utils.js +0 -192
- package/dist/i18n/duration.d.ts +0 -113
- package/dist/i18n/duration.js +0 -398
- package/dist/i18n/format.d.ts +0 -34
- package/dist/i18n/format.js +0 -378
- package/dist/i18n/index.d.ts +0 -9
- package/dist/i18n/index.js +0 -8
- package/dist/itertools/index.d.ts +0 -251
- package/dist/itertools/index.js +0 -434
- package/dist/math/index.d.ts +0 -79
- package/dist/math/index.js +0 -81
- package/dist/mod.d.ts +0 -1
- package/dist/mod.js +0 -1
- package/dist/operators/index.d.ts +0 -148
- package/dist/operators/index.js +0 -325
- package/dist/types.d.ts +0 -19
- package/dist/types.js +0 -1
package/package.json
CHANGED
|
@@ -1,69 +1,117 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "atomic-fns",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"files": [
|
|
6
|
-
"dist/*"
|
|
7
|
-
],
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Like Lodash, but for today's platform: collections, object paths, deep equality, decimals, sorted containers, ids, hashing and encoding, with no dependencies.",
|
|
8
5
|
"type": "module",
|
|
9
|
-
"module": "dist/index.js",
|
|
10
|
-
"main": "dist/index.js",
|
|
11
|
-
"types": "dist/index.d.ts",
|
|
12
6
|
"sideEffects": false,
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./collections": {
|
|
13
|
+
"types": "./dist/collections/index.d.ts",
|
|
14
|
+
"default": "./dist/collections/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./object": {
|
|
17
|
+
"types": "./dist/object/index.d.ts",
|
|
18
|
+
"default": "./dist/object/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./array": {
|
|
21
|
+
"types": "./dist/array/index.d.ts",
|
|
22
|
+
"default": "./dist/array/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./function": {
|
|
25
|
+
"types": "./dist/function/index.d.ts",
|
|
26
|
+
"default": "./dist/function/index.js"
|
|
27
|
+
},
|
|
28
|
+
"./async": {
|
|
29
|
+
"types": "./dist/async/index.d.ts",
|
|
30
|
+
"default": "./dist/async/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./string": {
|
|
33
|
+
"types": "./dist/string/index.d.ts",
|
|
34
|
+
"default": "./dist/string/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./number": {
|
|
37
|
+
"types": "./dist/number/index.d.ts",
|
|
38
|
+
"default": "./dist/number/index.js"
|
|
39
|
+
},
|
|
40
|
+
"./random": {
|
|
41
|
+
"types": "./dist/random/index.d.ts",
|
|
42
|
+
"default": "./dist/random/index.js"
|
|
43
|
+
},
|
|
44
|
+
"./id": {
|
|
45
|
+
"types": "./dist/id/index.d.ts",
|
|
46
|
+
"default": "./dist/id/index.js"
|
|
47
|
+
},
|
|
48
|
+
"./hash": {
|
|
49
|
+
"types": "./dist/hash/index.d.ts",
|
|
50
|
+
"default": "./dist/hash/index.js"
|
|
51
|
+
},
|
|
52
|
+
"./encoding": {
|
|
53
|
+
"types": "./dist/encoding/index.d.ts",
|
|
54
|
+
"default": "./dist/encoding/index.js"
|
|
55
|
+
},
|
|
56
|
+
"./is": {
|
|
57
|
+
"types": "./dist/is/index.d.ts",
|
|
58
|
+
"default": "./dist/is/index.js"
|
|
59
|
+
},
|
|
60
|
+
"./decimal": {
|
|
61
|
+
"types": "./dist/decimal/index.d.ts",
|
|
62
|
+
"default": "./dist/decimal/index.js"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"files": [
|
|
66
|
+
"dist"
|
|
67
|
+
],
|
|
68
|
+
"engines": {
|
|
69
|
+
"node": "^24.22.3 || >=26.13.1"
|
|
70
|
+
},
|
|
13
71
|
"scripts": {
|
|
14
|
-
"preversion": "npm test",
|
|
15
|
-
"version": "npm run build",
|
|
16
|
-
"postversion": "git push && git push --tags",
|
|
17
|
-
"prepublishOnly": "npm run build",
|
|
18
|
-
"test": "vitest run",
|
|
19
|
-
"tsc": "tsc -p . --declaration && node scripts/declaration-imports.ts",
|
|
20
|
-
"tsc:w": "tsc -p . --declaration --watch",
|
|
21
72
|
"lint": "biome check --diagnostic-level=error .",
|
|
22
|
-
"build": "npm run lint && npm test && npm run tsc",
|
|
23
|
-
"docs": "deno doc --html --name atomic-fns --output docs src/index.ts src/*/index.ts",
|
|
24
|
-
"check": "npm run lint && npm run tsc && npm test && npm run jsr",
|
|
25
73
|
"format": "biome format --write .",
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
74
|
+
"typecheck": "tsc -p .",
|
|
75
|
+
"test": "vitest run",
|
|
76
|
+
"test:coverage": "vitest run --coverage",
|
|
77
|
+
"build": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.build.json && node scripts/declaration-imports.ts",
|
|
78
|
+
"test:dist": "node scripts/check-dist.ts",
|
|
79
|
+
"test:consumer": "node scripts/check-consumer.ts",
|
|
80
|
+
"lint:pkg": "npm exec -- publint --strict && npm exec -- attw --pack . --profile esm-only",
|
|
81
|
+
"docs:lint": "node scripts/check-docs.ts",
|
|
82
|
+
"jsr": "deno publish --dry-run --allow-dirty --set-version $npm_package_version",
|
|
83
|
+
"check": "npm run lint && npm run typecheck && npm run test:coverage && npm run build && npm run test:dist && npm run test:consumer && npm run lint:pkg && npm run docs:lint && npm run jsr",
|
|
84
|
+
"prepublishOnly": "npm run check"
|
|
34
85
|
},
|
|
35
86
|
"repository": {
|
|
36
87
|
"type": "git",
|
|
37
|
-
"url": "https://github.com/adrian2x/atomic-fns.git"
|
|
88
|
+
"url": "git+https://github.com/adrian2x/atomic-fns.git"
|
|
38
89
|
},
|
|
90
|
+
"homepage": "https://jsr.io/@atomic-stack/atomic-fns",
|
|
91
|
+
"bugs": {
|
|
92
|
+
"url": "https://github.com/adrian2x/atomic-fns/issues"
|
|
93
|
+
},
|
|
94
|
+
"author": "Adrian Cruz",
|
|
95
|
+
"license": "Apache-2.0",
|
|
39
96
|
"keywords": [
|
|
40
|
-
"modules",
|
|
41
|
-
"stdlib",
|
|
42
|
-
"util",
|
|
43
|
-
"fp",
|
|
44
|
-
"lazy",
|
|
45
|
-
"itertools",
|
|
46
|
-
"core-js",
|
|
47
97
|
"lodash",
|
|
48
98
|
"lodash-es",
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"es2021",
|
|
55
|
-
"es2022",
|
|
99
|
+
"utilities",
|
|
100
|
+
"collections",
|
|
101
|
+
"decimal",
|
|
102
|
+
"sorted-map",
|
|
103
|
+
"deep-equal",
|
|
56
104
|
"esnext",
|
|
57
|
-
"es-next",
|
|
58
|
-
"@esnext",
|
|
59
|
-
"@es-next",
|
|
60
|
-
"atomicfns",
|
|
61
105
|
"atomic-fns"
|
|
62
106
|
],
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
107
|
+
"devDependencies": {
|
|
108
|
+
"@arethetypeswrong/cli": "^0.18.5",
|
|
109
|
+
"@biomejs/biome": "^2.6.5",
|
|
110
|
+
"@types/node": "^26.6.6",
|
|
111
|
+
"@vitest/coverage-v8": "^5.1.0",
|
|
112
|
+
"deno": "^2.9.6",
|
|
113
|
+
"publint": "^0.3.25",
|
|
114
|
+
"typescript": "^7.0.2",
|
|
115
|
+
"vitest": "^5.1.0"
|
|
116
|
+
}
|
|
69
117
|
}
|
|
@@ -1,230 +0,0 @@
|
|
|
1
|
-
import { type Comparer } from '../operators/index.js';
|
|
2
|
-
import { Mapping } from './abc.js';
|
|
3
|
-
import type { Iteratee } from '../types.js';
|
|
4
|
-
export declare class BTree<K = any, V = any> extends Mapping<K, V> {
|
|
5
|
-
private root;
|
|
6
|
-
count: number;
|
|
7
|
-
_maxNodeSize: number;
|
|
8
|
-
/**
|
|
9
|
-
* provides a total order over keys (and a strict partial order over the type K)
|
|
10
|
-
* @returns a negative value if a < b, 0 if a === b and a positive value if a > b
|
|
11
|
-
*/
|
|
12
|
-
_compare: Comparer;
|
|
13
|
-
/**
|
|
14
|
-
* Initializes an empty B+ tree.
|
|
15
|
-
* @param {?Iterable<[K, V]>} [entries] The initial key value pairs.
|
|
16
|
-
* @param compareFn Custom function to compare pairs of elements in the tree.
|
|
17
|
-
* If not specified, {@link operators.compare} is used.
|
|
18
|
-
* @param {number} [maxNodeSize=64] Branching factor (maximum items or children per node)
|
|
19
|
-
* Must be in range 4..256. If undefined or <4 then default is used; if >256 then 256.
|
|
20
|
-
*/
|
|
21
|
-
constructor(entries?: Iterable<[K, V]>, compareFn?: Comparer, maxNodeSize?: number);
|
|
22
|
-
/** Gets the number of key-value pairs in the tree. */
|
|
23
|
-
get size(): number;
|
|
24
|
-
/** Releases the tree so that its size is 0. */
|
|
25
|
-
clear(): void;
|
|
26
|
-
/**
|
|
27
|
-
* Finds a pair in the tree and returns the associated value.
|
|
28
|
-
* @param defaultValue a value to return if the key was not found.
|
|
29
|
-
* @returns the value, or defaultValue if the key was not found.
|
|
30
|
-
* @description Computational complexity: O(log size)
|
|
31
|
-
*/
|
|
32
|
-
get(key: K, defaultValue?: V): V | undefined;
|
|
33
|
-
/**
|
|
34
|
-
* Adds or overwrites a key-value pair in the B+ tree.
|
|
35
|
-
* @param key the key is used to determine the sort order of
|
|
36
|
-
* data in the tree.
|
|
37
|
-
* @param value data to associate with the key (optional)
|
|
38
|
-
* @returns true if a new key-value pair was added.
|
|
39
|
-
* @description Computational complexity: O(log size)
|
|
40
|
-
* Note: when overwriting a previous entry, the key is updated
|
|
41
|
-
* as well as the value. This has no effect unless the new key
|
|
42
|
-
* has data that does not affect its sort order.
|
|
43
|
-
*/
|
|
44
|
-
set(key: K, value: V): boolean;
|
|
45
|
-
add(key: K): boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Returns true if the key exists in the B+ tree, false if not.
|
|
48
|
-
* @param key Key to detect
|
|
49
|
-
* @description Computational complexity: O(log size)
|
|
50
|
-
*/
|
|
51
|
-
contains(key: K): boolean;
|
|
52
|
-
/**
|
|
53
|
-
* Removes a single key-value pair from the B+ tree.
|
|
54
|
-
* @param key Key to find
|
|
55
|
-
* @returns true if a pair was found and removed, false otherwise.
|
|
56
|
-
* @description Computational complexity: O(log size)
|
|
57
|
-
*/
|
|
58
|
-
remove(key: K): boolean;
|
|
59
|
-
/** Returns an iterator that provides items in order (ascending order if
|
|
60
|
-
* the collection's comparator uses ascending order, as is the default.)
|
|
61
|
-
* @param lowestKey First key to be iterated, or undefined to start at
|
|
62
|
-
* minKey(). If the specified key doesn't exist then iteration
|
|
63
|
-
* starts at the next higher key (according to the comparator).
|
|
64
|
-
* @param reusedArray Optional array used repeatedly to store key-value
|
|
65
|
-
* pairs, to avoid creating a new array on every iteration.
|
|
66
|
-
* Note: changing the tree during iteration may skip or repeat keys.
|
|
67
|
-
*/
|
|
68
|
-
entries(lowestKey?: K, reusedArray?: Array<K | V>): IterableIterator<[K, V]>;
|
|
69
|
-
/** Returns an iterator that provides items in reversed order.
|
|
70
|
-
* @param highestKey Key at which to start iterating, or undefined to
|
|
71
|
-
* start at maxKey(). If the specified key doesn't exist then iteration
|
|
72
|
-
* starts at the next lower key (according to the comparator).
|
|
73
|
-
* @param reusedArray Optional array used repeatedly to store key-value
|
|
74
|
-
* pairs, to avoid creating a new array on every iteration.
|
|
75
|
-
* @param skipHighest Iff this flag is true and the highestKey exists in the
|
|
76
|
-
* collection, the pair matching highestKey is skipped, not iterated.
|
|
77
|
-
* Note: changing the tree during iteration may skip or repeat keys.
|
|
78
|
-
*/
|
|
79
|
-
reversed(highestKey?: K, reusedArray?: Array<K | V>, skipHighest?: boolean): IterableIterator<[K, V]>;
|
|
80
|
-
private findPath;
|
|
81
|
-
/** Returns a new iterator for iterating the keys of each pair in ascending order.
|
|
82
|
-
* @param firstKey: Minimum key to include in the output. */
|
|
83
|
-
keys(firstKey?: K): IterableIterator<K>;
|
|
84
|
-
/** Gets the lowest key in the tree. Complexity: O(log size) */
|
|
85
|
-
minKey(): K;
|
|
86
|
-
/** Gets the highest key in the tree. Complexity: O(1) */
|
|
87
|
-
maxKey(): K;
|
|
88
|
-
/** Returns a new iterator for iterating the values of each pair in order by key.
|
|
89
|
-
* @param firstKey: Minimum key whose associated value is included in the output. */
|
|
90
|
-
values(firstKey?: K): IterableIterator<V>;
|
|
91
|
-
/** Returns the maximum number of children/values before nodes will split. */
|
|
92
|
-
get maxNodeSize(): number;
|
|
93
|
-
/** Performs a deep cloning of the tree, immediately duplicating any nodes that are
|
|
94
|
-
* not currently marked as shared, in order to avoid marking any
|
|
95
|
-
* additional nodes as shared.
|
|
96
|
-
* @param force Clone all nodes, even shared ones.
|
|
97
|
-
*/
|
|
98
|
-
clone(force?: boolean): BTree<K, V>;
|
|
99
|
-
/** Gets an array filled with the contents of the tree, sorted by key */
|
|
100
|
-
toArray(): Array<[K, V]>;
|
|
101
|
-
/** Gets a string representing the tree's data based on toArray(). */
|
|
102
|
-
toString(): string;
|
|
103
|
-
/** Returns the next pair whose key is larger than the specified key (or undefined if there is none).
|
|
104
|
-
* If key === undefined, this function returns the lowest pair.
|
|
105
|
-
* @param key The key to search for.
|
|
106
|
-
* @param reusedArray Optional array used repeatedly to store key-value pairs, to
|
|
107
|
-
* avoid creating a new array on every iteration.
|
|
108
|
-
*/
|
|
109
|
-
lowerBound(key: K | undefined, reusedArray?: [K, V]): [K, V] | undefined;
|
|
110
|
-
/** Returns the next key larger than the specified key, or undefined if there is none.
|
|
111
|
-
* Also, nextHigherKey(undefined) returns the lowest key.
|
|
112
|
-
*/
|
|
113
|
-
/** Returns the next pair whose key is smaller than the specified key (or undefined if there is none).
|
|
114
|
-
* If key === undefined, this function returns the highest pair.
|
|
115
|
-
* @param key The key to search for.
|
|
116
|
-
* @param reusedArray Optional array used repeatedly to store key-value pairs, to
|
|
117
|
-
* avoid creating a new array each time you call this method.
|
|
118
|
-
*/
|
|
119
|
-
upperBound(key: K | undefined, reusedArray?: [K, V]): [K, V] | undefined;
|
|
120
|
-
/** Returns the next key smaller than the specified key, or undefined if there is none.
|
|
121
|
-
* Also, nextLowerKey(undefined) returns the highest key.
|
|
122
|
-
*/
|
|
123
|
-
/** Returns the key-value pair associated with the supplied key if it exists
|
|
124
|
-
* or the pair associated with the next lower pair otherwise. If there is no
|
|
125
|
-
* next lower pair, undefined is returned.
|
|
126
|
-
* @param key The key to search for.
|
|
127
|
-
* @param reusedArray Optional array used repeatedly to store key-value pairs, to
|
|
128
|
-
* avoid creating a new array each time you call this method.
|
|
129
|
-
* */
|
|
130
|
-
floor(key: K, reusedArray?: [K, V]): [K, V] | undefined;
|
|
131
|
-
/** Returns the key-value pair associated with the supplied key if it exists
|
|
132
|
-
* or the next higher pair otherwise. If there is no next higher pair,
|
|
133
|
-
* undefined is returned.
|
|
134
|
-
* @param key The key to search for.
|
|
135
|
-
* @param reusedArray Optional array used repeatedly to store key-value pairs, to
|
|
136
|
-
* avoid creating a new array each time you call this method.
|
|
137
|
-
* */
|
|
138
|
-
ceiling(key: K, reusedArray?: [K, V]): [K, V] | undefined;
|
|
139
|
-
/**
|
|
140
|
-
* Builds an array of pairs from the specified range of keys, sorted by key.
|
|
141
|
-
* Each returned pair is also an array: pair[0] is the key, pair[1] is the value.
|
|
142
|
-
* @param low The first key in the array will be greater than or equal to `low`.
|
|
143
|
-
* @param high This method returns when a key larger than this is reached.
|
|
144
|
-
* @param includeHigh If the `high` key is present, its pair will be included
|
|
145
|
-
* in the output if and only if this parameter is true. Note: if the
|
|
146
|
-
* `low` key is present, it is included in the output unless `low`
|
|
147
|
-
* equals `high` and this parameter is false.
|
|
148
|
-
* @param maxLength Length limit. keysRange will stop scanning the tree when
|
|
149
|
-
* the array reaches this size.
|
|
150
|
-
* @description Computational complexity: O(result.length + log size)
|
|
151
|
-
*/
|
|
152
|
-
keysRange(low: K, high: K, includeHigh?: boolean, maxLength?: number): Array<[K, V]>;
|
|
153
|
-
/** Adds all pairs from a list of key-value pairs.
|
|
154
|
-
* @param entries Pairs to add to this tree. If there are duplicate keys,
|
|
155
|
-
* later pairs currently overwrite earlier ones (e.g. [[0,1],[0,7]]
|
|
156
|
-
* associates 0 with 7.)
|
|
157
|
-
* @returns The number of pairs added to the collection.
|
|
158
|
-
* @description Computational complexity: O(pairs.length * log(size + pairs.length))
|
|
159
|
-
*/
|
|
160
|
-
extend(entries: Iterable<[K, V]>): number;
|
|
161
|
-
/**
|
|
162
|
-
* Scans the specified range of keys, in ascending order by key.
|
|
163
|
-
* Note: the callback `onFound` must not insert or remove items in the
|
|
164
|
-
* collection. Doing so may cause incorrect data to be sent to the
|
|
165
|
-
* callback afterward.
|
|
166
|
-
* @param low The first key scanned will be greater than or equal to `low`.
|
|
167
|
-
* @param high Scanning stops when a key larger than this is reached.
|
|
168
|
-
* @param includeHigh If the `high` key is present, `onFound` is called for
|
|
169
|
-
* that final pair if and only if this parameter is true.
|
|
170
|
-
* @param onFound A function that is called for each key-value pair. This
|
|
171
|
-
* function can return {done:R} to stop early with result R.
|
|
172
|
-
* @param initialCounter Initial third argument of onFound. This value
|
|
173
|
-
* increases by one each time `onFound` is called. Default: 0
|
|
174
|
-
* @returns The number of values found, or R if the callback returned
|
|
175
|
-
* `{done:R}` to stop early.
|
|
176
|
-
* @description Computational complexity: O(number of items scanned + log size)
|
|
177
|
-
*/
|
|
178
|
-
rangeForEach<R = number>(low: K, high: K, includeHigh: boolean, onFound?: Iteratee<K, V>, initialCounter?: number): R | number;
|
|
179
|
-
/**
|
|
180
|
-
* Scans and potentially modifies values for a subsequence of keys.
|
|
181
|
-
* Note: the callback `onFound` should ideally be a pure function.
|
|
182
|
-
* Specifically, it must not insert items, call clone(), or change
|
|
183
|
-
* the collection except via return value; out-of-band editing may
|
|
184
|
-
* cause an exception or may cause incorrect data to be sent to
|
|
185
|
-
* the callback (duplicate or missed items). It must not cause a
|
|
186
|
-
* clone() of the collection, otherwise the clone could be modified
|
|
187
|
-
* by changes requested by the callback.
|
|
188
|
-
* @param low The first key scanned will be greater than or equal to `low`.
|
|
189
|
-
* @param high Scanning stops when a key larger than this is reached.
|
|
190
|
-
* @param includeHigh If the `high` key is present, `onFound` is called for
|
|
191
|
-
* that final pair if and only if this parameter is true.
|
|
192
|
-
* @param onFound A function that is called for each key-value pair. This
|
|
193
|
-
* function can return `{value:v}` to change the value associated
|
|
194
|
-
* with the current key, `{delete:true}` to delete the current pair,
|
|
195
|
-
* `{done:R}` to stop early with result R, or it can return nothing
|
|
196
|
-
* (undefined, null or {}) to cause no effect and continue iterating.
|
|
197
|
-
* `{done:R}` can be combined with one of the other two commands.
|
|
198
|
-
* The third argument `counter` is the number of items iterated
|
|
199
|
-
* previously; it equals 0 when `onFound` is called the first time.
|
|
200
|
-
* @returns The number of values scanned, or R if the callback returned
|
|
201
|
-
* `{done:R}` to stop early.
|
|
202
|
-
* @description
|
|
203
|
-
* Computational complexity: O(number of items scanned + log size)
|
|
204
|
-
* Note: if the tree has been cloned with clone(), any shared
|
|
205
|
-
* nodes are copied before `onFound` is called. This takes O(n) time
|
|
206
|
-
* where n is proportional to the amount of shared data scanned.
|
|
207
|
-
*/
|
|
208
|
-
rangeUpdate<R = V>(low: K, high: K, includeHigh: boolean, onFound: (k: K, v: V | undefined, counter: number) => any, initialCounter?: number): R | number;
|
|
209
|
-
/**
|
|
210
|
-
* Removes a range of key-value pairs from the B+ tree.
|
|
211
|
-
* @param low The first key scanned will be greater than or equal to `low`.
|
|
212
|
-
* @param high Scanning stops when a key larger than this is reached.
|
|
213
|
-
* @param includeHigh Specifies whether the `high` key, if present, is deleted.
|
|
214
|
-
* @returns The number of key-value pairs that were deleted.
|
|
215
|
-
* @description Computational complexity: O(log size + number of items deleted)
|
|
216
|
-
*/
|
|
217
|
-
removeRange(low: K, high: K, includeHigh: boolean): number;
|
|
218
|
-
/** Removes a series of keys from the collection. */
|
|
219
|
-
removeKeys(keys: K[]): number;
|
|
220
|
-
/** Gets the height of the tree: the number of internal nodes between the
|
|
221
|
-
* BTree object and its leaf nodes (zero if there are no internal nodes). */
|
|
222
|
-
get height(): number;
|
|
223
|
-
/** Makes the object read-only to ensure it is not accidentally modified.
|
|
224
|
-
* This is accomplished by replacing mutator functions with a function
|
|
225
|
-
* that throws an Error. Compared to using a property (e.g. this.isFrozen)
|
|
226
|
-
* this implementation gives better performance in non-frozen BTrees.
|
|
227
|
-
*/
|
|
228
|
-
freeze(): void;
|
|
229
|
-
[Symbol.iterator](): IterableIterator<[K, V]>;
|
|
230
|
-
}
|