scats 1.0.32 → 1.2.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 +82 -3
- package/coverage/clover.xml +937 -0
- package/coverage/coverage-final.json +15 -0
- package/coverage/lcov-report/array-iterable.ts.html +1709 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +79 -0
- package/coverage/lcov-report/collection.ts.html +1475 -0
- package/coverage/lcov-report/either.ts.html +1934 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/hashmap.ts.html +527 -0
- package/coverage/lcov-report/hashset.ts.html +392 -0
- package/coverage/lcov-report/index.html +126 -0
- package/coverage/lcov-report/index.ts.html +101 -0
- package/coverage/lcov-report/option.ts.html +758 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +170 -0
- package/coverage/lcov-report/src/abstract-map.ts.html +317 -0
- package/coverage/lcov-report/src/abstract-set.ts.html +200 -0
- package/coverage/lcov-report/src/array-iterable.ts.html +1751 -0
- package/coverage/lcov-report/src/collection.ts.html +1778 -0
- package/coverage/lcov-report/src/either.ts.html +1934 -0
- package/coverage/lcov-report/src/hashmap.ts.html +428 -0
- package/coverage/lcov-report/src/hashset.ts.html +482 -0
- package/coverage/lcov-report/src/index.html +276 -0
- package/coverage/lcov-report/src/index.ts.html +110 -0
- package/coverage/lcov-report/src/mutable/hashmap.ts.html +821 -0
- package/coverage/lcov-report/src/mutable/hashset.ts.html +611 -0
- package/coverage/lcov-report/src/mutable/index.html +126 -0
- package/coverage/lcov-report/src/mutable.ts.html +89 -0
- package/coverage/lcov-report/src/option.ts.html +758 -0
- package/coverage/lcov-report/src/try.ts.html +923 -0
- package/coverage/lcov-report/src/util.ts.html +518 -0
- package/coverage/lcov-report/try.ts.html +923 -0
- package/coverage/lcov-report/util.ts.html +518 -0
- package/coverage/lcov.info +2223 -0
- package/dist/abstract-map.d.ts +25 -0
- package/dist/abstract-map.js +62 -0
- package/dist/abstract-set.d.ts +13 -0
- package/dist/abstract-set.js +33 -0
- package/dist/array-iterable.d.ts +1 -3
- package/dist/array-iterable.js +21 -23
- package/dist/collection.d.ts +59 -20
- package/dist/collection.js +254 -62
- package/dist/hashmap.d.ts +12 -26
- package/dist/hashmap.js +39 -58
- package/dist/hashset.d.ts +12 -17
- package/dist/hashset.js +25 -35
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/mutable/hashmap.d.ts +24 -0
- package/dist/mutable/hashmap.js +118 -0
- package/dist/mutable/hashset.d.ts +20 -0
- package/dist/mutable/hashset.js +88 -0
- package/dist/mutable.d.ts +3 -0
- package/dist/mutable.js +9 -0
- package/dist/option.js +1 -1
- package/package.json +12 -12
- package/src/abstract-map.ts +79 -0
- package/src/abstract-set.ts +40 -0
- package/src/array-iterable.ts +26 -12
- package/src/collection.ts +394 -85
- package/src/either.ts +2 -2
- package/src/hashmap.ts +74 -73
- package/src/hashset.ts +82 -42
- package/src/index.ts +3 -0
- package/src/mutable/hashmap.ts +247 -0
- package/src/mutable/hashset.ts +177 -0
- package/src/mutable.ts +3 -0
- package/src/option.ts +2 -2
- package/src/try.ts +9 -9
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ArrayIterable } from './array-iterable';
|
|
2
|
+
import { Option } from './option';
|
|
3
|
+
import { HashSet } from './hashset';
|
|
4
|
+
import { Collection } from './collection';
|
|
5
|
+
export declare type Tuple2<K, V> = [K, V];
|
|
6
|
+
export declare abstract class AbstractMap<K, V, S extends AbstractMap<K, V, any>> extends ArrayIterable<Tuple2<K, V>, S> {
|
|
7
|
+
protected readonly map: Map<K, V>;
|
|
8
|
+
protected constructor(map: Map<K, V>);
|
|
9
|
+
get size(): number;
|
|
10
|
+
get isEmpty(): boolean;
|
|
11
|
+
get(key: K): Option<V>;
|
|
12
|
+
getOrElse(key: K, defaultValue: () => V): V;
|
|
13
|
+
getOrElseValue(key: K, defaultValue: V): V;
|
|
14
|
+
get keySet(): HashSet<K>;
|
|
15
|
+
get keyIterator(): IterableIterator<K>;
|
|
16
|
+
get keys(): Collection<K>;
|
|
17
|
+
get values(): Collection<V>;
|
|
18
|
+
get valueIterator(): IterableIterator<V>;
|
|
19
|
+
get entries(): Collection<Tuple2<K, V>>;
|
|
20
|
+
get entriesIterator(): IterableIterator<Tuple2<K, V>>;
|
|
21
|
+
containsKey(key: K): boolean;
|
|
22
|
+
get toCollection(): Collection<Tuple2<K, V>>;
|
|
23
|
+
get toMap(): Map<K, V>;
|
|
24
|
+
get toArray(): Array<Tuple2<K, V>>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AbstractMap = void 0;
|
|
4
|
+
const array_iterable_1 = require("./array-iterable");
|
|
5
|
+
const option_1 = require("./option");
|
|
6
|
+
const hashset_1 = require("./hashset");
|
|
7
|
+
const collection_1 = require("./collection");
|
|
8
|
+
class AbstractMap extends array_iterable_1.ArrayIterable {
|
|
9
|
+
constructor(map) {
|
|
10
|
+
super();
|
|
11
|
+
this.map = map;
|
|
12
|
+
}
|
|
13
|
+
get size() {
|
|
14
|
+
return this.map.size;
|
|
15
|
+
}
|
|
16
|
+
get isEmpty() {
|
|
17
|
+
return this.map.size <= 0;
|
|
18
|
+
}
|
|
19
|
+
get(key) {
|
|
20
|
+
return option_1.option(this.map.get(key));
|
|
21
|
+
}
|
|
22
|
+
getOrElse(key, defaultValue) {
|
|
23
|
+
return this.get(key).getOrElse(defaultValue);
|
|
24
|
+
}
|
|
25
|
+
getOrElseValue(key, defaultValue) {
|
|
26
|
+
return this.get(key).getOrElseValue(defaultValue);
|
|
27
|
+
}
|
|
28
|
+
get keySet() {
|
|
29
|
+
return hashset_1.HashSet.of(...Array.from(this.map.keys()));
|
|
30
|
+
}
|
|
31
|
+
get keyIterator() {
|
|
32
|
+
return this.map.keys();
|
|
33
|
+
}
|
|
34
|
+
get keys() {
|
|
35
|
+
return new collection_1.Collection(Array.from(this.map.keys()));
|
|
36
|
+
}
|
|
37
|
+
get values() {
|
|
38
|
+
return new collection_1.Collection(Array.from(this.map.values()));
|
|
39
|
+
}
|
|
40
|
+
get valueIterator() {
|
|
41
|
+
return this.map.values();
|
|
42
|
+
}
|
|
43
|
+
get entries() {
|
|
44
|
+
return new collection_1.Collection(Array.from(this.map.entries()));
|
|
45
|
+
}
|
|
46
|
+
get entriesIterator() {
|
|
47
|
+
return this.map.entries();
|
|
48
|
+
}
|
|
49
|
+
containsKey(key) {
|
|
50
|
+
return this.map.has(key);
|
|
51
|
+
}
|
|
52
|
+
get toCollection() {
|
|
53
|
+
return new collection_1.Collection(Array.from(this.map.entries()));
|
|
54
|
+
}
|
|
55
|
+
get toMap() {
|
|
56
|
+
return this.map;
|
|
57
|
+
}
|
|
58
|
+
get toArray() {
|
|
59
|
+
return Array.from(this.map.entries());
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.AbstractMap = AbstractMap;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ArrayIterable } from './array-iterable';
|
|
2
|
+
import { ArrayBuffer, Collection } from './collection';
|
|
3
|
+
export declare abstract class AbstractSet<T, S extends AbstractSet<T, any>> extends ArrayIterable<T, S> {
|
|
4
|
+
protected readonly items: Set<T>;
|
|
5
|
+
protected constructor(items: Set<T>);
|
|
6
|
+
contains(item: T): boolean;
|
|
7
|
+
get toArray(): Array<T>;
|
|
8
|
+
get toCollection(): Collection<T>;
|
|
9
|
+
get toSet(): Set<T>;
|
|
10
|
+
get isEmpty(): boolean;
|
|
11
|
+
get size(): number;
|
|
12
|
+
get toBuffer(): ArrayBuffer<T>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AbstractSet = void 0;
|
|
4
|
+
const array_iterable_1 = require("./array-iterable");
|
|
5
|
+
const collection_1 = require("./collection");
|
|
6
|
+
class AbstractSet extends array_iterable_1.ArrayIterable {
|
|
7
|
+
constructor(items) {
|
|
8
|
+
super();
|
|
9
|
+
this.items = items;
|
|
10
|
+
}
|
|
11
|
+
contains(item) {
|
|
12
|
+
return this.items.has(item);
|
|
13
|
+
}
|
|
14
|
+
get toArray() {
|
|
15
|
+
return Array.from(this.items.keys());
|
|
16
|
+
}
|
|
17
|
+
get toCollection() {
|
|
18
|
+
return new collection_1.Collection(Array.from(this.items.keys()));
|
|
19
|
+
}
|
|
20
|
+
get toSet() {
|
|
21
|
+
return new Set(this.items);
|
|
22
|
+
}
|
|
23
|
+
get isEmpty() {
|
|
24
|
+
return this.items.size <= 0;
|
|
25
|
+
}
|
|
26
|
+
get size() {
|
|
27
|
+
return this.items.size;
|
|
28
|
+
}
|
|
29
|
+
get toBuffer() {
|
|
30
|
+
return new collection_1.ArrayBuffer(Array.from(this.items.keys()));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.AbstractSet = AbstractSet;
|
package/dist/array-iterable.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { Option } from './
|
|
2
|
-
import { HashMap } from './hashmap';
|
|
3
|
-
import { Collection } from './collection';
|
|
1
|
+
import { Collection, HashMap, Option } from './index';
|
|
4
2
|
export declare abstract class ArrayIterable<T, C extends ArrayIterable<T, any>> implements Iterable<T> {
|
|
5
3
|
[Symbol.iterator](): Iterator<T, T | undefined, undefined>;
|
|
6
4
|
abstract get toArray(): Array<T>;
|
package/dist/array-iterable.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ArrayIterable = void 0;
|
|
4
|
-
const
|
|
5
|
-
const hashmap_1 = require("./hashmap");
|
|
6
|
-
const collection_1 = require("./collection");
|
|
4
|
+
const index_1 = require("./index");
|
|
7
5
|
class ArrayIterable {
|
|
8
6
|
[Symbol.iterator]() {
|
|
9
7
|
let i = 0;
|
|
@@ -40,7 +38,7 @@ class ArrayIterable {
|
|
|
40
38
|
return this.toArray.find(i => p(i)) !== undefined;
|
|
41
39
|
}
|
|
42
40
|
find(p) {
|
|
43
|
-
return
|
|
41
|
+
return index_1.option(this.toArray.find(i => p(i)));
|
|
44
42
|
}
|
|
45
43
|
count(p) {
|
|
46
44
|
let res = 0;
|
|
@@ -67,7 +65,7 @@ class ArrayIterable {
|
|
|
67
65
|
return this.reduceLeftOption(op);
|
|
68
66
|
}
|
|
69
67
|
get headOption() {
|
|
70
|
-
return this.isEmpty ?
|
|
68
|
+
return this.isEmpty ? index_1.none : index_1.some(this.head);
|
|
71
69
|
}
|
|
72
70
|
get head() {
|
|
73
71
|
if (this.isEmpty) {
|
|
@@ -78,7 +76,7 @@ class ArrayIterable {
|
|
|
78
76
|
}
|
|
79
77
|
}
|
|
80
78
|
get lastOption() {
|
|
81
|
-
return this.isEmpty ?
|
|
79
|
+
return this.isEmpty ? index_1.none : index_1.some(this.last);
|
|
82
80
|
}
|
|
83
81
|
get last() {
|
|
84
82
|
if (this.isEmpty) {
|
|
@@ -102,11 +100,11 @@ class ArrayIterable {
|
|
|
102
100
|
return acc;
|
|
103
101
|
}
|
|
104
102
|
reduceLeftOption(op) {
|
|
105
|
-
return this.isEmpty ?
|
|
103
|
+
return this.isEmpty ? index_1.none : index_1.some(this.reduceLeft(op));
|
|
106
104
|
}
|
|
107
105
|
foldRight(initial) {
|
|
108
106
|
return (op) => {
|
|
109
|
-
return new
|
|
107
|
+
return new index_1.Collection(this.toArray)
|
|
110
108
|
.reverse
|
|
111
109
|
.foldLeft(initial)((a, n) => op(n, a));
|
|
112
110
|
};
|
|
@@ -125,7 +123,7 @@ class ArrayIterable {
|
|
|
125
123
|
return acc;
|
|
126
124
|
}
|
|
127
125
|
reduceRightOption(op) {
|
|
128
|
-
return this.isEmpty ?
|
|
126
|
+
return this.isEmpty ? index_1.none : index_1.some(this.reduceRight(op));
|
|
129
127
|
}
|
|
130
128
|
foldLeft(initial) {
|
|
131
129
|
return (op) => {
|
|
@@ -136,10 +134,10 @@ class ArrayIterable {
|
|
|
136
134
|
return this.foldLeft(initial);
|
|
137
135
|
}
|
|
138
136
|
groupBy(field) {
|
|
139
|
-
return this.foldLeft(
|
|
137
|
+
return this.foldLeft(index_1.HashMap.empty)((acc, next) => {
|
|
140
138
|
const key = field(next);
|
|
141
|
-
const existing = acc.get(key).getOrElseValue(
|
|
142
|
-
return acc.set(key, new
|
|
139
|
+
const existing = acc.get(key).getOrElseValue(index_1.Collection.empty);
|
|
140
|
+
return acc.set(key, new index_1.Collection(existing.toArray.concat(next)));
|
|
143
141
|
});
|
|
144
142
|
}
|
|
145
143
|
minBy(toNumber) {
|
|
@@ -160,7 +158,7 @@ class ArrayIterable {
|
|
|
160
158
|
}
|
|
161
159
|
}
|
|
162
160
|
minByOption(toNumber) {
|
|
163
|
-
return this.isEmpty ?
|
|
161
|
+
return this.isEmpty ? index_1.none : index_1.some(this.minBy(toNumber));
|
|
164
162
|
}
|
|
165
163
|
maxBy(toNumber) {
|
|
166
164
|
if (this.isEmpty) {
|
|
@@ -180,7 +178,7 @@ class ArrayIterable {
|
|
|
180
178
|
}
|
|
181
179
|
}
|
|
182
180
|
maxByOption(toNumber) {
|
|
183
|
-
return this.isEmpty ?
|
|
181
|
+
return this.isEmpty ? index_1.none : index_1.some(this.maxBy(toNumber));
|
|
184
182
|
}
|
|
185
183
|
partition(p) {
|
|
186
184
|
const array = this.toArray;
|
|
@@ -250,12 +248,12 @@ class ArrayIterable {
|
|
|
250
248
|
}
|
|
251
249
|
sliding(length, step = 1) {
|
|
252
250
|
if (this.isEmpty) {
|
|
253
|
-
return
|
|
251
|
+
return index_1.Collection.empty;
|
|
254
252
|
}
|
|
255
253
|
else {
|
|
256
254
|
const itemsSize = this.size;
|
|
257
255
|
if (itemsSize <= length) {
|
|
258
|
-
return
|
|
256
|
+
return index_1.Collection.of(this);
|
|
259
257
|
}
|
|
260
258
|
else {
|
|
261
259
|
const result = [];
|
|
@@ -269,7 +267,7 @@ class ArrayIterable {
|
|
|
269
267
|
left += step;
|
|
270
268
|
right = left + length;
|
|
271
269
|
}
|
|
272
|
-
return new
|
|
270
|
+
return new index_1.Collection(result);
|
|
273
271
|
}
|
|
274
272
|
}
|
|
275
273
|
}
|
|
@@ -311,9 +309,9 @@ class ArrayIterable {
|
|
|
311
309
|
}
|
|
312
310
|
groupMap(key) {
|
|
313
311
|
return (value) => {
|
|
314
|
-
return this.foldLeft(
|
|
312
|
+
return this.foldLeft(index_1.HashMap.empty)((acc, next) => {
|
|
315
313
|
const nextKey = key(next);
|
|
316
|
-
const existingColl = acc.getOrElse(nextKey, () =>
|
|
314
|
+
const existingColl = acc.getOrElse(nextKey, () => index_1.Collection.empty);
|
|
317
315
|
const updatedColl = existingColl.appended(value(next));
|
|
318
316
|
return acc.updated(nextKey, updatedColl);
|
|
319
317
|
});
|
|
@@ -322,7 +320,7 @@ class ArrayIterable {
|
|
|
322
320
|
groupMapReduce(key) {
|
|
323
321
|
return (value) => {
|
|
324
322
|
return (reduce) => {
|
|
325
|
-
return this.foldLeft(
|
|
323
|
+
return this.foldLeft(index_1.HashMap.empty)((acc, next) => {
|
|
326
324
|
const nextKey = key(next);
|
|
327
325
|
const nextValue = value(next);
|
|
328
326
|
return acc.updated(nextKey, acc.get(nextKey).map(e => reduce(e, nextValue)).getOrElseValue(nextValue));
|
|
@@ -361,7 +359,7 @@ class ArrayIterable {
|
|
|
361
359
|
for (let i = 0; i < array.length; i++) {
|
|
362
360
|
res.push([array[i], i]);
|
|
363
361
|
}
|
|
364
|
-
return new
|
|
362
|
+
return new index_1.Collection(res);
|
|
365
363
|
}
|
|
366
364
|
get tails() {
|
|
367
365
|
const array = this.toArray;
|
|
@@ -369,7 +367,7 @@ class ArrayIterable {
|
|
|
369
367
|
for (let i = 0; i <= array.length; i++) {
|
|
370
368
|
res.push(this.takeRight(array.length - i));
|
|
371
369
|
}
|
|
372
|
-
return new
|
|
370
|
+
return new index_1.Collection(res);
|
|
373
371
|
}
|
|
374
372
|
get inits() {
|
|
375
373
|
const array = this.toArray;
|
|
@@ -377,7 +375,7 @@ class ArrayIterable {
|
|
|
377
375
|
for (let i = 0; i <= array.length; i++) {
|
|
378
376
|
res.push(this.take(array.length - i));
|
|
379
377
|
}
|
|
380
|
-
return new
|
|
378
|
+
return new index_1.Collection(res);
|
|
381
379
|
}
|
|
382
380
|
}
|
|
383
381
|
exports.ArrayIterable = ArrayIterable;
|
package/dist/collection.d.ts
CHANGED
|
@@ -1,39 +1,78 @@
|
|
|
1
|
-
import { HashMap } from './hashmap';
|
|
2
|
-
import { HashSet } from './hashset';
|
|
3
|
-
import { ArrayIterable } from './array-iterable';
|
|
4
1
|
import { Mappable } from './mappable';
|
|
2
|
+
import { HashMap, HashSet, Option } from './index';
|
|
5
3
|
import { Filterable } from './util';
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
import { ArrayIterable } from './array-iterable';
|
|
5
|
+
export declare abstract class ArrayBackedCollection<T, C extends ArrayIterable<T, any>> extends ArrayIterable<T, C> {
|
|
6
|
+
protected abstract readonly items: T[];
|
|
7
|
+
protected checkWithinBounds(lo: number, hi: number): void;
|
|
8
|
+
get reverse(): C;
|
|
9
|
+
get toArray(): T[];
|
|
10
|
+
get(index: number): T;
|
|
11
|
+
get toSet(): HashSet<T>;
|
|
12
|
+
indexOf(item: T): number;
|
|
13
|
+
get distinct(): C;
|
|
14
|
+
distinctBy(key: (item: T) => string | number): C;
|
|
15
|
+
appended(item: T): C;
|
|
16
|
+
appendedAll(other: Iterable<T>): C;
|
|
17
|
+
prepended(item: T): C;
|
|
18
|
+
prependedAll(other: Iterable<T>): C;
|
|
19
|
+
concat(other: Iterable<T>): C;
|
|
20
|
+
slice(from: number, until: number): C;
|
|
21
|
+
sort(param: (a: T, b: T) => number): C;
|
|
22
|
+
sortBy(fieldToNumber: (a: T) => number): C;
|
|
23
|
+
get length(): number;
|
|
24
|
+
}
|
|
25
|
+
export declare class Collection<T> extends ArrayBackedCollection<T, Collection<T>> implements Mappable<T>, Filterable<T, Collection<T>> {
|
|
26
|
+
protected readonly items: T[];
|
|
8
27
|
constructor(items: T[]);
|
|
9
28
|
static empty: Collection<any>;
|
|
10
29
|
protected fromArray(array: T[]): Collection<T>;
|
|
11
30
|
static of<T>(...items: T[]): Collection<T>;
|
|
31
|
+
static from<T>(elements: Iterable<T>): Collection<T>;
|
|
12
32
|
static fill<A>(len: number): (elem: (idx: number) => A) => Collection<A>;
|
|
13
|
-
slice(from: number, until: number): Collection<T>;
|
|
14
33
|
map<B>(f: (item: T) => B): Collection<B>;
|
|
15
34
|
flatMap<B>(f: (item: T) => Collection<B>): Collection<B>;
|
|
35
|
+
flatMapOption<B>(f: (item: T) => Option<B>): Collection<B>;
|
|
16
36
|
mapPromise<B>(f: (v: T) => Promise<B>): Promise<Collection<B>>;
|
|
17
37
|
mapPromiseAll<B>(f: (v: T) => Promise<B>): Promise<Collection<B>>;
|
|
18
38
|
flatMapPromise<B>(f: (item: T) => Promise<Collection<B>>): Promise<Collection<B>>;
|
|
19
39
|
flatMapPromiseAll<B>(f: (v: T) => Promise<Collection<B>>): Promise<Collection<B>>;
|
|
20
40
|
flatten<B>(): Collection<B>;
|
|
21
|
-
get(
|
|
22
|
-
get toArray(): T[];
|
|
23
|
-
get reverse(): Collection<T>;
|
|
24
|
-
sort(param: (a: T, b: T) => number): Collection<T>;
|
|
25
|
-
sortBy(fieldToNumber: (a: T) => number): Collection<T>;
|
|
26
|
-
appended(item: T): Collection<T>;
|
|
27
|
-
appendedAll(other: Collection<T>): Collection<T>;
|
|
28
|
-
prepended(item: T): Collection<T>;
|
|
29
|
-
prependedAll(other: Collection<T>): Collection<T>;
|
|
30
|
-
concat(other: Collection<T>): Collection<T>;
|
|
31
|
-
get toSet(): HashSet<T>;
|
|
32
|
-
get distinct(): Collection<T>;
|
|
33
|
-
distinctBy(key: (item: T) => string | number): Collection<T>;
|
|
41
|
+
get toBuffer(): ArrayBuffer<T>;
|
|
34
42
|
toMap<K, V>(mapper: (item: T) => [K, V]): HashMap<K, V>;
|
|
35
|
-
indexOf(item: T): number;
|
|
36
43
|
zip<B>(that: Collection<B>): Collection<[T, B]>;
|
|
37
44
|
zipAll<B>(that: Collection<B>, thisElem: T, thatElem: B): Collection<[T, B]>;
|
|
38
45
|
}
|
|
39
46
|
export declare const Nil: Collection<any>;
|
|
47
|
+
export declare class ArrayBuffer<T> extends ArrayBackedCollection<T, ArrayBuffer<T>> implements Mappable<T>, Filterable<T, ArrayBuffer<T>> {
|
|
48
|
+
protected readonly items: T[];
|
|
49
|
+
static get empty(): ArrayBuffer<any>;
|
|
50
|
+
constructor(items: T[]);
|
|
51
|
+
static of<T>(...elements: T[]): ArrayBuffer<T>;
|
|
52
|
+
static from<T>(elements: Iterable<T>): ArrayBuffer<T>;
|
|
53
|
+
static fill<A>(len: number): (elem: (idx: number) => A) => ArrayBuffer<A>;
|
|
54
|
+
protected fromArray(array: T[]): ArrayBuffer<T>;
|
|
55
|
+
update(index: number, element: T): void;
|
|
56
|
+
set(index: number, element: T): void;
|
|
57
|
+
clear(): void;
|
|
58
|
+
append(element: T): this;
|
|
59
|
+
appendAll(elements: Iterable<T>): this;
|
|
60
|
+
prepend(element: T): this;
|
|
61
|
+
prependAll(elements: Iterable<T>): this;
|
|
62
|
+
insert(idx: number, element: T): void;
|
|
63
|
+
insertAll(idx: number, elements: Iterable<T>): void;
|
|
64
|
+
remove(index: number, count?: number): void;
|
|
65
|
+
subtractOne(element: T): this;
|
|
66
|
+
subtractAll(elements: Iterable<T>): this;
|
|
67
|
+
sort(compareFn?: (a: T, b: T) => number): this;
|
|
68
|
+
get toCollection(): Collection<T>;
|
|
69
|
+
flatMap<B>(f: (item: T) => ArrayBuffer<B>): ArrayBuffer<B>;
|
|
70
|
+
flatMapOption<B>(f: (item: T) => Option<B>): ArrayBuffer<B>;
|
|
71
|
+
flatMapPromise<B>(f: (item: T) => Promise<ArrayBuffer<B>>): Promise<ArrayBuffer<B>>;
|
|
72
|
+
map<B>(f: (item: T) => B): ArrayBuffer<B>;
|
|
73
|
+
mapPromise<B>(f: (v: T) => Promise<B>): Promise<ArrayBuffer<B>>;
|
|
74
|
+
mapPromiseAll<B>(f: (v: T) => Promise<B>): Promise<ArrayBuffer<B>>;
|
|
75
|
+
flatMapPromiseAll<B>(f: (v: T) => Promise<ArrayBuffer<B>>): Promise<ArrayBuffer<B>>;
|
|
76
|
+
flatten<B>(): ArrayBuffer<B>;
|
|
77
|
+
toMap<K, V>(mapper: (item: T) => [K, V]): HashMap<K, V>;
|
|
78
|
+
}
|