deque-typed 1.48.0 → 1.48.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/dist/data-structures/base/index.d.ts +1 -0
- package/dist/data-structures/base/index.js +17 -0
- package/dist/data-structures/base/iterable-base.d.ts +232 -0
- package/dist/data-structures/base/iterable-base.js +312 -0
- package/dist/data-structures/binary-tree/binary-tree.d.ts +45 -40
- package/dist/data-structures/binary-tree/binary-tree.js +91 -88
- package/dist/data-structures/binary-tree/tree-multimap.d.ts +12 -0
- package/dist/data-structures/binary-tree/tree-multimap.js +16 -0
- package/dist/data-structures/graph/abstract-graph.d.ts +44 -6
- package/dist/data-structures/graph/abstract-graph.js +50 -27
- package/dist/data-structures/hash/hash-map.d.ts +160 -44
- package/dist/data-structures/hash/hash-map.js +314 -82
- package/dist/data-structures/heap/heap.d.ts +50 -7
- package/dist/data-structures/heap/heap.js +60 -30
- package/dist/data-structures/index.d.ts +1 -0
- package/dist/data-structures/index.js +1 -0
- package/dist/data-structures/linked-list/doubly-linked-list.d.ts +38 -51
- package/dist/data-structures/linked-list/doubly-linked-list.js +46 -73
- package/dist/data-structures/linked-list/singly-linked-list.d.ts +32 -51
- package/dist/data-structures/linked-list/singly-linked-list.js +40 -73
- package/dist/data-structures/queue/deque.d.ts +29 -51
- package/dist/data-structures/queue/deque.js +36 -71
- package/dist/data-structures/queue/queue.d.ts +49 -48
- package/dist/data-structures/queue/queue.js +69 -82
- package/dist/data-structures/stack/stack.d.ts +43 -10
- package/dist/data-structures/stack/stack.js +50 -31
- package/dist/data-structures/trie/trie.d.ts +41 -6
- package/dist/data-structures/trie/trie.js +53 -32
- package/dist/types/data-structures/base/base.d.ts +5 -0
- package/dist/types/data-structures/base/base.js +2 -0
- package/dist/types/data-structures/base/index.d.ts +1 -0
- package/dist/types/data-structures/base/index.js +17 -0
- package/dist/types/data-structures/hash/hash-map.d.ts +4 -0
- package/dist/types/data-structures/index.d.ts +1 -0
- package/dist/types/data-structures/index.js +1 -0
- package/package.json +2 -2
- package/src/data-structures/base/index.ts +1 -0
- package/src/data-structures/base/iterable-base.ts +329 -0
- package/src/data-structures/binary-tree/binary-tree.ts +98 -93
- package/src/data-structures/binary-tree/tree-multimap.ts +18 -0
- package/src/data-structures/graph/abstract-graph.ts +55 -28
- package/src/data-structures/hash/hash-map.ts +334 -83
- package/src/data-structures/heap/heap.ts +63 -36
- package/src/data-structures/index.ts +1 -0
- package/src/data-structures/linked-list/doubly-linked-list.ts +50 -79
- package/src/data-structures/linked-list/singly-linked-list.ts +45 -80
- package/src/data-structures/queue/deque.ts +40 -82
- package/src/data-structures/queue/queue.ts +72 -87
- package/src/data-structures/stack/stack.ts +53 -34
- package/src/data-structures/trie/trie.ts +58 -35
- package/src/types/data-structures/base/base.ts +6 -0
- package/src/types/data-structures/base/index.ts +1 -0
- package/src/types/data-structures/hash/hash-map.ts +2 -0
- package/src/types/data-structures/index.ts +1 -0
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { IterableElementBase } from "../base";
|
|
2
|
+
import { ElementCallback } from "../../types";
|
|
1
3
|
/**
|
|
2
4
|
* @license MIT
|
|
3
5
|
* @copyright Tyler Zeng <zrwusa@gmail.com>
|
|
4
6
|
* @class
|
|
5
7
|
*/
|
|
6
|
-
export declare class Stack<E = any> {
|
|
8
|
+
export declare class Stack<E = any> extends IterableElementBase<E> {
|
|
7
9
|
/**
|
|
8
10
|
* The constructor initializes an array of elements, which can be provided as an optional parameter.
|
|
9
11
|
* @param {E[]} [elements] - The `elements` parameter is an optional parameter of type `E[]`, which represents an array
|
|
@@ -104,17 +106,48 @@ export declare class Stack<E = any> {
|
|
|
104
106
|
*/
|
|
105
107
|
clone(): Stack<E>;
|
|
106
108
|
/**
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
+
* Time Complexity: O(n)
|
|
110
|
+
* Space Complexity: O(n)
|
|
109
111
|
*/
|
|
110
|
-
[Symbol.iterator](): Generator<E, void, unknown>;
|
|
111
112
|
/**
|
|
112
|
-
*
|
|
113
|
-
*
|
|
113
|
+
* Time Complexity: O(n)
|
|
114
|
+
* Space Complexity: O(n)
|
|
115
|
+
*
|
|
116
|
+
* The `filter` function creates a new stack containing elements from the original stack that satisfy
|
|
117
|
+
* a given predicate function.
|
|
118
|
+
* @param predicate - The `predicate` parameter is a callback function that takes three arguments:
|
|
119
|
+
* the current element being iterated over, the index of the current element, and the stack itself.
|
|
120
|
+
* It should return a boolean value indicating whether the element should be included in the filtered
|
|
121
|
+
* stack or not.
|
|
122
|
+
* @param {any} [thisArg] - The `thisArg` parameter is an optional argument that specifies the value
|
|
123
|
+
* to be used as `this` when executing the `predicate` function. If `thisArg` is provided, it will be
|
|
124
|
+
* passed as the `this` value to the `predicate` function. If `thisArg` is
|
|
125
|
+
* @returns The `filter` method is returning a new `Stack` object that contains the elements that
|
|
126
|
+
* satisfy the given predicate function.
|
|
127
|
+
*/
|
|
128
|
+
filter(predicate: ElementCallback<E, boolean>, thisArg?: any): Stack<E>;
|
|
129
|
+
/**
|
|
130
|
+
* Time Complexity: O(n)
|
|
131
|
+
* Space Complexity: O(n)
|
|
114
132
|
*/
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
133
|
+
/**
|
|
134
|
+
* Time Complexity: O(n)
|
|
135
|
+
* Space Complexity: O(n)
|
|
136
|
+
*
|
|
137
|
+
* The `map` function takes a callback function and applies it to each element in the stack,
|
|
138
|
+
* returning a new stack with the results.
|
|
139
|
+
* @param callback - The `callback` parameter is a function that will be called for each element in
|
|
140
|
+
* the stack. It takes three arguments:
|
|
141
|
+
* @param {any} [thisArg] - The `thisArg` parameter is an optional argument that specifies the value
|
|
142
|
+
* to be used as `this` when executing the `callback` function. If `thisArg` is provided, it will be
|
|
143
|
+
* passed as the `this` value to the `callback` function. If `thisArg` is
|
|
144
|
+
* @returns The `map` method is returning a new `Stack` object.
|
|
145
|
+
*/
|
|
146
|
+
map<T>(callback: ElementCallback<E, T>, thisArg?: any): Stack<T>;
|
|
119
147
|
print(): void;
|
|
148
|
+
/**
|
|
149
|
+
* Custom iterator for the Stack class.
|
|
150
|
+
* @returns An iterator object.
|
|
151
|
+
*/
|
|
152
|
+
protected _getIterator(): Generator<E, void, unknown>;
|
|
120
153
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Stack = void 0;
|
|
4
|
+
const base_1 = require("../base");
|
|
4
5
|
/**
|
|
5
6
|
* @license MIT
|
|
6
7
|
* @copyright Tyler Zeng <zrwusa@gmail.com>
|
|
7
8
|
* @class
|
|
8
9
|
*/
|
|
9
|
-
class Stack {
|
|
10
|
+
class Stack extends base_1.IterableElementBase {
|
|
10
11
|
/**
|
|
11
12
|
* The constructor initializes an array of elements, which can be provided as an optional parameter.
|
|
12
13
|
* @param {E[]} [elements] - The `elements` parameter is an optional parameter of type `E[]`, which represents an array
|
|
@@ -14,6 +15,7 @@ class Stack {
|
|
|
14
15
|
* is provided and is an array, it is assigned to the `_elements
|
|
15
16
|
*/
|
|
16
17
|
constructor(elements) {
|
|
18
|
+
super();
|
|
17
19
|
this._elements = [];
|
|
18
20
|
if (elements) {
|
|
19
21
|
for (const el of elements) {
|
|
@@ -138,56 +140,73 @@ class Stack {
|
|
|
138
140
|
return new Stack(this.elements.slice());
|
|
139
141
|
}
|
|
140
142
|
/**
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
+
* Time Complexity: O(n)
|
|
144
|
+
* Space Complexity: O(n)
|
|
143
145
|
*/
|
|
144
|
-
*[Symbol.iterator]() {
|
|
145
|
-
for (let i = 0; i < this.elements.length; i++) {
|
|
146
|
-
yield this.elements[i];
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
146
|
/**
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
147
|
+
* Time Complexity: O(n)
|
|
148
|
+
* Space Complexity: O(n)
|
|
149
|
+
*
|
|
150
|
+
* The `filter` function creates a new stack containing elements from the original stack that satisfy
|
|
151
|
+
* a given predicate function.
|
|
152
|
+
* @param predicate - The `predicate` parameter is a callback function that takes three arguments:
|
|
153
|
+
* the current element being iterated over, the index of the current element, and the stack itself.
|
|
154
|
+
* It should return a boolean value indicating whether the element should be included in the filtered
|
|
155
|
+
* stack or not.
|
|
156
|
+
* @param {any} [thisArg] - The `thisArg` parameter is an optional argument that specifies the value
|
|
157
|
+
* to be used as `this` when executing the `predicate` function. If `thisArg` is provided, it will be
|
|
158
|
+
* passed as the `this` value to the `predicate` function. If `thisArg` is
|
|
159
|
+
* @returns The `filter` method is returning a new `Stack` object that contains the elements that
|
|
160
|
+
* satisfy the given predicate function.
|
|
161
|
+
*/
|
|
162
|
+
filter(predicate, thisArg) {
|
|
161
163
|
const newStack = new Stack();
|
|
162
164
|
let index = 0;
|
|
163
165
|
for (const el of this) {
|
|
164
|
-
if (predicate(el, index, this)) {
|
|
166
|
+
if (predicate.call(thisArg, el, index, this)) {
|
|
165
167
|
newStack.push(el);
|
|
166
168
|
}
|
|
167
169
|
index++;
|
|
168
170
|
}
|
|
169
171
|
return newStack;
|
|
170
172
|
}
|
|
171
|
-
|
|
173
|
+
/**
|
|
174
|
+
* Time Complexity: O(n)
|
|
175
|
+
* Space Complexity: O(n)
|
|
176
|
+
*/
|
|
177
|
+
/**
|
|
178
|
+
* Time Complexity: O(n)
|
|
179
|
+
* Space Complexity: O(n)
|
|
180
|
+
*
|
|
181
|
+
* The `map` function takes a callback function and applies it to each element in the stack,
|
|
182
|
+
* returning a new stack with the results.
|
|
183
|
+
* @param callback - The `callback` parameter is a function that will be called for each element in
|
|
184
|
+
* the stack. It takes three arguments:
|
|
185
|
+
* @param {any} [thisArg] - The `thisArg` parameter is an optional argument that specifies the value
|
|
186
|
+
* to be used as `this` when executing the `callback` function. If `thisArg` is provided, it will be
|
|
187
|
+
* passed as the `this` value to the `callback` function. If `thisArg` is
|
|
188
|
+
* @returns The `map` method is returning a new `Stack` object.
|
|
189
|
+
*/
|
|
190
|
+
map(callback, thisArg) {
|
|
172
191
|
const newStack = new Stack();
|
|
173
192
|
let index = 0;
|
|
174
193
|
for (const el of this) {
|
|
175
|
-
newStack.push(callback(el, index, this));
|
|
194
|
+
newStack.push(callback.call(thisArg, el, index, this));
|
|
176
195
|
index++;
|
|
177
196
|
}
|
|
178
197
|
return newStack;
|
|
179
198
|
}
|
|
180
|
-
reduce(callback, initialValue) {
|
|
181
|
-
let accumulator = initialValue;
|
|
182
|
-
let index = 0;
|
|
183
|
-
for (const el of this) {
|
|
184
|
-
accumulator = callback(accumulator, el, index, this);
|
|
185
|
-
index++;
|
|
186
|
-
}
|
|
187
|
-
return accumulator;
|
|
188
|
-
}
|
|
189
199
|
print() {
|
|
190
200
|
console.log([...this]);
|
|
191
201
|
}
|
|
202
|
+
/**
|
|
203
|
+
* Custom iterator for the Stack class.
|
|
204
|
+
* @returns An iterator object.
|
|
205
|
+
*/
|
|
206
|
+
*_getIterator() {
|
|
207
|
+
for (let i = 0; i < this.elements.length; i++) {
|
|
208
|
+
yield this.elements[i];
|
|
209
|
+
}
|
|
210
|
+
}
|
|
192
211
|
}
|
|
193
212
|
exports.Stack = Stack;
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* @copyright Copyright (c) 2022 Tyler Zeng <zrwusa@gmail.com>
|
|
6
6
|
* @license MIT License
|
|
7
7
|
*/
|
|
8
|
+
import { IterableElementBase } from "../base";
|
|
9
|
+
import { ElementCallback } from "../../types";
|
|
8
10
|
/**
|
|
9
11
|
* TrieNode represents a node in the Trie data structure. It holds a character key, a map of children nodes,
|
|
10
12
|
* and a flag indicating whether it's the end of a word.
|
|
@@ -18,7 +20,7 @@ export declare class TrieNode {
|
|
|
18
20
|
/**
|
|
19
21
|
* Trie represents a Trie data structure. It provides basic Trie operations and additional methods.
|
|
20
22
|
*/
|
|
21
|
-
export declare class Trie {
|
|
23
|
+
export declare class Trie extends IterableElementBase<string> {
|
|
22
24
|
constructor(words?: string[], caseSensitive?: boolean);
|
|
23
25
|
protected _size: number;
|
|
24
26
|
get size(): number;
|
|
@@ -142,12 +144,45 @@ export declare class Trie {
|
|
|
142
144
|
* @returns {string[]} an array of strings.
|
|
143
145
|
*/
|
|
144
146
|
getWords(prefix?: string, max?: number, isAllWhenEmptyPrefix?: boolean): string[];
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
147
|
+
/**
|
|
148
|
+
* Time Complexity: O(n)
|
|
149
|
+
* Space Complexity: O(n)
|
|
150
|
+
*/
|
|
151
|
+
/**
|
|
152
|
+
* Time Complexity: O(n)
|
|
153
|
+
* Space Complexity: O(n)
|
|
154
|
+
*
|
|
155
|
+
* The `filter` function takes a predicate function and returns a new array containing all the
|
|
156
|
+
* elements for which the predicate function returns true.
|
|
157
|
+
* @param predicate - The `predicate` parameter is a callback function that takes three arguments:
|
|
158
|
+
* `word`, `index`, and `this`. It should return a boolean value indicating whether the current
|
|
159
|
+
* element should be included in the filtered results or not.
|
|
160
|
+
* @param {any} [thisArg] - The `thisArg` parameter is an optional argument that allows you to
|
|
161
|
+
* specify the value of `this` within the `predicate` function. It is used when you want to bind a
|
|
162
|
+
* specific object as the context for the `predicate` function. If `thisArg` is provided, it will be
|
|
163
|
+
* @returns The `filter` method is returning an array of strings (`string[]`).
|
|
164
|
+
*/
|
|
165
|
+
filter(predicate: ElementCallback<string, boolean>, thisArg?: any): string[];
|
|
166
|
+
/**
|
|
167
|
+
* Time Complexity: O(n)
|
|
168
|
+
* Space Complexity: O(n)
|
|
169
|
+
*/
|
|
170
|
+
/**
|
|
171
|
+
* Time Complexity: O(n)
|
|
172
|
+
* Space Complexity: O(n)
|
|
173
|
+
*
|
|
174
|
+
* The `map` function creates a new Trie by applying a callback function to each element in the Trie.
|
|
175
|
+
* @param callback - The callback parameter is a function that will be called for each element in the
|
|
176
|
+
* Trie. It takes three arguments: the current element in the Trie, the index of the current element,
|
|
177
|
+
* and the Trie itself. The callback function should return a new value for the element.
|
|
178
|
+
* @param {any} [thisArg] - The `thisArg` parameter is an optional argument that specifies the value
|
|
179
|
+
* to be used as `this` when executing the `callback` function. If `thisArg` is provided, it will be
|
|
180
|
+
* passed as the `this` value to the `callback` function. If `thisArg` is
|
|
181
|
+
* @returns The `map` function is returning a new Trie object.
|
|
182
|
+
*/
|
|
183
|
+
map(callback: ElementCallback<string, string>, thisArg?: any): Trie;
|
|
150
184
|
print(): void;
|
|
185
|
+
protected _getIterator(): IterableIterator<string>;
|
|
151
186
|
/**
|
|
152
187
|
* Time Complexity: O(M), where M is the length of the input string.
|
|
153
188
|
* Space Complexity: O(1) - Constant space.
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.Trie = exports.TrieNode = void 0;
|
|
11
|
+
const base_1 = require("../base");
|
|
11
12
|
/**
|
|
12
13
|
* TrieNode represents a node in the Trie data structure. It holds a character key, a map of children nodes,
|
|
13
14
|
* and a flag indicating whether it's the end of a word.
|
|
@@ -23,8 +24,9 @@ exports.TrieNode = TrieNode;
|
|
|
23
24
|
/**
|
|
24
25
|
* Trie represents a Trie data structure. It provides basic Trie operations and additional methods.
|
|
25
26
|
*/
|
|
26
|
-
class Trie {
|
|
27
|
+
class Trie extends base_1.IterableElementBase {
|
|
27
28
|
constructor(words, caseSensitive = true) {
|
|
29
|
+
super();
|
|
28
30
|
this._root = new TrieNode('');
|
|
29
31
|
this._caseSensitive = caseSensitive;
|
|
30
32
|
this._size = 0;
|
|
@@ -317,56 +319,75 @@ class Trie {
|
|
|
317
319
|
dfs(startNode, prefix);
|
|
318
320
|
return words;
|
|
319
321
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
filter(predicate) {
|
|
322
|
+
/**
|
|
323
|
+
* Time Complexity: O(n)
|
|
324
|
+
* Space Complexity: O(n)
|
|
325
|
+
*/
|
|
326
|
+
/**
|
|
327
|
+
* Time Complexity: O(n)
|
|
328
|
+
* Space Complexity: O(n)
|
|
329
|
+
*
|
|
330
|
+
* The `filter` function takes a predicate function and returns a new array containing all the
|
|
331
|
+
* elements for which the predicate function returns true.
|
|
332
|
+
* @param predicate - The `predicate` parameter is a callback function that takes three arguments:
|
|
333
|
+
* `word`, `index`, and `this`. It should return a boolean value indicating whether the current
|
|
334
|
+
* element should be included in the filtered results or not.
|
|
335
|
+
* @param {any} [thisArg] - The `thisArg` parameter is an optional argument that allows you to
|
|
336
|
+
* specify the value of `this` within the `predicate` function. It is used when you want to bind a
|
|
337
|
+
* specific object as the context for the `predicate` function. If `thisArg` is provided, it will be
|
|
338
|
+
* @returns The `filter` method is returning an array of strings (`string[]`).
|
|
339
|
+
*/
|
|
340
|
+
filter(predicate, thisArg) {
|
|
339
341
|
const results = [];
|
|
340
342
|
let index = 0;
|
|
341
343
|
for (const word of this) {
|
|
342
|
-
if (predicate(word, index, this)) {
|
|
344
|
+
if (predicate.call(thisArg, word, index, this)) {
|
|
343
345
|
results.push(word);
|
|
344
346
|
}
|
|
345
347
|
index++;
|
|
346
348
|
}
|
|
347
349
|
return results;
|
|
348
350
|
}
|
|
349
|
-
|
|
351
|
+
/**
|
|
352
|
+
* Time Complexity: O(n)
|
|
353
|
+
* Space Complexity: O(n)
|
|
354
|
+
*/
|
|
355
|
+
/**
|
|
356
|
+
* Time Complexity: O(n)
|
|
357
|
+
* Space Complexity: O(n)
|
|
358
|
+
*
|
|
359
|
+
* The `map` function creates a new Trie by applying a callback function to each element in the Trie.
|
|
360
|
+
* @param callback - The callback parameter is a function that will be called for each element in the
|
|
361
|
+
* Trie. It takes three arguments: the current element in the Trie, the index of the current element,
|
|
362
|
+
* and the Trie itself. The callback function should return a new value for the element.
|
|
363
|
+
* @param {any} [thisArg] - The `thisArg` parameter is an optional argument that specifies the value
|
|
364
|
+
* to be used as `this` when executing the `callback` function. If `thisArg` is provided, it will be
|
|
365
|
+
* passed as the `this` value to the `callback` function. If `thisArg` is
|
|
366
|
+
* @returns The `map` function is returning a new Trie object.
|
|
367
|
+
*/
|
|
368
|
+
map(callback, thisArg) {
|
|
350
369
|
const newTrie = new Trie();
|
|
351
370
|
let index = 0;
|
|
352
371
|
for (const word of this) {
|
|
353
|
-
newTrie.add(callback(word, index, this));
|
|
372
|
+
newTrie.add(callback.call(thisArg, word, index, this));
|
|
354
373
|
index++;
|
|
355
374
|
}
|
|
356
375
|
return newTrie;
|
|
357
376
|
}
|
|
358
|
-
reduce(callback, initialValue) {
|
|
359
|
-
let accumulator = initialValue;
|
|
360
|
-
let index = 0;
|
|
361
|
-
for (const word of this) {
|
|
362
|
-
accumulator = callback(accumulator, word, index, this);
|
|
363
|
-
index++;
|
|
364
|
-
}
|
|
365
|
-
return accumulator;
|
|
366
|
-
}
|
|
367
377
|
print() {
|
|
368
378
|
console.log([...this]);
|
|
369
379
|
}
|
|
380
|
+
*_getIterator() {
|
|
381
|
+
function* _dfs(node, path) {
|
|
382
|
+
if (node.isEnd) {
|
|
383
|
+
yield path;
|
|
384
|
+
}
|
|
385
|
+
for (const [char, childNode] of node.children) {
|
|
386
|
+
yield* _dfs(childNode, path + char);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
yield* _dfs(this.root, '');
|
|
390
|
+
}
|
|
370
391
|
/**
|
|
371
392
|
* Time Complexity: O(M), where M is the length of the input string.
|
|
372
393
|
* Space Complexity: O(1) - Constant space.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IterableElementBase, IterablePairBase } from "../../../data-structures";
|
|
2
|
+
export type PairCallback<K, V, R> = (value: V, key: K, index: number, container: IterablePairBase<K, V>) => R;
|
|
3
|
+
export type ElementCallback<V, R> = (element: V, index: number, container: IterableElementBase<V>) => R;
|
|
4
|
+
export type ReducePairCallback<K, V, R> = (accumulator: R, value: V, key: K, index: number, container: IterablePairBase<K, V>) => R;
|
|
5
|
+
export type ReduceElementCallback<V, R> = (accumulator: R, element: V, index: number, container: IterableElementBase<V>) => R;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './base';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./base"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deque-typed",
|
|
3
|
-
"version": "1.48.
|
|
3
|
+
"version": "1.48.2",
|
|
4
4
|
"description": "Deque. Javascript & Typescript Data Structure.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -119,6 +119,6 @@
|
|
|
119
119
|
"typescript": "^4.9.5"
|
|
120
120
|
},
|
|
121
121
|
"dependencies": {
|
|
122
|
-
"data-structure-typed": "^1.48.
|
|
122
|
+
"data-structure-typed": "^1.48.2"
|
|
123
123
|
}
|
|
124
124
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './iterable-base';
|