scats 1.1.1 → 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 +36 -2
- package/coverage/clover.xml +934 -783
- package/coverage/coverage-final.json +14 -9
- package/coverage/lcov-report/index.html +18 -123
- 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.info +1237 -916
- 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 +37 -36
- package/dist/collection.js +169 -143
- package/dist/hashmap.d.ts +11 -27
- package/dist/hashmap.js +22 -63
- package/dist/hashset.d.ts +9 -15
- package/dist/hashset.js +22 -41
- 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/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 +254 -153
- package/src/either.ts +2 -2
- package/src/hashmap.ts +46 -79
- package/src/hashset.ts +75 -45
- 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 +1 -1
- package/src/try.ts +9 -9
package/README.md
CHANGED
|
@@ -218,7 +218,6 @@ map.size; // 1
|
|
|
218
218
|
map.isEmpty; // false
|
|
219
219
|
HashMap.empty.isEmpty; // true
|
|
220
220
|
map.nonEmpty; // true
|
|
221
|
-
map.nonEmpty; // true
|
|
222
221
|
map.get('1'); // some(1)
|
|
223
222
|
map.get('5'); // none
|
|
224
223
|
map.getOrElse('1', () => 5); // 1
|
|
@@ -229,7 +228,7 @@ map.values; // Collection.of(1, 2)
|
|
|
229
228
|
map.entries; // Collection.of(['1', 1], ['2', 2])
|
|
230
229
|
map.appendedAll(HashMap.of(['3', 3])); // HashMap.of(['1', 1], ['2', 2], ['3', 3])
|
|
231
230
|
map.set('2', 3); // HashMap.of(['1', 1], ['2', 3])
|
|
232
|
-
map.
|
|
231
|
+
map.removed('2'); // HashMap.of(['1', 1])
|
|
233
232
|
map.updated('2', 4); // HashMap.of(['1', 1], ['2', 4])
|
|
234
233
|
```
|
|
235
234
|
|
|
@@ -384,3 +383,38 @@ c.take(2); // Collection.of(1, 2)
|
|
|
384
383
|
c.drop(1); // Collection.of(2, 3);
|
|
385
384
|
c.head; // 1
|
|
386
385
|
```
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
## mutable.HashMap
|
|
389
|
+
```typescript
|
|
390
|
+
import {mutable} from "scats";
|
|
391
|
+
|
|
392
|
+
const map = new mutable.HashMap<string, number>()
|
|
393
|
+
map.set('Alice', 11); // ('Alice' -> 11)
|
|
394
|
+
map.set('Bob', 12); // ('Alice' -> 11, 'Bob' -> 12)
|
|
395
|
+
map.clear(); // ()
|
|
396
|
+
map.put('Steve', 14); // returns some(14), map: ('Steve' -> 14)
|
|
397
|
+
map.update('Alice', 11); // ('Steve' -> 14, 'Alice' -> 11)
|
|
398
|
+
map.remove('Alice'); // ('Steve' -> 14)
|
|
399
|
+
map.addOne(['Bob', 12]); // ('Steve' -> 14, 'Bob' -> 12)
|
|
400
|
+
map.subtractOne('Bob'); // ('Steve' -> 14)
|
|
401
|
+
map.addAll([['Alice', 11], ['Bob', 12]]); // ('Steve' -> 14, 'Alice' -> 11, 'Bob' -> 12)
|
|
402
|
+
map.mapValuesInPlace(([name, age]) => age + 1); // ('Steve' -> 15, 'Alice' -> 12, 'Bob' -> 13)
|
|
403
|
+
map.filterInPlace(([name, age]) => age > 13); // ('Steve' -> 15)
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
## mutable.HashSet
|
|
408
|
+
```typescript
|
|
409
|
+
import {mutable} from "scats";
|
|
410
|
+
|
|
411
|
+
const set = new mutable.HashSet<string, number>()
|
|
412
|
+
set.add(1); // true. set = [1]
|
|
413
|
+
set.add(1); // false. set = [1]
|
|
414
|
+
set.clear(); // []]
|
|
415
|
+
set.add(1); // true. set = [1]
|
|
416
|
+
set.remove(2); false. set = [1]
|
|
417
|
+
set.remove(1); true. set = []
|
|
418
|
+
set.addAll([2, 3]); set = [1, 2, 3]
|
|
419
|
+
set.filterInPlace(x => x > 2); // [3]
|
|
420
|
+
```
|