effect 3.14.3 → 3.14.4
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/cjs/HashSet.js +111 -87
- package/dist/cjs/HashSet.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/dts/HashSet.d.ts +149 -106
- package/dist/dts/HashSet.d.ts.map +1 -1
- package/dist/dts/index.d.ts +40 -40
- package/dist/esm/HashSet.js +111 -87
- package/dist/esm/HashSet.js.map +1 -1
- package/dist/esm/index.js +40 -40
- package/dist/esm/internal/version.js +1 -1
- package/package.json +1 -1
- package/src/HashSet.ts +149 -106
- package/src/index.ts +40 -40
- package/src/internal/version.ts +1 -1
package/dist/esm/HashSet.js
CHANGED
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
*
|
|
34
34
|
* ## Performance Characteristics
|
|
35
35
|
*
|
|
36
|
-
* - **Lookup** operations ({@
|
|
36
|
+
* - **Lookup** operations ({@link module:HashSet.has}): **`O(1)`** average time
|
|
37
37
|
* complexity
|
|
38
|
-
* - **Insertion** operations ({@
|
|
38
|
+
* - **Insertion** operations ({@link module:HashSet.add}): **`O(1)`** average time
|
|
39
39
|
* complexity
|
|
40
|
-
* - **Removal** operations ({@
|
|
41
|
-
* complexity
|
|
42
|
-
* - **Set** operations ({@
|
|
43
|
-
* {@
|
|
40
|
+
* - **Removal** operations ({@link module:HashSet.remove}): **`O(1)`** average
|
|
41
|
+
* time complexity
|
|
42
|
+
* - **Set** operations ({@link module:HashSet.union},
|
|
43
|
+
* {@link module:HashSet.intersection}): **`O(n)`** where n is the size of the
|
|
44
44
|
* smaller set
|
|
45
45
|
* - **Iteration**: **`O(n)`** where n is the size of the set
|
|
46
46
|
*
|
|
@@ -53,40 +53,40 @@
|
|
|
53
53
|
*
|
|
54
54
|
* ## Operations Reference
|
|
55
55
|
*
|
|
56
|
-
* | Category | Operation
|
|
57
|
-
* | ------------ |
|
|
58
|
-
* | constructors | {@
|
|
59
|
-
* | constructors | {@
|
|
60
|
-
* | constructors | {@
|
|
61
|
-
* | |
|
|
62
|
-
* | elements | {@
|
|
63
|
-
* | elements | {@
|
|
64
|
-
* | elements | {@
|
|
65
|
-
* | elements | {@
|
|
66
|
-
* | |
|
|
67
|
-
* | getters | {@
|
|
68
|
-
* | getters | {@
|
|
69
|
-
* | getters | {@
|
|
70
|
-
* | |
|
|
71
|
-
* | mutations | {@
|
|
72
|
-
* | mutations | {@
|
|
73
|
-
* | mutations | {@
|
|
74
|
-
* | |
|
|
75
|
-
* | operations | {@
|
|
76
|
-
* | operations | {@
|
|
77
|
-
* | operations | {@
|
|
78
|
-
* | |
|
|
79
|
-
* | mapping | {@
|
|
80
|
-
* | |
|
|
81
|
-
* | sequencing | {@
|
|
82
|
-
* | |
|
|
83
|
-
* | traversing | {@
|
|
84
|
-
* | |
|
|
85
|
-
* | folding | {@
|
|
86
|
-
* | |
|
|
87
|
-
* | filtering | {@
|
|
88
|
-
* | |
|
|
89
|
-
* | partitioning | {@
|
|
56
|
+
* | Category | Operation | Description | Complexity |
|
|
57
|
+
* | ------------ | ----------------------------------- | ------------------------------------------- | ---------- |
|
|
58
|
+
* | constructors | {@link module:HashSet.empty} | Creates an empty HashSet | O(1) |
|
|
59
|
+
* | constructors | {@link module:HashSet.fromIterable} | Creates a HashSet from an iterable | O(n) |
|
|
60
|
+
* | constructors | {@link module:HashSet.make} | Creates a HashSet from multiple values | O(n) |
|
|
61
|
+
* | | | | |
|
|
62
|
+
* | elements | {@link module:HashSet.has} | Checks if a value exists in the set | O(1) avg |
|
|
63
|
+
* | elements | {@link module:HashSet.some} | Checks if any element satisfies a predicate | O(n) |
|
|
64
|
+
* | elements | {@link module:HashSet.every} | Checks if all elements satisfy a predicate | O(n) |
|
|
65
|
+
* | elements | {@link module:HashSet.isSubset} | Checks if a set is a subset of another | O(n) |
|
|
66
|
+
* | | | | |
|
|
67
|
+
* | getters | {@link module:HashSet.values} | Gets an iterator of all values | O(1) |
|
|
68
|
+
* | getters | {@link module:HashSet.toValues} | Gets an array of all values | O(n) |
|
|
69
|
+
* | getters | {@link module:HashSet.size} | Gets the number of elements | O(1) |
|
|
70
|
+
* | | | | |
|
|
71
|
+
* | mutations | {@link module:HashSet.add} | Adds a value to the set | O(1) avg |
|
|
72
|
+
* | mutations | {@link module:HashSet.remove} | Removes a value from the set | O(1) avg |
|
|
73
|
+
* | mutations | {@link module:HashSet.toggle} | Toggles a value's presence | O(1) avg |
|
|
74
|
+
* | | | | |
|
|
75
|
+
* | operations | {@link module:HashSet.difference} | Computes set difference (A - B) | O(n) |
|
|
76
|
+
* | operations | {@link module:HashSet.intersection} | Computes set intersection (A ∩ B) | O(n) |
|
|
77
|
+
* | operations | {@link module:HashSet.union} | Computes set union (A ∪ B) | O(n) |
|
|
78
|
+
* | | | | |
|
|
79
|
+
* | mapping | {@link module:HashSet.map} | Transforms each element | O(n) |
|
|
80
|
+
* | | | | |
|
|
81
|
+
* | sequencing | {@link module:HashSet.flatMap} | Transforms and flattens elements | O(n) |
|
|
82
|
+
* | | | | |
|
|
83
|
+
* | traversing | {@link module:HashSet.forEach} | Applies a function to each element | O(n) |
|
|
84
|
+
* | | | | |
|
|
85
|
+
* | folding | {@link module:HashSet.reduce} | Reduces the set to a single value | O(n) |
|
|
86
|
+
* | | | | |
|
|
87
|
+
* | filtering | {@link module:HashSet.filter} | Keeps elements that satisfy a predicate | O(n) |
|
|
88
|
+
* | | | | |
|
|
89
|
+
* | partitioning | {@link module:HashSet.partition} | Splits into two sets by a predicate | O(n) |
|
|
90
90
|
*
|
|
91
91
|
* ## Notes
|
|
92
92
|
*
|
|
@@ -284,7 +284,7 @@ export const isHashSet = HS.isHashSet;
|
|
|
284
284
|
* ) // Output: [1, 2]
|
|
285
285
|
* ```
|
|
286
286
|
*
|
|
287
|
-
* @see Other `HashSet` constructors are {@link make} {@link fromIterable}
|
|
287
|
+
* @see Other `HashSet` constructors are {@link module:HashSet.make} {@link module:HashSet.fromIterable}
|
|
288
288
|
*/
|
|
289
289
|
export const empty = HS.empty;
|
|
290
290
|
/**
|
|
@@ -295,9 +295,10 @@ export const empty = HS.empty;
|
|
|
295
295
|
* @memberof HashSet
|
|
296
296
|
* @since 2.0.0
|
|
297
297
|
* @category constructors
|
|
298
|
-
* @example
|
|
298
|
+
* @example
|
|
299
299
|
*
|
|
300
300
|
* ```ts
|
|
301
|
+
* // Creating a HashSet from an Array
|
|
301
302
|
* import { HashSet, pipe } from "effect"
|
|
302
303
|
*
|
|
303
304
|
* console.log(
|
|
@@ -309,9 +310,10 @@ export const empty = HS.empty;
|
|
|
309
310
|
* ) // Output: [1, 2, 3, 4, 5]
|
|
310
311
|
* ```
|
|
311
312
|
*
|
|
312
|
-
* @example
|
|
313
|
+
* @example
|
|
313
314
|
*
|
|
314
315
|
* ```ts
|
|
316
|
+
* // Creating a HashSet from a Set
|
|
315
317
|
* import { HashSet, pipe } from "effect"
|
|
316
318
|
*
|
|
317
319
|
* console.log(
|
|
@@ -323,9 +325,10 @@ export const empty = HS.empty;
|
|
|
323
325
|
* ) // Output: ["apple", "banana", "orange"]
|
|
324
326
|
* ```
|
|
325
327
|
*
|
|
326
|
-
* @example
|
|
328
|
+
* @example
|
|
327
329
|
*
|
|
328
330
|
* ```ts
|
|
331
|
+
* // Creating a HashSet from a Generator
|
|
329
332
|
* import { HashSet } from "effect"
|
|
330
333
|
*
|
|
331
334
|
* // Generator functions return iterables
|
|
@@ -344,9 +347,10 @@ export const empty = HS.empty;
|
|
|
344
347
|
* // Outputs: [0, 1, 2, 3, 5, 8, 13, 21, 34] but in unsorted order
|
|
345
348
|
* ```
|
|
346
349
|
*
|
|
347
|
-
* @example
|
|
350
|
+
* @example
|
|
348
351
|
*
|
|
349
352
|
* ```ts
|
|
353
|
+
* // Creating a HashSet from another HashSet
|
|
350
354
|
* import { HashSet, pipe } from "effect"
|
|
351
355
|
*
|
|
352
356
|
* console.log(
|
|
@@ -359,10 +363,10 @@ export const empty = HS.empty;
|
|
|
359
363
|
* ) // Output: [1, 2, 3, 4]
|
|
360
364
|
* ```
|
|
361
365
|
*
|
|
362
|
-
* @example
|
|
363
|
-
* {@link Chunk}
|
|
366
|
+
* @example
|
|
364
367
|
*
|
|
365
368
|
* ```ts
|
|
369
|
+
* // Creating a HashSet from other Effect's data structures like Chunk
|
|
366
370
|
* import { Chunk, HashSet, pipe } from "effect"
|
|
367
371
|
*
|
|
368
372
|
* console.log(
|
|
@@ -374,7 +378,7 @@ export const empty = HS.empty;
|
|
|
374
378
|
* ) // Outputs: [1, 2, 3, 4]
|
|
375
379
|
* ```
|
|
376
380
|
*
|
|
377
|
-
* @see Other `HashSet` constructors are {@link empty} {@link make}
|
|
381
|
+
* @see Other `HashSet` constructors are {@link module:HashSet.empty} {@link module:HashSet.make}
|
|
378
382
|
*/
|
|
379
383
|
export const fromIterable = HS.fromIterable;
|
|
380
384
|
/**
|
|
@@ -462,7 +466,7 @@ export const fromIterable = HS.fromIterable;
|
|
|
462
466
|
* )
|
|
463
467
|
* ```
|
|
464
468
|
*
|
|
465
|
-
* @see Other `HashSet` constructors are {@
|
|
469
|
+
* @see Other `HashSet` constructors are {@link module:HashSet.fromIterable} {@link module:HashSet.empty}
|
|
466
470
|
*/
|
|
467
471
|
export const make = HS.make;
|
|
468
472
|
/**
|
|
@@ -473,9 +477,10 @@ export const make = HS.make;
|
|
|
473
477
|
* @memberof HashSet
|
|
474
478
|
* @since 2.0.0
|
|
475
479
|
* @category elements
|
|
476
|
-
* @example
|
|
480
|
+
* @example
|
|
477
481
|
*
|
|
478
482
|
* ```ts
|
|
483
|
+
* // Syntax
|
|
479
484
|
* import { HashSet, pipe } from "effect"
|
|
480
485
|
*
|
|
481
486
|
* // with `data-last`, a.k.a. `pipeable` API
|
|
@@ -489,7 +494,7 @@ export const make = HS.make;
|
|
|
489
494
|
* ```
|
|
490
495
|
*
|
|
491
496
|
* @returns A `boolean` signaling the presence of the value in the HashSet
|
|
492
|
-
* @see Other `HashSet` elements are {@link some} {@link every} {@link isSubset}
|
|
497
|
+
* @see Other `HashSet` elements are {@link module:HashSet.some} {@link module:HashSet.every} {@link module:HashSet.isSubset}
|
|
493
498
|
*/
|
|
494
499
|
export const has = HS.has;
|
|
495
500
|
/**
|
|
@@ -500,9 +505,10 @@ export const has = HS.has;
|
|
|
500
505
|
* @memberof HashSet
|
|
501
506
|
* @since 2.0.0
|
|
502
507
|
* @category elements
|
|
503
|
-
* @example
|
|
508
|
+
* @example
|
|
504
509
|
*
|
|
505
510
|
* ```ts
|
|
511
|
+
* // Syntax
|
|
506
512
|
* import { HashSet, pipe } from "effect"
|
|
507
513
|
*
|
|
508
514
|
* const set: HashSet.HashSet<number> = HashSet.make(0, 1, 2)
|
|
@@ -520,7 +526,7 @@ export const has = HS.has;
|
|
|
520
526
|
* HashSet.some(set, (n) => n > 0) // true
|
|
521
527
|
* ```
|
|
522
528
|
*
|
|
523
|
-
* @see Other `HashSet` elements are {@link has} {@link every} {@link isSubset}
|
|
529
|
+
* @see Other `HashSet` elements are {@link module:HashSet.has} {@link module:HashSet.every} {@link module:HashSet.isSubset}
|
|
524
530
|
*/
|
|
525
531
|
export const some = HS.some;
|
|
526
532
|
/**
|
|
@@ -532,9 +538,10 @@ export const some = HS.some;
|
|
|
532
538
|
* @memberof HashSet
|
|
533
539
|
* @since 2.0.0
|
|
534
540
|
* @category elements
|
|
535
|
-
* @example
|
|
541
|
+
* @example
|
|
536
542
|
*
|
|
537
543
|
* ```ts
|
|
544
|
+
* // Syntax with Refinement
|
|
538
545
|
* import { HashSet, pipe, Predicate } from "effect"
|
|
539
546
|
*
|
|
540
547
|
* const numberOrString = HashSet.make(1, "1", "one", "uno")
|
|
@@ -556,9 +563,10 @@ export const some = HS.some;
|
|
|
556
563
|
* ) // HashSet.HashSet<string>
|
|
557
564
|
* ```
|
|
558
565
|
*
|
|
559
|
-
* @example
|
|
566
|
+
* @example
|
|
560
567
|
*
|
|
561
568
|
* ```ts
|
|
569
|
+
* // Syntax with Predicate
|
|
562
570
|
* import { HashSet, pipe } from "effect"
|
|
563
571
|
*
|
|
564
572
|
* const set = HashSet.make(1, 2, 3)
|
|
@@ -578,7 +586,7 @@ export const some = HS.some;
|
|
|
578
586
|
*
|
|
579
587
|
* @returns A boolean once it has evaluated that whole collection fulfill the
|
|
580
588
|
* Predicate function
|
|
581
|
-
* @see Other `HashSet` elements are {@link has} {@link some} {@link isSubset}
|
|
589
|
+
* @see Other `HashSet` elements are {@link module:HashSet.has} {@link module:HashSet.some} {@link module:HashSet.isSubset}
|
|
582
590
|
*/
|
|
583
591
|
export const every = HS.every;
|
|
584
592
|
/**
|
|
@@ -592,9 +600,10 @@ export const every = HS.every;
|
|
|
592
600
|
* @memberof HashSet
|
|
593
601
|
* @since 2.0.0
|
|
594
602
|
* @category elements
|
|
595
|
-
* @example
|
|
603
|
+
* @example
|
|
596
604
|
*
|
|
597
605
|
* ```ts
|
|
606
|
+
* // Syntax
|
|
598
607
|
* import { HashSet, pipe } from "effect"
|
|
599
608
|
*
|
|
600
609
|
* const set1 = HashSet.make(0, 1)
|
|
@@ -614,7 +623,7 @@ export const every = HS.every;
|
|
|
614
623
|
* HashSet.isSubset(set1, set3) // true)
|
|
615
624
|
* ```
|
|
616
625
|
*
|
|
617
|
-
* @see Other `HashSet` elements are {@link has} {@link some} {@link every}
|
|
626
|
+
* @see Other `HashSet` elements are {@link module:HashSet.has} {@link module:HashSet.some} {@link module:HashSet.every}
|
|
618
627
|
*/
|
|
619
628
|
export const isSubset = HS.isSubset;
|
|
620
629
|
/**
|
|
@@ -640,7 +649,7 @@ export const isSubset = HS.isSubset;
|
|
|
640
649
|
* }
|
|
641
650
|
* ```
|
|
642
651
|
*
|
|
643
|
-
* @see Other `HashSet` getters are {@link toValues} {@link size}
|
|
652
|
+
* @see Other `HashSet` getters are {@link module:HashSet.toValues} {@link module:HashSet.size}
|
|
644
653
|
*/
|
|
645
654
|
export const values = HS.values;
|
|
646
655
|
/**
|
|
@@ -666,7 +675,7 @@ export const values = HS.values;
|
|
|
666
675
|
* )
|
|
667
676
|
* ```
|
|
668
677
|
*
|
|
669
|
-
* @see Other `HashSet` getters are {@link values} {@link size}
|
|
678
|
+
* @see Other `HashSet` getters are {@link module:HashSet.values} {@link module:HashSet.size}
|
|
670
679
|
*/
|
|
671
680
|
export const toValues = self => Array.from(values(self));
|
|
672
681
|
/**
|
|
@@ -691,7 +700,7 @@ export const toValues = self => Array.from(values(self));
|
|
|
691
700
|
* )
|
|
692
701
|
* ```
|
|
693
702
|
*
|
|
694
|
-
* @see Other `HashSet` getters are {@link values} {@link toValues}
|
|
703
|
+
* @see Other `HashSet` getters are {@link module:HashSet.values} {@link module:HashSet.toValues}
|
|
695
704
|
*/
|
|
696
705
|
export const size = HS.size;
|
|
697
706
|
/**
|
|
@@ -738,7 +747,7 @@ export const size = HS.size;
|
|
|
738
747
|
* console.log(HashSet.toValues(mutableSet).sort((a, b) => a - b)) // [0, 1, 2, 3, ...rest]
|
|
739
748
|
* ```
|
|
740
749
|
*
|
|
741
|
-
* @see Other `HashSet` mutations are {@link add} {@link remove} {@link toggle} {@link endMutation} {@link mutate}
|
|
750
|
+
* @see Other `HashSet` mutations are {@link module:HashSet.add} {@link module:HashSet.remove} {@link module:HashSet.toggle} {@link module:HashSet.endMutation} {@link module:HashSet.mutate}
|
|
742
751
|
*/
|
|
743
752
|
export const beginMutation = HS.beginMutation;
|
|
744
753
|
/**
|
|
@@ -785,21 +794,22 @@ export const beginMutation = HS.beginMutation;
|
|
|
785
794
|
* assert.deepStrictEqual(HashSet.toValues(newSet).sort(), [1, 2, 3, 4])
|
|
786
795
|
* ```
|
|
787
796
|
*
|
|
788
|
-
* @see Other `HashSet` mutations are {@
|
|
797
|
+
* @see Other `HashSet` mutations are {@link module:HashSet.add} {@link module:HashSet.remove} {@link module:HashSet.toggle} {@link module:HashSet.beginMutation} {@link module:HashSet.mutate}
|
|
789
798
|
*/
|
|
790
799
|
export const endMutation = HS.endMutation;
|
|
791
800
|
/**
|
|
792
801
|
* Mutates the `HashSet` within the context of the provided function.
|
|
793
802
|
*
|
|
794
803
|
* You can consider it a functional abstraction on top of the lower-level
|
|
795
|
-
* mutation primitives of {@
|
|
796
|
-
* context` `->` {@
|
|
804
|
+
* mutation primitives of {@link module:HashSet.beginMutation} `->` `mutable
|
|
805
|
+
* context` `->` {@link HashSet.endMutation}.
|
|
797
806
|
*
|
|
798
807
|
* @memberof HashSet
|
|
799
808
|
* @since 2.0.0
|
|
800
|
-
* @example
|
|
809
|
+
* @example
|
|
801
810
|
*
|
|
802
811
|
* ```ts
|
|
812
|
+
* // Syntax
|
|
803
813
|
* import { HashSet, pipe } from "effect"
|
|
804
814
|
*
|
|
805
815
|
* // with data-last, a.k.a. pipeable API
|
|
@@ -826,7 +836,7 @@ export const endMutation = HS.endMutation;
|
|
|
826
836
|
* })
|
|
827
837
|
* ```
|
|
828
838
|
*
|
|
829
|
-
* @see Other `HashSet` mutations are {@
|
|
839
|
+
* @see Other `HashSet` mutations are {@link module:HashSet.add} {@link module:HashSet.remove} {@link module:HashSet.toggle} {@link module:HashSet.beginMutation} {@link module:HashSet.endMutation}
|
|
830
840
|
*/
|
|
831
841
|
export const mutate = HS.mutate;
|
|
832
842
|
/**
|
|
@@ -843,9 +853,10 @@ export const mutate = HS.mutate;
|
|
|
843
853
|
* with the added value.
|
|
844
854
|
* @memberof HashSet
|
|
845
855
|
* @since 2.0.0
|
|
846
|
-
* @example
|
|
856
|
+
* @example
|
|
847
857
|
*
|
|
848
858
|
* ```ts
|
|
859
|
+
* // Syntax
|
|
849
860
|
* import { HashSet, pipe } from "effect"
|
|
850
861
|
*
|
|
851
862
|
* // with data-last, a.k.a. pipeable API
|
|
@@ -858,7 +869,7 @@ export const mutate = HS.mutate;
|
|
|
858
869
|
* HashSet.add(HashSet.empty(), 0)
|
|
859
870
|
* ```
|
|
860
871
|
*
|
|
861
|
-
* @see Other `HashSet` mutations are {@link remove} {@link toggle} {@link beginMutation} {@link endMutation} {@link mutate}
|
|
872
|
+
* @see Other `HashSet` mutations are {@link module:HashSet.remove} {@link module:HashSet.toggle} {@link module:HashSet.beginMutation} {@link module:HashSet.endMutation} {@link module:HashSet.mutate}
|
|
862
873
|
*/
|
|
863
874
|
export const add = HS.add;
|
|
864
875
|
/**
|
|
@@ -868,9 +879,10 @@ export const add = HS.add;
|
|
|
868
879
|
*
|
|
869
880
|
* @memberof HashSet
|
|
870
881
|
* @since 2.0.0
|
|
871
|
-
* @example
|
|
882
|
+
* @example
|
|
872
883
|
*
|
|
873
884
|
* ```ts
|
|
885
|
+
* // Syntax
|
|
874
886
|
* import { HashSet, pipe } from "effect"
|
|
875
887
|
*
|
|
876
888
|
* // with `data-last`, a.k.a. `pipeable` API
|
|
@@ -883,7 +895,7 @@ export const add = HS.add;
|
|
|
883
895
|
* HashSet.remove(HashSet.make(0, 1, 2), 0)
|
|
884
896
|
* ```
|
|
885
897
|
*
|
|
886
|
-
* @see Other `HashSet` mutations are {@link add} {@link toggle} {@link beginMutation} {@link endMutation} {@link mutate}
|
|
898
|
+
* @see Other `HashSet` mutations are {@link module:HashSet.add} {@link module:HashSet.toggle} {@link module:HashSet.beginMutation} {@link module:HashSet.endMutation} {@link module:HashSet.mutate}
|
|
887
899
|
*/
|
|
888
900
|
export const remove = HS.remove;
|
|
889
901
|
/**
|
|
@@ -899,9 +911,10 @@ export const remove = HS.remove;
|
|
|
899
911
|
*
|
|
900
912
|
* @memberof HashSet
|
|
901
913
|
* @since 2.0.0
|
|
902
|
-
* @example
|
|
914
|
+
* @example
|
|
903
915
|
*
|
|
904
916
|
* ```ts
|
|
917
|
+
* // Syntax
|
|
905
918
|
* import { HashSet, pipe } from "effect"
|
|
906
919
|
*
|
|
907
920
|
* // with data-last, a.k.a. pipeable API
|
|
@@ -914,7 +927,7 @@ export const remove = HS.remove;
|
|
|
914
927
|
* HashSet.difference(HashSet.make(1, 2, 3), HashSet.make(3, 4, 5))
|
|
915
928
|
* ```
|
|
916
929
|
*
|
|
917
|
-
* @see Other `HashSet` operations are {@link intersection} {@link union}
|
|
930
|
+
* @see Other `HashSet` operations are {@link module:HashSet.intersection} {@link module:HashSet.union}
|
|
918
931
|
*/
|
|
919
932
|
export const difference = HS.difference;
|
|
920
933
|
/**
|
|
@@ -929,9 +942,10 @@ export const difference = HS.difference;
|
|
|
929
942
|
*
|
|
930
943
|
* @memberof HashSet
|
|
931
944
|
* @since 2.0.0
|
|
932
|
-
* @example
|
|
945
|
+
* @example
|
|
933
946
|
*
|
|
934
947
|
* ```ts
|
|
948
|
+
* // Syntax
|
|
935
949
|
* import { HashSet, pipe } from "effect"
|
|
936
950
|
*
|
|
937
951
|
* // with data-last, a.k.a. pipeable API
|
|
@@ -944,7 +958,7 @@ export const difference = HS.difference;
|
|
|
944
958
|
* HashSet.intersection(HashSet.make(1, 2, 3), HashSet.make(2, 3, 4))
|
|
945
959
|
* ```
|
|
946
960
|
*
|
|
947
|
-
* @see Other `HashSet` operations are {@link difference} {@link union}
|
|
961
|
+
* @see Other `HashSet` operations are {@link module:HashSet.difference} {@link module:HashSet.union}
|
|
948
962
|
*/
|
|
949
963
|
export const intersection = HS.intersection;
|
|
950
964
|
/**
|
|
@@ -958,9 +972,10 @@ export const intersection = HS.intersection;
|
|
|
958
972
|
*
|
|
959
973
|
* @memberof HashSet
|
|
960
974
|
* @since 2.0.0
|
|
961
|
-
* @example
|
|
975
|
+
* @example
|
|
962
976
|
*
|
|
963
977
|
* ```ts
|
|
978
|
+
* // Syntax
|
|
964
979
|
* import { HashSet, pipe } from "effect"
|
|
965
980
|
*
|
|
966
981
|
* // with data-last, a.k.a. pipeable API
|
|
@@ -973,7 +988,7 @@ export const intersection = HS.intersection;
|
|
|
973
988
|
* HashSet.union(HashSet.make(1, 2, 3), HashSet.make(3, 4, 5))
|
|
974
989
|
* ```
|
|
975
990
|
*
|
|
976
|
-
* @see Other `HashSet` operations are {@link difference} {@link intersection}
|
|
991
|
+
* @see Other `HashSet` operations are {@link module:HashSet.difference} {@link module:HashSet.intersection}
|
|
977
992
|
*/
|
|
978
993
|
export const union = HS.union;
|
|
979
994
|
/**
|
|
@@ -985,9 +1000,10 @@ export const union = HS.union;
|
|
|
985
1000
|
*
|
|
986
1001
|
* @memberof HashSet
|
|
987
1002
|
* @since 2.0.0
|
|
988
|
-
* @example
|
|
1003
|
+
* @example
|
|
989
1004
|
*
|
|
990
1005
|
* ```ts
|
|
1006
|
+
* // Syntax
|
|
991
1007
|
* import { HashSet, pipe } from "effect"
|
|
992
1008
|
*
|
|
993
1009
|
* // with `data-last`, a.k.a. `pipeable` API
|
|
@@ -1002,7 +1018,7 @@ export const union = HS.union;
|
|
|
1002
1018
|
*
|
|
1003
1019
|
* @returns A new `HashSet` where the toggled value is being either added or
|
|
1004
1020
|
* removed based on the initial `HashSet` state.
|
|
1005
|
-
* @see Other `HashSet` mutations are {@link add} {@link remove} {@link beginMutation} {@link endMutation} {@link mutate}
|
|
1021
|
+
* @see Other `HashSet` mutations are {@link module:HashSet.add} {@link module:HashSet.remove} {@link module:HashSet.beginMutation} {@link module:HashSet.endMutation} {@link module:HashSet.mutate}
|
|
1006
1022
|
*/
|
|
1007
1023
|
export const toggle = HS.toggle;
|
|
1008
1024
|
/**
|
|
@@ -1013,9 +1029,10 @@ export const toggle = HS.toggle;
|
|
|
1013
1029
|
* @memberof HashSet
|
|
1014
1030
|
* @since 2.0.0
|
|
1015
1031
|
* @category mapping
|
|
1016
|
-
* @example
|
|
1032
|
+
* @example
|
|
1017
1033
|
*
|
|
1018
1034
|
* ```ts
|
|
1035
|
+
* // Syntax
|
|
1019
1036
|
* import { HashSet, pipe } from "effect"
|
|
1020
1037
|
*
|
|
1021
1038
|
* // with `data-last`, a.k.a. `pipeable` API
|
|
@@ -1040,9 +1057,10 @@ export const map = HS.map;
|
|
|
1040
1057
|
* @memberof HashSet
|
|
1041
1058
|
* @since 2.0.0
|
|
1042
1059
|
* @category sequencing
|
|
1043
|
-
* @example
|
|
1060
|
+
* @example
|
|
1044
1061
|
*
|
|
1045
1062
|
* ```ts
|
|
1063
|
+
* // Syntax
|
|
1046
1064
|
* import { HashSet, pipe } from "effect"
|
|
1047
1065
|
*
|
|
1048
1066
|
* // with `data-last`, a.k.a. `pipeable` API
|
|
@@ -1070,9 +1088,10 @@ export const flatMap = HS.flatMap;
|
|
|
1070
1088
|
* @memberof HashSet
|
|
1071
1089
|
* @since 2.0.0
|
|
1072
1090
|
* @category traversing
|
|
1073
|
-
* @example
|
|
1091
|
+
* @example
|
|
1074
1092
|
*
|
|
1075
1093
|
* ```ts
|
|
1094
|
+
* // Syntax
|
|
1076
1095
|
* import { HashSet, pipe } from "effect"
|
|
1077
1096
|
*
|
|
1078
1097
|
* // with `data-last`, a.k.a. `pipeable` API
|
|
@@ -1094,9 +1113,10 @@ export const forEach = HS.forEach;
|
|
|
1094
1113
|
* @memberof HashSet
|
|
1095
1114
|
* @since 2.0.0
|
|
1096
1115
|
* @category folding
|
|
1097
|
-
* @example
|
|
1116
|
+
* @example
|
|
1098
1117
|
*
|
|
1099
1118
|
* ```ts
|
|
1119
|
+
* // Syntax
|
|
1100
1120
|
* import { HashSet, pipe } from "effect"
|
|
1101
1121
|
*
|
|
1102
1122
|
* const sum = (a: number, b: number): number => a + b
|
|
@@ -1120,9 +1140,10 @@ export const reduce = HS.reduce;
|
|
|
1120
1140
|
* @memberof HashSet
|
|
1121
1141
|
* @since 2.0.0
|
|
1122
1142
|
* @category filtering
|
|
1123
|
-
* @example
|
|
1143
|
+
* @example
|
|
1124
1144
|
*
|
|
1125
1145
|
* ```ts
|
|
1146
|
+
* // Syntax with Predicate
|
|
1126
1147
|
* import { HashSet, type Predicate, pipe } from "effect"
|
|
1127
1148
|
*
|
|
1128
1149
|
* const filterPositiveNumbers: Predicate.Predicate<number> = (n) => n > 0
|
|
@@ -1140,9 +1161,10 @@ export const reduce = HS.reduce;
|
|
|
1140
1161
|
* HashSet.filter(HashSet.make(-2, -1, 0, 1, 2), filterPositiveNumbers)
|
|
1141
1162
|
* ```
|
|
1142
1163
|
*
|
|
1143
|
-
* @example
|
|
1164
|
+
* @example
|
|
1144
1165
|
*
|
|
1145
1166
|
* ```ts
|
|
1167
|
+
* /// Syntax with Refinement
|
|
1146
1168
|
* import { HashSet, pipe } from "effect"
|
|
1147
1169
|
*
|
|
1148
1170
|
* const stringRefinement = (value: unknown): value is string =>
|
|
@@ -1178,9 +1200,10 @@ export const filter = HS.filter;
|
|
|
1178
1200
|
* @memberof HashSet
|
|
1179
1201
|
* @since 2.0.0
|
|
1180
1202
|
* @category partitioning
|
|
1181
|
-
* @example
|
|
1203
|
+
* @example
|
|
1182
1204
|
*
|
|
1183
1205
|
* ```ts
|
|
1206
|
+
* // Syntax with Predicate
|
|
1184
1207
|
* import { HashSet, pipe, Predicate } from "effect"
|
|
1185
1208
|
*
|
|
1186
1209
|
* // with `data-last`, a.k.a. `pipeable` API
|
|
@@ -1198,9 +1221,10 @@ export const filter = HS.filter;
|
|
|
1198
1221
|
* HashSet.partition(HashSet.make(0, 1, 2, 3, 4, 5), (n) => n % 2 === 0)
|
|
1199
1222
|
* ```
|
|
1200
1223
|
*
|
|
1201
|
-
* @example
|
|
1224
|
+
* @example
|
|
1202
1225
|
*
|
|
1203
1226
|
* ```ts
|
|
1227
|
+
* // Syntax with Refinement
|
|
1204
1228
|
* import { HashSet, pipe, Predicate } from "effect"
|
|
1205
1229
|
*
|
|
1206
1230
|
* const stringRefinement: Predicate.Refinement<string | number, string> = (
|
package/dist/esm/HashSet.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HashSet.js","names":["HS","TypeId","HashSetTypeId","isHashSet","empty","fromIterable","make","has","some","every","isSubset","values","toValues","self","Array","from","size","beginMutation","endMutation","mutate","add","remove","difference","intersection","union","toggle","map","flatMap","forEach","reduce","filter","partition"],"sources":["../../src/HashSet.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgQA,OAAO,KAAKA,EAAE,MAAM,uBAAuB;AAK3C,MAAMC,MAAM,GAAkBD,EAAE,CAACE,aAAuB;
|
|
1
|
+
{"version":3,"file":"HashSet.js","names":["HS","TypeId","HashSetTypeId","isHashSet","empty","fromIterable","make","has","some","every","isSubset","values","toValues","self","Array","from","size","beginMutation","endMutation","mutate","add","remove","difference","intersection","union","toggle","map","flatMap","forEach","reduce","filter","partition"],"sources":["../../src/HashSet.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgQA,OAAO,KAAKA,EAAE,MAAM,uBAAuB;AAK3C,MAAMC,MAAM,GAAkBD,EAAE,CAACE,aAAuB;AA2BxD;;;;;AAKA,OAAO,MAAMC,SAAS,GAoDlBH,EAAE,CAACG,SAAS;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,OAAO,MAAMC,KAAK,GAAgCJ,EAAE,CAACI,KAAK;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6FA,O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