effect 4.0.0-beta.102 → 4.0.0-beta.103
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/Array.d.ts +971 -1037
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +381 -407
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +433 -756
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +200 -325
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +207 -267
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +107 -135
- package/dist/BigInt.js.map +1 -1
- package/dist/Boolean.d.ts +146 -188
- package/dist/Boolean.d.ts.map +1 -1
- package/dist/Boolean.js +64 -84
- package/dist/Boolean.js.map +1 -1
- package/dist/Brand.js.map +1 -1
- package/dist/Cache.d.ts +405 -254
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +166 -101
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +167 -277
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +122 -176
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +729 -768
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +514 -440
- package/dist/Channel.js.map +1 -1
- package/dist/ChannelSchema.d.ts +1 -1
- package/dist/ChannelSchema.d.ts.map +1 -1
- package/dist/ChannelSchema.js.map +1 -1
- package/dist/Chunk.d.ts +834 -1173
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +326 -439
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +180 -49
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js +96 -31
- package/dist/Clock.js.map +1 -1
- package/dist/Combiner.d.ts +20 -33
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +18 -30
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +225 -173
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +336 -265
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +194 -68
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +115 -80
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +233 -33
- package/dist/Console.d.ts.map +1 -1
- package/dist/Console.js +232 -32
- package/dist/Console.js.map +1 -1
- package/dist/Context.d.ts +151 -274
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +171 -214
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +68 -77
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +57 -66
- package/dist/Cron.js.map +1 -1
- package/dist/Crypto.d.ts +13 -15
- package/dist/Crypto.d.ts.map +1 -1
- package/dist/Crypto.js +9 -10
- package/dist/Crypto.js.map +1 -1
- package/dist/Data.d.ts +60 -80
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +16 -23
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +562 -660
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +307 -362
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +253 -256
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +104 -96
- package/dist/Deferred.js.map +1 -1
- package/dist/Duration.d.ts +216 -308
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +132 -186
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +2841 -3247
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +1322 -1546
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.js.map +1 -1
- package/dist/Encoding.d.ts +22 -40
- package/dist/Encoding.d.ts.map +1 -1
- package/dist/Encoding.js +22 -40
- package/dist/Encoding.js.map +1 -1
- package/dist/Equal.d.ts +33 -37
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +29 -21
- package/dist/Equal.js.map +1 -1
- package/dist/Equivalence.d.ts +103 -105
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +77 -79
- package/dist/Equivalence.js.map +1 -1
- package/dist/ErrorReporter.d.ts +51 -27
- package/dist/ErrorReporter.d.ts.map +1 -1
- package/dist/ErrorReporter.js +50 -26
- package/dist/ErrorReporter.js.map +1 -1
- package/dist/ExecutionPlan.d.ts +13 -55
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +7 -28
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Exit.d.ts +116 -192
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js +82 -130
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +82 -146
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js +48 -87
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +152 -105
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +106 -73
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +213 -168
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +114 -89
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +123 -81
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +85 -59
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +153 -264
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +42 -147
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts +61 -33
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +26 -15
- package/dist/Filter.js.map +1 -1
- package/dist/Formatter.d.ts +25 -33
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +48 -49
- package/dist/Formatter.js.map +1 -1
- package/dist/Function.d.ts +76 -145
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +40 -57
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +360 -714
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +168 -297
- package/dist/Graph.js.map +1 -1
- package/dist/HKT.d.ts +12 -6
- package/dist/HKT.d.ts.map +1 -1
- package/dist/Hash.d.ts +47 -83
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +46 -68
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +319 -411
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +122 -166
- package/dist/HashMap.js.map +1 -1
- package/dist/HashRing.d.ts.map +1 -1
- package/dist/HashRing.js +1 -0
- package/dist/HashRing.js.map +1 -1
- package/dist/HashSet.d.ts +177 -284
- package/dist/HashSet.d.ts.map +1 -1
- package/dist/HashSet.js +68 -109
- package/dist/HashSet.js.map +1 -1
- package/dist/Inspectable.d.ts +12 -12
- package/dist/Inspectable.js +8 -8
- package/dist/Inspectable.js.map +1 -1
- package/dist/Iterable.d.ts +620 -786
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +228 -306
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonPatch.d.ts +11 -13
- package/dist/JsonPatch.d.ts.map +1 -1
- package/dist/JsonPatch.js +44 -102
- package/dist/JsonPatch.js.map +1 -1
- package/dist/JsonPointer.d.ts +8 -8
- package/dist/JsonPointer.js +8 -8
- package/dist/JsonPointer.js.map +1 -1
- package/dist/JsonSchema.d.ts +98 -44
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +297 -234
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Latch.d.ts +23 -35
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +16 -28
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +359 -260
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +195 -175
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +42 -29
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +31 -21
- package/dist/LayerMap.js.map +1 -1
- package/dist/LayerRef.d.ts +6 -2
- package/dist/LayerRef.d.ts.map +1 -1
- package/dist/LayerRef.js +6 -2
- package/dist/LayerRef.js.map +1 -1
- package/dist/LogLevel.d.ts +114 -214
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/LogLevel.js +41 -76
- package/dist/LogLevel.js.map +1 -1
- package/dist/Logger.d.ts +218 -467
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +204 -450
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +7 -5
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +7 -5
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Match.d.ts +217 -252
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +150 -183
- package/dist/Match.js.map +1 -1
- package/dist/Metric.d.ts +442 -993
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +198 -642
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +144 -173
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +68 -79
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableHashSet.d.ts +84 -89
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableHashSet.js +44 -47
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/MutableList.d.ts +71 -370
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +59 -284
- package/dist/MutableList.js.map +1 -1
- package/dist/MutableRef.d.ts +420 -243
- package/dist/MutableRef.d.ts.map +1 -1
- package/dist/MutableRef.js +209 -120
- package/dist/MutableRef.js.map +1 -1
- package/dist/Newtype.d.ts +21 -14
- package/dist/Newtype.d.ts.map +1 -1
- package/dist/Newtype.js +15 -13
- package/dist/Newtype.js.map +1 -1
- package/dist/NonEmptyIterable.d.ts +7 -137
- package/dist/NonEmptyIterable.d.ts.map +1 -1
- package/dist/NonEmptyIterable.js +5 -93
- package/dist/NonEmptyIterable.js.map +1 -1
- package/dist/Number.d.ts +196 -233
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +90 -109
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts +97 -189
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +187 -290
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +447 -812
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +211 -392
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +109 -109
- package/dist/Order.js +91 -91
- package/dist/Order.js.map +1 -1
- package/dist/Ordering.d.ts +20 -23
- package/dist/Ordering.d.ts.map +1 -1
- package/dist/Ordering.js +8 -9
- package/dist/Ordering.js.map +1 -1
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Path.d.ts +38 -41
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +3 -4
- package/dist/Path.js.map +1 -1
- package/dist/Pipeable.d.ts +6 -5
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/Pipeable.js +2 -2
- package/dist/Pipeable.js.map +1 -1
- package/dist/PlatformError.d.ts +4 -4
- package/dist/PlatformError.js +3 -3
- package/dist/PlatformError.js.map +1 -1
- package/dist/Pool.d.ts +4 -2
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +4 -2
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts +200 -181
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/Predicate.js +100 -108
- package/dist/Predicate.js.map +1 -1
- package/dist/PrimaryKey.d.ts +7 -7
- package/dist/PrimaryKey.js +5 -5
- package/dist/PrimaryKey.js.map +1 -1
- package/dist/PubSub.d.ts +425 -494
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +373 -362
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts +24 -18
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Pull.js +11 -9
- package/dist/Pull.js.map +1 -1
- package/dist/Queue.d.ts +200 -159
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +162 -132
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +49 -74
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +35 -54
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +121 -63
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +42 -21
- package/dist/RcMap.js.map +1 -1
- package/dist/RcRef.d.ts +24 -13
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/RcRef.js +15 -9
- package/dist/RcRef.js.map +1 -1
- package/dist/Record.d.ts +291 -488
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +111 -202
- package/dist/Record.js.map +1 -1
- package/dist/Redactable.d.ts +6 -2
- package/dist/Redactable.d.ts.map +1 -1
- package/dist/Redactable.js +7 -2
- package/dist/Redactable.js.map +1 -1
- package/dist/Redacted.d.ts +25 -25
- package/dist/Redacted.d.ts.map +1 -1
- package/dist/Redacted.js +19 -20
- package/dist/Redacted.js.map +1 -1
- package/dist/Reducer.d.ts +8 -15
- package/dist/Reducer.d.ts.map +1 -1
- package/dist/Reducer.js +6 -12
- package/dist/Reducer.js.map +1 -1
- package/dist/Ref.d.ts +95 -165
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +75 -122
- package/dist/Ref.js.map +1 -1
- package/dist/References.d.ts +102 -168
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +102 -168
- package/dist/References.js.map +1 -1
- package/dist/RegExp.d.ts +10 -14
- package/dist/RegExp.d.ts.map +1 -1
- package/dist/RegExp.js +10 -14
- package/dist/RegExp.js.map +1 -1
- package/dist/Request.d.ts +31 -21
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +16 -13
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +201 -90
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +87 -41
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Resource.js.map +1 -1
- package/dist/Result.d.ts +302 -470
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +133 -217
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +50 -75
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +39 -60
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +290 -1636
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +162 -803
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +5 -5
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +18 -6
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +644 -642
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +491 -527
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +27 -50
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +366 -279
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaError.d.ts +7 -6
- package/dist/SchemaError.d.ts.map +1 -1
- package/dist/SchemaError.js +7 -6
- package/dist/SchemaError.js.map +1 -1
- package/dist/SchemaGetter.d.ts +217 -174
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +218 -185
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts +62 -190
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +73 -265
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +2 -2
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +123 -75
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +22 -36
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +20 -26
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +114 -74
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +120 -85
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Scope.d.ts +123 -151
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +72 -92
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.js.map +1 -1
- package/dist/ScopedRef.d.ts +3 -3
- package/dist/ScopedRef.js +2 -2
- package/dist/ScopedRef.js.map +1 -1
- package/dist/Semaphore.d.ts +96 -10
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +78 -39
- package/dist/Semaphore.js.map +1 -1
- package/dist/Sink.d.ts +117 -107
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +107 -100
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +1 -1
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +2415 -2949
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +1078 -1381
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +262 -308
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +184 -215
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +109 -114
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +41 -50
- package/dist/Struct.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +282 -250
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +104 -92
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/Symbol.d.ts +3 -3
- package/dist/Symbol.js +3 -3
- package/dist/Symbol.js.map +1 -1
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Take.js.map +1 -1
- package/dist/Terminal.d.ts +2 -2
- package/dist/Terminal.js +1 -1
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +100 -54
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +41 -24
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +287 -679
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +109 -251
- package/dist/Trie.js.map +1 -1
- package/dist/Tuple.d.ts +92 -127
- package/dist/Tuple.d.ts.map +1 -1
- package/dist/Tuple.js +42 -57
- package/dist/Tuple.js.map +1 -1
- package/dist/TxChunk.d.ts +201 -121
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +85 -56
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +62 -46
- package/dist/TxDeferred.d.ts.map +1 -1
- package/dist/TxDeferred.js +30 -22
- package/dist/TxDeferred.js.map +1 -1
- package/dist/TxHashMap.d.ts +631 -779
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +268 -330
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +297 -236
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +130 -100
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +126 -95
- package/dist/TxPriorityQueue.d.ts.map +1 -1
- package/dist/TxPriorityQueue.js +74 -56
- package/dist/TxPriorityQueue.js.map +1 -1
- package/dist/TxPubSub.d.ts +101 -88
- package/dist/TxPubSub.d.ts.map +1 -1
- package/dist/TxPubSub.js +87 -66
- package/dist/TxPubSub.js.map +1 -1
- package/dist/TxQueue.d.ts +200 -180
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +160 -136
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +97 -66
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +67 -45
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/TxRef.d.ts +51 -32
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +23 -15
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +129 -95
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +85 -70
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +97 -70
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.js +44 -34
- package/dist/TxSubscriptionRef.js.map +1 -1
- package/dist/Types.d.ts +126 -67
- package/dist/Types.d.ts.map +1 -1
- package/dist/UndefinedOr.js.map +1 -1
- package/dist/Unify.d.ts +45 -65
- package/dist/Unify.d.ts.map +1 -1
- package/dist/Unify.js +6 -9
- package/dist/Unify.js.map +1 -1
- package/dist/Utils.d.ts +23 -16
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +3 -7
- package/dist/Utils.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/array.js.map +1 -1
- package/dist/internal/core.js +1 -1
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +4 -0
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/doNotation.js.map +1 -1
- package/dist/internal/effect.js +77 -40
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/equal.js.map +1 -1
- package/dist/internal/errors.js.map +1 -1
- package/dist/internal/executionPlan.js.map +1 -1
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/hashSet.js.map +1 -1
- package/dist/internal/layer.js.map +1 -1
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/metric.js.map +1 -1
- package/dist/internal/option.js.map +1 -1
- package/dist/internal/persistence.d.ts +2 -0
- package/dist/internal/persistence.d.ts.map +1 -0
- package/dist/internal/persistence.js +3 -0
- package/dist/internal/persistence.js.map +1 -0
- package/dist/internal/random.js.map +1 -1
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/internal/record.js.map +1 -1
- package/dist/internal/redacted.js.map +1 -1
- package/dist/internal/references.js +3 -0
- package/dist/internal/references.js.map +1 -1
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/result.js.map +1 -1
- package/dist/internal/schedule.js.map +1 -1
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/cause.js.map +1 -1
- package/dist/internal/schema/fromJsonSchemaDocument.js +13 -11
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/fromRepresentation.js +8 -15
- package/dist/internal/schema/fromRepresentation.js.map +1 -1
- package/dist/internal/schema/parser.d.ts +14 -0
- package/dist/internal/schema/parser.d.ts.map +1 -0
- package/dist/internal/schema/parser.js +13 -0
- package/dist/internal/schema/parser.js.map +1 -0
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/internal/schema/toArbitrary.js.map +1 -1
- package/dist/internal/schema/toCodeDocument.js.map +1 -1
- package/dist/internal/schema/toEquivalence.js.map +1 -1
- package/dist/internal/schema/toJsonSchemaDocument.js +48 -6
- package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/toRepresentation.js +87 -107
- package/dist/internal/schema/toRepresentation.js.map +1 -1
- package/dist/internal/stackTraceLimit.js.map +1 -1
- package/dist/internal/stream.js.map +1 -1
- package/dist/internal/tracer.js.map +1 -1
- package/dist/internal/trie.js +13 -9
- package/dist/internal/trie.js.map +1 -1
- package/dist/testing/FastCheck.d.ts +8 -7
- package/dist/testing/FastCheck.d.ts.map +1 -1
- package/dist/testing/FastCheck.js +8 -7
- package/dist/testing/FastCheck.js.map +1 -1
- package/dist/testing/TestClock.d.ts +57 -28
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +50 -18
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestConsole.d.ts +32 -31
- package/dist/testing/TestConsole.d.ts.map +1 -1
- package/dist/testing/TestConsole.js +24 -22
- package/dist/testing/TestConsole.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +29 -29
- package/dist/testing/TestSchema.js +25 -25
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +95 -118
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +94 -117
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +132 -97
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +55 -51
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
- package/dist/unstable/ai/IdGenerator.d.ts +32 -28
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.js +26 -21
- package/dist/unstable/ai/IdGenerator.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +107 -67
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +104 -64
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpProtocol.d.ts +30 -0
- package/dist/unstable/ai/McpProtocol.d.ts.map +1 -0
- package/dist/unstable/ai/McpProtocol.js +20 -0
- package/dist/unstable/ai/McpProtocol.js.map +1 -0
- package/dist/unstable/ai/McpSchema.d.ts +141 -75
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +58 -50
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +68 -59
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +694 -241
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +8 -19
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +9 -20
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +112 -38
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +53 -17
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +28 -14
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +9 -4
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
- package/dist/unstable/ai/Telemetry.d.ts +46 -13
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +18 -7
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts +14 -3
- package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
- package/dist/unstable/ai/Tokenizer.js +10 -2
- package/dist/unstable/ai/Tokenizer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +59 -44
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +48 -39
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +26 -8
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +18 -4
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/index.d.ts +4 -0
- package/dist/unstable/ai/index.d.ts.map +1 -1
- package/dist/unstable/ai/index.js +4 -0
- package/dist/unstable/ai/index.js.map +1 -1
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/ai/internal/mcpProtocol.d.ts +21 -0
- package/dist/unstable/ai/internal/mcpProtocol.d.ts.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocol.js +22 -0
- package/dist/unstable/ai/internal/mcpProtocol.js.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts +2 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.js +32 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.js.map +1 -0
- package/dist/unstable/ai/internal/structured-output.js +14 -15
- package/dist/unstable/ai/internal/structured-output.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +273 -69
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +111 -33
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliConfig.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +69 -76
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +57 -61
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +35 -54
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +26 -42
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +705 -107
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +238 -42
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.js.map +1 -1
- package/dist/unstable/cli/Flag.d.ts +418 -138
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +197 -71
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +1 -1
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/HelpDoc.d.ts +12 -4
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/Param.d.ts +292 -78
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +128 -46
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +370 -149
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +344 -136
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.d.ts +23 -14
- package/dist/unstable/cli/Prompt.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.js +23 -14
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cli/internal/ansi.js.map +1 -1
- package/dist/unstable/cli/internal/auto-suggest.js.map +1 -1
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
- package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
- package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
- package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cli/internal/help.js.map +1 -1
- package/dist/unstable/cli/internal/lexer.js +17 -7
- package/dist/unstable/cli/internal/lexer.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +2 -2
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cli/internal/wizard.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterError.js.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts +8 -8
- package/dist/unstable/cluster/ClusterSchema.js +8 -8
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +5 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +10 -10
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +8 -8
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityAddress.js.map +1 -1
- package/dist/unstable/cluster/EntityId.js.map +1 -1
- package/dist/unstable/cluster/EntityProxy.d.ts +4 -2
- package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxy.js +4 -2
- package/dist/unstable/cluster/EntityProxy.js.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +2 -2
- package/dist/unstable/cluster/EntityResource.js +2 -2
- package/dist/unstable/cluster/EntityResource.js.map +1 -1
- package/dist/unstable/cluster/EntityType.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +3 -3
- package/dist/unstable/cluster/Envelope.js +3 -3
- package/dist/unstable/cluster/Envelope.js.map +1 -1
- package/dist/unstable/cluster/HttpRunner.d.ts +2 -2
- package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/HttpRunner.js +6 -4
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/MachineId.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +9 -9
- package/dist/unstable/cluster/Message.js +6 -6
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +15 -15
- package/dist/unstable/cluster/MessageStorage.js +5 -5
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +4 -4
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts +1 -1
- package/dist/unstable/cluster/RunnerHealth.js +1 -1
- package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts +2 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +16 -16
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts +2 -2
- package/dist/unstable/cluster/RunnerStorage.js +1 -1
- package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +6 -6
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +19 -10
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +3 -2
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +3 -3
- package/dist/unstable/cluster/ShardingConfig.js +3 -3
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/ShardingRegistrationEvent.js.map +1 -1
- package/dist/unstable/cluster/SingleRunner.js.map +1 -1
- package/dist/unstable/cluster/Singleton.js.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts +1 -1
- package/dist/unstable/cluster/SingletonAddress.js +1 -1
- package/dist/unstable/cluster/SingletonAddress.js.map +1 -1
- package/dist/unstable/cluster/Snowflake.d.ts +8 -8
- package/dist/unstable/cluster/Snowflake.js +8 -8
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/SocketRunner.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +20 -5
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/TestRunner.js.map +1 -1
- package/dist/unstable/cluster/index.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +5 -5
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
- package/dist/unstable/cluster/internal/hash.js.map +1 -1
- package/dist/unstable/cluster/internal/interruptors.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
- package/dist/unstable/cluster/internal/shardLock.js.map +1 -1
- package/dist/unstable/devtools/DevTools.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/devtools/DevToolsServer.js.map +1 -1
- package/dist/unstable/devtools/index.js.map +1 -1
- package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.js +6 -8
- package/dist/unstable/encoding/Msgpack.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +72 -8
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +58 -8
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/encoding/index.js.map +1 -1
- package/dist/unstable/eventlog/Event.d.ts +20 -20
- package/dist/unstable/eventlog/Event.js.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts +4 -4
- package/dist/unstable/eventlog/EventGroup.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +15 -15
- package/dist/unstable/eventlog/EventJournal.js +13 -13
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +3 -3
- package/dist/unstable/eventlog/EventLog.js +3 -3
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +2 -2
- package/dist/unstable/eventlog/EventLogMessage.js +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +15 -15
- package/dist/unstable/eventlog/EventLogRemote.js +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.d.ts +11 -2
- package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.js +45 -21
- package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +4 -4
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.js +13 -5
- package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +5 -5
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +14 -6
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/index.js.map +1 -1
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +2 -2
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +30 -18
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts +1 -1
- package/dist/unstable/http/Etag.js +1 -1
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/unstable/http/FetchHttpClient.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +2 -2
- package/dist/unstable/http/Headers.js +2 -2
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +5 -3
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpBody.js +11 -5
- package/dist/unstable/http/HttpBody.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +51 -44
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +46 -17
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +2 -0
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +4 -4
- package/dist/unstable/http/HttpClientResponse.js +2 -2
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +6 -6
- package/dist/unstable/http/HttpEffect.js +3 -3
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts +6 -9
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMethod.js +6 -9
- package/dist/unstable/http/HttpMethod.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +75 -9
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +164 -39
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts +76 -0
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +32 -0
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +88 -89
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +78 -79
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts +13 -13
- package/dist/unstable/http/HttpServer.js +6 -6
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +2 -2
- package/dist/unstable/http/HttpServerError.js +2 -2
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +4 -4
- package/dist/unstable/http/HttpServerRequest.js +4 -4
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +22 -0
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +10 -0
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +35 -7
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpStaticServer.js +35 -7
- package/dist/unstable/http/HttpStaticServer.js.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +6 -6
- package/dist/unstable/http/Multipart.js +5 -5
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/Template.js.map +1 -1
- package/dist/unstable/http/Url.d.ts +33 -63
- package/dist/unstable/http/Url.d.ts.map +1 -1
- package/dist/unstable/http/Url.js +14 -28
- package/dist/unstable/http/Url.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +10 -18
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +9 -17
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/http/internal/compression.d.ts +2 -0
- package/dist/unstable/http/internal/compression.d.ts.map +1 -0
- package/dist/unstable/http/internal/compression.js +155 -0
- package/dist/unstable/http/internal/compression.js.map +1 -0
- package/dist/unstable/http/internal/preResponseHandler.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +10 -11
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +4 -5
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +11 -13
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +42 -42
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +13 -13
- package/dist/unstable/httpapi/HttpApiError.js +13 -13
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +15 -15
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +71 -24
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +57 -10
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +0 -12
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +6 -6
- package/dist/unstable/httpapi/HttpApiSchema.js +4 -4
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +13 -13
- package/dist/unstable/httpapi/OpenApi.js +13 -13
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/httpapi/index.js.map +1 -1
- package/dist/unstable/httpapi/internal/html.js.map +1 -1
- package/dist/unstable/httpapi/internal/httpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/internal/httpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/internal/mediaType.js.map +1 -1
- package/dist/unstable/observability/Otlp.js.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +12 -14
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +17 -4
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +4 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpResource.d.ts +16 -7
- package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpResource.js +21 -12
- package/dist/unstable/observability/OtlpResource.js.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts +13 -4
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +10 -3
- package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
- package/dist/unstable/observability/index.js.map +1 -1
- package/dist/unstable/observability/internal/otlpEnv.js +1 -1
- package/dist/unstable/observability/internal/otlpEnv.js.map +1 -1
- package/dist/unstable/observability/internal/otlpProtobuf.js.map +1 -1
- package/dist/unstable/observability/internal/protobuf.js +3 -0
- package/dist/unstable/observability/internal/protobuf.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +8 -3
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +22 -13
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +8 -8
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +6 -6
- package/dist/unstable/persistence/PersistedQueue.js +6 -6
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +3 -3
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +91 -15
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +26 -15
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +24 -13
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts +2 -2
- package/dist/unstable/persistence/Redis.js +1 -1
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/persistence/index.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +64 -21
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js +14 -5
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +21 -10
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/process/index.js.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.d.ts +8 -8
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.js +10 -10
- package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +25 -22
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +14 -13
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +4 -1
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRef.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +24 -3
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +4 -1
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Hydration.d.ts +1 -1
- package/dist/unstable/reactivity/Hydration.js +1 -1
- package/dist/unstable/reactivity/Hydration.js.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/reactivity/index.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +35 -33
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +4 -2
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +12 -12
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +12 -11
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts +8 -8
- package/dist/unstable/rpc/RpcGroup.js +1 -1
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMessage.d.ts +31 -30
- package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.js +6 -6
- package/dist/unstable/rpc/RpcMessage.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +10 -10
- package/dist/unstable/rpc/RpcMiddleware.js +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +4 -4
- package/dist/unstable/rpc/RpcSchema.js +3 -3
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +58 -7
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +175 -96
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +13 -13
- package/dist/unstable/rpc/RpcServer.js +17 -13
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/RpcTest.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts +5 -5
- package/dist/unstable/rpc/RpcWorker.js +4 -4
- package/dist/unstable/rpc/RpcWorker.js.map +1 -1
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/rpc/index.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +52 -50
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +35 -33
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +5 -5
- package/dist/unstable/schema/VariantSchema.js +2 -2
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/schema/index.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +11 -3
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +9 -4
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.js.map +1 -1
- package/dist/unstable/socket/index.js.map +1 -1
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +1 -1
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +2 -2
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +2 -2
- package/dist/unstable/sql/SqlModel.js +2 -2
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts +5 -5
- package/dist/unstable/sql/SqlResolver.js +2 -2
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/dist/unstable/sql/SqlStream.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +6 -6
- package/dist/unstable/sql/Statement.js +15 -15
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/sql/index.js.map +1 -1
- package/dist/unstable/workers/Transferable.d.ts +1 -1
- package/dist/unstable/workers/Transferable.js +1 -1
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts +2 -2
- package/dist/unstable/workers/Worker.js +2 -2
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workers/WorkerError.d.ts +7 -7
- package/dist/unstable/workers/WorkerError.js +6 -6
- package/dist/unstable/workers/WorkerError.js.map +1 -1
- package/dist/unstable/workers/WorkerRunner.d.ts +1 -1
- package/dist/unstable/workers/WorkerRunner.js +1 -1
- package/dist/unstable/workers/WorkerRunner.js.map +1 -1
- package/dist/unstable/workers/index.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +2 -2
- package/dist/unstable/workflow/Activity.js +2 -2
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts +1 -1
- package/dist/unstable/workflow/DurableClock.js +1 -1
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +10 -10
- package/dist/unstable/workflow/DurableDeferred.js +5 -5
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/DurableQueue.d.ts +22 -20
- package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableQueue.js +22 -20
- package/dist/unstable/workflow/DurableQueue.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +21 -21
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +13 -14
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.d.ts +4 -2
- package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.js +4 -2
- package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
- package/dist/unstable/workflow/index.js.map +1 -1
- package/dist/unstable/workflow/internal/crypto.js.map +1 -1
- package/package.json +5 -6
- package/src/Array.ts +982 -1045
- package/src/BigDecimal.ts +433 -756
- package/src/BigInt.ts +213 -269
- package/src/Boolean.ts +146 -188
- package/src/Cache.ts +409 -255
- package/src/Cause.ts +167 -277
- package/src/Channel.ts +891 -816
- package/src/ChannelSchema.ts +1 -1
- package/src/Chunk.ts +841 -1181
- package/src/Clock.ts +181 -49
- package/src/Combiner.ts +20 -33
- package/src/Config.ts +615 -332
- package/src/ConfigProvider.ts +214 -120
- package/src/Console.ts +289 -39
- package/src/Context.ts +319 -378
- package/src/Cron.ts +68 -77
- package/src/Crypto.ts +13 -15
- package/src/Data.ts +60 -80
- package/src/DateTime.ts +564 -660
- package/src/Deferred.ts +253 -256
- package/src/Duration.ts +216 -308
- package/src/Effect.ts +2893 -3279
- package/src/Encoding.ts +22 -40
- package/src/Equal.ts +49 -39
- package/src/Equivalence.ts +103 -105
- package/src/ErrorReporter.ts +51 -27
- package/src/ExecutionPlan.ts +13 -55
- package/src/Exit.ts +116 -192
- package/src/Fiber.ts +81 -148
- package/src/FiberHandle.ts +152 -105
- package/src/FiberMap.ts +225 -174
- package/src/FiberSet.ts +124 -82
- package/src/FileSystem.ts +155 -263
- package/src/Filter.ts +61 -33
- package/src/Formatter.ts +54 -56
- package/src/Function.ts +76 -145
- package/src/Graph.ts +416 -770
- package/src/HKT.ts +12 -6
- package/src/Hash.ts +52 -83
- package/src/HashMap.ts +319 -411
- package/src/HashRing.ts +1 -0
- package/src/HashSet.ts +177 -284
- package/src/Inspectable.ts +12 -12
- package/src/Iterable.ts +620 -786
- package/src/JsonPatch.ts +58 -112
- package/src/JsonPointer.ts +8 -8
- package/src/JsonSchema.ts +402 -244
- package/src/Latch.ts +23 -35
- package/src/Layer.ts +359 -260
- package/src/LayerMap.ts +49 -29
- package/src/LayerRef.ts +6 -2
- package/src/LogLevel.ts +114 -214
- package/src/Logger.ts +344 -697
- package/src/ManagedRuntime.ts +7 -5
- package/src/Match.ts +217 -252
- package/src/Metric.ts +516 -1089
- package/src/MutableHashMap.ts +218 -255
- package/src/MutableHashSet.ts +84 -89
- package/src/MutableList.ts +73 -370
- package/src/MutableRef.ts +420 -243
- package/src/Newtype.ts +21 -14
- package/src/NonEmptyIterable.ts +7 -137
- package/src/Number.ts +196 -233
- package/src/Optic.ts +243 -383
- package/src/Option.ts +447 -812
- package/src/Order.ts +109 -109
- package/src/Ordering.ts +20 -23
- package/src/Path.ts +38 -41
- package/src/Pipeable.ts +6 -5
- package/src/PlatformError.ts +4 -4
- package/src/Pool.ts +4 -2
- package/src/Predicate.ts +200 -181
- package/src/PrimaryKey.ts +7 -7
- package/src/PubSub.ts +526 -552
- package/src/Pull.ts +24 -18
- package/src/Queue.ts +200 -159
- package/src/Random.ts +49 -74
- package/src/RcMap.ts +121 -63
- package/src/RcRef.ts +24 -13
- package/src/Record.ts +291 -488
- package/src/Redactable.ts +10 -3
- package/src/Redacted.ts +25 -25
- package/src/Reducer.ts +8 -15
- package/src/Ref.ts +221 -361
- package/src/References.ts +102 -168
- package/src/RegExp.ts +10 -14
- package/src/Request.ts +31 -21
- package/src/RequestResolver.ts +202 -91
- package/src/Result.ts +312 -484
- package/src/Runtime.ts +50 -75
- package/src/Schedule.ts +308 -1734
- package/src/Scheduler.ts +20 -7
- package/src/Schema.ts +716 -745
- package/src/SchemaAST.ts +466 -358
- package/src/SchemaError.ts +7 -6
- package/src/SchemaGetter.ts +242 -190
- package/src/SchemaIssue.ts +89 -275
- package/src/SchemaParser.ts +180 -93
- package/src/SchemaRepresentation.ts +22 -40
- package/src/SchemaTransformation.ts +129 -88
- package/src/Scope.ts +123 -151
- package/src/ScopedRef.ts +4 -4
- package/src/Semaphore.ts +152 -51
- package/src/Sink.ts +128 -113
- package/src/Stdio.ts +1 -1
- package/src/Stream.ts +2602 -3123
- package/src/String.ts +275 -312
- package/src/Struct.ts +109 -114
- package/src/SubscriptionRef.ts +284 -252
- package/src/Symbol.ts +3 -3
- package/src/Terminal.ts +2 -2
- package/src/Tracer.ts +102 -55
- package/src/Trie.ts +287 -679
- package/src/Tuple.ts +92 -127
- package/src/TxChunk.ts +201 -121
- package/src/TxDeferred.ts +62 -46
- package/src/TxHashMap.ts +645 -799
- package/src/TxHashSet.ts +443 -356
- package/src/TxPriorityQueue.ts +130 -98
- package/src/TxPubSub.ts +107 -80
- package/src/TxQueue.ts +214 -183
- package/src/TxReentrantLock.ts +97 -66
- package/src/TxRef.ts +51 -32
- package/src/TxSemaphore.ts +129 -95
- package/src/TxSubscriptionRef.ts +97 -70
- package/src/Types.ts +126 -67
- package/src/Unify.ts +45 -65
- package/src/Utils.ts +23 -16
- package/src/internal/core.ts +2 -2
- package/src/internal/dateTime.ts +6 -0
- package/src/internal/effect.ts +93 -48
- package/src/internal/persistence.ts +2 -0
- package/src/internal/references.ts +3 -2
- package/src/internal/schema/fromJsonSchemaDocument.ts +15 -13
- package/src/internal/schema/fromRepresentation.ts +10 -16
- package/src/internal/schema/parser.ts +22 -0
- package/src/internal/schema/toJsonSchemaDocument.ts +60 -6
- package/src/internal/schema/toRepresentation.ts +104 -119
- package/src/internal/trie.ts +10 -11
- package/src/testing/FastCheck.ts +8 -7
- package/src/testing/TestClock.ts +72 -30
- package/src/testing/TestConsole.ts +32 -31
- package/src/testing/TestSchema.ts +29 -29
- package/src/unstable/ai/AiError.ts +95 -118
- package/src/unstable/ai/AnthropicStructuredOutput.ts +1 -1
- package/src/unstable/ai/Chat.ts +132 -97
- package/src/unstable/ai/IdGenerator.ts +32 -28
- package/src/unstable/ai/LanguageModel.ts +107 -67
- package/src/unstable/ai/McpProtocol.ts +48 -0
- package/src/unstable/ai/McpSchema.ts +60 -50
- package/src/unstable/ai/McpServer.ts +930 -304
- package/src/unstable/ai/Model.ts +9 -20
- package/src/unstable/ai/OpenAiStructuredOutput.ts +1 -1
- package/src/unstable/ai/Prompt.ts +145 -43
- package/src/unstable/ai/Response.ts +28 -14
- package/src/unstable/ai/Telemetry.ts +46 -13
- package/src/unstable/ai/Tokenizer.ts +14 -3
- package/src/unstable/ai/Tool.ts +59 -44
- package/src/unstable/ai/Toolkit.ts +26 -8
- package/src/unstable/ai/index.ts +5 -0
- package/src/unstable/ai/internal/mcpProtocol.ts +85 -0
- package/src/unstable/ai/internal/mcpProtocolRegistry.ts +70 -0
- package/src/unstable/ai/internal/structured-output.ts +13 -18
- package/src/unstable/cli/Argument.ts +273 -69
- package/src/unstable/cli/CliError.ts +69 -76
- package/src/unstable/cli/CliOutput.ts +44 -58
- package/src/unstable/cli/Command.ts +705 -107
- package/src/unstable/cli/Flag.ts +418 -138
- package/src/unstable/cli/GlobalFlag.ts +1 -1
- package/src/unstable/cli/HelpDoc.ts +12 -4
- package/src/unstable/cli/Param.ts +292 -78
- package/src/unstable/cli/Primitive.ts +370 -149
- package/src/unstable/cli/Prompt.ts +28 -14
- package/src/unstable/cli/internal/lexer.ts +8 -2
- package/src/unstable/cli/internal/parser.ts +2 -2
- package/src/unstable/cluster/ClusterSchema.ts +8 -8
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +5 -1
- package/src/unstable/cluster/Entity.ts +15 -16
- package/src/unstable/cluster/EntityProxy.ts +4 -2
- package/src/unstable/cluster/EntityResource.ts +2 -2
- package/src/unstable/cluster/Envelope.ts +3 -3
- package/src/unstable/cluster/HttpRunner.ts +6 -4
- package/src/unstable/cluster/Message.ts +9 -9
- package/src/unstable/cluster/MessageStorage.ts +15 -15
- package/src/unstable/cluster/Reply.ts +4 -6
- package/src/unstable/cluster/RunnerHealth.ts +1 -1
- package/src/unstable/cluster/RunnerServer.ts +41 -8
- package/src/unstable/cluster/RunnerStorage.ts +2 -2
- package/src/unstable/cluster/Runners.ts +23 -12
- package/src/unstable/cluster/Sharding.ts +7 -8
- package/src/unstable/cluster/ShardingConfig.ts +3 -3
- package/src/unstable/cluster/SingletonAddress.ts +1 -1
- package/src/unstable/cluster/Snowflake.ts +8 -8
- package/src/unstable/cluster/SqlMessageStorage.ts +1 -1
- package/src/unstable/cluster/SqlRunnerStorage.ts +21 -5
- package/src/unstable/cluster/internal/entityManager.ts +11 -15
- package/src/unstable/encoding/Msgpack.ts +6 -8
- package/src/unstable/encoding/Sse.ts +98 -16
- package/src/unstable/eventlog/Event.ts +20 -20
- package/src/unstable/eventlog/EventGroup.ts +4 -4
- package/src/unstable/eventlog/EventJournal.ts +15 -15
- package/src/unstable/eventlog/EventLog.ts +3 -3
- package/src/unstable/eventlog/EventLogEncryption.ts +1 -1
- package/src/unstable/eventlog/EventLogMessage.ts +2 -2
- package/src/unstable/eventlog/EventLogRemote.ts +1 -1
- package/src/unstable/eventlog/EventLogServer.ts +41 -7
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +13 -5
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +14 -6
- package/src/unstable/eventlog/EventLogSessionAuth.ts +1 -1
- package/src/unstable/http/Cookies.ts +35 -21
- package/src/unstable/http/Etag.ts +1 -1
- package/src/unstable/http/FetchHttpClient.ts +3 -1
- package/src/unstable/http/Headers.ts +2 -2
- package/src/unstable/http/HttpBody.ts +20 -5
- package/src/unstable/http/HttpClient.ts +83 -55
- package/src/unstable/http/HttpClientRequest.ts +2 -0
- package/src/unstable/http/HttpClientResponse.ts +4 -4
- package/src/unstable/http/HttpEffect.ts +8 -8
- package/src/unstable/http/HttpMethod.ts +6 -9
- package/src/unstable/http/HttpMiddleware.ts +202 -39
- package/src/unstable/http/HttpPlatform.ts +95 -0
- package/src/unstable/http/HttpRouter.ts +102 -98
- package/src/unstable/http/HttpServer.ts +13 -13
- package/src/unstable/http/HttpServerError.ts +2 -2
- package/src/unstable/http/HttpServerRequest.ts +4 -4
- package/src/unstable/http/HttpServerResponse.ts +30 -0
- package/src/unstable/http/HttpStaticServer.ts +35 -7
- package/src/unstable/http/Multipart.ts +6 -6
- package/src/unstable/http/Url.ts +33 -63
- package/src/unstable/http/UrlParams.ts +10 -18
- package/src/unstable/http/internal/compression.ts +196 -0
- package/src/unstable/httpapi/HttpApiBuilder.ts +10 -9
- package/src/unstable/httpapi/HttpApiClient.ts +14 -14
- package/src/unstable/httpapi/HttpApiEndpoint.ts +42 -42
- package/src/unstable/httpapi/HttpApiError.ts +13 -13
- package/src/unstable/httpapi/HttpApiGroup.ts +15 -15
- package/src/unstable/httpapi/HttpApiMiddleware.ts +71 -24
- package/src/unstable/httpapi/HttpApiScalar.ts +0 -12
- package/src/unstable/httpapi/HttpApiSchema.ts +6 -6
- package/src/unstable/httpapi/OpenApi.ts +13 -13
- package/src/unstable/observability/OtlpExporter.ts +31 -19
- package/src/unstable/observability/OtlpMetrics.ts +4 -1
- package/src/unstable/observability/OtlpResource.ts +26 -17
- package/src/unstable/observability/PrometheusMetrics.ts +13 -4
- package/src/unstable/observability/internal/otlpEnv.ts +1 -1
- package/src/unstable/observability/internal/protobuf.ts +3 -0
- package/src/unstable/persistence/KeyValueStore.ts +72 -49
- package/src/unstable/persistence/Persistable.ts +8 -8
- package/src/unstable/persistence/PersistedQueue.ts +6 -6
- package/src/unstable/persistence/Persistence.ts +126 -19
- package/src/unstable/persistence/RateLimiter.ts +26 -15
- package/src/unstable/persistence/Redis.ts +2 -2
- package/src/unstable/process/ChildProcess.ts +64 -21
- package/src/unstable/process/ChildProcessSpawner.ts +21 -10
- package/src/unstable/reactivity/AsyncResult.ts +12 -13
- package/src/unstable/reactivity/Atom.ts +28 -25
- package/src/unstable/reactivity/AtomHttpApi.ts +5 -4
- package/src/unstable/reactivity/AtomRegistry.ts +24 -3
- package/src/unstable/reactivity/AtomRpc.ts +5 -4
- package/src/unstable/reactivity/Hydration.ts +1 -1
- package/src/unstable/rpc/Rpc.ts +35 -33
- package/src/unstable/rpc/RpcClient.ts +16 -15
- package/src/unstable/rpc/RpcGroup.ts +8 -8
- package/src/unstable/rpc/RpcMessage.ts +31 -30
- package/src/unstable/rpc/RpcMiddleware.ts +10 -10
- package/src/unstable/rpc/RpcSchema.ts +4 -4
- package/src/unstable/rpc/RpcSerialization.ts +167 -68
- package/src/unstable/rpc/RpcServer.ts +18 -15
- package/src/unstable/rpc/RpcWorker.ts +5 -5
- package/src/unstable/schema/Model.ts +52 -50
- package/src/unstable/schema/VariantSchema.ts +5 -5
- package/src/unstable/socket/Socket.ts +17 -4
- package/src/unstable/sql/SqlClient.ts +5 -6
- package/src/unstable/sql/SqlModel.ts +2 -2
- package/src/unstable/sql/SqlResolver.ts +5 -5
- package/src/unstable/sql/Statement.ts +24 -23
- package/src/unstable/workers/Transferable.ts +1 -1
- package/src/unstable/workers/Worker.ts +2 -2
- package/src/unstable/workers/WorkerError.ts +7 -7
- package/src/unstable/workers/WorkerRunner.ts +1 -1
- package/src/unstable/workflow/Activity.ts +2 -2
- package/src/unstable/workflow/DurableClock.ts +1 -1
- package/src/unstable/workflow/DurableDeferred.ts +10 -10
- package/src/unstable/workflow/DurableQueue.ts +22 -20
- package/src/unstable/workflow/Workflow.ts +23 -23
- package/src/unstable/workflow/WorkflowEngine.ts +1 -1
- package/src/unstable/workflow/WorkflowProxy.ts +4 -2
- package/dist/internal/version.d.ts +0 -3
- package/dist/internal/version.d.ts.map +0 -1
- package/dist/internal/version.js +0 -2
- package/dist/internal/version.js.map +0 -1
- package/src/internal/version.ts +0 -2
package/dist/Iterable.d.ts
CHANGED
|
@@ -24,21 +24,21 @@ import type { NoInfer } from "./Types.ts";
|
|
|
24
24
|
*
|
|
25
25
|
* **Example** (Generating values by index)
|
|
26
26
|
*
|
|
27
|
-
* ```ts
|
|
27
|
+
* ```ts import.meta.vitest
|
|
28
28
|
* import { Iterable } from "effect"
|
|
29
29
|
*
|
|
30
30
|
* // Generate first 5 even numbers
|
|
31
31
|
* const evens = Iterable.makeBy((n) => n * 2, { length: 5 })
|
|
32
|
-
*
|
|
32
|
+
* Array.from(evens) // => [0, 2, 4, 6, 8]
|
|
33
33
|
*
|
|
34
34
|
* // Generate squares
|
|
35
35
|
* const squares = Iterable.makeBy((n) => n * n, { length: 4 })
|
|
36
|
-
*
|
|
36
|
+
* Array.from(squares) // => [0, 1, 4, 9]
|
|
37
37
|
*
|
|
38
38
|
* // Infinite sequence (be careful when consuming!)
|
|
39
39
|
* const naturals = Iterable.makeBy((n) => n)
|
|
40
40
|
* const first10 = Iterable.take(naturals, 10)
|
|
41
|
-
*
|
|
41
|
+
* Array.from(first10) // => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
42
42
|
* ```
|
|
43
43
|
*
|
|
44
44
|
* @category constructors
|
|
@@ -58,11 +58,10 @@ export declare const makeBy: <A>(f: (i: number) => A, options?: {
|
|
|
58
58
|
*
|
|
59
59
|
* **Example** (Creating a range)
|
|
60
60
|
*
|
|
61
|
-
* ```ts
|
|
61
|
+
* ```ts import.meta.vitest
|
|
62
62
|
* import { Iterable } from "effect"
|
|
63
|
-
* import * as assert from "node:assert"
|
|
64
63
|
*
|
|
65
|
-
*
|
|
64
|
+
* Array.from(Iterable.range(1, 3)) // => [1, 2, 3]
|
|
66
65
|
* ```
|
|
67
66
|
*
|
|
68
67
|
* @category constructors
|
|
@@ -78,11 +77,10 @@ export declare const range: (start: number, end?: number) => Iterable<number>;
|
|
|
78
77
|
*
|
|
79
78
|
* **Example** (Repeating a value)
|
|
80
79
|
*
|
|
81
|
-
* ```ts
|
|
80
|
+
* ```ts import.meta.vitest
|
|
82
81
|
* import { Iterable } from "effect"
|
|
83
|
-
* import * as assert from "node:assert"
|
|
84
82
|
*
|
|
85
|
-
*
|
|
83
|
+
* Array.from(Iterable.replicate("a", 3)) // => ["a", "a", "a"]
|
|
86
84
|
* ```
|
|
87
85
|
*
|
|
88
86
|
* @category constructors
|
|
@@ -98,11 +96,10 @@ export declare const replicate: {
|
|
|
98
96
|
*
|
|
99
97
|
* **Example** (Repeating a value)
|
|
100
98
|
*
|
|
101
|
-
* ```ts
|
|
99
|
+
* ```ts import.meta.vitest
|
|
102
100
|
* import { Iterable } from "effect"
|
|
103
|
-
* import * as assert from "node:assert"
|
|
104
101
|
*
|
|
105
|
-
*
|
|
102
|
+
* Array.from(Iterable.replicate("a", 3)) // => ["a", "a", "a"]
|
|
106
103
|
* ```
|
|
107
104
|
*
|
|
108
105
|
* @category constructors
|
|
@@ -118,11 +115,10 @@ export declare const replicate: {
|
|
|
118
115
|
*
|
|
119
116
|
* **Example** (Repeating a value)
|
|
120
117
|
*
|
|
121
|
-
* ```ts
|
|
118
|
+
* ```ts import.meta.vitest
|
|
122
119
|
* import { Iterable } from "effect"
|
|
123
|
-
* import * as assert from "node:assert"
|
|
124
120
|
*
|
|
125
|
-
*
|
|
121
|
+
* Array.from(Iterable.replicate("a", 3)) // => ["a", "a", "a"]
|
|
126
122
|
* ```
|
|
127
123
|
*
|
|
128
124
|
* @category constructors
|
|
@@ -210,15 +206,11 @@ export declare const forever: <A>(self: Iterable<A>) => Iterable<A>;
|
|
|
210
206
|
*
|
|
211
207
|
* **Example** (Converting a record to entries)
|
|
212
208
|
*
|
|
213
|
-
* ```ts
|
|
209
|
+
* ```ts import.meta.vitest
|
|
214
210
|
* import { Iterable } from "effect"
|
|
215
|
-
* import * as assert from "node:assert"
|
|
216
211
|
*
|
|
217
212
|
* const x = { a: 1, b: 2, c: 3 }
|
|
218
|
-
*
|
|
219
|
-
* "c",
|
|
220
|
-
* 3
|
|
221
|
-
* ]])
|
|
213
|
+
* Array.from(Iterable.fromRecord(x)) // => [["a", 1], ["b", 2], ["c", 3]]
|
|
222
214
|
* ```
|
|
223
215
|
*
|
|
224
216
|
* @category converting
|
|
@@ -230,17 +222,17 @@ export declare const fromRecord: <K extends string, A>(self: Readonly<Record<K,
|
|
|
230
222
|
*
|
|
231
223
|
* **Example** (Prepending an element)
|
|
232
224
|
*
|
|
233
|
-
* ```ts
|
|
225
|
+
* ```ts import.meta.vitest
|
|
234
226
|
* import { Iterable } from "effect"
|
|
235
227
|
*
|
|
236
228
|
* const numbers = [2, 3, 4]
|
|
237
229
|
* const withOne = Iterable.prepend(numbers, 1)
|
|
238
|
-
*
|
|
230
|
+
* Array.from(withOne) // => [1, 2, 3, 4]
|
|
239
231
|
*
|
|
240
232
|
* // Works with any iterable
|
|
241
233
|
* const letters = "abc"
|
|
242
234
|
* const withZ = Iterable.prepend(letters, "z")
|
|
243
|
-
*
|
|
235
|
+
* Array.from(withZ) // => ["z", "a", "b", "c"]
|
|
244
236
|
* ```
|
|
245
237
|
*
|
|
246
238
|
* @category combining
|
|
@@ -252,17 +244,17 @@ export declare const prepend: {
|
|
|
252
244
|
*
|
|
253
245
|
* **Example** (Prepending an element)
|
|
254
246
|
*
|
|
255
|
-
* ```ts
|
|
247
|
+
* ```ts import.meta.vitest
|
|
256
248
|
* import { Iterable } from "effect"
|
|
257
249
|
*
|
|
258
250
|
* const numbers = [2, 3, 4]
|
|
259
251
|
* const withOne = Iterable.prepend(numbers, 1)
|
|
260
|
-
*
|
|
252
|
+
* Array.from(withOne) // => [1, 2, 3, 4]
|
|
261
253
|
*
|
|
262
254
|
* // Works with any iterable
|
|
263
255
|
* const letters = "abc"
|
|
264
256
|
* const withZ = Iterable.prepend(letters, "z")
|
|
265
|
-
*
|
|
257
|
+
* Array.from(withZ) // => ["z", "a", "b", "c"]
|
|
266
258
|
* ```
|
|
267
259
|
*
|
|
268
260
|
* @category combining
|
|
@@ -274,17 +266,17 @@ export declare const prepend: {
|
|
|
274
266
|
*
|
|
275
267
|
* **Example** (Prepending an element)
|
|
276
268
|
*
|
|
277
|
-
* ```ts
|
|
269
|
+
* ```ts import.meta.vitest
|
|
278
270
|
* import { Iterable } from "effect"
|
|
279
271
|
*
|
|
280
272
|
* const numbers = [2, 3, 4]
|
|
281
273
|
* const withOne = Iterable.prepend(numbers, 1)
|
|
282
|
-
*
|
|
274
|
+
* Array.from(withOne) // => [1, 2, 3, 4]
|
|
283
275
|
*
|
|
284
276
|
* // Works with any iterable
|
|
285
277
|
* const letters = "abc"
|
|
286
278
|
* const withZ = Iterable.prepend(letters, "z")
|
|
287
|
-
*
|
|
279
|
+
* Array.from(withZ) // => ["z", "a", "b", "c"]
|
|
288
280
|
* ```
|
|
289
281
|
*
|
|
290
282
|
* @category combining
|
|
@@ -297,14 +289,10 @@ export declare const prepend: {
|
|
|
297
289
|
*
|
|
298
290
|
* **Example** (Prepending another iterable)
|
|
299
291
|
*
|
|
300
|
-
* ```ts
|
|
292
|
+
* ```ts import.meta.vitest
|
|
301
293
|
* import { Iterable } from "effect"
|
|
302
|
-
* import * as assert from "node:assert"
|
|
303
294
|
*
|
|
304
|
-
*
|
|
305
|
-
* Array.from(Iterable.prependAll([1, 2], ["a", "b"])),
|
|
306
|
-
* ["a", "b", 1, 2]
|
|
307
|
-
* )
|
|
295
|
+
* Array.from(Iterable.prependAll([1, 2], ["a", "b"])) // => ["a", "b", 1, 2]
|
|
308
296
|
* ```
|
|
309
297
|
*
|
|
310
298
|
* @category combining
|
|
@@ -316,14 +304,10 @@ export declare const prependAll: {
|
|
|
316
304
|
*
|
|
317
305
|
* **Example** (Prepending another iterable)
|
|
318
306
|
*
|
|
319
|
-
* ```ts
|
|
307
|
+
* ```ts import.meta.vitest
|
|
320
308
|
* import { Iterable } from "effect"
|
|
321
|
-
* import * as assert from "node:assert"
|
|
322
309
|
*
|
|
323
|
-
*
|
|
324
|
-
* Array.from(Iterable.prependAll([1, 2], ["a", "b"])),
|
|
325
|
-
* ["a", "b", 1, 2]
|
|
326
|
-
* )
|
|
310
|
+
* Array.from(Iterable.prependAll([1, 2], ["a", "b"])) // => ["a", "b", 1, 2]
|
|
327
311
|
* ```
|
|
328
312
|
*
|
|
329
313
|
* @category combining
|
|
@@ -335,14 +319,10 @@ export declare const prependAll: {
|
|
|
335
319
|
*
|
|
336
320
|
* **Example** (Prepending another iterable)
|
|
337
321
|
*
|
|
338
|
-
* ```ts
|
|
322
|
+
* ```ts import.meta.vitest
|
|
339
323
|
* import { Iterable } from "effect"
|
|
340
|
-
* import * as assert from "node:assert"
|
|
341
324
|
*
|
|
342
|
-
*
|
|
343
|
-
* Array.from(Iterable.prependAll([1, 2], ["a", "b"])),
|
|
344
|
-
* ["a", "b", 1, 2]
|
|
345
|
-
* )
|
|
325
|
+
* Array.from(Iterable.prependAll([1, 2], ["a", "b"])) // => ["a", "b", 1, 2]
|
|
346
326
|
* ```
|
|
347
327
|
*
|
|
348
328
|
* @category combining
|
|
@@ -370,19 +350,11 @@ export declare const prependAll: {
|
|
|
370
350
|
*
|
|
371
351
|
* **Example** (Appending an element)
|
|
372
352
|
*
|
|
373
|
-
* ```ts
|
|
353
|
+
* ```ts import.meta.vitest
|
|
374
354
|
* import { Iterable } from "effect"
|
|
375
355
|
*
|
|
376
356
|
* const numbers = [1, 2, 3]
|
|
377
|
-
*
|
|
378
|
-
* console.log(Array.from(withFour)) // [1, 2, 3, 4]
|
|
379
|
-
*
|
|
380
|
-
* // Chain multiple appends
|
|
381
|
-
* const result = Iterable.append(
|
|
382
|
-
* Iterable.append([1, 2], 3),
|
|
383
|
-
* 4
|
|
384
|
-
* )
|
|
385
|
-
* console.log(Array.from(result)) // [1, 2, 3, 4]
|
|
357
|
+
* Array.from(Iterable.append(numbers, 4)) // => [1, 2, 3, 4]
|
|
386
358
|
* ```
|
|
387
359
|
*
|
|
388
360
|
* @see {@link prepend} for adding one element before the existing elements
|
|
@@ -412,19 +384,11 @@ export declare const append: {
|
|
|
412
384
|
*
|
|
413
385
|
* **Example** (Appending an element)
|
|
414
386
|
*
|
|
415
|
-
* ```ts
|
|
387
|
+
* ```ts import.meta.vitest
|
|
416
388
|
* import { Iterable } from "effect"
|
|
417
389
|
*
|
|
418
390
|
* const numbers = [1, 2, 3]
|
|
419
|
-
*
|
|
420
|
-
* console.log(Array.from(withFour)) // [1, 2, 3, 4]
|
|
421
|
-
*
|
|
422
|
-
* // Chain multiple appends
|
|
423
|
-
* const result = Iterable.append(
|
|
424
|
-
* Iterable.append([1, 2], 3),
|
|
425
|
-
* 4
|
|
426
|
-
* )
|
|
427
|
-
* console.log(Array.from(result)) // [1, 2, 3, 4]
|
|
391
|
+
* Array.from(Iterable.append(numbers, 4)) // => [1, 2, 3, 4]
|
|
428
392
|
* ```
|
|
429
393
|
*
|
|
430
394
|
* @see {@link prepend} for adding one element before the existing elements
|
|
@@ -454,19 +418,11 @@ export declare const append: {
|
|
|
454
418
|
*
|
|
455
419
|
* **Example** (Appending an element)
|
|
456
420
|
*
|
|
457
|
-
* ```ts
|
|
421
|
+
* ```ts import.meta.vitest
|
|
458
422
|
* import { Iterable } from "effect"
|
|
459
423
|
*
|
|
460
424
|
* const numbers = [1, 2, 3]
|
|
461
|
-
*
|
|
462
|
-
* console.log(Array.from(withFour)) // [1, 2, 3, 4]
|
|
463
|
-
*
|
|
464
|
-
* // Chain multiple appends
|
|
465
|
-
* const result = Iterable.append(
|
|
466
|
-
* Iterable.append([1, 2], 3),
|
|
467
|
-
* 4
|
|
468
|
-
* )
|
|
469
|
-
* console.log(Array.from(result)) // [1, 2, 3, 4]
|
|
425
|
+
* Array.from(Iterable.append(numbers, 4)) // => [1, 2, 3, 4]
|
|
470
426
|
* ```
|
|
471
427
|
*
|
|
472
428
|
* @see {@link prepend} for adding one element before the existing elements
|
|
@@ -496,25 +452,21 @@ export declare const append: {
|
|
|
496
452
|
*
|
|
497
453
|
* **Example** (Concatenating iterables)
|
|
498
454
|
*
|
|
499
|
-
* ```ts
|
|
455
|
+
* ```ts import.meta.vitest
|
|
500
456
|
* import { Iterable } from "effect"
|
|
501
457
|
*
|
|
502
|
-
*
|
|
503
|
-
* const second = [4, 5, 6]
|
|
504
|
-
* const combined = Iterable.appendAll(first, second)
|
|
505
|
-
* console.log(Array.from(combined)) // [1, 2, 3, 4, 5, 6]
|
|
458
|
+
* Array.from(Iterable.appendAll([1, 2, 3], [4, 5, 6])) // => [1, 2, 3, 4, 5, 6]
|
|
506
459
|
*
|
|
507
460
|
* // Works with different iterable types
|
|
508
461
|
* const numbers = [1, 2]
|
|
509
462
|
* const letters = "abc"
|
|
510
463
|
* const mixed = Iterable.appendAll(numbers, letters)
|
|
511
|
-
*
|
|
464
|
+
* Array.from(mixed) // => [1, 2, "a", "b", "c"]
|
|
512
465
|
*
|
|
513
466
|
* // Lazy evaluation - only consumes what's needed
|
|
514
467
|
* const infinite = Iterable.range(1)
|
|
515
468
|
* const finite = [0, -1, -2]
|
|
516
|
-
*
|
|
517
|
-
* console.log(Array.from(result)) // [0, -1, -2, 1, 2]
|
|
469
|
+
* Array.from(Iterable.take(Iterable.appendAll(finite, infinite), 5)) // => [0, -1, -2, 1, 2]
|
|
518
470
|
* ```
|
|
519
471
|
*
|
|
520
472
|
* @see {@link append} for appending one value instead of another iterable
|
|
@@ -543,25 +495,21 @@ export declare const appendAll: {
|
|
|
543
495
|
*
|
|
544
496
|
* **Example** (Concatenating iterables)
|
|
545
497
|
*
|
|
546
|
-
* ```ts
|
|
498
|
+
* ```ts import.meta.vitest
|
|
547
499
|
* import { Iterable } from "effect"
|
|
548
500
|
*
|
|
549
|
-
*
|
|
550
|
-
* const second = [4, 5, 6]
|
|
551
|
-
* const combined = Iterable.appendAll(first, second)
|
|
552
|
-
* console.log(Array.from(combined)) // [1, 2, 3, 4, 5, 6]
|
|
501
|
+
* Array.from(Iterable.appendAll([1, 2, 3], [4, 5, 6])) // => [1, 2, 3, 4, 5, 6]
|
|
553
502
|
*
|
|
554
503
|
* // Works with different iterable types
|
|
555
504
|
* const numbers = [1, 2]
|
|
556
505
|
* const letters = "abc"
|
|
557
506
|
* const mixed = Iterable.appendAll(numbers, letters)
|
|
558
|
-
*
|
|
507
|
+
* Array.from(mixed) // => [1, 2, "a", "b", "c"]
|
|
559
508
|
*
|
|
560
509
|
* // Lazy evaluation - only consumes what's needed
|
|
561
510
|
* const infinite = Iterable.range(1)
|
|
562
511
|
* const finite = [0, -1, -2]
|
|
563
|
-
*
|
|
564
|
-
* console.log(Array.from(result)) // [0, -1, -2, 1, 2]
|
|
512
|
+
* Array.from(Iterable.take(Iterable.appendAll(finite, infinite), 5)) // => [0, -1, -2, 1, 2]
|
|
565
513
|
* ```
|
|
566
514
|
*
|
|
567
515
|
* @see {@link append} for appending one value instead of another iterable
|
|
@@ -590,25 +538,21 @@ export declare const appendAll: {
|
|
|
590
538
|
*
|
|
591
539
|
* **Example** (Concatenating iterables)
|
|
592
540
|
*
|
|
593
|
-
* ```ts
|
|
541
|
+
* ```ts import.meta.vitest
|
|
594
542
|
* import { Iterable } from "effect"
|
|
595
543
|
*
|
|
596
|
-
*
|
|
597
|
-
* const second = [4, 5, 6]
|
|
598
|
-
* const combined = Iterable.appendAll(first, second)
|
|
599
|
-
* console.log(Array.from(combined)) // [1, 2, 3, 4, 5, 6]
|
|
544
|
+
* Array.from(Iterable.appendAll([1, 2, 3], [4, 5, 6])) // => [1, 2, 3, 4, 5, 6]
|
|
600
545
|
*
|
|
601
546
|
* // Works with different iterable types
|
|
602
547
|
* const numbers = [1, 2]
|
|
603
548
|
* const letters = "abc"
|
|
604
549
|
* const mixed = Iterable.appendAll(numbers, letters)
|
|
605
|
-
*
|
|
550
|
+
* Array.from(mixed) // => [1, 2, "a", "b", "c"]
|
|
606
551
|
*
|
|
607
552
|
* // Lazy evaluation - only consumes what's needed
|
|
608
553
|
* const infinite = Iterable.range(1)
|
|
609
554
|
* const finite = [0, -1, -2]
|
|
610
|
-
*
|
|
611
|
-
* console.log(Array.from(result)) // [0, -1, -2, 1, 2]
|
|
555
|
+
* Array.from(Iterable.take(Iterable.appendAll(finite, infinite), 5)) // => [0, -1, -2, 1, 2]
|
|
612
556
|
* ```
|
|
613
557
|
*
|
|
614
558
|
* @see {@link append} for appending one value instead of another iterable
|
|
@@ -624,23 +568,23 @@ export declare const appendAll: {
|
|
|
624
568
|
*
|
|
625
569
|
* **Example** (Tracking running results)
|
|
626
570
|
*
|
|
627
|
-
* ```ts
|
|
571
|
+
* ```ts import.meta.vitest
|
|
628
572
|
* import { Iterable } from "effect"
|
|
629
573
|
*
|
|
630
574
|
* // Running sum of numbers
|
|
631
575
|
* const numbers = [1, 2, 3, 4, 5]
|
|
632
576
|
* const runningSum = Iterable.scan(numbers, 0, (acc, n) => acc + n)
|
|
633
|
-
*
|
|
577
|
+
* Array.from(runningSum) // => [0, 1, 3, 6, 10, 15]
|
|
634
578
|
*
|
|
635
579
|
* // Build strings progressively
|
|
636
580
|
* const letters = ["a", "b", "c"]
|
|
637
581
|
* const progressive = Iterable.scan(letters, "", (acc, letter) => acc + letter)
|
|
638
|
-
*
|
|
582
|
+
* Array.from(progressive) // => ["", "a", "ab", "abc"]
|
|
639
583
|
*
|
|
640
584
|
* // Track maximum values seen so far
|
|
641
585
|
* const values = [3, 1, 4, 1, 5, 9, 2]
|
|
642
586
|
* const runningMax = Iterable.scan(values, -Infinity, Math.max)
|
|
643
|
-
*
|
|
587
|
+
* Array.from(runningMax) // => [-Infinity, 3, 3, 4, 4, 5, 9, 9]
|
|
644
588
|
* ```
|
|
645
589
|
*
|
|
646
590
|
* @category folding
|
|
@@ -652,23 +596,23 @@ export declare const scan: {
|
|
|
652
596
|
*
|
|
653
597
|
* **Example** (Tracking running results)
|
|
654
598
|
*
|
|
655
|
-
* ```ts
|
|
599
|
+
* ```ts import.meta.vitest
|
|
656
600
|
* import { Iterable } from "effect"
|
|
657
601
|
*
|
|
658
602
|
* // Running sum of numbers
|
|
659
603
|
* const numbers = [1, 2, 3, 4, 5]
|
|
660
604
|
* const runningSum = Iterable.scan(numbers, 0, (acc, n) => acc + n)
|
|
661
|
-
*
|
|
605
|
+
* Array.from(runningSum) // => [0, 1, 3, 6, 10, 15]
|
|
662
606
|
*
|
|
663
607
|
* // Build strings progressively
|
|
664
608
|
* const letters = ["a", "b", "c"]
|
|
665
609
|
* const progressive = Iterable.scan(letters, "", (acc, letter) => acc + letter)
|
|
666
|
-
*
|
|
610
|
+
* Array.from(progressive) // => ["", "a", "ab", "abc"]
|
|
667
611
|
*
|
|
668
612
|
* // Track maximum values seen so far
|
|
669
613
|
* const values = [3, 1, 4, 1, 5, 9, 2]
|
|
670
614
|
* const runningMax = Iterable.scan(values, -Infinity, Math.max)
|
|
671
|
-
*
|
|
615
|
+
* Array.from(runningMax) // => [-Infinity, 3, 3, 4, 4, 5, 9, 9]
|
|
672
616
|
* ```
|
|
673
617
|
*
|
|
674
618
|
* @category folding
|
|
@@ -680,23 +624,23 @@ export declare const scan: {
|
|
|
680
624
|
*
|
|
681
625
|
* **Example** (Tracking running results)
|
|
682
626
|
*
|
|
683
|
-
* ```ts
|
|
627
|
+
* ```ts import.meta.vitest
|
|
684
628
|
* import { Iterable } from "effect"
|
|
685
629
|
*
|
|
686
630
|
* // Running sum of numbers
|
|
687
631
|
* const numbers = [1, 2, 3, 4, 5]
|
|
688
632
|
* const runningSum = Iterable.scan(numbers, 0, (acc, n) => acc + n)
|
|
689
|
-
*
|
|
633
|
+
* Array.from(runningSum) // => [0, 1, 3, 6, 10, 15]
|
|
690
634
|
*
|
|
691
635
|
* // Build strings progressively
|
|
692
636
|
* const letters = ["a", "b", "c"]
|
|
693
637
|
* const progressive = Iterable.scan(letters, "", (acc, letter) => acc + letter)
|
|
694
|
-
*
|
|
638
|
+
* Array.from(progressive) // => ["", "a", "ab", "abc"]
|
|
695
639
|
*
|
|
696
640
|
* // Track maximum values seen so far
|
|
697
641
|
* const values = [3, 1, 4, 1, 5, 9, 2]
|
|
698
642
|
* const runningMax = Iterable.scan(values, -Infinity, Math.max)
|
|
699
|
-
*
|
|
643
|
+
* Array.from(runningMax) // => [-Infinity, 3, 3, 4, 4, 5, 9, 9]
|
|
700
644
|
* ```
|
|
701
645
|
*
|
|
702
646
|
* @category folding
|
|
@@ -709,12 +653,11 @@ export declare const scan: {
|
|
|
709
653
|
*
|
|
710
654
|
* **Example** (Checking for emptiness)
|
|
711
655
|
*
|
|
712
|
-
* ```ts
|
|
656
|
+
* ```ts import.meta.vitest
|
|
713
657
|
* import { Iterable } from "effect"
|
|
714
|
-
* import * as assert from "node:assert"
|
|
715
658
|
*
|
|
716
|
-
*
|
|
717
|
-
*
|
|
659
|
+
* Iterable.isEmpty([]) // => true
|
|
660
|
+
* Iterable.isEmpty([1, 2, 3]) // => false
|
|
718
661
|
* ```
|
|
719
662
|
*
|
|
720
663
|
* @category guards
|
|
@@ -726,22 +669,22 @@ export declare const isEmpty: <A>(self: Iterable<A>) => self is Iterable<never>;
|
|
|
726
669
|
*
|
|
727
670
|
* **Example** (Counting iterable elements)
|
|
728
671
|
*
|
|
729
|
-
* ```ts
|
|
672
|
+
* ```ts import.meta.vitest
|
|
730
673
|
* import { Iterable } from "effect"
|
|
731
674
|
*
|
|
732
675
|
* const numbers = [1, 2, 3, 4, 5]
|
|
733
|
-
*
|
|
676
|
+
* Iterable.size(numbers) // => 5
|
|
734
677
|
*
|
|
735
678
|
* const empty = Iterable.empty<number>()
|
|
736
|
-
*
|
|
679
|
+
* Iterable.size(empty) // => 0
|
|
737
680
|
*
|
|
738
681
|
* // Works with any iterable
|
|
739
682
|
* const letters = "hello"
|
|
740
|
-
*
|
|
683
|
+
* Iterable.size(letters) // => 5
|
|
741
684
|
*
|
|
742
685
|
* // Note: This consumes the entire iterable
|
|
743
686
|
* const range = Iterable.range(1, 100)
|
|
744
|
-
*
|
|
687
|
+
* Iterable.size(range) // => 100
|
|
745
688
|
* ```
|
|
746
689
|
*
|
|
747
690
|
* @category getters
|
|
@@ -753,24 +696,24 @@ export declare const size: <A>(self: Iterable<A>) => number;
|
|
|
753
696
|
*
|
|
754
697
|
* **Example** (Getting the first element)
|
|
755
698
|
*
|
|
756
|
-
* ```ts
|
|
699
|
+
* ```ts import.meta.vitest
|
|
757
700
|
* import { Iterable, Option } from "effect"
|
|
758
701
|
*
|
|
759
702
|
* const numbers = [1, 2, 3]
|
|
760
|
-
*
|
|
703
|
+
* Iterable.head(numbers) // => Option.some(1)
|
|
761
704
|
*
|
|
762
705
|
* const empty = Iterable.empty<number>()
|
|
763
|
-
*
|
|
706
|
+
* Iterable.head(empty) // => Option.none()
|
|
764
707
|
*
|
|
765
708
|
* // Safe way to get first element
|
|
766
709
|
* const firstEven = Iterable.head(
|
|
767
710
|
* Iterable.filter([1, 3, 4, 5], (x) => x % 2 === 0)
|
|
768
711
|
* )
|
|
769
|
-
*
|
|
712
|
+
* firstEven // => Option.some(4)
|
|
770
713
|
*
|
|
771
714
|
* // Use with Option methods
|
|
772
715
|
* const doubled = Option.map(Iterable.head([5, 10, 15]), (x) => x * 2)
|
|
773
|
-
*
|
|
716
|
+
* doubled // => Option.some(10)
|
|
774
717
|
* ```
|
|
775
718
|
*
|
|
776
719
|
* @category getters
|
|
@@ -791,21 +734,21 @@ export declare const head: <A>(self: Iterable<A>) => Option<A>;
|
|
|
791
734
|
*
|
|
792
735
|
* **Example** (Getting the first element unsafely)
|
|
793
736
|
*
|
|
794
|
-
* ```ts
|
|
737
|
+
* ```ts import.meta.vitest
|
|
795
738
|
* import { Iterable } from "effect"
|
|
796
739
|
*
|
|
797
740
|
* const numbers = [1, 2, 3]
|
|
798
|
-
*
|
|
741
|
+
* Iterable.headUnsafe(numbers) // => 1
|
|
799
742
|
*
|
|
800
743
|
* const letters = "hello"
|
|
801
|
-
*
|
|
744
|
+
* Iterable.headUnsafe(letters) // => "h"
|
|
802
745
|
*
|
|
803
746
|
* // Iterable.headUnsafe(Iterable.empty<number>())
|
|
804
747
|
* // throws Error: "headUnsafe: empty iterable"
|
|
805
748
|
*
|
|
806
749
|
* // Use only when you're certain the iterable is non-empty
|
|
807
750
|
* const nonEmpty = Iterable.range(1, 10)
|
|
808
|
-
*
|
|
751
|
+
* Iterable.headUnsafe(nonEmpty) // => 1
|
|
809
752
|
* ```
|
|
810
753
|
*
|
|
811
754
|
* @category getters
|
|
@@ -821,25 +764,25 @@ export declare const headUnsafe: <A>(self: Iterable<A>) => A;
|
|
|
821
764
|
*
|
|
822
765
|
* **Example** (Taking from the start)
|
|
823
766
|
*
|
|
824
|
-
* ```ts
|
|
767
|
+
* ```ts import.meta.vitest
|
|
825
768
|
* import { Iterable } from "effect"
|
|
826
769
|
*
|
|
827
770
|
* const numbers = [1, 2, 3, 4, 5]
|
|
828
771
|
* const firstThree = Iterable.take(numbers, 3)
|
|
829
|
-
*
|
|
772
|
+
* Array.from(firstThree) // => [1, 2, 3]
|
|
830
773
|
*
|
|
831
774
|
* // Taking more than available returns all elements
|
|
832
775
|
* const firstTen = Iterable.take(numbers, 10)
|
|
833
|
-
*
|
|
776
|
+
* Array.from(firstTen) // => [1, 2, 3, 4, 5]
|
|
834
777
|
*
|
|
835
778
|
* // Taking 0 or negative returns empty
|
|
836
779
|
* const none = Iterable.take(numbers, 0)
|
|
837
|
-
*
|
|
780
|
+
* Array.from(none) // => []
|
|
838
781
|
*
|
|
839
782
|
* // Useful with infinite iterables
|
|
840
783
|
* const naturals = Iterable.range(1)
|
|
841
784
|
* const firstFive = Iterable.take(naturals, 5)
|
|
842
|
-
*
|
|
785
|
+
* Array.from(firstFive) // => [1, 2, 3, 4, 5]
|
|
843
786
|
* ```
|
|
844
787
|
*
|
|
845
788
|
* @category getters
|
|
@@ -855,25 +798,25 @@ export declare const take: {
|
|
|
855
798
|
*
|
|
856
799
|
* **Example** (Taking from the start)
|
|
857
800
|
*
|
|
858
|
-
* ```ts
|
|
801
|
+
* ```ts import.meta.vitest
|
|
859
802
|
* import { Iterable } from "effect"
|
|
860
803
|
*
|
|
861
804
|
* const numbers = [1, 2, 3, 4, 5]
|
|
862
805
|
* const firstThree = Iterable.take(numbers, 3)
|
|
863
|
-
*
|
|
806
|
+
* Array.from(firstThree) // => [1, 2, 3]
|
|
864
807
|
*
|
|
865
808
|
* // Taking more than available returns all elements
|
|
866
809
|
* const firstTen = Iterable.take(numbers, 10)
|
|
867
|
-
*
|
|
810
|
+
* Array.from(firstTen) // => [1, 2, 3, 4, 5]
|
|
868
811
|
*
|
|
869
812
|
* // Taking 0 or negative returns empty
|
|
870
813
|
* const none = Iterable.take(numbers, 0)
|
|
871
|
-
*
|
|
814
|
+
* Array.from(none) // => []
|
|
872
815
|
*
|
|
873
816
|
* // Useful with infinite iterables
|
|
874
817
|
* const naturals = Iterable.range(1)
|
|
875
818
|
* const firstFive = Iterable.take(naturals, 5)
|
|
876
|
-
*
|
|
819
|
+
* Array.from(firstFive) // => [1, 2, 3, 4, 5]
|
|
877
820
|
* ```
|
|
878
821
|
*
|
|
879
822
|
* @category getters
|
|
@@ -889,25 +832,25 @@ export declare const take: {
|
|
|
889
832
|
*
|
|
890
833
|
* **Example** (Taking from the start)
|
|
891
834
|
*
|
|
892
|
-
* ```ts
|
|
835
|
+
* ```ts import.meta.vitest
|
|
893
836
|
* import { Iterable } from "effect"
|
|
894
837
|
*
|
|
895
838
|
* const numbers = [1, 2, 3, 4, 5]
|
|
896
839
|
* const firstThree = Iterable.take(numbers, 3)
|
|
897
|
-
*
|
|
840
|
+
* Array.from(firstThree) // => [1, 2, 3]
|
|
898
841
|
*
|
|
899
842
|
* // Taking more than available returns all elements
|
|
900
843
|
* const firstTen = Iterable.take(numbers, 10)
|
|
901
|
-
*
|
|
844
|
+
* Array.from(firstTen) // => [1, 2, 3, 4, 5]
|
|
902
845
|
*
|
|
903
846
|
* // Taking 0 or negative returns empty
|
|
904
847
|
* const none = Iterable.take(numbers, 0)
|
|
905
|
-
*
|
|
848
|
+
* Array.from(none) // => []
|
|
906
849
|
*
|
|
907
850
|
* // Useful with infinite iterables
|
|
908
851
|
* const naturals = Iterable.range(1)
|
|
909
852
|
* const firstFive = Iterable.take(naturals, 5)
|
|
910
|
-
*
|
|
853
|
+
* Array.from(firstFive) // => [1, 2, 3, 4, 5]
|
|
911
854
|
* ```
|
|
912
855
|
*
|
|
913
856
|
* @category getters
|
|
@@ -921,22 +864,22 @@ export declare const take: {
|
|
|
921
864
|
*
|
|
922
865
|
* **Example** (Taking while a predicate holds)
|
|
923
866
|
*
|
|
924
|
-
* ```ts
|
|
867
|
+
* ```ts import.meta.vitest
|
|
925
868
|
* import { Iterable } from "effect"
|
|
926
869
|
*
|
|
927
870
|
* const numbers = [2, 4, 6, 8, 3, 10, 12]
|
|
928
871
|
* const evenPrefix = Iterable.takeWhile(numbers, (x) => x % 2 === 0)
|
|
929
|
-
*
|
|
872
|
+
* Array.from(evenPrefix) // => [2, 4, 6, 8]
|
|
930
873
|
*
|
|
931
874
|
* // With index
|
|
932
875
|
* const letters = ["a", "b", "c", "d", "e"]
|
|
933
876
|
* const firstThreeByIndex = Iterable.takeWhile(letters, (_, i) => i < 3)
|
|
934
|
-
*
|
|
877
|
+
* Array.from(firstThreeByIndex) // => ["a", "b", "c"]
|
|
935
878
|
*
|
|
936
879
|
* // Stops at first non-matching element
|
|
937
880
|
* const mixed = [1, 3, 5, 4, 7, 9]
|
|
938
881
|
* const oddPrefix = Iterable.takeWhile(mixed, (x) => x % 2 === 1)
|
|
939
|
-
*
|
|
882
|
+
* Array.from(oddPrefix) // => [1, 3, 5]
|
|
940
883
|
*
|
|
941
884
|
* // Type refinement
|
|
942
885
|
* const values: Array<string | number> = ["a", "b", "c", 1, "d"]
|
|
@@ -944,7 +887,7 @@ export declare const take: {
|
|
|
944
887
|
* values,
|
|
945
888
|
* (x): x is string => typeof x === "string"
|
|
946
889
|
* )
|
|
947
|
-
*
|
|
890
|
+
* Array.from(stringPrefix) // => ["a", "b", "c"]
|
|
948
891
|
* ```
|
|
949
892
|
*
|
|
950
893
|
* @category getters
|
|
@@ -957,22 +900,22 @@ export declare const takeWhile: {
|
|
|
957
900
|
*
|
|
958
901
|
* **Example** (Taking while a predicate holds)
|
|
959
902
|
*
|
|
960
|
-
* ```ts
|
|
903
|
+
* ```ts import.meta.vitest
|
|
961
904
|
* import { Iterable } from "effect"
|
|
962
905
|
*
|
|
963
906
|
* const numbers = [2, 4, 6, 8, 3, 10, 12]
|
|
964
907
|
* const evenPrefix = Iterable.takeWhile(numbers, (x) => x % 2 === 0)
|
|
965
|
-
*
|
|
908
|
+
* Array.from(evenPrefix) // => [2, 4, 6, 8]
|
|
966
909
|
*
|
|
967
910
|
* // With index
|
|
968
911
|
* const letters = ["a", "b", "c", "d", "e"]
|
|
969
912
|
* const firstThreeByIndex = Iterable.takeWhile(letters, (_, i) => i < 3)
|
|
970
|
-
*
|
|
913
|
+
* Array.from(firstThreeByIndex) // => ["a", "b", "c"]
|
|
971
914
|
*
|
|
972
915
|
* // Stops at first non-matching element
|
|
973
916
|
* const mixed = [1, 3, 5, 4, 7, 9]
|
|
974
917
|
* const oddPrefix = Iterable.takeWhile(mixed, (x) => x % 2 === 1)
|
|
975
|
-
*
|
|
918
|
+
* Array.from(oddPrefix) // => [1, 3, 5]
|
|
976
919
|
*
|
|
977
920
|
* // Type refinement
|
|
978
921
|
* const values: Array<string | number> = ["a", "b", "c", 1, "d"]
|
|
@@ -980,7 +923,7 @@ export declare const takeWhile: {
|
|
|
980
923
|
* values,
|
|
981
924
|
* (x): x is string => typeof x === "string"
|
|
982
925
|
* )
|
|
983
|
-
*
|
|
926
|
+
* Array.from(stringPrefix) // => ["a", "b", "c"]
|
|
984
927
|
* ```
|
|
985
928
|
*
|
|
986
929
|
* @category getters
|
|
@@ -993,22 +936,22 @@ export declare const takeWhile: {
|
|
|
993
936
|
*
|
|
994
937
|
* **Example** (Taking while a predicate holds)
|
|
995
938
|
*
|
|
996
|
-
* ```ts
|
|
939
|
+
* ```ts import.meta.vitest
|
|
997
940
|
* import { Iterable } from "effect"
|
|
998
941
|
*
|
|
999
942
|
* const numbers = [2, 4, 6, 8, 3, 10, 12]
|
|
1000
943
|
* const evenPrefix = Iterable.takeWhile(numbers, (x) => x % 2 === 0)
|
|
1001
|
-
*
|
|
944
|
+
* Array.from(evenPrefix) // => [2, 4, 6, 8]
|
|
1002
945
|
*
|
|
1003
946
|
* // With index
|
|
1004
947
|
* const letters = ["a", "b", "c", "d", "e"]
|
|
1005
948
|
* const firstThreeByIndex = Iterable.takeWhile(letters, (_, i) => i < 3)
|
|
1006
|
-
*
|
|
949
|
+
* Array.from(firstThreeByIndex) // => ["a", "b", "c"]
|
|
1007
950
|
*
|
|
1008
951
|
* // Stops at first non-matching element
|
|
1009
952
|
* const mixed = [1, 3, 5, 4, 7, 9]
|
|
1010
953
|
* const oddPrefix = Iterable.takeWhile(mixed, (x) => x % 2 === 1)
|
|
1011
|
-
*
|
|
954
|
+
* Array.from(oddPrefix) // => [1, 3, 5]
|
|
1012
955
|
*
|
|
1013
956
|
* // Type refinement
|
|
1014
957
|
* const values: Array<string | number> = ["a", "b", "c", 1, "d"]
|
|
@@ -1016,7 +959,7 @@ export declare const takeWhile: {
|
|
|
1016
959
|
* values,
|
|
1017
960
|
* (x): x is string => typeof x === "string"
|
|
1018
961
|
* )
|
|
1019
|
-
*
|
|
962
|
+
* Array.from(stringPrefix) // => ["a", "b", "c"]
|
|
1020
963
|
* ```
|
|
1021
964
|
*
|
|
1022
965
|
* @category getters
|
|
@@ -1029,22 +972,22 @@ export declare const takeWhile: {
|
|
|
1029
972
|
*
|
|
1030
973
|
* **Example** (Taking while a predicate holds)
|
|
1031
974
|
*
|
|
1032
|
-
* ```ts
|
|
975
|
+
* ```ts import.meta.vitest
|
|
1033
976
|
* import { Iterable } from "effect"
|
|
1034
977
|
*
|
|
1035
978
|
* const numbers = [2, 4, 6, 8, 3, 10, 12]
|
|
1036
979
|
* const evenPrefix = Iterable.takeWhile(numbers, (x) => x % 2 === 0)
|
|
1037
|
-
*
|
|
980
|
+
* Array.from(evenPrefix) // => [2, 4, 6, 8]
|
|
1038
981
|
*
|
|
1039
982
|
* // With index
|
|
1040
983
|
* const letters = ["a", "b", "c", "d", "e"]
|
|
1041
984
|
* const firstThreeByIndex = Iterable.takeWhile(letters, (_, i) => i < 3)
|
|
1042
|
-
*
|
|
985
|
+
* Array.from(firstThreeByIndex) // => ["a", "b", "c"]
|
|
1043
986
|
*
|
|
1044
987
|
* // Stops at first non-matching element
|
|
1045
988
|
* const mixed = [1, 3, 5, 4, 7, 9]
|
|
1046
989
|
* const oddPrefix = Iterable.takeWhile(mixed, (x) => x % 2 === 1)
|
|
1047
|
-
*
|
|
990
|
+
* Array.from(oddPrefix) // => [1, 3, 5]
|
|
1048
991
|
*
|
|
1049
992
|
* // Type refinement
|
|
1050
993
|
* const values: Array<string | number> = ["a", "b", "c", 1, "d"]
|
|
@@ -1052,7 +995,7 @@ export declare const takeWhile: {
|
|
|
1052
995
|
* values,
|
|
1053
996
|
* (x): x is string => typeof x === "string"
|
|
1054
997
|
* )
|
|
1055
|
-
*
|
|
998
|
+
* Array.from(stringPrefix) // => ["a", "b", "c"]
|
|
1056
999
|
* ```
|
|
1057
1000
|
*
|
|
1058
1001
|
* @category getters
|
|
@@ -1065,22 +1008,22 @@ export declare const takeWhile: {
|
|
|
1065
1008
|
*
|
|
1066
1009
|
* **Example** (Taking while a predicate holds)
|
|
1067
1010
|
*
|
|
1068
|
-
* ```ts
|
|
1011
|
+
* ```ts import.meta.vitest
|
|
1069
1012
|
* import { Iterable } from "effect"
|
|
1070
1013
|
*
|
|
1071
1014
|
* const numbers = [2, 4, 6, 8, 3, 10, 12]
|
|
1072
1015
|
* const evenPrefix = Iterable.takeWhile(numbers, (x) => x % 2 === 0)
|
|
1073
|
-
*
|
|
1016
|
+
* Array.from(evenPrefix) // => [2, 4, 6, 8]
|
|
1074
1017
|
*
|
|
1075
1018
|
* // With index
|
|
1076
1019
|
* const letters = ["a", "b", "c", "d", "e"]
|
|
1077
1020
|
* const firstThreeByIndex = Iterable.takeWhile(letters, (_, i) => i < 3)
|
|
1078
|
-
*
|
|
1021
|
+
* Array.from(firstThreeByIndex) // => ["a", "b", "c"]
|
|
1079
1022
|
*
|
|
1080
1023
|
* // Stops at first non-matching element
|
|
1081
1024
|
* const mixed = [1, 3, 5, 4, 7, 9]
|
|
1082
1025
|
* const oddPrefix = Iterable.takeWhile(mixed, (x) => x % 2 === 1)
|
|
1083
|
-
*
|
|
1026
|
+
* Array.from(oddPrefix) // => [1, 3, 5]
|
|
1084
1027
|
*
|
|
1085
1028
|
* // Type refinement
|
|
1086
1029
|
* const values: Array<string | number> = ["a", "b", "c", 1, "d"]
|
|
@@ -1088,7 +1031,7 @@ export declare const takeWhile: {
|
|
|
1088
1031
|
* values,
|
|
1089
1032
|
* (x): x is string => typeof x === "string"
|
|
1090
1033
|
* )
|
|
1091
|
-
*
|
|
1034
|
+
* Array.from(stringPrefix) // => ["a", "b", "c"]
|
|
1092
1035
|
* ```
|
|
1093
1036
|
*
|
|
1094
1037
|
* @category getters
|
|
@@ -1105,24 +1048,24 @@ export declare const takeWhile: {
|
|
|
1105
1048
|
*
|
|
1106
1049
|
* **Example** (Dropping from the start)
|
|
1107
1050
|
*
|
|
1108
|
-
* ```ts
|
|
1051
|
+
* ```ts import.meta.vitest
|
|
1109
1052
|
* import { Iterable } from "effect"
|
|
1110
1053
|
*
|
|
1111
1054
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1112
1055
|
* const withoutFirstTwo = Iterable.drop(numbers, 2)
|
|
1113
|
-
*
|
|
1056
|
+
* Array.from(withoutFirstTwo) // => [3, 4, 5]
|
|
1114
1057
|
*
|
|
1115
1058
|
* // Dropping more than available returns empty
|
|
1116
1059
|
* const withoutFirstTen = Iterable.drop(numbers, 10)
|
|
1117
|
-
*
|
|
1060
|
+
* Array.from(withoutFirstTen) // => []
|
|
1118
1061
|
*
|
|
1119
1062
|
* // Dropping 0 or negative returns all elements
|
|
1120
1063
|
* const all = Iterable.drop(numbers, 0)
|
|
1121
|
-
*
|
|
1064
|
+
* Array.from(all) // => [1, 2, 3, 4, 5]
|
|
1122
1065
|
*
|
|
1123
1066
|
* // Combine with take for slicing
|
|
1124
1067
|
* const slice = Iterable.take(Iterable.drop(numbers, 1), 3)
|
|
1125
|
-
*
|
|
1068
|
+
* Array.from(slice) // => [2, 3, 4]
|
|
1126
1069
|
* ```
|
|
1127
1070
|
*
|
|
1128
1071
|
* @category getters
|
|
@@ -1138,24 +1081,24 @@ export declare const drop: {
|
|
|
1138
1081
|
*
|
|
1139
1082
|
* **Example** (Dropping from the start)
|
|
1140
1083
|
*
|
|
1141
|
-
* ```ts
|
|
1084
|
+
* ```ts import.meta.vitest
|
|
1142
1085
|
* import { Iterable } from "effect"
|
|
1143
1086
|
*
|
|
1144
1087
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1145
1088
|
* const withoutFirstTwo = Iterable.drop(numbers, 2)
|
|
1146
|
-
*
|
|
1089
|
+
* Array.from(withoutFirstTwo) // => [3, 4, 5]
|
|
1147
1090
|
*
|
|
1148
1091
|
* // Dropping more than available returns empty
|
|
1149
1092
|
* const withoutFirstTen = Iterable.drop(numbers, 10)
|
|
1150
|
-
*
|
|
1093
|
+
* Array.from(withoutFirstTen) // => []
|
|
1151
1094
|
*
|
|
1152
1095
|
* // Dropping 0 or negative returns all elements
|
|
1153
1096
|
* const all = Iterable.drop(numbers, 0)
|
|
1154
|
-
*
|
|
1097
|
+
* Array.from(all) // => [1, 2, 3, 4, 5]
|
|
1155
1098
|
*
|
|
1156
1099
|
* // Combine with take for slicing
|
|
1157
1100
|
* const slice = Iterable.take(Iterable.drop(numbers, 1), 3)
|
|
1158
|
-
*
|
|
1101
|
+
* Array.from(slice) // => [2, 3, 4]
|
|
1159
1102
|
* ```
|
|
1160
1103
|
*
|
|
1161
1104
|
* @category getters
|
|
@@ -1171,24 +1114,24 @@ export declare const drop: {
|
|
|
1171
1114
|
*
|
|
1172
1115
|
* **Example** (Dropping from the start)
|
|
1173
1116
|
*
|
|
1174
|
-
* ```ts
|
|
1117
|
+
* ```ts import.meta.vitest
|
|
1175
1118
|
* import { Iterable } from "effect"
|
|
1176
1119
|
*
|
|
1177
1120
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1178
1121
|
* const withoutFirstTwo = Iterable.drop(numbers, 2)
|
|
1179
|
-
*
|
|
1122
|
+
* Array.from(withoutFirstTwo) // => [3, 4, 5]
|
|
1180
1123
|
*
|
|
1181
1124
|
* // Dropping more than available returns empty
|
|
1182
1125
|
* const withoutFirstTen = Iterable.drop(numbers, 10)
|
|
1183
|
-
*
|
|
1126
|
+
* Array.from(withoutFirstTen) // => []
|
|
1184
1127
|
*
|
|
1185
1128
|
* // Dropping 0 or negative returns all elements
|
|
1186
1129
|
* const all = Iterable.drop(numbers, 0)
|
|
1187
|
-
*
|
|
1130
|
+
* Array.from(all) // => [1, 2, 3, 4, 5]
|
|
1188
1131
|
*
|
|
1189
1132
|
* // Combine with take for slicing
|
|
1190
1133
|
* const slice = Iterable.take(Iterable.drop(numbers, 1), 3)
|
|
1191
|
-
*
|
|
1134
|
+
* Array.from(slice) // => [2, 3, 4]
|
|
1192
1135
|
* ```
|
|
1193
1136
|
*
|
|
1194
1137
|
* @category getters
|
|
@@ -1202,20 +1145,20 @@ export declare const drop: {
|
|
|
1202
1145
|
*
|
|
1203
1146
|
* **Example** (Finding the first match)
|
|
1204
1147
|
*
|
|
1205
|
-
* ```ts
|
|
1148
|
+
* ```ts import.meta.vitest
|
|
1206
1149
|
* import { Iterable, Option } from "effect"
|
|
1207
1150
|
*
|
|
1208
1151
|
* const numbers = [1, 3, 4, 6, 8]
|
|
1209
1152
|
* const firstEven = Iterable.findFirst(numbers, (x) => x % 2 === 0)
|
|
1210
|
-
*
|
|
1153
|
+
* firstEven // => Option.some(4)
|
|
1211
1154
|
*
|
|
1212
1155
|
* const firstGreaterThan10 = Iterable.findFirst(numbers, (x) => x > 10)
|
|
1213
|
-
*
|
|
1156
|
+
* firstGreaterThan10 // => Option.none()
|
|
1214
1157
|
*
|
|
1215
1158
|
* // With index
|
|
1216
1159
|
* const letters = ["a", "b", "c", "d"]
|
|
1217
1160
|
* const atEvenIndex = Iterable.findFirst(letters, (_, i) => i % 2 === 0)
|
|
1218
|
-
*
|
|
1161
|
+
* atEvenIndex // => Option.some("a")
|
|
1219
1162
|
*
|
|
1220
1163
|
* // Type refinement
|
|
1221
1164
|
* const mixed: Array<string | number> = [1, "hello", 2, "world"]
|
|
@@ -1223,17 +1166,17 @@ export declare const drop: {
|
|
|
1223
1166
|
* mixed,
|
|
1224
1167
|
* (x): x is string => typeof x === "string"
|
|
1225
1168
|
* )
|
|
1226
|
-
*
|
|
1169
|
+
* firstString // => Option.some("hello")
|
|
1227
1170
|
*
|
|
1228
1171
|
* // Transform during search
|
|
1229
1172
|
* const findSquareRoot = Iterable.findFirst([1, 4, 9, 16], (x) => {
|
|
1230
1173
|
* const sqrt = Math.sqrt(x)
|
|
1231
1174
|
* return Number.isInteger(sqrt) ? Option.some(sqrt) : Option.none()
|
|
1232
1175
|
* })
|
|
1233
|
-
*
|
|
1176
|
+
* findSquareRoot // => Option.some(1)
|
|
1234
1177
|
* ```
|
|
1235
1178
|
*
|
|
1236
|
-
* @category
|
|
1179
|
+
* @category searching
|
|
1237
1180
|
* @since 2.0.0
|
|
1238
1181
|
*/
|
|
1239
1182
|
export declare const findFirst: {
|
|
@@ -1243,20 +1186,20 @@ export declare const findFirst: {
|
|
|
1243
1186
|
*
|
|
1244
1187
|
* **Example** (Finding the first match)
|
|
1245
1188
|
*
|
|
1246
|
-
* ```ts
|
|
1189
|
+
* ```ts import.meta.vitest
|
|
1247
1190
|
* import { Iterable, Option } from "effect"
|
|
1248
1191
|
*
|
|
1249
1192
|
* const numbers = [1, 3, 4, 6, 8]
|
|
1250
1193
|
* const firstEven = Iterable.findFirst(numbers, (x) => x % 2 === 0)
|
|
1251
|
-
*
|
|
1194
|
+
* firstEven // => Option.some(4)
|
|
1252
1195
|
*
|
|
1253
1196
|
* const firstGreaterThan10 = Iterable.findFirst(numbers, (x) => x > 10)
|
|
1254
|
-
*
|
|
1197
|
+
* firstGreaterThan10 // => Option.none()
|
|
1255
1198
|
*
|
|
1256
1199
|
* // With index
|
|
1257
1200
|
* const letters = ["a", "b", "c", "d"]
|
|
1258
1201
|
* const atEvenIndex = Iterable.findFirst(letters, (_, i) => i % 2 === 0)
|
|
1259
|
-
*
|
|
1202
|
+
* atEvenIndex // => Option.some("a")
|
|
1260
1203
|
*
|
|
1261
1204
|
* // Type refinement
|
|
1262
1205
|
* const mixed: Array<string | number> = [1, "hello", 2, "world"]
|
|
@@ -1264,17 +1207,17 @@ export declare const findFirst: {
|
|
|
1264
1207
|
* mixed,
|
|
1265
1208
|
* (x): x is string => typeof x === "string"
|
|
1266
1209
|
* )
|
|
1267
|
-
*
|
|
1210
|
+
* firstString // => Option.some("hello")
|
|
1268
1211
|
*
|
|
1269
1212
|
* // Transform during search
|
|
1270
1213
|
* const findSquareRoot = Iterable.findFirst([1, 4, 9, 16], (x) => {
|
|
1271
1214
|
* const sqrt = Math.sqrt(x)
|
|
1272
1215
|
* return Number.isInteger(sqrt) ? Option.some(sqrt) : Option.none()
|
|
1273
1216
|
* })
|
|
1274
|
-
*
|
|
1217
|
+
* findSquareRoot // => Option.some(1)
|
|
1275
1218
|
* ```
|
|
1276
1219
|
*
|
|
1277
|
-
* @category
|
|
1220
|
+
* @category searching
|
|
1278
1221
|
* @since 2.0.0
|
|
1279
1222
|
*/
|
|
1280
1223
|
<A, B>(f: (a: NoInfer<A>, i: number) => Option<B>): (self: Iterable<A>) => Option<B>;
|
|
@@ -1284,20 +1227,20 @@ export declare const findFirst: {
|
|
|
1284
1227
|
*
|
|
1285
1228
|
* **Example** (Finding the first match)
|
|
1286
1229
|
*
|
|
1287
|
-
* ```ts
|
|
1230
|
+
* ```ts import.meta.vitest
|
|
1288
1231
|
* import { Iterable, Option } from "effect"
|
|
1289
1232
|
*
|
|
1290
1233
|
* const numbers = [1, 3, 4, 6, 8]
|
|
1291
1234
|
* const firstEven = Iterable.findFirst(numbers, (x) => x % 2 === 0)
|
|
1292
|
-
*
|
|
1235
|
+
* firstEven // => Option.some(4)
|
|
1293
1236
|
*
|
|
1294
1237
|
* const firstGreaterThan10 = Iterable.findFirst(numbers, (x) => x > 10)
|
|
1295
|
-
*
|
|
1238
|
+
* firstGreaterThan10 // => Option.none()
|
|
1296
1239
|
*
|
|
1297
1240
|
* // With index
|
|
1298
1241
|
* const letters = ["a", "b", "c", "d"]
|
|
1299
1242
|
* const atEvenIndex = Iterable.findFirst(letters, (_, i) => i % 2 === 0)
|
|
1300
|
-
*
|
|
1243
|
+
* atEvenIndex // => Option.some("a")
|
|
1301
1244
|
*
|
|
1302
1245
|
* // Type refinement
|
|
1303
1246
|
* const mixed: Array<string | number> = [1, "hello", 2, "world"]
|
|
@@ -1305,17 +1248,17 @@ export declare const findFirst: {
|
|
|
1305
1248
|
* mixed,
|
|
1306
1249
|
* (x): x is string => typeof x === "string"
|
|
1307
1250
|
* )
|
|
1308
|
-
*
|
|
1251
|
+
* firstString // => Option.some("hello")
|
|
1309
1252
|
*
|
|
1310
1253
|
* // Transform during search
|
|
1311
1254
|
* const findSquareRoot = Iterable.findFirst([1, 4, 9, 16], (x) => {
|
|
1312
1255
|
* const sqrt = Math.sqrt(x)
|
|
1313
1256
|
* return Number.isInteger(sqrt) ? Option.some(sqrt) : Option.none()
|
|
1314
1257
|
* })
|
|
1315
|
-
*
|
|
1258
|
+
* findSquareRoot // => Option.some(1)
|
|
1316
1259
|
* ```
|
|
1317
1260
|
*
|
|
1318
|
-
* @category
|
|
1261
|
+
* @category searching
|
|
1319
1262
|
* @since 2.0.0
|
|
1320
1263
|
*/
|
|
1321
1264
|
<A, B extends A>(refinement: (a: NoInfer<A>, i: number) => a is B): (self: Iterable<A>) => Option<B>;
|
|
@@ -1325,20 +1268,20 @@ export declare const findFirst: {
|
|
|
1325
1268
|
*
|
|
1326
1269
|
* **Example** (Finding the first match)
|
|
1327
1270
|
*
|
|
1328
|
-
* ```ts
|
|
1271
|
+
* ```ts import.meta.vitest
|
|
1329
1272
|
* import { Iterable, Option } from "effect"
|
|
1330
1273
|
*
|
|
1331
1274
|
* const numbers = [1, 3, 4, 6, 8]
|
|
1332
1275
|
* const firstEven = Iterable.findFirst(numbers, (x) => x % 2 === 0)
|
|
1333
|
-
*
|
|
1276
|
+
* firstEven // => Option.some(4)
|
|
1334
1277
|
*
|
|
1335
1278
|
* const firstGreaterThan10 = Iterable.findFirst(numbers, (x) => x > 10)
|
|
1336
|
-
*
|
|
1279
|
+
* firstGreaterThan10 // => Option.none()
|
|
1337
1280
|
*
|
|
1338
1281
|
* // With index
|
|
1339
1282
|
* const letters = ["a", "b", "c", "d"]
|
|
1340
1283
|
* const atEvenIndex = Iterable.findFirst(letters, (_, i) => i % 2 === 0)
|
|
1341
|
-
*
|
|
1284
|
+
* atEvenIndex // => Option.some("a")
|
|
1342
1285
|
*
|
|
1343
1286
|
* // Type refinement
|
|
1344
1287
|
* const mixed: Array<string | number> = [1, "hello", 2, "world"]
|
|
@@ -1346,17 +1289,17 @@ export declare const findFirst: {
|
|
|
1346
1289
|
* mixed,
|
|
1347
1290
|
* (x): x is string => typeof x === "string"
|
|
1348
1291
|
* )
|
|
1349
|
-
*
|
|
1292
|
+
* firstString // => Option.some("hello")
|
|
1350
1293
|
*
|
|
1351
1294
|
* // Transform during search
|
|
1352
1295
|
* const findSquareRoot = Iterable.findFirst([1, 4, 9, 16], (x) => {
|
|
1353
1296
|
* const sqrt = Math.sqrt(x)
|
|
1354
1297
|
* return Number.isInteger(sqrt) ? Option.some(sqrt) : Option.none()
|
|
1355
1298
|
* })
|
|
1356
|
-
*
|
|
1299
|
+
* findSquareRoot // => Option.some(1)
|
|
1357
1300
|
* ```
|
|
1358
1301
|
*
|
|
1359
|
-
* @category
|
|
1302
|
+
* @category searching
|
|
1360
1303
|
* @since 2.0.0
|
|
1361
1304
|
*/
|
|
1362
1305
|
<A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => Option<A>;
|
|
@@ -1366,20 +1309,20 @@ export declare const findFirst: {
|
|
|
1366
1309
|
*
|
|
1367
1310
|
* **Example** (Finding the first match)
|
|
1368
1311
|
*
|
|
1369
|
-
* ```ts
|
|
1312
|
+
* ```ts import.meta.vitest
|
|
1370
1313
|
* import { Iterable, Option } from "effect"
|
|
1371
1314
|
*
|
|
1372
1315
|
* const numbers = [1, 3, 4, 6, 8]
|
|
1373
1316
|
* const firstEven = Iterable.findFirst(numbers, (x) => x % 2 === 0)
|
|
1374
|
-
*
|
|
1317
|
+
* firstEven // => Option.some(4)
|
|
1375
1318
|
*
|
|
1376
1319
|
* const firstGreaterThan10 = Iterable.findFirst(numbers, (x) => x > 10)
|
|
1377
|
-
*
|
|
1320
|
+
* firstGreaterThan10 // => Option.none()
|
|
1378
1321
|
*
|
|
1379
1322
|
* // With index
|
|
1380
1323
|
* const letters = ["a", "b", "c", "d"]
|
|
1381
1324
|
* const atEvenIndex = Iterable.findFirst(letters, (_, i) => i % 2 === 0)
|
|
1382
|
-
*
|
|
1325
|
+
* atEvenIndex // => Option.some("a")
|
|
1383
1326
|
*
|
|
1384
1327
|
* // Type refinement
|
|
1385
1328
|
* const mixed: Array<string | number> = [1, "hello", 2, "world"]
|
|
@@ -1387,17 +1330,17 @@ export declare const findFirst: {
|
|
|
1387
1330
|
* mixed,
|
|
1388
1331
|
* (x): x is string => typeof x === "string"
|
|
1389
1332
|
* )
|
|
1390
|
-
*
|
|
1333
|
+
* firstString // => Option.some("hello")
|
|
1391
1334
|
*
|
|
1392
1335
|
* // Transform during search
|
|
1393
1336
|
* const findSquareRoot = Iterable.findFirst([1, 4, 9, 16], (x) => {
|
|
1394
1337
|
* const sqrt = Math.sqrt(x)
|
|
1395
1338
|
* return Number.isInteger(sqrt) ? Option.some(sqrt) : Option.none()
|
|
1396
1339
|
* })
|
|
1397
|
-
*
|
|
1340
|
+
* findSquareRoot // => Option.some(1)
|
|
1398
1341
|
* ```
|
|
1399
1342
|
*
|
|
1400
|
-
* @category
|
|
1343
|
+
* @category searching
|
|
1401
1344
|
* @since 2.0.0
|
|
1402
1345
|
*/
|
|
1403
1346
|
<A, B>(self: Iterable<A>, f: (a: A, i: number) => Option<B>): Option<B>;
|
|
@@ -1407,20 +1350,20 @@ export declare const findFirst: {
|
|
|
1407
1350
|
*
|
|
1408
1351
|
* **Example** (Finding the first match)
|
|
1409
1352
|
*
|
|
1410
|
-
* ```ts
|
|
1353
|
+
* ```ts import.meta.vitest
|
|
1411
1354
|
* import { Iterable, Option } from "effect"
|
|
1412
1355
|
*
|
|
1413
1356
|
* const numbers = [1, 3, 4, 6, 8]
|
|
1414
1357
|
* const firstEven = Iterable.findFirst(numbers, (x) => x % 2 === 0)
|
|
1415
|
-
*
|
|
1358
|
+
* firstEven // => Option.some(4)
|
|
1416
1359
|
*
|
|
1417
1360
|
* const firstGreaterThan10 = Iterable.findFirst(numbers, (x) => x > 10)
|
|
1418
|
-
*
|
|
1361
|
+
* firstGreaterThan10 // => Option.none()
|
|
1419
1362
|
*
|
|
1420
1363
|
* // With index
|
|
1421
1364
|
* const letters = ["a", "b", "c", "d"]
|
|
1422
1365
|
* const atEvenIndex = Iterable.findFirst(letters, (_, i) => i % 2 === 0)
|
|
1423
|
-
*
|
|
1366
|
+
* atEvenIndex // => Option.some("a")
|
|
1424
1367
|
*
|
|
1425
1368
|
* // Type refinement
|
|
1426
1369
|
* const mixed: Array<string | number> = [1, "hello", 2, "world"]
|
|
@@ -1428,17 +1371,17 @@ export declare const findFirst: {
|
|
|
1428
1371
|
* mixed,
|
|
1429
1372
|
* (x): x is string => typeof x === "string"
|
|
1430
1373
|
* )
|
|
1431
|
-
*
|
|
1374
|
+
* firstString // => Option.some("hello")
|
|
1432
1375
|
*
|
|
1433
1376
|
* // Transform during search
|
|
1434
1377
|
* const findSquareRoot = Iterable.findFirst([1, 4, 9, 16], (x) => {
|
|
1435
1378
|
* const sqrt = Math.sqrt(x)
|
|
1436
1379
|
* return Number.isInteger(sqrt) ? Option.some(sqrt) : Option.none()
|
|
1437
1380
|
* })
|
|
1438
|
-
*
|
|
1381
|
+
* findSquareRoot // => Option.some(1)
|
|
1439
1382
|
* ```
|
|
1440
1383
|
*
|
|
1441
|
-
* @category
|
|
1384
|
+
* @category searching
|
|
1442
1385
|
* @since 2.0.0
|
|
1443
1386
|
*/
|
|
1444
1387
|
<A, B extends A>(self: Iterable<A>, refinement: (a: A, i: number) => a is B): Option<B>;
|
|
@@ -1448,20 +1391,20 @@ export declare const findFirst: {
|
|
|
1448
1391
|
*
|
|
1449
1392
|
* **Example** (Finding the first match)
|
|
1450
1393
|
*
|
|
1451
|
-
* ```ts
|
|
1394
|
+
* ```ts import.meta.vitest
|
|
1452
1395
|
* import { Iterable, Option } from "effect"
|
|
1453
1396
|
*
|
|
1454
1397
|
* const numbers = [1, 3, 4, 6, 8]
|
|
1455
1398
|
* const firstEven = Iterable.findFirst(numbers, (x) => x % 2 === 0)
|
|
1456
|
-
*
|
|
1399
|
+
* firstEven // => Option.some(4)
|
|
1457
1400
|
*
|
|
1458
1401
|
* const firstGreaterThan10 = Iterable.findFirst(numbers, (x) => x > 10)
|
|
1459
|
-
*
|
|
1402
|
+
* firstGreaterThan10 // => Option.none()
|
|
1460
1403
|
*
|
|
1461
1404
|
* // With index
|
|
1462
1405
|
* const letters = ["a", "b", "c", "d"]
|
|
1463
1406
|
* const atEvenIndex = Iterable.findFirst(letters, (_, i) => i % 2 === 0)
|
|
1464
|
-
*
|
|
1407
|
+
* atEvenIndex // => Option.some("a")
|
|
1465
1408
|
*
|
|
1466
1409
|
* // Type refinement
|
|
1467
1410
|
* const mixed: Array<string | number> = [1, "hello", 2, "world"]
|
|
@@ -1469,17 +1412,17 @@ export declare const findFirst: {
|
|
|
1469
1412
|
* mixed,
|
|
1470
1413
|
* (x): x is string => typeof x === "string"
|
|
1471
1414
|
* )
|
|
1472
|
-
*
|
|
1415
|
+
* firstString // => Option.some("hello")
|
|
1473
1416
|
*
|
|
1474
1417
|
* // Transform during search
|
|
1475
1418
|
* const findSquareRoot = Iterable.findFirst([1, 4, 9, 16], (x) => {
|
|
1476
1419
|
* const sqrt = Math.sqrt(x)
|
|
1477
1420
|
* return Number.isInteger(sqrt) ? Option.some(sqrt) : Option.none()
|
|
1478
1421
|
* })
|
|
1479
|
-
*
|
|
1422
|
+
* findSquareRoot // => Option.some(1)
|
|
1480
1423
|
* ```
|
|
1481
1424
|
*
|
|
1482
|
-
* @category
|
|
1425
|
+
* @category searching
|
|
1483
1426
|
* @since 2.0.0
|
|
1484
1427
|
*/
|
|
1485
1428
|
<A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Option<A>;
|
|
@@ -1489,20 +1432,20 @@ export declare const findFirst: {
|
|
|
1489
1432
|
*
|
|
1490
1433
|
* **Example** (Finding the last match)
|
|
1491
1434
|
*
|
|
1492
|
-
* ```ts
|
|
1493
|
-
* import { Iterable } from "effect"
|
|
1435
|
+
* ```ts import.meta.vitest
|
|
1436
|
+
* import { Iterable, Option } from "effect"
|
|
1494
1437
|
*
|
|
1495
1438
|
* const numbers = [1, 3, 4, 6, 8, 2]
|
|
1496
1439
|
* const lastEven = Iterable.findLast(numbers, (x) => x % 2 === 0)
|
|
1497
|
-
*
|
|
1440
|
+
* lastEven // => Option.some(2)
|
|
1498
1441
|
*
|
|
1499
1442
|
* const lastGreaterThan10 = Iterable.findLast(numbers, (x) => x > 10)
|
|
1500
|
-
*
|
|
1443
|
+
* lastGreaterThan10 // => Option.none()
|
|
1501
1444
|
*
|
|
1502
1445
|
* // With index
|
|
1503
1446
|
* const letters = ["a", "b", "c", "d", "e"]
|
|
1504
1447
|
* const lastAtEvenIndex = Iterable.findLast(letters, (_, i) => i % 2 === 0)
|
|
1505
|
-
*
|
|
1448
|
+
* lastAtEvenIndex // => Option.some("e")
|
|
1506
1449
|
*
|
|
1507
1450
|
* // Type refinement
|
|
1508
1451
|
* const mixed: Array<string | number> = [1, "hello", 2, "world", 3]
|
|
@@ -1510,10 +1453,10 @@ export declare const findFirst: {
|
|
|
1510
1453
|
* mixed,
|
|
1511
1454
|
* (x): x is string => typeof x === "string"
|
|
1512
1455
|
* )
|
|
1513
|
-
*
|
|
1456
|
+
* lastString // => Option.some("world")
|
|
1514
1457
|
* ```
|
|
1515
1458
|
*
|
|
1516
|
-
* @category
|
|
1459
|
+
* @category searching
|
|
1517
1460
|
* @since 2.0.0
|
|
1518
1461
|
*/
|
|
1519
1462
|
export declare const findLast: {
|
|
@@ -1522,20 +1465,20 @@ export declare const findLast: {
|
|
|
1522
1465
|
*
|
|
1523
1466
|
* **Example** (Finding the last match)
|
|
1524
1467
|
*
|
|
1525
|
-
* ```ts
|
|
1526
|
-
* import { Iterable } from "effect"
|
|
1468
|
+
* ```ts import.meta.vitest
|
|
1469
|
+
* import { Iterable, Option } from "effect"
|
|
1527
1470
|
*
|
|
1528
1471
|
* const numbers = [1, 3, 4, 6, 8, 2]
|
|
1529
1472
|
* const lastEven = Iterable.findLast(numbers, (x) => x % 2 === 0)
|
|
1530
|
-
*
|
|
1473
|
+
* lastEven // => Option.some(2)
|
|
1531
1474
|
*
|
|
1532
1475
|
* const lastGreaterThan10 = Iterable.findLast(numbers, (x) => x > 10)
|
|
1533
|
-
*
|
|
1476
|
+
* lastGreaterThan10 // => Option.none()
|
|
1534
1477
|
*
|
|
1535
1478
|
* // With index
|
|
1536
1479
|
* const letters = ["a", "b", "c", "d", "e"]
|
|
1537
1480
|
* const lastAtEvenIndex = Iterable.findLast(letters, (_, i) => i % 2 === 0)
|
|
1538
|
-
*
|
|
1481
|
+
* lastAtEvenIndex // => Option.some("e")
|
|
1539
1482
|
*
|
|
1540
1483
|
* // Type refinement
|
|
1541
1484
|
* const mixed: Array<string | number> = [1, "hello", 2, "world", 3]
|
|
@@ -1543,10 +1486,10 @@ export declare const findLast: {
|
|
|
1543
1486
|
* mixed,
|
|
1544
1487
|
* (x): x is string => typeof x === "string"
|
|
1545
1488
|
* )
|
|
1546
|
-
*
|
|
1489
|
+
* lastString // => Option.some("world")
|
|
1547
1490
|
* ```
|
|
1548
1491
|
*
|
|
1549
|
-
* @category
|
|
1492
|
+
* @category searching
|
|
1550
1493
|
* @since 2.0.0
|
|
1551
1494
|
*/
|
|
1552
1495
|
<A, B>(f: (a: NoInfer<A>, i: number) => Option<B>): (self: Iterable<A>) => Option<B>;
|
|
@@ -1555,20 +1498,20 @@ export declare const findLast: {
|
|
|
1555
1498
|
*
|
|
1556
1499
|
* **Example** (Finding the last match)
|
|
1557
1500
|
*
|
|
1558
|
-
* ```ts
|
|
1559
|
-
* import { Iterable } from "effect"
|
|
1501
|
+
* ```ts import.meta.vitest
|
|
1502
|
+
* import { Iterable, Option } from "effect"
|
|
1560
1503
|
*
|
|
1561
1504
|
* const numbers = [1, 3, 4, 6, 8, 2]
|
|
1562
1505
|
* const lastEven = Iterable.findLast(numbers, (x) => x % 2 === 0)
|
|
1563
|
-
*
|
|
1506
|
+
* lastEven // => Option.some(2)
|
|
1564
1507
|
*
|
|
1565
1508
|
* const lastGreaterThan10 = Iterable.findLast(numbers, (x) => x > 10)
|
|
1566
|
-
*
|
|
1509
|
+
* lastGreaterThan10 // => Option.none()
|
|
1567
1510
|
*
|
|
1568
1511
|
* // With index
|
|
1569
1512
|
* const letters = ["a", "b", "c", "d", "e"]
|
|
1570
1513
|
* const lastAtEvenIndex = Iterable.findLast(letters, (_, i) => i % 2 === 0)
|
|
1571
|
-
*
|
|
1514
|
+
* lastAtEvenIndex // => Option.some("e")
|
|
1572
1515
|
*
|
|
1573
1516
|
* // Type refinement
|
|
1574
1517
|
* const mixed: Array<string | number> = [1, "hello", 2, "world", 3]
|
|
@@ -1576,10 +1519,10 @@ export declare const findLast: {
|
|
|
1576
1519
|
* mixed,
|
|
1577
1520
|
* (x): x is string => typeof x === "string"
|
|
1578
1521
|
* )
|
|
1579
|
-
*
|
|
1522
|
+
* lastString // => Option.some("world")
|
|
1580
1523
|
* ```
|
|
1581
1524
|
*
|
|
1582
|
-
* @category
|
|
1525
|
+
* @category searching
|
|
1583
1526
|
* @since 2.0.0
|
|
1584
1527
|
*/
|
|
1585
1528
|
<A, B extends A>(refinement: (a: NoInfer<A>, i: number) => a is B): (self: Iterable<A>) => Option<B>;
|
|
@@ -1588,20 +1531,20 @@ export declare const findLast: {
|
|
|
1588
1531
|
*
|
|
1589
1532
|
* **Example** (Finding the last match)
|
|
1590
1533
|
*
|
|
1591
|
-
* ```ts
|
|
1592
|
-
* import { Iterable } from "effect"
|
|
1534
|
+
* ```ts import.meta.vitest
|
|
1535
|
+
* import { Iterable, Option } from "effect"
|
|
1593
1536
|
*
|
|
1594
1537
|
* const numbers = [1, 3, 4, 6, 8, 2]
|
|
1595
1538
|
* const lastEven = Iterable.findLast(numbers, (x) => x % 2 === 0)
|
|
1596
|
-
*
|
|
1539
|
+
* lastEven // => Option.some(2)
|
|
1597
1540
|
*
|
|
1598
1541
|
* const lastGreaterThan10 = Iterable.findLast(numbers, (x) => x > 10)
|
|
1599
|
-
*
|
|
1542
|
+
* lastGreaterThan10 // => Option.none()
|
|
1600
1543
|
*
|
|
1601
1544
|
* // With index
|
|
1602
1545
|
* const letters = ["a", "b", "c", "d", "e"]
|
|
1603
1546
|
* const lastAtEvenIndex = Iterable.findLast(letters, (_, i) => i % 2 === 0)
|
|
1604
|
-
*
|
|
1547
|
+
* lastAtEvenIndex // => Option.some("e")
|
|
1605
1548
|
*
|
|
1606
1549
|
* // Type refinement
|
|
1607
1550
|
* const mixed: Array<string | number> = [1, "hello", 2, "world", 3]
|
|
@@ -1609,10 +1552,10 @@ export declare const findLast: {
|
|
|
1609
1552
|
* mixed,
|
|
1610
1553
|
* (x): x is string => typeof x === "string"
|
|
1611
1554
|
* )
|
|
1612
|
-
*
|
|
1555
|
+
* lastString // => Option.some("world")
|
|
1613
1556
|
* ```
|
|
1614
1557
|
*
|
|
1615
|
-
* @category
|
|
1558
|
+
* @category searching
|
|
1616
1559
|
* @since 2.0.0
|
|
1617
1560
|
*/
|
|
1618
1561
|
<A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => Option<A>;
|
|
@@ -1621,20 +1564,20 @@ export declare const findLast: {
|
|
|
1621
1564
|
*
|
|
1622
1565
|
* **Example** (Finding the last match)
|
|
1623
1566
|
*
|
|
1624
|
-
* ```ts
|
|
1625
|
-
* import { Iterable } from "effect"
|
|
1567
|
+
* ```ts import.meta.vitest
|
|
1568
|
+
* import { Iterable, Option } from "effect"
|
|
1626
1569
|
*
|
|
1627
1570
|
* const numbers = [1, 3, 4, 6, 8, 2]
|
|
1628
1571
|
* const lastEven = Iterable.findLast(numbers, (x) => x % 2 === 0)
|
|
1629
|
-
*
|
|
1572
|
+
* lastEven // => Option.some(2)
|
|
1630
1573
|
*
|
|
1631
1574
|
* const lastGreaterThan10 = Iterable.findLast(numbers, (x) => x > 10)
|
|
1632
|
-
*
|
|
1575
|
+
* lastGreaterThan10 // => Option.none()
|
|
1633
1576
|
*
|
|
1634
1577
|
* // With index
|
|
1635
1578
|
* const letters = ["a", "b", "c", "d", "e"]
|
|
1636
1579
|
* const lastAtEvenIndex = Iterable.findLast(letters, (_, i) => i % 2 === 0)
|
|
1637
|
-
*
|
|
1580
|
+
* lastAtEvenIndex // => Option.some("e")
|
|
1638
1581
|
*
|
|
1639
1582
|
* // Type refinement
|
|
1640
1583
|
* const mixed: Array<string | number> = [1, "hello", 2, "world", 3]
|
|
@@ -1642,10 +1585,10 @@ export declare const findLast: {
|
|
|
1642
1585
|
* mixed,
|
|
1643
1586
|
* (x): x is string => typeof x === "string"
|
|
1644
1587
|
* )
|
|
1645
|
-
*
|
|
1588
|
+
* lastString // => Option.some("world")
|
|
1646
1589
|
* ```
|
|
1647
1590
|
*
|
|
1648
|
-
* @category
|
|
1591
|
+
* @category searching
|
|
1649
1592
|
* @since 2.0.0
|
|
1650
1593
|
*/
|
|
1651
1594
|
<A, B>(self: Iterable<A>, f: (a: A, i: number) => Option<B>): Option<B>;
|
|
@@ -1654,20 +1597,20 @@ export declare const findLast: {
|
|
|
1654
1597
|
*
|
|
1655
1598
|
* **Example** (Finding the last match)
|
|
1656
1599
|
*
|
|
1657
|
-
* ```ts
|
|
1658
|
-
* import { Iterable } from "effect"
|
|
1600
|
+
* ```ts import.meta.vitest
|
|
1601
|
+
* import { Iterable, Option } from "effect"
|
|
1659
1602
|
*
|
|
1660
1603
|
* const numbers = [1, 3, 4, 6, 8, 2]
|
|
1661
1604
|
* const lastEven = Iterable.findLast(numbers, (x) => x % 2 === 0)
|
|
1662
|
-
*
|
|
1605
|
+
* lastEven // => Option.some(2)
|
|
1663
1606
|
*
|
|
1664
1607
|
* const lastGreaterThan10 = Iterable.findLast(numbers, (x) => x > 10)
|
|
1665
|
-
*
|
|
1608
|
+
* lastGreaterThan10 // => Option.none()
|
|
1666
1609
|
*
|
|
1667
1610
|
* // With index
|
|
1668
1611
|
* const letters = ["a", "b", "c", "d", "e"]
|
|
1669
1612
|
* const lastAtEvenIndex = Iterable.findLast(letters, (_, i) => i % 2 === 0)
|
|
1670
|
-
*
|
|
1613
|
+
* lastAtEvenIndex // => Option.some("e")
|
|
1671
1614
|
*
|
|
1672
1615
|
* // Type refinement
|
|
1673
1616
|
* const mixed: Array<string | number> = [1, "hello", 2, "world", 3]
|
|
@@ -1675,10 +1618,10 @@ export declare const findLast: {
|
|
|
1675
1618
|
* mixed,
|
|
1676
1619
|
* (x): x is string => typeof x === "string"
|
|
1677
1620
|
* )
|
|
1678
|
-
*
|
|
1621
|
+
* lastString // => Option.some("world")
|
|
1679
1622
|
* ```
|
|
1680
1623
|
*
|
|
1681
|
-
* @category
|
|
1624
|
+
* @category searching
|
|
1682
1625
|
* @since 2.0.0
|
|
1683
1626
|
*/
|
|
1684
1627
|
<A, B extends A>(self: Iterable<A>, refinement: (a: A, i: number) => a is B): Option<B>;
|
|
@@ -1687,20 +1630,20 @@ export declare const findLast: {
|
|
|
1687
1630
|
*
|
|
1688
1631
|
* **Example** (Finding the last match)
|
|
1689
1632
|
*
|
|
1690
|
-
* ```ts
|
|
1691
|
-
* import { Iterable } from "effect"
|
|
1633
|
+
* ```ts import.meta.vitest
|
|
1634
|
+
* import { Iterable, Option } from "effect"
|
|
1692
1635
|
*
|
|
1693
1636
|
* const numbers = [1, 3, 4, 6, 8, 2]
|
|
1694
1637
|
* const lastEven = Iterable.findLast(numbers, (x) => x % 2 === 0)
|
|
1695
|
-
*
|
|
1638
|
+
* lastEven // => Option.some(2)
|
|
1696
1639
|
*
|
|
1697
1640
|
* const lastGreaterThan10 = Iterable.findLast(numbers, (x) => x > 10)
|
|
1698
|
-
*
|
|
1641
|
+
* lastGreaterThan10 // => Option.none()
|
|
1699
1642
|
*
|
|
1700
1643
|
* // With index
|
|
1701
1644
|
* const letters = ["a", "b", "c", "d", "e"]
|
|
1702
1645
|
* const lastAtEvenIndex = Iterable.findLast(letters, (_, i) => i % 2 === 0)
|
|
1703
|
-
*
|
|
1646
|
+
* lastAtEvenIndex // => Option.some("e")
|
|
1704
1647
|
*
|
|
1705
1648
|
* // Type refinement
|
|
1706
1649
|
* const mixed: Array<string | number> = [1, "hello", 2, "world", 3]
|
|
@@ -1708,10 +1651,10 @@ export declare const findLast: {
|
|
|
1708
1651
|
* mixed,
|
|
1709
1652
|
* (x): x is string => typeof x === "string"
|
|
1710
1653
|
* )
|
|
1711
|
-
*
|
|
1654
|
+
* lastString // => Option.some("world")
|
|
1712
1655
|
* ```
|
|
1713
1656
|
*
|
|
1714
|
-
* @category
|
|
1657
|
+
* @category searching
|
|
1715
1658
|
* @since 2.0.0
|
|
1716
1659
|
*/
|
|
1717
1660
|
<A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): Option<A>;
|
|
@@ -1721,31 +1664,31 @@ export declare const findLast: {
|
|
|
1721
1664
|
*
|
|
1722
1665
|
* **Example** (Zipping iterables)
|
|
1723
1666
|
*
|
|
1724
|
-
* ```ts
|
|
1667
|
+
* ```ts import.meta.vitest
|
|
1725
1668
|
* import { Iterable } from "effect"
|
|
1726
1669
|
*
|
|
1727
1670
|
* const numbers = [1, 2, 3]
|
|
1728
1671
|
* const letters = ["a", "b", "c"]
|
|
1729
1672
|
* const zipped = Iterable.zip(numbers, letters)
|
|
1730
|
-
*
|
|
1673
|
+
* Array.from(zipped) // => [[1, "a"], [2, "b"], [3, "c"]]
|
|
1731
1674
|
*
|
|
1732
1675
|
* // Different lengths - shorter one determines result length
|
|
1733
1676
|
* const short = [1, 2]
|
|
1734
1677
|
* const long = ["a", "b", "c", "d"]
|
|
1735
1678
|
* const partial = Iterable.zip(short, long)
|
|
1736
|
-
*
|
|
1679
|
+
* Array.from(partial) // => [[1, "a"], [2, "b"]]
|
|
1737
1680
|
*
|
|
1738
1681
|
* // Works with any iterables
|
|
1739
1682
|
* const range = Iterable.range(1, 3)
|
|
1740
1683
|
* const word = "abc"
|
|
1741
1684
|
* const mixed = Iterable.zip(range, word)
|
|
1742
|
-
*
|
|
1685
|
+
* Array.from(mixed) // => [[1, "a"], [2, "b"], [3, "c"]]
|
|
1743
1686
|
*
|
|
1744
1687
|
* // Create indexed pairs
|
|
1745
1688
|
* const values = ["apple", "banana", "cherry"]
|
|
1746
1689
|
* const indices = Iterable.range(0, 2)
|
|
1747
1690
|
* const indexed = Iterable.zip(indices, values)
|
|
1748
|
-
*
|
|
1691
|
+
* Array.from(indexed) // => [[0, "apple"], [1, "banana"], [2, "cherry"]]
|
|
1749
1692
|
* ```
|
|
1750
1693
|
*
|
|
1751
1694
|
* @category zipping
|
|
@@ -1757,31 +1700,31 @@ export declare const zip: {
|
|
|
1757
1700
|
*
|
|
1758
1701
|
* **Example** (Zipping iterables)
|
|
1759
1702
|
*
|
|
1760
|
-
* ```ts
|
|
1703
|
+
* ```ts import.meta.vitest
|
|
1761
1704
|
* import { Iterable } from "effect"
|
|
1762
1705
|
*
|
|
1763
1706
|
* const numbers = [1, 2, 3]
|
|
1764
1707
|
* const letters = ["a", "b", "c"]
|
|
1765
1708
|
* const zipped = Iterable.zip(numbers, letters)
|
|
1766
|
-
*
|
|
1709
|
+
* Array.from(zipped) // => [[1, "a"], [2, "b"], [3, "c"]]
|
|
1767
1710
|
*
|
|
1768
1711
|
* // Different lengths - shorter one determines result length
|
|
1769
1712
|
* const short = [1, 2]
|
|
1770
1713
|
* const long = ["a", "b", "c", "d"]
|
|
1771
1714
|
* const partial = Iterable.zip(short, long)
|
|
1772
|
-
*
|
|
1715
|
+
* Array.from(partial) // => [[1, "a"], [2, "b"]]
|
|
1773
1716
|
*
|
|
1774
1717
|
* // Works with any iterables
|
|
1775
1718
|
* const range = Iterable.range(1, 3)
|
|
1776
1719
|
* const word = "abc"
|
|
1777
1720
|
* const mixed = Iterable.zip(range, word)
|
|
1778
|
-
*
|
|
1721
|
+
* Array.from(mixed) // => [[1, "a"], [2, "b"], [3, "c"]]
|
|
1779
1722
|
*
|
|
1780
1723
|
* // Create indexed pairs
|
|
1781
1724
|
* const values = ["apple", "banana", "cherry"]
|
|
1782
1725
|
* const indices = Iterable.range(0, 2)
|
|
1783
1726
|
* const indexed = Iterable.zip(indices, values)
|
|
1784
|
-
*
|
|
1727
|
+
* Array.from(indexed) // => [[0, "apple"], [1, "banana"], [2, "cherry"]]
|
|
1785
1728
|
* ```
|
|
1786
1729
|
*
|
|
1787
1730
|
* @category zipping
|
|
@@ -1793,31 +1736,31 @@ export declare const zip: {
|
|
|
1793
1736
|
*
|
|
1794
1737
|
* **Example** (Zipping iterables)
|
|
1795
1738
|
*
|
|
1796
|
-
* ```ts
|
|
1739
|
+
* ```ts import.meta.vitest
|
|
1797
1740
|
* import { Iterable } from "effect"
|
|
1798
1741
|
*
|
|
1799
1742
|
* const numbers = [1, 2, 3]
|
|
1800
1743
|
* const letters = ["a", "b", "c"]
|
|
1801
1744
|
* const zipped = Iterable.zip(numbers, letters)
|
|
1802
|
-
*
|
|
1745
|
+
* Array.from(zipped) // => [[1, "a"], [2, "b"], [3, "c"]]
|
|
1803
1746
|
*
|
|
1804
1747
|
* // Different lengths - shorter one determines result length
|
|
1805
1748
|
* const short = [1, 2]
|
|
1806
1749
|
* const long = ["a", "b", "c", "d"]
|
|
1807
1750
|
* const partial = Iterable.zip(short, long)
|
|
1808
|
-
*
|
|
1751
|
+
* Array.from(partial) // => [[1, "a"], [2, "b"]]
|
|
1809
1752
|
*
|
|
1810
1753
|
* // Works with any iterables
|
|
1811
1754
|
* const range = Iterable.range(1, 3)
|
|
1812
1755
|
* const word = "abc"
|
|
1813
1756
|
* const mixed = Iterable.zip(range, word)
|
|
1814
|
-
*
|
|
1757
|
+
* Array.from(mixed) // => [[1, "a"], [2, "b"], [3, "c"]]
|
|
1815
1758
|
*
|
|
1816
1759
|
* // Create indexed pairs
|
|
1817
1760
|
* const values = ["apple", "banana", "cherry"]
|
|
1818
1761
|
* const indices = Iterable.range(0, 2)
|
|
1819
1762
|
* const indexed = Iterable.zip(indices, values)
|
|
1820
|
-
*
|
|
1763
|
+
* Array.from(indexed) // => [[0, "apple"], [1, "banana"], [2, "cherry"]]
|
|
1821
1764
|
* ```
|
|
1822
1765
|
*
|
|
1823
1766
|
* @category zipping
|
|
@@ -1831,14 +1774,14 @@ export declare const zip: {
|
|
|
1831
1774
|
*
|
|
1832
1775
|
* **Example** (Zipping with a combining function)
|
|
1833
1776
|
*
|
|
1834
|
-
* ```ts
|
|
1777
|
+
* ```ts import.meta.vitest
|
|
1835
1778
|
* import { Iterable } from "effect"
|
|
1836
1779
|
*
|
|
1837
1780
|
* // Add corresponding elements
|
|
1838
1781
|
* const a = [1, 2, 3, 4]
|
|
1839
1782
|
* const b = [10, 20, 30, 40]
|
|
1840
1783
|
* const sums = Iterable.zipWith(a, b, (x, y) => x + y)
|
|
1841
|
-
*
|
|
1784
|
+
* Array.from(sums) // => [11, 22, 33, 44]
|
|
1842
1785
|
*
|
|
1843
1786
|
* // Combine strings
|
|
1844
1787
|
* const firstNames = ["John", "Jane", "Bob"]
|
|
@@ -1848,7 +1791,7 @@ export declare const zip: {
|
|
|
1848
1791
|
* lastNames,
|
|
1849
1792
|
* (first, last) => `${first} ${last}`
|
|
1850
1793
|
* )
|
|
1851
|
-
*
|
|
1794
|
+
* Array.from(fullNames) // => ["John Doe", "Jane Smith", "Bob Johnson"]
|
|
1852
1795
|
*
|
|
1853
1796
|
* // Different lengths - stops at shorter
|
|
1854
1797
|
* const short = [1, 2]
|
|
@@ -1858,7 +1801,7 @@ export declare const zip: {
|
|
|
1858
1801
|
* long,
|
|
1859
1802
|
* (num, letter) => `${num}${letter}`
|
|
1860
1803
|
* )
|
|
1861
|
-
*
|
|
1804
|
+
* Array.from(combined) // => ["1a", "2b"]
|
|
1862
1805
|
*
|
|
1863
1806
|
* // Complex transformations
|
|
1864
1807
|
* const prices = [10.99, 25.50, 5.00]
|
|
@@ -1866,7 +1809,7 @@ export declare const zip: {
|
|
|
1866
1809
|
* const totals = Iterable.zipWith(prices, quantities, (price, qty) => {
|
|
1867
1810
|
* return Math.round(price * qty * 100) / 100 // round to 2 decimal places
|
|
1868
1811
|
* })
|
|
1869
|
-
*
|
|
1812
|
+
* Array.from(totals) // => [21.98, 25.5, 15]
|
|
1870
1813
|
* ```
|
|
1871
1814
|
*
|
|
1872
1815
|
* @category zipping
|
|
@@ -1879,14 +1822,14 @@ export declare const zipWith: {
|
|
|
1879
1822
|
*
|
|
1880
1823
|
* **Example** (Zipping with a combining function)
|
|
1881
1824
|
*
|
|
1882
|
-
* ```ts
|
|
1825
|
+
* ```ts import.meta.vitest
|
|
1883
1826
|
* import { Iterable } from "effect"
|
|
1884
1827
|
*
|
|
1885
1828
|
* // Add corresponding elements
|
|
1886
1829
|
* const a = [1, 2, 3, 4]
|
|
1887
1830
|
* const b = [10, 20, 30, 40]
|
|
1888
1831
|
* const sums = Iterable.zipWith(a, b, (x, y) => x + y)
|
|
1889
|
-
*
|
|
1832
|
+
* Array.from(sums) // => [11, 22, 33, 44]
|
|
1890
1833
|
*
|
|
1891
1834
|
* // Combine strings
|
|
1892
1835
|
* const firstNames = ["John", "Jane", "Bob"]
|
|
@@ -1896,7 +1839,7 @@ export declare const zipWith: {
|
|
|
1896
1839
|
* lastNames,
|
|
1897
1840
|
* (first, last) => `${first} ${last}`
|
|
1898
1841
|
* )
|
|
1899
|
-
*
|
|
1842
|
+
* Array.from(fullNames) // => ["John Doe", "Jane Smith", "Bob Johnson"]
|
|
1900
1843
|
*
|
|
1901
1844
|
* // Different lengths - stops at shorter
|
|
1902
1845
|
* const short = [1, 2]
|
|
@@ -1906,7 +1849,7 @@ export declare const zipWith: {
|
|
|
1906
1849
|
* long,
|
|
1907
1850
|
* (num, letter) => `${num}${letter}`
|
|
1908
1851
|
* )
|
|
1909
|
-
*
|
|
1852
|
+
* Array.from(combined) // => ["1a", "2b"]
|
|
1910
1853
|
*
|
|
1911
1854
|
* // Complex transformations
|
|
1912
1855
|
* const prices = [10.99, 25.50, 5.00]
|
|
@@ -1914,7 +1857,7 @@ export declare const zipWith: {
|
|
|
1914
1857
|
* const totals = Iterable.zipWith(prices, quantities, (price, qty) => {
|
|
1915
1858
|
* return Math.round(price * qty * 100) / 100 // round to 2 decimal places
|
|
1916
1859
|
* })
|
|
1917
|
-
*
|
|
1860
|
+
* Array.from(totals) // => [21.98, 25.5, 15]
|
|
1918
1861
|
* ```
|
|
1919
1862
|
*
|
|
1920
1863
|
* @category zipping
|
|
@@ -1927,14 +1870,14 @@ export declare const zipWith: {
|
|
|
1927
1870
|
*
|
|
1928
1871
|
* **Example** (Zipping with a combining function)
|
|
1929
1872
|
*
|
|
1930
|
-
* ```ts
|
|
1873
|
+
* ```ts import.meta.vitest
|
|
1931
1874
|
* import { Iterable } from "effect"
|
|
1932
1875
|
*
|
|
1933
1876
|
* // Add corresponding elements
|
|
1934
1877
|
* const a = [1, 2, 3, 4]
|
|
1935
1878
|
* const b = [10, 20, 30, 40]
|
|
1936
1879
|
* const sums = Iterable.zipWith(a, b, (x, y) => x + y)
|
|
1937
|
-
*
|
|
1880
|
+
* Array.from(sums) // => [11, 22, 33, 44]
|
|
1938
1881
|
*
|
|
1939
1882
|
* // Combine strings
|
|
1940
1883
|
* const firstNames = ["John", "Jane", "Bob"]
|
|
@@ -1944,7 +1887,7 @@ export declare const zipWith: {
|
|
|
1944
1887
|
* lastNames,
|
|
1945
1888
|
* (first, last) => `${first} ${last}`
|
|
1946
1889
|
* )
|
|
1947
|
-
*
|
|
1890
|
+
* Array.from(fullNames) // => ["John Doe", "Jane Smith", "Bob Johnson"]
|
|
1948
1891
|
*
|
|
1949
1892
|
* // Different lengths - stops at shorter
|
|
1950
1893
|
* const short = [1, 2]
|
|
@@ -1954,7 +1897,7 @@ export declare const zipWith: {
|
|
|
1954
1897
|
* long,
|
|
1955
1898
|
* (num, letter) => `${num}${letter}`
|
|
1956
1899
|
* )
|
|
1957
|
-
*
|
|
1900
|
+
* Array.from(combined) // => ["1a", "2b"]
|
|
1958
1901
|
*
|
|
1959
1902
|
* // Complex transformations
|
|
1960
1903
|
* const prices = [10.99, 25.50, 5.00]
|
|
@@ -1962,7 +1905,7 @@ export declare const zipWith: {
|
|
|
1962
1905
|
* const totals = Iterable.zipWith(prices, quantities, (price, qty) => {
|
|
1963
1906
|
* return Math.round(price * qty * 100) / 100 // round to 2 decimal places
|
|
1964
1907
|
* })
|
|
1965
|
-
*
|
|
1908
|
+
* Array.from(totals) // => [21.98, 25.5, 15]
|
|
1966
1909
|
* ```
|
|
1967
1910
|
*
|
|
1968
1911
|
* @category zipping
|
|
@@ -1983,33 +1926,33 @@ export declare const zipWith: {
|
|
|
1983
1926
|
*
|
|
1984
1927
|
* **Example** (Interspersing separators)
|
|
1985
1928
|
*
|
|
1986
|
-
* ```ts
|
|
1929
|
+
* ```ts import.meta.vitest
|
|
1987
1930
|
* import { Iterable } from "effect"
|
|
1988
1931
|
*
|
|
1989
1932
|
* // Join numbers with separator
|
|
1990
1933
|
* const numbers = [1, 2, 3, 4]
|
|
1991
1934
|
* const withCommas = Iterable.intersperse(numbers, ",")
|
|
1992
|
-
*
|
|
1935
|
+
* Array.from(withCommas) // => [1, ",", 2, ",", 3, ",", 4]
|
|
1993
1936
|
*
|
|
1994
1937
|
* // Join words with spaces
|
|
1995
1938
|
* const words = ["hello", "world", "from", "effect"]
|
|
1996
1939
|
* const sentence = Iterable.intersperse(words, " ")
|
|
1997
|
-
*
|
|
1940
|
+
* Array.from(sentence).join("") // => "hello world from effect"
|
|
1998
1941
|
*
|
|
1999
1942
|
* // Empty iterable remains empty
|
|
2000
1943
|
* const empty = Iterable.empty<string>()
|
|
2001
1944
|
* const stillEmpty = Iterable.intersperse(empty, "-")
|
|
2002
|
-
*
|
|
1945
|
+
* Array.from(stillEmpty) // => []
|
|
2003
1946
|
*
|
|
2004
1947
|
* // Single element has no separators added
|
|
2005
1948
|
* const single = [42]
|
|
2006
1949
|
* const noSeparator = Iterable.intersperse(single, "|")
|
|
2007
|
-
*
|
|
1950
|
+
* Array.from(noSeparator) // => [42]
|
|
2008
1951
|
*
|
|
2009
1952
|
* // Build CSS-like strings
|
|
2010
1953
|
* const styles = ["color: red", "font-size: 14px", "margin: 10px"]
|
|
2011
1954
|
* const css = Iterable.intersperse(styles, "; ")
|
|
2012
|
-
*
|
|
1955
|
+
* Array.from(css).join("") // => "color: red; font-size: 14px; margin: 10px"
|
|
2013
1956
|
* ```
|
|
2014
1957
|
*
|
|
2015
1958
|
* @category combining
|
|
@@ -2029,33 +1972,33 @@ export declare const intersperse: {
|
|
|
2029
1972
|
*
|
|
2030
1973
|
* **Example** (Interspersing separators)
|
|
2031
1974
|
*
|
|
2032
|
-
* ```ts
|
|
1975
|
+
* ```ts import.meta.vitest
|
|
2033
1976
|
* import { Iterable } from "effect"
|
|
2034
1977
|
*
|
|
2035
1978
|
* // Join numbers with separator
|
|
2036
1979
|
* const numbers = [1, 2, 3, 4]
|
|
2037
1980
|
* const withCommas = Iterable.intersperse(numbers, ",")
|
|
2038
|
-
*
|
|
1981
|
+
* Array.from(withCommas) // => [1, ",", 2, ",", 3, ",", 4]
|
|
2039
1982
|
*
|
|
2040
1983
|
* // Join words with spaces
|
|
2041
1984
|
* const words = ["hello", "world", "from", "effect"]
|
|
2042
1985
|
* const sentence = Iterable.intersperse(words, " ")
|
|
2043
|
-
*
|
|
1986
|
+
* Array.from(sentence).join("") // => "hello world from effect"
|
|
2044
1987
|
*
|
|
2045
1988
|
* // Empty iterable remains empty
|
|
2046
1989
|
* const empty = Iterable.empty<string>()
|
|
2047
1990
|
* const stillEmpty = Iterable.intersperse(empty, "-")
|
|
2048
|
-
*
|
|
1991
|
+
* Array.from(stillEmpty) // => []
|
|
2049
1992
|
*
|
|
2050
1993
|
* // Single element has no separators added
|
|
2051
1994
|
* const single = [42]
|
|
2052
1995
|
* const noSeparator = Iterable.intersperse(single, "|")
|
|
2053
|
-
*
|
|
1996
|
+
* Array.from(noSeparator) // => [42]
|
|
2054
1997
|
*
|
|
2055
1998
|
* // Build CSS-like strings
|
|
2056
1999
|
* const styles = ["color: red", "font-size: 14px", "margin: 10px"]
|
|
2057
2000
|
* const css = Iterable.intersperse(styles, "; ")
|
|
2058
|
-
*
|
|
2001
|
+
* Array.from(css).join("") // => "color: red; font-size: 14px; margin: 10px"
|
|
2059
2002
|
* ```
|
|
2060
2003
|
*
|
|
2061
2004
|
* @category combining
|
|
@@ -2075,33 +2018,33 @@ export declare const intersperse: {
|
|
|
2075
2018
|
*
|
|
2076
2019
|
* **Example** (Interspersing separators)
|
|
2077
2020
|
*
|
|
2078
|
-
* ```ts
|
|
2021
|
+
* ```ts import.meta.vitest
|
|
2079
2022
|
* import { Iterable } from "effect"
|
|
2080
2023
|
*
|
|
2081
2024
|
* // Join numbers with separator
|
|
2082
2025
|
* const numbers = [1, 2, 3, 4]
|
|
2083
2026
|
* const withCommas = Iterable.intersperse(numbers, ",")
|
|
2084
|
-
*
|
|
2027
|
+
* Array.from(withCommas) // => [1, ",", 2, ",", 3, ",", 4]
|
|
2085
2028
|
*
|
|
2086
2029
|
* // Join words with spaces
|
|
2087
2030
|
* const words = ["hello", "world", "from", "effect"]
|
|
2088
2031
|
* const sentence = Iterable.intersperse(words, " ")
|
|
2089
|
-
*
|
|
2032
|
+
* Array.from(sentence).join("") // => "hello world from effect"
|
|
2090
2033
|
*
|
|
2091
2034
|
* // Empty iterable remains empty
|
|
2092
2035
|
* const empty = Iterable.empty<string>()
|
|
2093
2036
|
* const stillEmpty = Iterable.intersperse(empty, "-")
|
|
2094
|
-
*
|
|
2037
|
+
* Array.from(stillEmpty) // => []
|
|
2095
2038
|
*
|
|
2096
2039
|
* // Single element has no separators added
|
|
2097
2040
|
* const single = [42]
|
|
2098
2041
|
* const noSeparator = Iterable.intersperse(single, "|")
|
|
2099
|
-
*
|
|
2042
|
+
* Array.from(noSeparator) // => [42]
|
|
2100
2043
|
*
|
|
2101
2044
|
* // Build CSS-like strings
|
|
2102
2045
|
* const styles = ["color: red", "font-size: 14px", "margin: 10px"]
|
|
2103
2046
|
* const css = Iterable.intersperse(styles, "; ")
|
|
2104
|
-
*
|
|
2047
|
+
* Array.from(css).join("") // => "color: red; font-size: 14px; margin: 10px"
|
|
2105
2048
|
* ```
|
|
2106
2049
|
*
|
|
2107
2050
|
* @category combining
|
|
@@ -2114,7 +2057,7 @@ export declare const intersperse: {
|
|
|
2114
2057
|
*
|
|
2115
2058
|
* **Example** (Checking membership with custom equivalence)
|
|
2116
2059
|
*
|
|
2117
|
-
* ```ts
|
|
2060
|
+
* ```ts import.meta.vitest
|
|
2118
2061
|
* import { Iterable } from "effect"
|
|
2119
2062
|
*
|
|
2120
2063
|
* // Custom equivalence for objects
|
|
@@ -2123,7 +2066,7 @@ export declare const intersperse: {
|
|
|
2123
2066
|
*
|
|
2124
2067
|
* const users = [{ id: 1 }, { id: 2 }]
|
|
2125
2068
|
* const hasUser1 = containsById(users, { id: 1 })
|
|
2126
|
-
*
|
|
2069
|
+
* hasUser1 // => true
|
|
2127
2070
|
*
|
|
2128
2071
|
* // Case-insensitive string comparison
|
|
2129
2072
|
* const caseInsensitive = (a: string, b: string) =>
|
|
@@ -2132,7 +2075,7 @@ export declare const intersperse: {
|
|
|
2132
2075
|
*
|
|
2133
2076
|
* const words = ["Hello", "World"]
|
|
2134
2077
|
* const hasHello = containsCaseInsensitive(words, "hello")
|
|
2135
|
-
*
|
|
2078
|
+
* hasHello // => true
|
|
2136
2079
|
*
|
|
2137
2080
|
* // Approximate number comparison
|
|
2138
2081
|
* const approxEqual = (a: number, b: number) => Math.abs(a - b) < 0.1
|
|
@@ -2140,10 +2083,10 @@ export declare const intersperse: {
|
|
|
2140
2083
|
*
|
|
2141
2084
|
* const values = [1.0, 2.0, 3.0]
|
|
2142
2085
|
* const hasAlmostTwo = containsApprox(values, 2.05)
|
|
2143
|
-
*
|
|
2086
|
+
* hasAlmostTwo // => true
|
|
2144
2087
|
* ```
|
|
2145
2088
|
*
|
|
2146
|
-
* @category
|
|
2089
|
+
* @category predicates
|
|
2147
2090
|
* @since 2.0.0
|
|
2148
2091
|
*/
|
|
2149
2092
|
export declare const containsWith: <A>(isEquivalent: (self: A, that: A) => boolean) => {
|
|
@@ -2161,29 +2104,29 @@ export declare const containsWith: <A>(isEquivalent: (self: A, that: A) => boole
|
|
|
2161
2104
|
*
|
|
2162
2105
|
* **Example** (Checking membership)
|
|
2163
2106
|
*
|
|
2164
|
-
* ```ts
|
|
2107
|
+
* ```ts import.meta.vitest
|
|
2165
2108
|
* import { Iterable } from "effect"
|
|
2166
2109
|
*
|
|
2167
2110
|
* const numbers = [1, 2, 3, 4, 5]
|
|
2168
|
-
*
|
|
2169
|
-
*
|
|
2111
|
+
* Iterable.contains(numbers, 3) // => true
|
|
2112
|
+
* Iterable.contains(numbers, 6) // => false
|
|
2170
2113
|
*
|
|
2171
2114
|
* const letters = "hello"
|
|
2172
|
-
*
|
|
2173
|
-
*
|
|
2115
|
+
* Iterable.contains(letters, "l") // => true
|
|
2116
|
+
* Iterable.contains(letters, "x") // => false
|
|
2174
2117
|
*
|
|
2175
2118
|
* // Works with any iterable
|
|
2176
2119
|
* const range = Iterable.range(1, 100)
|
|
2177
|
-
*
|
|
2178
|
-
*
|
|
2120
|
+
* Iterable.contains(range, 50) // => true
|
|
2121
|
+
* Iterable.contains(range, 150) // => false
|
|
2179
2122
|
*
|
|
2180
2123
|
* // Curried version
|
|
2181
2124
|
* const containsThree = Iterable.contains(3)
|
|
2182
|
-
*
|
|
2183
|
-
*
|
|
2125
|
+
* containsThree([1, 2, 3]) // => true
|
|
2126
|
+
* containsThree([4, 5, 6]) // => false
|
|
2184
2127
|
* ```
|
|
2185
2128
|
*
|
|
2186
|
-
* @category
|
|
2129
|
+
* @category predicates
|
|
2187
2130
|
* @since 2.0.0
|
|
2188
2131
|
*/
|
|
2189
2132
|
export declare const contains: {
|
|
@@ -2198,29 +2141,29 @@ export declare const contains: {
|
|
|
2198
2141
|
*
|
|
2199
2142
|
* **Example** (Checking membership)
|
|
2200
2143
|
*
|
|
2201
|
-
* ```ts
|
|
2144
|
+
* ```ts import.meta.vitest
|
|
2202
2145
|
* import { Iterable } from "effect"
|
|
2203
2146
|
*
|
|
2204
2147
|
* const numbers = [1, 2, 3, 4, 5]
|
|
2205
|
-
*
|
|
2206
|
-
*
|
|
2148
|
+
* Iterable.contains(numbers, 3) // => true
|
|
2149
|
+
* Iterable.contains(numbers, 6) // => false
|
|
2207
2150
|
*
|
|
2208
2151
|
* const letters = "hello"
|
|
2209
|
-
*
|
|
2210
|
-
*
|
|
2152
|
+
* Iterable.contains(letters, "l") // => true
|
|
2153
|
+
* Iterable.contains(letters, "x") // => false
|
|
2211
2154
|
*
|
|
2212
2155
|
* // Works with any iterable
|
|
2213
2156
|
* const range = Iterable.range(1, 100)
|
|
2214
|
-
*
|
|
2215
|
-
*
|
|
2157
|
+
* Iterable.contains(range, 50) // => true
|
|
2158
|
+
* Iterable.contains(range, 150) // => false
|
|
2216
2159
|
*
|
|
2217
2160
|
* // Curried version
|
|
2218
2161
|
* const containsThree = Iterable.contains(3)
|
|
2219
|
-
*
|
|
2220
|
-
*
|
|
2162
|
+
* containsThree([1, 2, 3]) // => true
|
|
2163
|
+
* containsThree([4, 5, 6]) // => false
|
|
2221
2164
|
* ```
|
|
2222
2165
|
*
|
|
2223
|
-
* @category
|
|
2166
|
+
* @category predicates
|
|
2224
2167
|
* @since 2.0.0
|
|
2225
2168
|
*/
|
|
2226
2169
|
<A>(a: A): (self: Iterable<A>) => boolean;
|
|
@@ -2235,29 +2178,29 @@ export declare const contains: {
|
|
|
2235
2178
|
*
|
|
2236
2179
|
* **Example** (Checking membership)
|
|
2237
2180
|
*
|
|
2238
|
-
* ```ts
|
|
2181
|
+
* ```ts import.meta.vitest
|
|
2239
2182
|
* import { Iterable } from "effect"
|
|
2240
2183
|
*
|
|
2241
2184
|
* const numbers = [1, 2, 3, 4, 5]
|
|
2242
|
-
*
|
|
2243
|
-
*
|
|
2185
|
+
* Iterable.contains(numbers, 3) // => true
|
|
2186
|
+
* Iterable.contains(numbers, 6) // => false
|
|
2244
2187
|
*
|
|
2245
2188
|
* const letters = "hello"
|
|
2246
|
-
*
|
|
2247
|
-
*
|
|
2189
|
+
* Iterable.contains(letters, "l") // => true
|
|
2190
|
+
* Iterable.contains(letters, "x") // => false
|
|
2248
2191
|
*
|
|
2249
2192
|
* // Works with any iterable
|
|
2250
2193
|
* const range = Iterable.range(1, 100)
|
|
2251
|
-
*
|
|
2252
|
-
*
|
|
2194
|
+
* Iterable.contains(range, 50) // => true
|
|
2195
|
+
* Iterable.contains(range, 150) // => false
|
|
2253
2196
|
*
|
|
2254
2197
|
* // Curried version
|
|
2255
2198
|
* const containsThree = Iterable.contains(3)
|
|
2256
|
-
*
|
|
2257
|
-
*
|
|
2199
|
+
* containsThree([1, 2, 3]) // => true
|
|
2200
|
+
* containsThree([4, 5, 6]) // => false
|
|
2258
2201
|
* ```
|
|
2259
2202
|
*
|
|
2260
|
-
* @category
|
|
2203
|
+
* @category predicates
|
|
2261
2204
|
* @since 2.0.0
|
|
2262
2205
|
*/
|
|
2263
2206
|
<A>(self: Iterable<A>, a: A): boolean;
|
|
@@ -2268,25 +2211,22 @@ export declare const contains: {
|
|
|
2268
2211
|
*
|
|
2269
2212
|
* **Example** (Chunking an iterable)
|
|
2270
2213
|
*
|
|
2271
|
-
* ```ts
|
|
2214
|
+
* ```ts import.meta.vitest
|
|
2272
2215
|
* import { Iterable } from "effect"
|
|
2273
2216
|
*
|
|
2274
2217
|
* const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
2275
2218
|
* const chunks = Iterable.chunksOf(numbers, 3)
|
|
2276
|
-
*
|
|
2277
|
-
* // [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
|
|
2219
|
+
* Array.from(chunks) // => [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
|
|
2278
2220
|
*
|
|
2279
2221
|
* // Last chunk can be shorter
|
|
2280
2222
|
* const uneven = [1, 2, 3, 4, 5, 6, 7]
|
|
2281
2223
|
* const chunks2 = Iterable.chunksOf(uneven, 3)
|
|
2282
|
-
*
|
|
2283
|
-
* // [[1, 2, 3], [4, 5, 6], [7]]
|
|
2224
|
+
* Array.from(chunks2) // => [[1, 2, 3], [4, 5, 6], [7]]
|
|
2284
2225
|
*
|
|
2285
2226
|
* // Chunk size larger than iterable
|
|
2286
2227
|
* const small = [1, 2]
|
|
2287
2228
|
* const chunks3 = Iterable.chunksOf(small, 5)
|
|
2288
|
-
*
|
|
2289
|
-
* // [[1, 2]]
|
|
2229
|
+
* Array.from(chunks3) // => [[1, 2]]
|
|
2290
2230
|
*
|
|
2291
2231
|
* // Process data in batches
|
|
2292
2232
|
* const data = Iterable.range(1, 100)
|
|
@@ -2295,7 +2235,7 @@ export declare const contains: {
|
|
|
2295
2235
|
* batches,
|
|
2296
2236
|
* (batch) => Iterable.reduce(batch, 0, (sum, n) => sum + n)
|
|
2297
2237
|
* )
|
|
2298
|
-
*
|
|
2238
|
+
* Array.from(Iterable.take(batchSums, 3)) // => [55, 155, 255]
|
|
2299
2239
|
* ```
|
|
2300
2240
|
*
|
|
2301
2241
|
* @category splitting
|
|
@@ -2308,25 +2248,22 @@ export declare const chunksOf: {
|
|
|
2308
2248
|
*
|
|
2309
2249
|
* **Example** (Chunking an iterable)
|
|
2310
2250
|
*
|
|
2311
|
-
* ```ts
|
|
2251
|
+
* ```ts import.meta.vitest
|
|
2312
2252
|
* import { Iterable } from "effect"
|
|
2313
2253
|
*
|
|
2314
2254
|
* const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
2315
2255
|
* const chunks = Iterable.chunksOf(numbers, 3)
|
|
2316
|
-
*
|
|
2317
|
-
* // [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
|
|
2256
|
+
* Array.from(chunks) // => [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
|
|
2318
2257
|
*
|
|
2319
2258
|
* // Last chunk can be shorter
|
|
2320
2259
|
* const uneven = [1, 2, 3, 4, 5, 6, 7]
|
|
2321
2260
|
* const chunks2 = Iterable.chunksOf(uneven, 3)
|
|
2322
|
-
*
|
|
2323
|
-
* // [[1, 2, 3], [4, 5, 6], [7]]
|
|
2261
|
+
* Array.from(chunks2) // => [[1, 2, 3], [4, 5, 6], [7]]
|
|
2324
2262
|
*
|
|
2325
2263
|
* // Chunk size larger than iterable
|
|
2326
2264
|
* const small = [1, 2]
|
|
2327
2265
|
* const chunks3 = Iterable.chunksOf(small, 5)
|
|
2328
|
-
*
|
|
2329
|
-
* // [[1, 2]]
|
|
2266
|
+
* Array.from(chunks3) // => [[1, 2]]
|
|
2330
2267
|
*
|
|
2331
2268
|
* // Process data in batches
|
|
2332
2269
|
* const data = Iterable.range(1, 100)
|
|
@@ -2335,7 +2272,7 @@ export declare const chunksOf: {
|
|
|
2335
2272
|
* batches,
|
|
2336
2273
|
* (batch) => Iterable.reduce(batch, 0, (sum, n) => sum + n)
|
|
2337
2274
|
* )
|
|
2338
|
-
*
|
|
2275
|
+
* Array.from(Iterable.take(batchSums, 3)) // => [55, 155, 255]
|
|
2339
2276
|
* ```
|
|
2340
2277
|
*
|
|
2341
2278
|
* @category splitting
|
|
@@ -2348,25 +2285,22 @@ export declare const chunksOf: {
|
|
|
2348
2285
|
*
|
|
2349
2286
|
* **Example** (Chunking an iterable)
|
|
2350
2287
|
*
|
|
2351
|
-
* ```ts
|
|
2288
|
+
* ```ts import.meta.vitest
|
|
2352
2289
|
* import { Iterable } from "effect"
|
|
2353
2290
|
*
|
|
2354
2291
|
* const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
2355
2292
|
* const chunks = Iterable.chunksOf(numbers, 3)
|
|
2356
|
-
*
|
|
2357
|
-
* // [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
|
|
2293
|
+
* Array.from(chunks) // => [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
|
|
2358
2294
|
*
|
|
2359
2295
|
* // Last chunk can be shorter
|
|
2360
2296
|
* const uneven = [1, 2, 3, 4, 5, 6, 7]
|
|
2361
2297
|
* const chunks2 = Iterable.chunksOf(uneven, 3)
|
|
2362
|
-
*
|
|
2363
|
-
* // [[1, 2, 3], [4, 5, 6], [7]]
|
|
2298
|
+
* Array.from(chunks2) // => [[1, 2, 3], [4, 5, 6], [7]]
|
|
2364
2299
|
*
|
|
2365
2300
|
* // Chunk size larger than iterable
|
|
2366
2301
|
* const small = [1, 2]
|
|
2367
2302
|
* const chunks3 = Iterable.chunksOf(small, 5)
|
|
2368
|
-
*
|
|
2369
|
-
* // [[1, 2]]
|
|
2303
|
+
* Array.from(chunks3) // => [[1, 2]]
|
|
2370
2304
|
*
|
|
2371
2305
|
* // Process data in batches
|
|
2372
2306
|
* const data = Iterable.range(1, 100)
|
|
@@ -2375,7 +2309,7 @@ export declare const chunksOf: {
|
|
|
2375
2309
|
* batches,
|
|
2376
2310
|
* (batch) => Iterable.reduce(batch, 0, (sum, n) => sum + n)
|
|
2377
2311
|
* )
|
|
2378
|
-
*
|
|
2312
|
+
* Array.from(Iterable.take(batchSums, 3)) // => [55, 155, 255]
|
|
2379
2313
|
* ```
|
|
2380
2314
|
*
|
|
2381
2315
|
* @category splitting
|
|
@@ -2388,35 +2322,31 @@ export declare const chunksOf: {
|
|
|
2388
2322
|
*
|
|
2389
2323
|
* **Example** (Grouping consecutive elements with custom equivalence)
|
|
2390
2324
|
*
|
|
2391
|
-
* ```ts
|
|
2325
|
+
* ```ts import.meta.vitest
|
|
2392
2326
|
* import { Iterable } from "effect"
|
|
2393
2327
|
*
|
|
2394
2328
|
* // Group consecutive equal numbers
|
|
2395
2329
|
* const numbers = [1, 1, 2, 2, 2, 3, 1, 1]
|
|
2396
2330
|
* const grouped = Iterable.groupWith(numbers, (a, b) => a === b)
|
|
2397
|
-
*
|
|
2398
|
-
* // [[1, 1], [2, 2, 2], [3], [1, 1]]
|
|
2331
|
+
* Array.from(grouped) // => [[1, 1], [2, 2, 2], [3], [1, 1]]
|
|
2399
2332
|
*
|
|
2400
2333
|
* // Case-insensitive grouping of strings
|
|
2401
2334
|
* const words = ["Apple", "APPLE", "banana", "Banana", "cherry"]
|
|
2402
2335
|
* const caseInsensitive = (a: string, b: string) =>
|
|
2403
2336
|
* a.toLowerCase() === b.toLowerCase()
|
|
2404
2337
|
* const groupedWords = Iterable.groupWith(words, caseInsensitive)
|
|
2405
|
-
*
|
|
2406
|
-
* // [["Apple", "APPLE"], ["banana", "Banana"], ["cherry"]]
|
|
2338
|
+
* Array.from(groupedWords) // => [["Apple", "APPLE"], ["banana", "Banana"], ["cherry"]]
|
|
2407
2339
|
*
|
|
2408
2340
|
* // Group by approximate equality
|
|
2409
2341
|
* const floats = [1.1, 1.12, 1.9, 2.01, 2.05, 3.5]
|
|
2410
2342
|
* const approxEqual = (a: number, b: number) => Math.abs(a - b) < 0.2
|
|
2411
2343
|
* const groupedFloats = Iterable.groupWith(floats, approxEqual)
|
|
2412
|
-
*
|
|
2413
|
-
* // [[1.1, 1.12], [1.9, 2.01, 2.05], [3.5]]
|
|
2344
|
+
* Array.from(groupedFloats) // => [[1.1, 1.12], [1.9, 2.01, 2.05], [3.5]]
|
|
2414
2345
|
*
|
|
2415
2346
|
* // Only groups consecutive elements
|
|
2416
2347
|
* const scattered = [1, 2, 1, 2, 1]
|
|
2417
2348
|
* const scatteredGroups = Iterable.groupWith(scattered, (a, b) => a === b)
|
|
2418
|
-
*
|
|
2419
|
-
* // [[1], [2], [1], [2], [1]] (no grouping since none are consecutive)
|
|
2349
|
+
* Array.from(scatteredGroups) // => [[1], [2], [1], [2], [1]]
|
|
2420
2350
|
* ```
|
|
2421
2351
|
*
|
|
2422
2352
|
* @category grouping
|
|
@@ -2428,35 +2358,31 @@ export declare const groupWith: {
|
|
|
2428
2358
|
*
|
|
2429
2359
|
* **Example** (Grouping consecutive elements with custom equivalence)
|
|
2430
2360
|
*
|
|
2431
|
-
* ```ts
|
|
2361
|
+
* ```ts import.meta.vitest
|
|
2432
2362
|
* import { Iterable } from "effect"
|
|
2433
2363
|
*
|
|
2434
2364
|
* // Group consecutive equal numbers
|
|
2435
2365
|
* const numbers = [1, 1, 2, 2, 2, 3, 1, 1]
|
|
2436
2366
|
* const grouped = Iterable.groupWith(numbers, (a, b) => a === b)
|
|
2437
|
-
*
|
|
2438
|
-
* // [[1, 1], [2, 2, 2], [3], [1, 1]]
|
|
2367
|
+
* Array.from(grouped) // => [[1, 1], [2, 2, 2], [3], [1, 1]]
|
|
2439
2368
|
*
|
|
2440
2369
|
* // Case-insensitive grouping of strings
|
|
2441
2370
|
* const words = ["Apple", "APPLE", "banana", "Banana", "cherry"]
|
|
2442
2371
|
* const caseInsensitive = (a: string, b: string) =>
|
|
2443
2372
|
* a.toLowerCase() === b.toLowerCase()
|
|
2444
2373
|
* const groupedWords = Iterable.groupWith(words, caseInsensitive)
|
|
2445
|
-
*
|
|
2446
|
-
* // [["Apple", "APPLE"], ["banana", "Banana"], ["cherry"]]
|
|
2374
|
+
* Array.from(groupedWords) // => [["Apple", "APPLE"], ["banana", "Banana"], ["cherry"]]
|
|
2447
2375
|
*
|
|
2448
2376
|
* // Group by approximate equality
|
|
2449
2377
|
* const floats = [1.1, 1.12, 1.9, 2.01, 2.05, 3.5]
|
|
2450
2378
|
* const approxEqual = (a: number, b: number) => Math.abs(a - b) < 0.2
|
|
2451
2379
|
* const groupedFloats = Iterable.groupWith(floats, approxEqual)
|
|
2452
|
-
*
|
|
2453
|
-
* // [[1.1, 1.12], [1.9, 2.01, 2.05], [3.5]]
|
|
2380
|
+
* Array.from(groupedFloats) // => [[1.1, 1.12], [1.9, 2.01, 2.05], [3.5]]
|
|
2454
2381
|
*
|
|
2455
2382
|
* // Only groups consecutive elements
|
|
2456
2383
|
* const scattered = [1, 2, 1, 2, 1]
|
|
2457
2384
|
* const scatteredGroups = Iterable.groupWith(scattered, (a, b) => a === b)
|
|
2458
|
-
*
|
|
2459
|
-
* // [[1], [2], [1], [2], [1]] (no grouping since none are consecutive)
|
|
2385
|
+
* Array.from(scatteredGroups) // => [[1], [2], [1], [2], [1]]
|
|
2460
2386
|
* ```
|
|
2461
2387
|
*
|
|
2462
2388
|
* @category grouping
|
|
@@ -2468,35 +2394,31 @@ export declare const groupWith: {
|
|
|
2468
2394
|
*
|
|
2469
2395
|
* **Example** (Grouping consecutive elements with custom equivalence)
|
|
2470
2396
|
*
|
|
2471
|
-
* ```ts
|
|
2397
|
+
* ```ts import.meta.vitest
|
|
2472
2398
|
* import { Iterable } from "effect"
|
|
2473
2399
|
*
|
|
2474
2400
|
* // Group consecutive equal numbers
|
|
2475
2401
|
* const numbers = [1, 1, 2, 2, 2, 3, 1, 1]
|
|
2476
2402
|
* const grouped = Iterable.groupWith(numbers, (a, b) => a === b)
|
|
2477
|
-
*
|
|
2478
|
-
* // [[1, 1], [2, 2, 2], [3], [1, 1]]
|
|
2403
|
+
* Array.from(grouped) // => [[1, 1], [2, 2, 2], [3], [1, 1]]
|
|
2479
2404
|
*
|
|
2480
2405
|
* // Case-insensitive grouping of strings
|
|
2481
2406
|
* const words = ["Apple", "APPLE", "banana", "Banana", "cherry"]
|
|
2482
2407
|
* const caseInsensitive = (a: string, b: string) =>
|
|
2483
2408
|
* a.toLowerCase() === b.toLowerCase()
|
|
2484
2409
|
* const groupedWords = Iterable.groupWith(words, caseInsensitive)
|
|
2485
|
-
*
|
|
2486
|
-
* // [["Apple", "APPLE"], ["banana", "Banana"], ["cherry"]]
|
|
2410
|
+
* Array.from(groupedWords) // => [["Apple", "APPLE"], ["banana", "Banana"], ["cherry"]]
|
|
2487
2411
|
*
|
|
2488
2412
|
* // Group by approximate equality
|
|
2489
2413
|
* const floats = [1.1, 1.12, 1.9, 2.01, 2.05, 3.5]
|
|
2490
2414
|
* const approxEqual = (a: number, b: number) => Math.abs(a - b) < 0.2
|
|
2491
2415
|
* const groupedFloats = Iterable.groupWith(floats, approxEqual)
|
|
2492
|
-
*
|
|
2493
|
-
* // [[1.1, 1.12], [1.9, 2.01, 2.05], [3.5]]
|
|
2416
|
+
* Array.from(groupedFloats) // => [[1.1, 1.12], [1.9, 2.01, 2.05], [3.5]]
|
|
2494
2417
|
*
|
|
2495
2418
|
* // Only groups consecutive elements
|
|
2496
2419
|
* const scattered = [1, 2, 1, 2, 1]
|
|
2497
2420
|
* const scatteredGroups = Iterable.groupWith(scattered, (a, b) => a === b)
|
|
2498
|
-
*
|
|
2499
|
-
* // [[1], [2], [1], [2], [1]] (no grouping since none are consecutive)
|
|
2421
|
+
* Array.from(scatteredGroups) // => [[1], [2], [1], [2], [1]]
|
|
2500
2422
|
* ```
|
|
2501
2423
|
*
|
|
2502
2424
|
* @category grouping
|
|
@@ -2509,18 +2431,16 @@ export declare const groupWith: {
|
|
|
2509
2431
|
*
|
|
2510
2432
|
* **Example** (Grouping consecutive elements)
|
|
2511
2433
|
*
|
|
2512
|
-
* ```ts
|
|
2434
|
+
* ```ts import.meta.vitest
|
|
2513
2435
|
* import { Iterable } from "effect"
|
|
2514
2436
|
*
|
|
2515
2437
|
* const numbers = [1, 1, 2, 2, 2, 3, 1, 1]
|
|
2516
2438
|
* const grouped = Iterable.group(numbers)
|
|
2517
|
-
*
|
|
2518
|
-
* // [[1, 1], [2, 2, 2], [3], [1, 1]]
|
|
2439
|
+
* Array.from(grouped) // => [[1, 1], [2, 2, 2], [3], [1, 1]]
|
|
2519
2440
|
*
|
|
2520
2441
|
* const letters = "aabbccaa"
|
|
2521
2442
|
* const groupedLetters = Iterable.group(letters)
|
|
2522
|
-
*
|
|
2523
|
-
* // [["a", "a"], ["b", "b"], ["c", "c"], ["a", "a"]]
|
|
2443
|
+
* Array.from(groupedLetters) // => [["a", "a"], ["b", "b"], ["c", "c"], ["a", "a"]]
|
|
2524
2444
|
*
|
|
2525
2445
|
* // Works with objects using deep equality
|
|
2526
2446
|
* const objects = [
|
|
@@ -2530,7 +2450,7 @@ export declare const groupWith: {
|
|
|
2530
2450
|
* { type: "A", value: 1 }
|
|
2531
2451
|
* ]
|
|
2532
2452
|
* const groupedObjects = Iterable.group(objects)
|
|
2533
|
-
*
|
|
2453
|
+
* Array.from(groupedObjects).length // => 3
|
|
2534
2454
|
* // Note: Only consecutive equal objects are grouped together
|
|
2535
2455
|
* ```
|
|
2536
2456
|
*
|
|
@@ -2549,20 +2469,18 @@ export declare const group: <A>(self: Iterable<A>) => Iterable<NonEmptyArray<A>>
|
|
|
2549
2469
|
*
|
|
2550
2470
|
* **Example** (Grouping by a key)
|
|
2551
2471
|
*
|
|
2552
|
-
* ```ts
|
|
2472
|
+
* ```ts import.meta.vitest
|
|
2553
2473
|
* import { Iterable } from "effect"
|
|
2554
2474
|
*
|
|
2555
2475
|
* // Group by string length
|
|
2556
2476
|
* const words = ["a", "bb", "ccc", "dd", "eee", "f"]
|
|
2557
2477
|
* const byLength = Iterable.groupBy(words, (word) => word.length.toString())
|
|
2558
|
-
*
|
|
2559
|
-
* // { "1": ["a", "f"], "2": ["bb", "dd"], "3": ["ccc", "eee"] }
|
|
2478
|
+
* byLength // => { "1": ["a", "f"], "2": ["bb", "dd"], "3": ["ccc", "eee"] }
|
|
2560
2479
|
*
|
|
2561
2480
|
* // Group by first letter
|
|
2562
2481
|
* const names = ["Alice", "Bob", "Charlie", "David", "Anna", "Betty"]
|
|
2563
2482
|
* const byFirstLetter = Iterable.groupBy(names, (name) => name[0])
|
|
2564
|
-
*
|
|
2565
|
-
* // { "A": ["Alice", "Anna"], "B": ["Bob", "Betty"], "C": ["Charlie"], "D": ["David"] }
|
|
2483
|
+
* byFirstLetter // => { A: ["Alice", "Anna"], B: ["Bob", "Betty"], C: ["Charlie"], D: ["David"] }
|
|
2566
2484
|
*
|
|
2567
2485
|
* // Group by category
|
|
2568
2486
|
* const items = [
|
|
@@ -2572,17 +2490,12 @@ export declare const group: <A>(self: Iterable<A>) => Iterable<NonEmptyArray<A>>
|
|
|
2572
2490
|
* { name: "broccoli", category: "vegetable" }
|
|
2573
2491
|
* ]
|
|
2574
2492
|
* const byCategory = Iterable.groupBy(items, (item) => item.category)
|
|
2575
|
-
*
|
|
2576
|
-
* // {
|
|
2577
|
-
* // "fruit": [{ name: "apple", category: "fruit" }, { name: "banana", category: "fruit" }],
|
|
2578
|
-
* // "vegetable": [{ name: "carrot", category: "vegetable" }, { name: "broccoli", category: "vegetable" }]
|
|
2579
|
-
* // }
|
|
2493
|
+
* Object.keys(byCategory) // => ["fruit", "vegetable"]
|
|
2580
2494
|
*
|
|
2581
2495
|
* // Group numbers by even/odd
|
|
2582
2496
|
* const numbers = [1, 2, 3, 4, 5, 6]
|
|
2583
2497
|
* const evenOdd = Iterable.groupBy(numbers, (n) => n % 2 === 0 ? "even" : "odd")
|
|
2584
|
-
*
|
|
2585
|
-
* // { "odd": [1, 3, 5], "even": [2, 4, 6] }
|
|
2498
|
+
* evenOdd // => { odd: [1, 3, 5], even: [2, 4, 6] }
|
|
2586
2499
|
* ```
|
|
2587
2500
|
*
|
|
2588
2501
|
* @category grouping
|
|
@@ -2600,20 +2513,18 @@ export declare const groupBy: {
|
|
|
2600
2513
|
*
|
|
2601
2514
|
* **Example** (Grouping by a key)
|
|
2602
2515
|
*
|
|
2603
|
-
* ```ts
|
|
2516
|
+
* ```ts import.meta.vitest
|
|
2604
2517
|
* import { Iterable } from "effect"
|
|
2605
2518
|
*
|
|
2606
2519
|
* // Group by string length
|
|
2607
2520
|
* const words = ["a", "bb", "ccc", "dd", "eee", "f"]
|
|
2608
2521
|
* const byLength = Iterable.groupBy(words, (word) => word.length.toString())
|
|
2609
|
-
*
|
|
2610
|
-
* // { "1": ["a", "f"], "2": ["bb", "dd"], "3": ["ccc", "eee"] }
|
|
2522
|
+
* byLength // => { "1": ["a", "f"], "2": ["bb", "dd"], "3": ["ccc", "eee"] }
|
|
2611
2523
|
*
|
|
2612
2524
|
* // Group by first letter
|
|
2613
2525
|
* const names = ["Alice", "Bob", "Charlie", "David", "Anna", "Betty"]
|
|
2614
2526
|
* const byFirstLetter = Iterable.groupBy(names, (name) => name[0])
|
|
2615
|
-
*
|
|
2616
|
-
* // { "A": ["Alice", "Anna"], "B": ["Bob", "Betty"], "C": ["Charlie"], "D": ["David"] }
|
|
2527
|
+
* byFirstLetter // => { A: ["Alice", "Anna"], B: ["Bob", "Betty"], C: ["Charlie"], D: ["David"] }
|
|
2617
2528
|
*
|
|
2618
2529
|
* // Group by category
|
|
2619
2530
|
* const items = [
|
|
@@ -2623,17 +2534,12 @@ export declare const groupBy: {
|
|
|
2623
2534
|
* { name: "broccoli", category: "vegetable" }
|
|
2624
2535
|
* ]
|
|
2625
2536
|
* const byCategory = Iterable.groupBy(items, (item) => item.category)
|
|
2626
|
-
*
|
|
2627
|
-
* // {
|
|
2628
|
-
* // "fruit": [{ name: "apple", category: "fruit" }, { name: "banana", category: "fruit" }],
|
|
2629
|
-
* // "vegetable": [{ name: "carrot", category: "vegetable" }, { name: "broccoli", category: "vegetable" }]
|
|
2630
|
-
* // }
|
|
2537
|
+
* Object.keys(byCategory) // => ["fruit", "vegetable"]
|
|
2631
2538
|
*
|
|
2632
2539
|
* // Group numbers by even/odd
|
|
2633
2540
|
* const numbers = [1, 2, 3, 4, 5, 6]
|
|
2634
2541
|
* const evenOdd = Iterable.groupBy(numbers, (n) => n % 2 === 0 ? "even" : "odd")
|
|
2635
|
-
*
|
|
2636
|
-
* // { "odd": [1, 3, 5], "even": [2, 4, 6] }
|
|
2542
|
+
* evenOdd // => { odd: [1, 3, 5], even: [2, 4, 6] }
|
|
2637
2543
|
* ```
|
|
2638
2544
|
*
|
|
2639
2545
|
* @category grouping
|
|
@@ -2651,20 +2557,18 @@ export declare const groupBy: {
|
|
|
2651
2557
|
*
|
|
2652
2558
|
* **Example** (Grouping by a key)
|
|
2653
2559
|
*
|
|
2654
|
-
* ```ts
|
|
2560
|
+
* ```ts import.meta.vitest
|
|
2655
2561
|
* import { Iterable } from "effect"
|
|
2656
2562
|
*
|
|
2657
2563
|
* // Group by string length
|
|
2658
2564
|
* const words = ["a", "bb", "ccc", "dd", "eee", "f"]
|
|
2659
2565
|
* const byLength = Iterable.groupBy(words, (word) => word.length.toString())
|
|
2660
|
-
*
|
|
2661
|
-
* // { "1": ["a", "f"], "2": ["bb", "dd"], "3": ["ccc", "eee"] }
|
|
2566
|
+
* byLength // => { "1": ["a", "f"], "2": ["bb", "dd"], "3": ["ccc", "eee"] }
|
|
2662
2567
|
*
|
|
2663
2568
|
* // Group by first letter
|
|
2664
2569
|
* const names = ["Alice", "Bob", "Charlie", "David", "Anna", "Betty"]
|
|
2665
2570
|
* const byFirstLetter = Iterable.groupBy(names, (name) => name[0])
|
|
2666
|
-
*
|
|
2667
|
-
* // { "A": ["Alice", "Anna"], "B": ["Bob", "Betty"], "C": ["Charlie"], "D": ["David"] }
|
|
2571
|
+
* byFirstLetter // => { A: ["Alice", "Anna"], B: ["Bob", "Betty"], C: ["Charlie"], D: ["David"] }
|
|
2668
2572
|
*
|
|
2669
2573
|
* // Group by category
|
|
2670
2574
|
* const items = [
|
|
@@ -2674,17 +2578,12 @@ export declare const groupBy: {
|
|
|
2674
2578
|
* { name: "broccoli", category: "vegetable" }
|
|
2675
2579
|
* ]
|
|
2676
2580
|
* const byCategory = Iterable.groupBy(items, (item) => item.category)
|
|
2677
|
-
*
|
|
2678
|
-
* // {
|
|
2679
|
-
* // "fruit": [{ name: "apple", category: "fruit" }, { name: "banana", category: "fruit" }],
|
|
2680
|
-
* // "vegetable": [{ name: "carrot", category: "vegetable" }, { name: "broccoli", category: "vegetable" }]
|
|
2681
|
-
* // }
|
|
2581
|
+
* Object.keys(byCategory) // => ["fruit", "vegetable"]
|
|
2682
2582
|
*
|
|
2683
2583
|
* // Group numbers by even/odd
|
|
2684
2584
|
* const numbers = [1, 2, 3, 4, 5, 6]
|
|
2685
2585
|
* const evenOdd = Iterable.groupBy(numbers, (n) => n % 2 === 0 ? "even" : "odd")
|
|
2686
|
-
*
|
|
2687
|
-
* // { "odd": [1, 3, 5], "even": [2, 4, 6] }
|
|
2586
|
+
* evenOdd // => { odd: [1, 3, 5], even: [2, 4, 6] }
|
|
2688
2587
|
* ```
|
|
2689
2588
|
*
|
|
2690
2589
|
* @category grouping
|
|
@@ -2702,18 +2601,10 @@ export declare const groupBy: {
|
|
|
2702
2601
|
*
|
|
2703
2602
|
* **Example** (Creating an empty iterable)
|
|
2704
2603
|
*
|
|
2705
|
-
* ```ts
|
|
2604
|
+
* ```ts import.meta.vitest
|
|
2706
2605
|
* import { Iterable } from "effect"
|
|
2707
2606
|
*
|
|
2708
|
-
*
|
|
2709
|
-
* console.log(Array.from(empty)) // []
|
|
2710
|
-
* console.log(Iterable.isEmpty(empty)) // true
|
|
2711
|
-
*
|
|
2712
|
-
* // Useful as base case for reductions
|
|
2713
|
-
* const hasData = true
|
|
2714
|
-
* const result = hasData
|
|
2715
|
-
* ? Iterable.range(1, 5)
|
|
2716
|
-
* : Iterable.empty<number>()
|
|
2607
|
+
* Array.from(Iterable.empty<string>()) // => []
|
|
2717
2608
|
* ```
|
|
2718
2609
|
*
|
|
2719
2610
|
* @category constructors
|
|
@@ -2730,11 +2621,11 @@ export declare const empty: <A = never>() => Iterable<A>;
|
|
|
2730
2621
|
*
|
|
2731
2622
|
* **Example** (Wrapping a single value)
|
|
2732
2623
|
*
|
|
2733
|
-
* ```ts
|
|
2624
|
+
* ```ts import.meta.vitest
|
|
2734
2625
|
* import { Iterable } from "effect"
|
|
2735
2626
|
*
|
|
2736
2627
|
* const single = Iterable.of(42)
|
|
2737
|
-
*
|
|
2628
|
+
* Array.from(single) // => [42]
|
|
2738
2629
|
*
|
|
2739
2630
|
* // Useful for creating homogeneous sequences
|
|
2740
2631
|
* const sequences = [
|
|
@@ -2749,7 +2640,7 @@ export declare const empty: <A = never>() => Iterable<A>;
|
|
|
2749
2640
|
* numbers,
|
|
2750
2641
|
* (n) => n % 2 === 0 ? Iterable.of(n) : Iterable.empty()
|
|
2751
2642
|
* )
|
|
2752
|
-
*
|
|
2643
|
+
* Array.from(evensOnly) // => [2, 4]
|
|
2753
2644
|
* ```
|
|
2754
2645
|
*
|
|
2755
2646
|
* @category constructors
|
|
@@ -2768,24 +2659,22 @@ export declare const of: <A>(a: A) => Iterable<A>;
|
|
|
2768
2659
|
*
|
|
2769
2660
|
* **Example** (Mapping elements)
|
|
2770
2661
|
*
|
|
2771
|
-
* ```ts
|
|
2662
|
+
* ```ts import.meta.vitest
|
|
2772
2663
|
* import { Iterable } from "effect"
|
|
2773
2664
|
*
|
|
2774
2665
|
* // Transform numbers to their squares
|
|
2775
2666
|
* const numbers = [1, 2, 3, 4, 5]
|
|
2776
2667
|
* const squares = Iterable.map(numbers, (x) => x * x)
|
|
2777
|
-
*
|
|
2668
|
+
* Array.from(squares) // => [1, 4, 9, 16, 25]
|
|
2778
2669
|
*
|
|
2779
2670
|
* // Use index in transformation
|
|
2780
2671
|
* const indexed = Iterable.map(["a", "b", "c"], (char, i) => `${i}: ${char}`)
|
|
2781
|
-
*
|
|
2672
|
+
* Array.from(indexed) // => ["0: a", "1: b", "2: c"]
|
|
2782
2673
|
*
|
|
2783
|
-
*
|
|
2784
|
-
* const result = Iterable.map(
|
|
2674
|
+
* Array.from(Iterable.map(
|
|
2785
2675
|
* Iterable.map([1, 2, 3], (x) => x * 2),
|
|
2786
2676
|
* (x) => x + 1
|
|
2787
|
-
* )
|
|
2788
|
-
* console.log(Array.from(result)) // [3, 5, 7]
|
|
2677
|
+
* )) // => [3, 5, 7]
|
|
2789
2678
|
* ```
|
|
2790
2679
|
*
|
|
2791
2680
|
* @category mapping
|
|
@@ -2804,24 +2693,22 @@ export declare const map: {
|
|
|
2804
2693
|
*
|
|
2805
2694
|
* **Example** (Mapping elements)
|
|
2806
2695
|
*
|
|
2807
|
-
* ```ts
|
|
2696
|
+
* ```ts import.meta.vitest
|
|
2808
2697
|
* import { Iterable } from "effect"
|
|
2809
2698
|
*
|
|
2810
2699
|
* // Transform numbers to their squares
|
|
2811
2700
|
* const numbers = [1, 2, 3, 4, 5]
|
|
2812
2701
|
* const squares = Iterable.map(numbers, (x) => x * x)
|
|
2813
|
-
*
|
|
2702
|
+
* Array.from(squares) // => [1, 4, 9, 16, 25]
|
|
2814
2703
|
*
|
|
2815
2704
|
* // Use index in transformation
|
|
2816
2705
|
* const indexed = Iterable.map(["a", "b", "c"], (char, i) => `${i}: ${char}`)
|
|
2817
|
-
*
|
|
2706
|
+
* Array.from(indexed) // => ["0: a", "1: b", "2: c"]
|
|
2818
2707
|
*
|
|
2819
|
-
*
|
|
2820
|
-
* const result = Iterable.map(
|
|
2708
|
+
* Array.from(Iterable.map(
|
|
2821
2709
|
* Iterable.map([1, 2, 3], (x) => x * 2),
|
|
2822
2710
|
* (x) => x + 1
|
|
2823
|
-
* )
|
|
2824
|
-
* console.log(Array.from(result)) // [3, 5, 7]
|
|
2711
|
+
* )) // => [3, 5, 7]
|
|
2825
2712
|
* ```
|
|
2826
2713
|
*
|
|
2827
2714
|
* @category mapping
|
|
@@ -2840,24 +2727,22 @@ export declare const map: {
|
|
|
2840
2727
|
*
|
|
2841
2728
|
* **Example** (Mapping elements)
|
|
2842
2729
|
*
|
|
2843
|
-
* ```ts
|
|
2730
|
+
* ```ts import.meta.vitest
|
|
2844
2731
|
* import { Iterable } from "effect"
|
|
2845
2732
|
*
|
|
2846
2733
|
* // Transform numbers to their squares
|
|
2847
2734
|
* const numbers = [1, 2, 3, 4, 5]
|
|
2848
2735
|
* const squares = Iterable.map(numbers, (x) => x * x)
|
|
2849
|
-
*
|
|
2736
|
+
* Array.from(squares) // => [1, 4, 9, 16, 25]
|
|
2850
2737
|
*
|
|
2851
2738
|
* // Use index in transformation
|
|
2852
2739
|
* const indexed = Iterable.map(["a", "b", "c"], (char, i) => `${i}: ${char}`)
|
|
2853
|
-
*
|
|
2740
|
+
* Array.from(indexed) // => ["0: a", "1: b", "2: c"]
|
|
2854
2741
|
*
|
|
2855
|
-
*
|
|
2856
|
-
* const result = Iterable.map(
|
|
2742
|
+
* Array.from(Iterable.map(
|
|
2857
2743
|
* Iterable.map([1, 2, 3], (x) => x * 2),
|
|
2858
2744
|
* (x) => x + 1
|
|
2859
|
-
* )
|
|
2860
|
-
* console.log(Array.from(result)) // [3, 5, 7]
|
|
2745
|
+
* )) // => [3, 5, 7]
|
|
2861
2746
|
* ```
|
|
2862
2747
|
*
|
|
2863
2748
|
* @category mapping
|
|
@@ -2870,18 +2755,18 @@ export declare const map: {
|
|
|
2870
2755
|
*
|
|
2871
2756
|
* **Example** (Flat mapping iterables)
|
|
2872
2757
|
*
|
|
2873
|
-
* ```ts
|
|
2758
|
+
* ```ts import.meta.vitest
|
|
2874
2759
|
* import { Iterable } from "effect"
|
|
2875
2760
|
*
|
|
2876
2761
|
* // Expand each number to a range
|
|
2877
2762
|
* const numbers = [1, 2, 3]
|
|
2878
2763
|
* const expanded = Iterable.flatMap(numbers, (n) => Iterable.range(1, n))
|
|
2879
|
-
*
|
|
2764
|
+
* Array.from(expanded) // => [1, 1, 2, 1, 2, 3]
|
|
2880
2765
|
*
|
|
2881
2766
|
* // Split strings into characters
|
|
2882
2767
|
* const words = ["hi", "bye"]
|
|
2883
2768
|
* const chars = Iterable.flatMap(words, (word) => word)
|
|
2884
|
-
*
|
|
2769
|
+
* Array.from(chars) // => ["h", "i", "b", "y", "e"]
|
|
2885
2770
|
*
|
|
2886
2771
|
* // Conditional expansion with empty iterables
|
|
2887
2772
|
* const values = [1, 2, 3, 4, 5]
|
|
@@ -2889,7 +2774,7 @@ export declare const map: {
|
|
|
2889
2774
|
* values,
|
|
2890
2775
|
* (n) => n % 2 === 0 ? [n, n * 2, n * 3] : []
|
|
2891
2776
|
* )
|
|
2892
|
-
*
|
|
2777
|
+
* Array.from(evenMultiples) // => [2, 4, 6, 4, 8, 12]
|
|
2893
2778
|
*
|
|
2894
2779
|
* // Use index in transformation
|
|
2895
2780
|
* const letters = ["a", "b", "c"]
|
|
@@ -2897,7 +2782,7 @@ export declare const map: {
|
|
|
2897
2782
|
* letters,
|
|
2898
2783
|
* (letter, i) => Iterable.replicate(letter, i + 1)
|
|
2899
2784
|
* )
|
|
2900
|
-
*
|
|
2785
|
+
* Array.from(indexed) // => ["a", "b", "b", "c", "c", "c"]
|
|
2901
2786
|
* ```
|
|
2902
2787
|
*
|
|
2903
2788
|
* @category sequencing
|
|
@@ -2909,18 +2794,18 @@ export declare const flatMap: {
|
|
|
2909
2794
|
*
|
|
2910
2795
|
* **Example** (Flat mapping iterables)
|
|
2911
2796
|
*
|
|
2912
|
-
* ```ts
|
|
2797
|
+
* ```ts import.meta.vitest
|
|
2913
2798
|
* import { Iterable } from "effect"
|
|
2914
2799
|
*
|
|
2915
2800
|
* // Expand each number to a range
|
|
2916
2801
|
* const numbers = [1, 2, 3]
|
|
2917
2802
|
* const expanded = Iterable.flatMap(numbers, (n) => Iterable.range(1, n))
|
|
2918
|
-
*
|
|
2803
|
+
* Array.from(expanded) // => [1, 1, 2, 1, 2, 3]
|
|
2919
2804
|
*
|
|
2920
2805
|
* // Split strings into characters
|
|
2921
2806
|
* const words = ["hi", "bye"]
|
|
2922
2807
|
* const chars = Iterable.flatMap(words, (word) => word)
|
|
2923
|
-
*
|
|
2808
|
+
* Array.from(chars) // => ["h", "i", "b", "y", "e"]
|
|
2924
2809
|
*
|
|
2925
2810
|
* // Conditional expansion with empty iterables
|
|
2926
2811
|
* const values = [1, 2, 3, 4, 5]
|
|
@@ -2928,7 +2813,7 @@ export declare const flatMap: {
|
|
|
2928
2813
|
* values,
|
|
2929
2814
|
* (n) => n % 2 === 0 ? [n, n * 2, n * 3] : []
|
|
2930
2815
|
* )
|
|
2931
|
-
*
|
|
2816
|
+
* Array.from(evenMultiples) // => [2, 4, 6, 4, 8, 12]
|
|
2932
2817
|
*
|
|
2933
2818
|
* // Use index in transformation
|
|
2934
2819
|
* const letters = ["a", "b", "c"]
|
|
@@ -2936,7 +2821,7 @@ export declare const flatMap: {
|
|
|
2936
2821
|
* letters,
|
|
2937
2822
|
* (letter, i) => Iterable.replicate(letter, i + 1)
|
|
2938
2823
|
* )
|
|
2939
|
-
*
|
|
2824
|
+
* Array.from(indexed) // => ["a", "b", "b", "c", "c", "c"]
|
|
2940
2825
|
* ```
|
|
2941
2826
|
*
|
|
2942
2827
|
* @category sequencing
|
|
@@ -2948,18 +2833,18 @@ export declare const flatMap: {
|
|
|
2948
2833
|
*
|
|
2949
2834
|
* **Example** (Flat mapping iterables)
|
|
2950
2835
|
*
|
|
2951
|
-
* ```ts
|
|
2836
|
+
* ```ts import.meta.vitest
|
|
2952
2837
|
* import { Iterable } from "effect"
|
|
2953
2838
|
*
|
|
2954
2839
|
* // Expand each number to a range
|
|
2955
2840
|
* const numbers = [1, 2, 3]
|
|
2956
2841
|
* const expanded = Iterable.flatMap(numbers, (n) => Iterable.range(1, n))
|
|
2957
|
-
*
|
|
2842
|
+
* Array.from(expanded) // => [1, 1, 2, 1, 2, 3]
|
|
2958
2843
|
*
|
|
2959
2844
|
* // Split strings into characters
|
|
2960
2845
|
* const words = ["hi", "bye"]
|
|
2961
2846
|
* const chars = Iterable.flatMap(words, (word) => word)
|
|
2962
|
-
*
|
|
2847
|
+
* Array.from(chars) // => ["h", "i", "b", "y", "e"]
|
|
2963
2848
|
*
|
|
2964
2849
|
* // Conditional expansion with empty iterables
|
|
2965
2850
|
* const values = [1, 2, 3, 4, 5]
|
|
@@ -2967,7 +2852,7 @@ export declare const flatMap: {
|
|
|
2967
2852
|
* values,
|
|
2968
2853
|
* (n) => n % 2 === 0 ? [n, n * 2, n * 3] : []
|
|
2969
2854
|
* )
|
|
2970
|
-
*
|
|
2855
|
+
* Array.from(evenMultiples) // => [2, 4, 6, 4, 8, 12]
|
|
2971
2856
|
*
|
|
2972
2857
|
* // Use index in transformation
|
|
2973
2858
|
* const letters = ["a", "b", "c"]
|
|
@@ -2975,7 +2860,7 @@ export declare const flatMap: {
|
|
|
2975
2860
|
* letters,
|
|
2976
2861
|
* (letter, i) => Iterable.replicate(letter, i + 1)
|
|
2977
2862
|
* )
|
|
2978
|
-
*
|
|
2863
|
+
* Array.from(indexed) // => ["a", "b", "b", "c", "c", "c"]
|
|
2979
2864
|
* ```
|
|
2980
2865
|
*
|
|
2981
2866
|
* @category sequencing
|
|
@@ -2988,29 +2873,29 @@ export declare const flatMap: {
|
|
|
2988
2873
|
*
|
|
2989
2874
|
* **Example** (Flattening nested iterables)
|
|
2990
2875
|
*
|
|
2991
|
-
* ```ts
|
|
2876
|
+
* ```ts import.meta.vitest
|
|
2992
2877
|
* import { Iterable } from "effect"
|
|
2993
2878
|
*
|
|
2994
2879
|
* // Flatten nested arrays
|
|
2995
2880
|
* const nested = [[1, 2], [3, 4], [5, 6]]
|
|
2996
2881
|
* const flat = Iterable.flatten(nested)
|
|
2997
|
-
*
|
|
2882
|
+
* Array.from(flat) // => [1, 2, 3, 4, 5, 6]
|
|
2998
2883
|
*
|
|
2999
2884
|
* // Flatten different iterable types
|
|
3000
2885
|
* const mixed: Array<Iterable<string>> = ["ab", "cd"]
|
|
3001
2886
|
* const flatMixed = Iterable.flatten(mixed)
|
|
3002
|
-
*
|
|
2887
|
+
* Array.from(flatMixed) // => ["a", "b", "c", "d"]
|
|
3003
2888
|
*
|
|
3004
2889
|
* // Flatten deeply nested (only one level)
|
|
3005
2890
|
* const deepNested = [[[1, 2]], [[3, 4]]]
|
|
3006
2891
|
* const oneLevelFlat = Iterable.flatten(deepNested)
|
|
3007
|
-
*
|
|
2892
|
+
* Array.from(oneLevelFlat) // => [[1, 2], [3, 4]]
|
|
3008
2893
|
* // [[1, 2], [3, 4]] (still contains arrays)
|
|
3009
2894
|
*
|
|
3010
2895
|
* // Empty iterables are handled correctly
|
|
3011
2896
|
* const withEmpty = [[1, 2], [], [3, 4], []]
|
|
3012
2897
|
* const flatWithEmpty = Iterable.flatten(withEmpty)
|
|
3013
|
-
*
|
|
2898
|
+
* Array.from(flatWithEmpty) // => [1, 2, 3, 4]
|
|
3014
2899
|
* ```
|
|
3015
2900
|
*
|
|
3016
2901
|
* @category sequencing
|
|
@@ -3028,7 +2913,7 @@ export declare const flatten: <A>(self: Iterable<Iterable<A>>) => Iterable<A>;
|
|
|
3028
2913
|
*
|
|
3029
2914
|
* **Example** (Filtering and transforming Result values)
|
|
3030
2915
|
*
|
|
3031
|
-
* ```ts
|
|
2916
|
+
* ```ts import.meta.vitest
|
|
3032
2917
|
* import { Iterable, Result } from "effect"
|
|
3033
2918
|
*
|
|
3034
2919
|
* // Parse strings to numbers, keeping only valid ones
|
|
@@ -3037,7 +2922,7 @@ export declare const flatten: <A>(self: Iterable<Iterable<A>>) => Iterable<A>;
|
|
|
3037
2922
|
* const num = parseInt(s)
|
|
3038
2923
|
* return isNaN(num) ? Result.failVoid : Result.succeed(num)
|
|
3039
2924
|
* })
|
|
3040
|
-
*
|
|
2925
|
+
* Array.from(numbers) // => [1, 2, 4]
|
|
3041
2926
|
*
|
|
3042
2927
|
* // Extract specific properties from objects
|
|
3043
2928
|
* const users = [
|
|
@@ -3051,7 +2936,7 @@ export declare const flatten: <A>(self: Iterable<Iterable<A>>) => Iterable<A>;
|
|
|
3051
2936
|
* (user) =>
|
|
3052
2937
|
* user.age >= 18 && user.email ? Result.succeed(user.email) : Result.failVoid
|
|
3053
2938
|
* )
|
|
3054
|
-
*
|
|
2939
|
+
* Array.from(adultEmails) // => ["alice@example.com", "charlie@example.com"]
|
|
3055
2940
|
*
|
|
3056
2941
|
* // Use index in transformation
|
|
3057
2942
|
* const items = ["a", "b", "c", "d", "e"]
|
|
@@ -3059,7 +2944,7 @@ export declare const flatten: <A>(self: Iterable<Iterable<A>>) => Iterable<A>;
|
|
|
3059
2944
|
* items,
|
|
3060
2945
|
* (item, i) => i % 2 === 0 ? Result.succeed(`${i}: ${item}`) : Result.failVoid
|
|
3061
2946
|
* )
|
|
3062
|
-
*
|
|
2947
|
+
* Array.from(evenIndexItems) // => ["0: a", "2: c", "4: e"]
|
|
3063
2948
|
* ```
|
|
3064
2949
|
*
|
|
3065
2950
|
* @category filtering
|
|
@@ -3077,7 +2962,7 @@ export declare const filterMap: {
|
|
|
3077
2962
|
*
|
|
3078
2963
|
* **Example** (Filtering and transforming Result values)
|
|
3079
2964
|
*
|
|
3080
|
-
* ```ts
|
|
2965
|
+
* ```ts import.meta.vitest
|
|
3081
2966
|
* import { Iterable, Result } from "effect"
|
|
3082
2967
|
*
|
|
3083
2968
|
* // Parse strings to numbers, keeping only valid ones
|
|
@@ -3086,7 +2971,7 @@ export declare const filterMap: {
|
|
|
3086
2971
|
* const num = parseInt(s)
|
|
3087
2972
|
* return isNaN(num) ? Result.failVoid : Result.succeed(num)
|
|
3088
2973
|
* })
|
|
3089
|
-
*
|
|
2974
|
+
* Array.from(numbers) // => [1, 2, 4]
|
|
3090
2975
|
*
|
|
3091
2976
|
* // Extract specific properties from objects
|
|
3092
2977
|
* const users = [
|
|
@@ -3100,7 +2985,7 @@ export declare const filterMap: {
|
|
|
3100
2985
|
* (user) =>
|
|
3101
2986
|
* user.age >= 18 && user.email ? Result.succeed(user.email) : Result.failVoid
|
|
3102
2987
|
* )
|
|
3103
|
-
*
|
|
2988
|
+
* Array.from(adultEmails) // => ["alice@example.com", "charlie@example.com"]
|
|
3104
2989
|
*
|
|
3105
2990
|
* // Use index in transformation
|
|
3106
2991
|
* const items = ["a", "b", "c", "d", "e"]
|
|
@@ -3108,7 +2993,7 @@ export declare const filterMap: {
|
|
|
3108
2993
|
* items,
|
|
3109
2994
|
* (item, i) => i % 2 === 0 ? Result.succeed(`${i}: ${item}`) : Result.failVoid
|
|
3110
2995
|
* )
|
|
3111
|
-
*
|
|
2996
|
+
* Array.from(evenIndexItems) // => ["0: a", "2: c", "4: e"]
|
|
3112
2997
|
* ```
|
|
3113
2998
|
*
|
|
3114
2999
|
* @category filtering
|
|
@@ -3126,7 +3011,7 @@ export declare const filterMap: {
|
|
|
3126
3011
|
*
|
|
3127
3012
|
* **Example** (Filtering and transforming Result values)
|
|
3128
3013
|
*
|
|
3129
|
-
* ```ts
|
|
3014
|
+
* ```ts import.meta.vitest
|
|
3130
3015
|
* import { Iterable, Result } from "effect"
|
|
3131
3016
|
*
|
|
3132
3017
|
* // Parse strings to numbers, keeping only valid ones
|
|
@@ -3135,7 +3020,7 @@ export declare const filterMap: {
|
|
|
3135
3020
|
* const num = parseInt(s)
|
|
3136
3021
|
* return isNaN(num) ? Result.failVoid : Result.succeed(num)
|
|
3137
3022
|
* })
|
|
3138
|
-
*
|
|
3023
|
+
* Array.from(numbers) // => [1, 2, 4]
|
|
3139
3024
|
*
|
|
3140
3025
|
* // Extract specific properties from objects
|
|
3141
3026
|
* const users = [
|
|
@@ -3149,7 +3034,7 @@ export declare const filterMap: {
|
|
|
3149
3034
|
* (user) =>
|
|
3150
3035
|
* user.age >= 18 && user.email ? Result.succeed(user.email) : Result.failVoid
|
|
3151
3036
|
* )
|
|
3152
|
-
*
|
|
3037
|
+
* Array.from(adultEmails) // => ["alice@example.com", "charlie@example.com"]
|
|
3153
3038
|
*
|
|
3154
3039
|
* // Use index in transformation
|
|
3155
3040
|
* const items = ["a", "b", "c", "d", "e"]
|
|
@@ -3157,7 +3042,7 @@ export declare const filterMap: {
|
|
|
3157
3042
|
* items,
|
|
3158
3043
|
* (item, i) => i % 2 === 0 ? Result.succeed(`${i}: ${item}`) : Result.failVoid
|
|
3159
3044
|
* )
|
|
3160
|
-
*
|
|
3045
|
+
* Array.from(evenIndexItems) // => ["0: a", "2: c", "4: e"]
|
|
3161
3046
|
* ```
|
|
3162
3047
|
*
|
|
3163
3048
|
* @category filtering
|
|
@@ -3170,7 +3055,7 @@ export declare const filterMap: {
|
|
|
3170
3055
|
*
|
|
3171
3056
|
* **Example** (Filtering and transforming until failure)
|
|
3172
3057
|
*
|
|
3173
|
-
* ```ts
|
|
3058
|
+
* ```ts import.meta.vitest
|
|
3174
3059
|
* import { Iterable, Result } from "effect"
|
|
3175
3060
|
*
|
|
3176
3061
|
* // Parse numbers until we hit an invalid one
|
|
@@ -3179,7 +3064,7 @@ export declare const filterMap: {
|
|
|
3179
3064
|
* const num = parseInt(s)
|
|
3180
3065
|
* return isNaN(num) ? Result.failVoid : Result.succeed(num)
|
|
3181
3066
|
* })
|
|
3182
|
-
*
|
|
3067
|
+
* Array.from(numbers) // => [1, 2, 3]
|
|
3183
3068
|
*
|
|
3184
3069
|
* // Take elements while they meet a condition and transform them
|
|
3185
3070
|
* const values = [2, 4, 6, 7, 8, 10]
|
|
@@ -3187,7 +3072,7 @@ export declare const filterMap: {
|
|
|
3187
3072
|
* values,
|
|
3188
3073
|
* (n) => n % 2 === 0 ? Result.succeed(n * 2) : Result.failVoid
|
|
3189
3074
|
* )
|
|
3190
|
-
*
|
|
3075
|
+
* Array.from(doubledEvens) // => [4, 8, 12]
|
|
3191
3076
|
*
|
|
3192
3077
|
* // Process with index until condition fails
|
|
3193
3078
|
* const letters = ["a", "b", "c", "d", "e"]
|
|
@@ -3195,7 +3080,7 @@ export declare const filterMap: {
|
|
|
3195
3080
|
* letters,
|
|
3196
3081
|
* (letter, i) => letter !== "c" ? Result.succeed(`${i}: ${letter}`) : Result.failVoid
|
|
3197
3082
|
* )
|
|
3198
|
-
*
|
|
3083
|
+
* Array.from(indexedUntilC) // => ["0: a", "1: b"]
|
|
3199
3084
|
* ```
|
|
3200
3085
|
*
|
|
3201
3086
|
* @category filtering
|
|
@@ -3207,7 +3092,7 @@ export declare const filterMapWhile: {
|
|
|
3207
3092
|
*
|
|
3208
3093
|
* **Example** (Filtering and transforming until failure)
|
|
3209
3094
|
*
|
|
3210
|
-
* ```ts
|
|
3095
|
+
* ```ts import.meta.vitest
|
|
3211
3096
|
* import { Iterable, Result } from "effect"
|
|
3212
3097
|
*
|
|
3213
3098
|
* // Parse numbers until we hit an invalid one
|
|
@@ -3216,7 +3101,7 @@ export declare const filterMapWhile: {
|
|
|
3216
3101
|
* const num = parseInt(s)
|
|
3217
3102
|
* return isNaN(num) ? Result.failVoid : Result.succeed(num)
|
|
3218
3103
|
* })
|
|
3219
|
-
*
|
|
3104
|
+
* Array.from(numbers) // => [1, 2, 3]
|
|
3220
3105
|
*
|
|
3221
3106
|
* // Take elements while they meet a condition and transform them
|
|
3222
3107
|
* const values = [2, 4, 6, 7, 8, 10]
|
|
@@ -3224,7 +3109,7 @@ export declare const filterMapWhile: {
|
|
|
3224
3109
|
* values,
|
|
3225
3110
|
* (n) => n % 2 === 0 ? Result.succeed(n * 2) : Result.failVoid
|
|
3226
3111
|
* )
|
|
3227
|
-
*
|
|
3112
|
+
* Array.from(doubledEvens) // => [4, 8, 12]
|
|
3228
3113
|
*
|
|
3229
3114
|
* // Process with index until condition fails
|
|
3230
3115
|
* const letters = ["a", "b", "c", "d", "e"]
|
|
@@ -3232,7 +3117,7 @@ export declare const filterMapWhile: {
|
|
|
3232
3117
|
* letters,
|
|
3233
3118
|
* (letter, i) => letter !== "c" ? Result.succeed(`${i}: ${letter}`) : Result.failVoid
|
|
3234
3119
|
* )
|
|
3235
|
-
*
|
|
3120
|
+
* Array.from(indexedUntilC) // => ["0: a", "1: b"]
|
|
3236
3121
|
* ```
|
|
3237
3122
|
*
|
|
3238
3123
|
* @category filtering
|
|
@@ -3244,7 +3129,7 @@ export declare const filterMapWhile: {
|
|
|
3244
3129
|
*
|
|
3245
3130
|
* **Example** (Filtering and transforming until failure)
|
|
3246
3131
|
*
|
|
3247
|
-
* ```ts
|
|
3132
|
+
* ```ts import.meta.vitest
|
|
3248
3133
|
* import { Iterable, Result } from "effect"
|
|
3249
3134
|
*
|
|
3250
3135
|
* // Parse numbers until we hit an invalid one
|
|
@@ -3253,7 +3138,7 @@ export declare const filterMapWhile: {
|
|
|
3253
3138
|
* const num = parseInt(s)
|
|
3254
3139
|
* return isNaN(num) ? Result.failVoid : Result.succeed(num)
|
|
3255
3140
|
* })
|
|
3256
|
-
*
|
|
3141
|
+
* Array.from(numbers) // => [1, 2, 3]
|
|
3257
3142
|
*
|
|
3258
3143
|
* // Take elements while they meet a condition and transform them
|
|
3259
3144
|
* const values = [2, 4, 6, 7, 8, 10]
|
|
@@ -3261,7 +3146,7 @@ export declare const filterMapWhile: {
|
|
|
3261
3146
|
* values,
|
|
3262
3147
|
* (n) => n % 2 === 0 ? Result.succeed(n * 2) : Result.failVoid
|
|
3263
3148
|
* )
|
|
3264
|
-
*
|
|
3149
|
+
* Array.from(doubledEvens) // => [4, 8, 12]
|
|
3265
3150
|
*
|
|
3266
3151
|
* // Process with index until condition fails
|
|
3267
3152
|
* const letters = ["a", "b", "c", "d", "e"]
|
|
@@ -3269,7 +3154,7 @@ export declare const filterMapWhile: {
|
|
|
3269
3154
|
* letters,
|
|
3270
3155
|
* (letter, i) => letter !== "c" ? Result.succeed(`${i}: ${letter}`) : Result.failVoid
|
|
3271
3156
|
* )
|
|
3272
|
-
*
|
|
3157
|
+
* Array.from(indexedUntilC) // => ["0: a", "1: b"]
|
|
3273
3158
|
* ```
|
|
3274
3159
|
*
|
|
3275
3160
|
* @category filtering
|
|
@@ -3282,16 +3167,10 @@ export declare const filterMapWhile: {
|
|
|
3282
3167
|
*
|
|
3283
3168
|
* **Example** (Extracting Some values)
|
|
3284
3169
|
*
|
|
3285
|
-
* ```ts
|
|
3170
|
+
* ```ts import.meta.vitest
|
|
3286
3171
|
* import { Iterable, Option } from "effect"
|
|
3287
|
-
* import * as assert from "node:assert"
|
|
3288
3172
|
*
|
|
3289
|
-
*
|
|
3290
|
-
* Array.from(
|
|
3291
|
-
* Iterable.getSomes([Option.some(1), Option.none(), Option.some(2)])
|
|
3292
|
-
* ),
|
|
3293
|
-
* [1, 2]
|
|
3294
|
-
* )
|
|
3173
|
+
* Array.from(Iterable.getSomes([Option.some(1), Option.none(), Option.some(2)])) // => [1, 2]
|
|
3295
3174
|
* ```
|
|
3296
3175
|
*
|
|
3297
3176
|
* @category filtering
|
|
@@ -3304,20 +3183,14 @@ export declare const getSomes: <A>(self: Iterable<Option<A>>) => Iterable<A>;
|
|
|
3304
3183
|
*
|
|
3305
3184
|
* **Example** (Extracting failures)
|
|
3306
3185
|
*
|
|
3307
|
-
* ```ts
|
|
3186
|
+
* ```ts import.meta.vitest
|
|
3308
3187
|
* import { Iterable, Result } from "effect"
|
|
3309
|
-
*
|
|
3310
|
-
*
|
|
3311
|
-
*
|
|
3312
|
-
*
|
|
3313
|
-
*
|
|
3314
|
-
*
|
|
3315
|
-
* Result.fail("err"),
|
|
3316
|
-
* Result.succeed(2)
|
|
3317
|
-
* ])
|
|
3318
|
-
* ),
|
|
3319
|
-
* ["err"]
|
|
3320
|
-
* )
|
|
3188
|
+
*
|
|
3189
|
+
* Array.from(Iterable.getFailures([
|
|
3190
|
+
* Result.succeed(1),
|
|
3191
|
+
* Result.fail("err"),
|
|
3192
|
+
* Result.succeed(2)
|
|
3193
|
+
* ])) // => ["err"]
|
|
3321
3194
|
* ```
|
|
3322
3195
|
*
|
|
3323
3196
|
* @category filtering
|
|
@@ -3330,20 +3203,14 @@ export declare const getFailures: <R0, L>(self: Iterable<Result<R0, L>>) => Iter
|
|
|
3330
3203
|
*
|
|
3331
3204
|
* **Example** (Extracting successes)
|
|
3332
3205
|
*
|
|
3333
|
-
* ```ts
|
|
3206
|
+
* ```ts import.meta.vitest
|
|
3334
3207
|
* import { Iterable, Result } from "effect"
|
|
3335
|
-
*
|
|
3336
|
-
*
|
|
3337
|
-
*
|
|
3338
|
-
*
|
|
3339
|
-
*
|
|
3340
|
-
*
|
|
3341
|
-
* Result.fail("err"),
|
|
3342
|
-
* Result.succeed(2)
|
|
3343
|
-
* ])
|
|
3344
|
-
* ),
|
|
3345
|
-
* [1, 2]
|
|
3346
|
-
* )
|
|
3208
|
+
*
|
|
3209
|
+
* Array.from(Iterable.getSuccesses([
|
|
3210
|
+
* Result.succeed(1),
|
|
3211
|
+
* Result.fail("err"),
|
|
3212
|
+
* Result.succeed(2)
|
|
3213
|
+
* ])) // => [1, 2]
|
|
3347
3214
|
* ```
|
|
3348
3215
|
*
|
|
3349
3216
|
* @category filtering
|
|
@@ -3361,18 +3228,18 @@ export declare const getSuccesses: <R0, L>(self: Iterable<Result<R0, L>>) => Ite
|
|
|
3361
3228
|
*
|
|
3362
3229
|
* **Example** (Filtering elements)
|
|
3363
3230
|
*
|
|
3364
|
-
* ```ts
|
|
3231
|
+
* ```ts import.meta.vitest
|
|
3365
3232
|
* import { Iterable } from "effect"
|
|
3366
3233
|
*
|
|
3367
3234
|
* // Filter even numbers
|
|
3368
3235
|
* const numbers = [1, 2, 3, 4, 5, 6]
|
|
3369
3236
|
* const evens = Iterable.filter(numbers, (x) => x % 2 === 0)
|
|
3370
|
-
*
|
|
3237
|
+
* Array.from(evens) // => [2, 4, 6]
|
|
3371
3238
|
*
|
|
3372
3239
|
* // Filter with index
|
|
3373
3240
|
* const items = ["a", "b", "c", "d"]
|
|
3374
3241
|
* const oddPositions = Iterable.filter(items, (_, i) => i % 2 === 1)
|
|
3375
|
-
*
|
|
3242
|
+
* Array.from(oddPositions) // => ["b", "d"]
|
|
3376
3243
|
*
|
|
3377
3244
|
* // Type refinement
|
|
3378
3245
|
* const mixed: Array<string | number> = ["hello", 42, "world", 100]
|
|
@@ -3380,14 +3247,14 @@ export declare const getSuccesses: <R0, L>(self: Iterable<Result<R0, L>>) => Ite
|
|
|
3380
3247
|
* mixed,
|
|
3381
3248
|
* (x): x is string => typeof x === "string"
|
|
3382
3249
|
* )
|
|
3383
|
-
*
|
|
3250
|
+
* Array.from(onlyStrings) // => ["hello", "world"]
|
|
3384
3251
|
*
|
|
3385
3252
|
* // Combine with map
|
|
3386
3253
|
* const processed = Iterable.map(
|
|
3387
3254
|
* Iterable.filter([1, 2, 3, 4, 5], (x) => x > 2),
|
|
3388
3255
|
* (x) => x * 10
|
|
3389
3256
|
* )
|
|
3390
|
-
*
|
|
3257
|
+
* Array.from(processed) // => [30, 40, 50]
|
|
3391
3258
|
* ```
|
|
3392
3259
|
*
|
|
3393
3260
|
* @category filtering
|
|
@@ -3405,18 +3272,18 @@ export declare const filter: {
|
|
|
3405
3272
|
*
|
|
3406
3273
|
* **Example** (Filtering elements)
|
|
3407
3274
|
*
|
|
3408
|
-
* ```ts
|
|
3275
|
+
* ```ts import.meta.vitest
|
|
3409
3276
|
* import { Iterable } from "effect"
|
|
3410
3277
|
*
|
|
3411
3278
|
* // Filter even numbers
|
|
3412
3279
|
* const numbers = [1, 2, 3, 4, 5, 6]
|
|
3413
3280
|
* const evens = Iterable.filter(numbers, (x) => x % 2 === 0)
|
|
3414
|
-
*
|
|
3281
|
+
* Array.from(evens) // => [2, 4, 6]
|
|
3415
3282
|
*
|
|
3416
3283
|
* // Filter with index
|
|
3417
3284
|
* const items = ["a", "b", "c", "d"]
|
|
3418
3285
|
* const oddPositions = Iterable.filter(items, (_, i) => i % 2 === 1)
|
|
3419
|
-
*
|
|
3286
|
+
* Array.from(oddPositions) // => ["b", "d"]
|
|
3420
3287
|
*
|
|
3421
3288
|
* // Type refinement
|
|
3422
3289
|
* const mixed: Array<string | number> = ["hello", 42, "world", 100]
|
|
@@ -3424,14 +3291,14 @@ export declare const filter: {
|
|
|
3424
3291
|
* mixed,
|
|
3425
3292
|
* (x): x is string => typeof x === "string"
|
|
3426
3293
|
* )
|
|
3427
|
-
*
|
|
3294
|
+
* Array.from(onlyStrings) // => ["hello", "world"]
|
|
3428
3295
|
*
|
|
3429
3296
|
* // Combine with map
|
|
3430
3297
|
* const processed = Iterable.map(
|
|
3431
3298
|
* Iterable.filter([1, 2, 3, 4, 5], (x) => x > 2),
|
|
3432
3299
|
* (x) => x * 10
|
|
3433
3300
|
* )
|
|
3434
|
-
*
|
|
3301
|
+
* Array.from(processed) // => [30, 40, 50]
|
|
3435
3302
|
* ```
|
|
3436
3303
|
*
|
|
3437
3304
|
* @category filtering
|
|
@@ -3449,18 +3316,18 @@ export declare const filter: {
|
|
|
3449
3316
|
*
|
|
3450
3317
|
* **Example** (Filtering elements)
|
|
3451
3318
|
*
|
|
3452
|
-
* ```ts
|
|
3319
|
+
* ```ts import.meta.vitest
|
|
3453
3320
|
* import { Iterable } from "effect"
|
|
3454
3321
|
*
|
|
3455
3322
|
* // Filter even numbers
|
|
3456
3323
|
* const numbers = [1, 2, 3, 4, 5, 6]
|
|
3457
3324
|
* const evens = Iterable.filter(numbers, (x) => x % 2 === 0)
|
|
3458
|
-
*
|
|
3325
|
+
* Array.from(evens) // => [2, 4, 6]
|
|
3459
3326
|
*
|
|
3460
3327
|
* // Filter with index
|
|
3461
3328
|
* const items = ["a", "b", "c", "d"]
|
|
3462
3329
|
* const oddPositions = Iterable.filter(items, (_, i) => i % 2 === 1)
|
|
3463
|
-
*
|
|
3330
|
+
* Array.from(oddPositions) // => ["b", "d"]
|
|
3464
3331
|
*
|
|
3465
3332
|
* // Type refinement
|
|
3466
3333
|
* const mixed: Array<string | number> = ["hello", 42, "world", 100]
|
|
@@ -3468,14 +3335,14 @@ export declare const filter: {
|
|
|
3468
3335
|
* mixed,
|
|
3469
3336
|
* (x): x is string => typeof x === "string"
|
|
3470
3337
|
* )
|
|
3471
|
-
*
|
|
3338
|
+
* Array.from(onlyStrings) // => ["hello", "world"]
|
|
3472
3339
|
*
|
|
3473
3340
|
* // Combine with map
|
|
3474
3341
|
* const processed = Iterable.map(
|
|
3475
3342
|
* Iterable.filter([1, 2, 3, 4, 5], (x) => x > 2),
|
|
3476
3343
|
* (x) => x * 10
|
|
3477
3344
|
* )
|
|
3478
|
-
*
|
|
3345
|
+
* Array.from(processed) // => [30, 40, 50]
|
|
3479
3346
|
* ```
|
|
3480
3347
|
*
|
|
3481
3348
|
* @category filtering
|
|
@@ -3493,18 +3360,18 @@ export declare const filter: {
|
|
|
3493
3360
|
*
|
|
3494
3361
|
* **Example** (Filtering elements)
|
|
3495
3362
|
*
|
|
3496
|
-
* ```ts
|
|
3363
|
+
* ```ts import.meta.vitest
|
|
3497
3364
|
* import { Iterable } from "effect"
|
|
3498
3365
|
*
|
|
3499
3366
|
* // Filter even numbers
|
|
3500
3367
|
* const numbers = [1, 2, 3, 4, 5, 6]
|
|
3501
3368
|
* const evens = Iterable.filter(numbers, (x) => x % 2 === 0)
|
|
3502
|
-
*
|
|
3369
|
+
* Array.from(evens) // => [2, 4, 6]
|
|
3503
3370
|
*
|
|
3504
3371
|
* // Filter with index
|
|
3505
3372
|
* const items = ["a", "b", "c", "d"]
|
|
3506
3373
|
* const oddPositions = Iterable.filter(items, (_, i) => i % 2 === 1)
|
|
3507
|
-
*
|
|
3374
|
+
* Array.from(oddPositions) // => ["b", "d"]
|
|
3508
3375
|
*
|
|
3509
3376
|
* // Type refinement
|
|
3510
3377
|
* const mixed: Array<string | number> = ["hello", 42, "world", 100]
|
|
@@ -3512,14 +3379,14 @@ export declare const filter: {
|
|
|
3512
3379
|
* mixed,
|
|
3513
3380
|
* (x): x is string => typeof x === "string"
|
|
3514
3381
|
* )
|
|
3515
|
-
*
|
|
3382
|
+
* Array.from(onlyStrings) // => ["hello", "world"]
|
|
3516
3383
|
*
|
|
3517
3384
|
* // Combine with map
|
|
3518
3385
|
* const processed = Iterable.map(
|
|
3519
3386
|
* Iterable.filter([1, 2, 3, 4, 5], (x) => x > 2),
|
|
3520
3387
|
* (x) => x * 10
|
|
3521
3388
|
* )
|
|
3522
|
-
*
|
|
3389
|
+
* Array.from(processed) // => [30, 40, 50]
|
|
3523
3390
|
* ```
|
|
3524
3391
|
*
|
|
3525
3392
|
* @category filtering
|
|
@@ -3537,18 +3404,18 @@ export declare const filter: {
|
|
|
3537
3404
|
*
|
|
3538
3405
|
* **Example** (Filtering elements)
|
|
3539
3406
|
*
|
|
3540
|
-
* ```ts
|
|
3407
|
+
* ```ts import.meta.vitest
|
|
3541
3408
|
* import { Iterable } from "effect"
|
|
3542
3409
|
*
|
|
3543
3410
|
* // Filter even numbers
|
|
3544
3411
|
* const numbers = [1, 2, 3, 4, 5, 6]
|
|
3545
3412
|
* const evens = Iterable.filter(numbers, (x) => x % 2 === 0)
|
|
3546
|
-
*
|
|
3413
|
+
* Array.from(evens) // => [2, 4, 6]
|
|
3547
3414
|
*
|
|
3548
3415
|
* // Filter with index
|
|
3549
3416
|
* const items = ["a", "b", "c", "d"]
|
|
3550
3417
|
* const oddPositions = Iterable.filter(items, (_, i) => i % 2 === 1)
|
|
3551
|
-
*
|
|
3418
|
+
* Array.from(oddPositions) // => ["b", "d"]
|
|
3552
3419
|
*
|
|
3553
3420
|
* // Type refinement
|
|
3554
3421
|
* const mixed: Array<string | number> = ["hello", 42, "world", 100]
|
|
@@ -3556,14 +3423,14 @@ export declare const filter: {
|
|
|
3556
3423
|
* mixed,
|
|
3557
3424
|
* (x): x is string => typeof x === "string"
|
|
3558
3425
|
* )
|
|
3559
|
-
*
|
|
3426
|
+
* Array.from(onlyStrings) // => ["hello", "world"]
|
|
3560
3427
|
*
|
|
3561
3428
|
* // Combine with map
|
|
3562
3429
|
* const processed = Iterable.map(
|
|
3563
3430
|
* Iterable.filter([1, 2, 3, 4, 5], (x) => x > 2),
|
|
3564
3431
|
* (x) => x * 10
|
|
3565
3432
|
* )
|
|
3566
|
-
*
|
|
3433
|
+
* Array.from(processed) // => [30, 40, 50]
|
|
3567
3434
|
* ```
|
|
3568
3435
|
*
|
|
3569
3436
|
* @category filtering
|
|
@@ -3581,7 +3448,7 @@ export declare const filter: {
|
|
|
3581
3448
|
*
|
|
3582
3449
|
* **Example** (Flat mapping nullable results)
|
|
3583
3450
|
*
|
|
3584
|
-
* ```ts
|
|
3451
|
+
* ```ts import.meta.vitest
|
|
3585
3452
|
* import { Iterable } from "effect"
|
|
3586
3453
|
*
|
|
3587
3454
|
* // Extract valid elements from nullable function results
|
|
@@ -3590,7 +3457,7 @@ export declare const filter: {
|
|
|
3590
3457
|
* const num = parseInt(s)
|
|
3591
3458
|
* return isNaN(num) ? null : num * 2
|
|
3592
3459
|
* })
|
|
3593
|
-
*
|
|
3460
|
+
* Array.from(parsed) // => [2, 4, 8]
|
|
3594
3461
|
*
|
|
3595
3462
|
* // Safe property access
|
|
3596
3463
|
* const objects = [
|
|
@@ -3600,7 +3467,7 @@ export declare const filter: {
|
|
|
3600
3467
|
* {}
|
|
3601
3468
|
* ]
|
|
3602
3469
|
* const values = Iterable.flatMapNullishOr(objects, (obj) => obj.nested?.value)
|
|
3603
|
-
*
|
|
3470
|
+
* Array.from(values) // => [10, 20]
|
|
3604
3471
|
*
|
|
3605
3472
|
* // Working with Map.get (returns undefined for missing keys)
|
|
3606
3473
|
* const map = new Map([
|
|
@@ -3610,7 +3477,7 @@ export declare const filter: {
|
|
|
3610
3477
|
* ])
|
|
3611
3478
|
* const keys = ["a", "x", "b", "y", "c"]
|
|
3612
3479
|
* const foundValues = Iterable.flatMapNullishOr(keys, (key) => map.get(key))
|
|
3613
|
-
*
|
|
3480
|
+
* Array.from(foundValues) // => [1, 2, 3]
|
|
3614
3481
|
* ```
|
|
3615
3482
|
*
|
|
3616
3483
|
* @category sequencing
|
|
@@ -3627,7 +3494,7 @@ export declare const flatMapNullishOr: {
|
|
|
3627
3494
|
*
|
|
3628
3495
|
* **Example** (Flat mapping nullable results)
|
|
3629
3496
|
*
|
|
3630
|
-
* ```ts
|
|
3497
|
+
* ```ts import.meta.vitest
|
|
3631
3498
|
* import { Iterable } from "effect"
|
|
3632
3499
|
*
|
|
3633
3500
|
* // Extract valid elements from nullable function results
|
|
@@ -3636,7 +3503,7 @@ export declare const flatMapNullishOr: {
|
|
|
3636
3503
|
* const num = parseInt(s)
|
|
3637
3504
|
* return isNaN(num) ? null : num * 2
|
|
3638
3505
|
* })
|
|
3639
|
-
*
|
|
3506
|
+
* Array.from(parsed) // => [2, 4, 8]
|
|
3640
3507
|
*
|
|
3641
3508
|
* // Safe property access
|
|
3642
3509
|
* const objects = [
|
|
@@ -3646,7 +3513,7 @@ export declare const flatMapNullishOr: {
|
|
|
3646
3513
|
* {}
|
|
3647
3514
|
* ]
|
|
3648
3515
|
* const values = Iterable.flatMapNullishOr(objects, (obj) => obj.nested?.value)
|
|
3649
|
-
*
|
|
3516
|
+
* Array.from(values) // => [10, 20]
|
|
3650
3517
|
*
|
|
3651
3518
|
* // Working with Map.get (returns undefined for missing keys)
|
|
3652
3519
|
* const map = new Map([
|
|
@@ -3656,7 +3523,7 @@ export declare const flatMapNullishOr: {
|
|
|
3656
3523
|
* ])
|
|
3657
3524
|
* const keys = ["a", "x", "b", "y", "c"]
|
|
3658
3525
|
* const foundValues = Iterable.flatMapNullishOr(keys, (key) => map.get(key))
|
|
3659
|
-
*
|
|
3526
|
+
* Array.from(foundValues) // => [1, 2, 3]
|
|
3660
3527
|
* ```
|
|
3661
3528
|
*
|
|
3662
3529
|
* @category sequencing
|
|
@@ -3673,7 +3540,7 @@ export declare const flatMapNullishOr: {
|
|
|
3673
3540
|
*
|
|
3674
3541
|
* **Example** (Flat mapping nullable results)
|
|
3675
3542
|
*
|
|
3676
|
-
* ```ts
|
|
3543
|
+
* ```ts import.meta.vitest
|
|
3677
3544
|
* import { Iterable } from "effect"
|
|
3678
3545
|
*
|
|
3679
3546
|
* // Extract valid elements from nullable function results
|
|
@@ -3682,7 +3549,7 @@ export declare const flatMapNullishOr: {
|
|
|
3682
3549
|
* const num = parseInt(s)
|
|
3683
3550
|
* return isNaN(num) ? null : num * 2
|
|
3684
3551
|
* })
|
|
3685
|
-
*
|
|
3552
|
+
* Array.from(parsed) // => [2, 4, 8]
|
|
3686
3553
|
*
|
|
3687
3554
|
* // Safe property access
|
|
3688
3555
|
* const objects = [
|
|
@@ -3692,7 +3559,7 @@ export declare const flatMapNullishOr: {
|
|
|
3692
3559
|
* {}
|
|
3693
3560
|
* ]
|
|
3694
3561
|
* const values = Iterable.flatMapNullishOr(objects, (obj) => obj.nested?.value)
|
|
3695
|
-
*
|
|
3562
|
+
* Array.from(values) // => [10, 20]
|
|
3696
3563
|
*
|
|
3697
3564
|
* // Working with Map.get (returns undefined for missing keys)
|
|
3698
3565
|
* const map = new Map([
|
|
@@ -3702,7 +3569,7 @@ export declare const flatMapNullishOr: {
|
|
|
3702
3569
|
* ])
|
|
3703
3570
|
* const keys = ["a", "x", "b", "y", "c"]
|
|
3704
3571
|
* const foundValues = Iterable.flatMapNullishOr(keys, (key) => map.get(key))
|
|
3705
|
-
*
|
|
3572
|
+
* Array.from(foundValues) // => [1, 2, 3]
|
|
3706
3573
|
* ```
|
|
3707
3574
|
*
|
|
3708
3575
|
* @category sequencing
|
|
@@ -3715,21 +3582,21 @@ export declare const flatMapNullishOr: {
|
|
|
3715
3582
|
*
|
|
3716
3583
|
* **Example** (Checking whether some element matches)
|
|
3717
3584
|
*
|
|
3718
|
-
* ```ts
|
|
3585
|
+
* ```ts import.meta.vitest
|
|
3719
3586
|
* import { Iterable } from "effect"
|
|
3720
3587
|
*
|
|
3721
3588
|
* const numbers = [1, 3, 5, 7, 8]
|
|
3722
3589
|
* const hasEven = Iterable.some(numbers, (x) => x % 2 === 0)
|
|
3723
|
-
*
|
|
3590
|
+
* hasEven // => true
|
|
3724
3591
|
*
|
|
3725
3592
|
* const allOdd = [1, 3, 5, 7]
|
|
3726
3593
|
* const hasEvenInAllOdd = Iterable.some(allOdd, (x) => x % 2 === 0)
|
|
3727
|
-
*
|
|
3594
|
+
* hasEvenInAllOdd // => false
|
|
3728
3595
|
*
|
|
3729
3596
|
* // With index
|
|
3730
3597
|
* const letters = ["a", "b", "c"]
|
|
3731
3598
|
* const hasElementAtIndex2 = Iterable.some(letters, (_, i) => i === 2)
|
|
3732
|
-
*
|
|
3599
|
+
* hasElementAtIndex2 // => true
|
|
3733
3600
|
*
|
|
3734
3601
|
* // Early termination - stops at first match
|
|
3735
3602
|
* const infiniteOdds = Iterable.filter(Iterable.range(1), (x) => x % 2 === 1)
|
|
@@ -3737,7 +3604,7 @@ export declare const flatMapNullishOr: {
|
|
|
3737
3604
|
* Iterable.take(infiniteOdds, 1000),
|
|
3738
3605
|
* (x) => x % 2 === 0
|
|
3739
3606
|
* )
|
|
3740
|
-
*
|
|
3607
|
+
* hasEvenInInfiniteOdds // => false
|
|
3741
3608
|
*
|
|
3742
3609
|
* // Type guard usage
|
|
3743
3610
|
* const mixed: Array<string | number> = [1, 2, "hello"]
|
|
@@ -3745,10 +3612,10 @@ export declare const flatMapNullishOr: {
|
|
|
3745
3612
|
* mixed,
|
|
3746
3613
|
* (x): x is string => typeof x === "string"
|
|
3747
3614
|
* )
|
|
3748
|
-
*
|
|
3615
|
+
* hasString // => true
|
|
3749
3616
|
* ```
|
|
3750
3617
|
*
|
|
3751
|
-
* @category
|
|
3618
|
+
* @category predicates
|
|
3752
3619
|
* @since 2.0.0
|
|
3753
3620
|
*/
|
|
3754
3621
|
export declare const some: {
|
|
@@ -3757,21 +3624,21 @@ export declare const some: {
|
|
|
3757
3624
|
*
|
|
3758
3625
|
* **Example** (Checking whether some element matches)
|
|
3759
3626
|
*
|
|
3760
|
-
* ```ts
|
|
3627
|
+
* ```ts import.meta.vitest
|
|
3761
3628
|
* import { Iterable } from "effect"
|
|
3762
3629
|
*
|
|
3763
3630
|
* const numbers = [1, 3, 5, 7, 8]
|
|
3764
3631
|
* const hasEven = Iterable.some(numbers, (x) => x % 2 === 0)
|
|
3765
|
-
*
|
|
3632
|
+
* hasEven // => true
|
|
3766
3633
|
*
|
|
3767
3634
|
* const allOdd = [1, 3, 5, 7]
|
|
3768
3635
|
* const hasEvenInAllOdd = Iterable.some(allOdd, (x) => x % 2 === 0)
|
|
3769
|
-
*
|
|
3636
|
+
* hasEvenInAllOdd // => false
|
|
3770
3637
|
*
|
|
3771
3638
|
* // With index
|
|
3772
3639
|
* const letters = ["a", "b", "c"]
|
|
3773
3640
|
* const hasElementAtIndex2 = Iterable.some(letters, (_, i) => i === 2)
|
|
3774
|
-
*
|
|
3641
|
+
* hasElementAtIndex2 // => true
|
|
3775
3642
|
*
|
|
3776
3643
|
* // Early termination - stops at first match
|
|
3777
3644
|
* const infiniteOdds = Iterable.filter(Iterable.range(1), (x) => x % 2 === 1)
|
|
@@ -3779,7 +3646,7 @@ export declare const some: {
|
|
|
3779
3646
|
* Iterable.take(infiniteOdds, 1000),
|
|
3780
3647
|
* (x) => x % 2 === 0
|
|
3781
3648
|
* )
|
|
3782
|
-
*
|
|
3649
|
+
* hasEvenInInfiniteOdds // => false
|
|
3783
3650
|
*
|
|
3784
3651
|
* // Type guard usage
|
|
3785
3652
|
* const mixed: Array<string | number> = [1, 2, "hello"]
|
|
@@ -3787,10 +3654,10 @@ export declare const some: {
|
|
|
3787
3654
|
* mixed,
|
|
3788
3655
|
* (x): x is string => typeof x === "string"
|
|
3789
3656
|
* )
|
|
3790
|
-
*
|
|
3657
|
+
* hasString // => true
|
|
3791
3658
|
* ```
|
|
3792
3659
|
*
|
|
3793
|
-
* @category
|
|
3660
|
+
* @category predicates
|
|
3794
3661
|
* @since 2.0.0
|
|
3795
3662
|
*/
|
|
3796
3663
|
<A>(predicate: (a: A, i: number) => boolean): (self: Iterable<A>) => boolean;
|
|
@@ -3799,21 +3666,21 @@ export declare const some: {
|
|
|
3799
3666
|
*
|
|
3800
3667
|
* **Example** (Checking whether some element matches)
|
|
3801
3668
|
*
|
|
3802
|
-
* ```ts
|
|
3669
|
+
* ```ts import.meta.vitest
|
|
3803
3670
|
* import { Iterable } from "effect"
|
|
3804
3671
|
*
|
|
3805
3672
|
* const numbers = [1, 3, 5, 7, 8]
|
|
3806
3673
|
* const hasEven = Iterable.some(numbers, (x) => x % 2 === 0)
|
|
3807
|
-
*
|
|
3674
|
+
* hasEven // => true
|
|
3808
3675
|
*
|
|
3809
3676
|
* const allOdd = [1, 3, 5, 7]
|
|
3810
3677
|
* const hasEvenInAllOdd = Iterable.some(allOdd, (x) => x % 2 === 0)
|
|
3811
|
-
*
|
|
3678
|
+
* hasEvenInAllOdd // => false
|
|
3812
3679
|
*
|
|
3813
3680
|
* // With index
|
|
3814
3681
|
* const letters = ["a", "b", "c"]
|
|
3815
3682
|
* const hasElementAtIndex2 = Iterable.some(letters, (_, i) => i === 2)
|
|
3816
|
-
*
|
|
3683
|
+
* hasElementAtIndex2 // => true
|
|
3817
3684
|
*
|
|
3818
3685
|
* // Early termination - stops at first match
|
|
3819
3686
|
* const infiniteOdds = Iterable.filter(Iterable.range(1), (x) => x % 2 === 1)
|
|
@@ -3821,7 +3688,7 @@ export declare const some: {
|
|
|
3821
3688
|
* Iterable.take(infiniteOdds, 1000),
|
|
3822
3689
|
* (x) => x % 2 === 0
|
|
3823
3690
|
* )
|
|
3824
|
-
*
|
|
3691
|
+
* hasEvenInInfiniteOdds // => false
|
|
3825
3692
|
*
|
|
3826
3693
|
* // Type guard usage
|
|
3827
3694
|
* const mixed: Array<string | number> = [1, 2, "hello"]
|
|
@@ -3829,10 +3696,10 @@ export declare const some: {
|
|
|
3829
3696
|
* mixed,
|
|
3830
3697
|
* (x): x is string => typeof x === "string"
|
|
3831
3698
|
* )
|
|
3832
|
-
*
|
|
3699
|
+
* hasString // => true
|
|
3833
3700
|
* ```
|
|
3834
3701
|
*
|
|
3835
|
-
* @category
|
|
3702
|
+
* @category predicates
|
|
3836
3703
|
* @since 2.0.0
|
|
3837
3704
|
*/
|
|
3838
3705
|
<A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean): boolean;
|
|
@@ -3849,21 +3716,21 @@ export declare const some: {
|
|
|
3849
3716
|
*
|
|
3850
3717
|
* **Example** (Unfolding state into values)
|
|
3851
3718
|
*
|
|
3852
|
-
* ```ts
|
|
3719
|
+
* ```ts import.meta.vitest
|
|
3853
3720
|
* import { Iterable, Option } from "effect"
|
|
3854
3721
|
*
|
|
3855
3722
|
* // Generate Fibonacci sequence
|
|
3856
3723
|
* const fibonacci = Iterable.unfold([0, 1], ([a, b]) => Option.some([a, [b, a + b]]))
|
|
3857
3724
|
* const first10Fib = Iterable.take(fibonacci, 10)
|
|
3858
|
-
*
|
|
3725
|
+
* Array.from(first10Fib) // => [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
|
|
3859
3726
|
*
|
|
3860
3727
|
* // Generate powers of 2 up to a limit
|
|
3861
3728
|
* const powersOf2 = Iterable.unfold(1, (n) => n <= 1000 ? Option.some([n, n * 2]) : Option.none())
|
|
3862
|
-
*
|
|
3729
|
+
* Array.from(powersOf2) // => [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
|
|
3863
3730
|
*
|
|
3864
3731
|
* // Generate countdown
|
|
3865
3732
|
* const countdown = Iterable.unfold(5, (n) => n > 0 ? Option.some([n, n - 1]) : Option.none())
|
|
3866
|
-
*
|
|
3733
|
+
* Array.from(countdown) // => [5, 4, 3, 2, 1]
|
|
3867
3734
|
*
|
|
3868
3735
|
* // Generate collatz sequence
|
|
3869
3736
|
* const collatz = Iterable.unfold(7, (n) => {
|
|
@@ -3871,7 +3738,7 @@ export declare const some: {
|
|
|
3871
3738
|
* const next = n % 2 === 0 ? n / 2 : n * 3 + 1
|
|
3872
3739
|
* return Option.some([n, next])
|
|
3873
3740
|
* })
|
|
3874
|
-
*
|
|
3741
|
+
* Array.from(collatz) // => [7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2]
|
|
3875
3742
|
* ```
|
|
3876
3743
|
*
|
|
3877
3744
|
* @category constructors
|
|
@@ -3883,37 +3750,40 @@ export declare const unfold: <B, A>(b: B, f: (b: B) => Option<readonly [A, B]>)
|
|
|
3883
3750
|
*
|
|
3884
3751
|
* **Example** (Iterating with side effects)
|
|
3885
3752
|
*
|
|
3886
|
-
* ```ts
|
|
3753
|
+
* ```ts import.meta.vitest
|
|
3887
3754
|
* import { Iterable } from "effect"
|
|
3888
3755
|
*
|
|
3889
|
-
* //
|
|
3756
|
+
* // Collect each visited element
|
|
3890
3757
|
* const numbers = [1, 2, 3, 4, 5]
|
|
3891
|
-
*
|
|
3892
|
-
*
|
|
3758
|
+
* const visited: Array<number> = []
|
|
3759
|
+
* Iterable.forEach(numbers, (n) => visited.push(n))
|
|
3760
|
+
* visited // => [1, 2, 3, 4, 5]
|
|
3893
3761
|
*
|
|
3894
3762
|
* // Use index in the callback
|
|
3895
3763
|
* const letters = ["a", "b", "c"]
|
|
3764
|
+
* const indexed: Array<string> = []
|
|
3896
3765
|
* Iterable.forEach(letters, (letter, i) => {
|
|
3897
|
-
*
|
|
3766
|
+
* indexed.push(`${i}: ${letter}`)
|
|
3898
3767
|
* })
|
|
3899
|
-
* //
|
|
3768
|
+
* indexed // => ["0: a", "1: b", "2: c"]
|
|
3900
3769
|
*
|
|
3901
3770
|
* // Side effects with any iterable
|
|
3902
3771
|
* const results: Array<number> = []
|
|
3903
3772
|
* Iterable.forEach(Iterable.range(1, 5), (n) => {
|
|
3904
3773
|
* results.push(n * n)
|
|
3905
3774
|
* })
|
|
3906
|
-
*
|
|
3775
|
+
* results // => [1, 4, 9, 16, 25]
|
|
3907
3776
|
*
|
|
3908
3777
|
* // Process in chunks
|
|
3909
3778
|
* const data = Iterable.chunksOf([1, 2, 3, 4, 5, 6], 2)
|
|
3779
|
+
* const processed: Array<Array<number>> = []
|
|
3910
3780
|
* Iterable.forEach(data, (chunk) => {
|
|
3911
|
-
*
|
|
3781
|
+
* processed.push(Array.from(chunk))
|
|
3912
3782
|
* })
|
|
3913
|
-
* //
|
|
3783
|
+
* processed // => [[1, 2], [3, 4], [5, 6]]
|
|
3914
3784
|
* ```
|
|
3915
3785
|
*
|
|
3916
|
-
* @category
|
|
3786
|
+
* @category traversing
|
|
3917
3787
|
* @since 2.0.0
|
|
3918
3788
|
*/
|
|
3919
3789
|
export declare const forEach: {
|
|
@@ -3922,37 +3792,40 @@ export declare const forEach: {
|
|
|
3922
3792
|
*
|
|
3923
3793
|
* **Example** (Iterating with side effects)
|
|
3924
3794
|
*
|
|
3925
|
-
* ```ts
|
|
3795
|
+
* ```ts import.meta.vitest
|
|
3926
3796
|
* import { Iterable } from "effect"
|
|
3927
3797
|
*
|
|
3928
|
-
* //
|
|
3798
|
+
* // Collect each visited element
|
|
3929
3799
|
* const numbers = [1, 2, 3, 4, 5]
|
|
3930
|
-
*
|
|
3931
|
-
*
|
|
3800
|
+
* const visited: Array<number> = []
|
|
3801
|
+
* Iterable.forEach(numbers, (n) => visited.push(n))
|
|
3802
|
+
* visited // => [1, 2, 3, 4, 5]
|
|
3932
3803
|
*
|
|
3933
3804
|
* // Use index in the callback
|
|
3934
3805
|
* const letters = ["a", "b", "c"]
|
|
3806
|
+
* const indexed: Array<string> = []
|
|
3935
3807
|
* Iterable.forEach(letters, (letter, i) => {
|
|
3936
|
-
*
|
|
3808
|
+
* indexed.push(`${i}: ${letter}`)
|
|
3937
3809
|
* })
|
|
3938
|
-
* //
|
|
3810
|
+
* indexed // => ["0: a", "1: b", "2: c"]
|
|
3939
3811
|
*
|
|
3940
3812
|
* // Side effects with any iterable
|
|
3941
3813
|
* const results: Array<number> = []
|
|
3942
3814
|
* Iterable.forEach(Iterable.range(1, 5), (n) => {
|
|
3943
3815
|
* results.push(n * n)
|
|
3944
3816
|
* })
|
|
3945
|
-
*
|
|
3817
|
+
* results // => [1, 4, 9, 16, 25]
|
|
3946
3818
|
*
|
|
3947
3819
|
* // Process in chunks
|
|
3948
3820
|
* const data = Iterable.chunksOf([1, 2, 3, 4, 5, 6], 2)
|
|
3821
|
+
* const processed: Array<Array<number>> = []
|
|
3949
3822
|
* Iterable.forEach(data, (chunk) => {
|
|
3950
|
-
*
|
|
3823
|
+
* processed.push(Array.from(chunk))
|
|
3951
3824
|
* })
|
|
3952
|
-
* //
|
|
3825
|
+
* processed // => [[1, 2], [3, 4], [5, 6]]
|
|
3953
3826
|
* ```
|
|
3954
3827
|
*
|
|
3955
|
-
* @category
|
|
3828
|
+
* @category traversing
|
|
3956
3829
|
* @since 2.0.0
|
|
3957
3830
|
*/
|
|
3958
3831
|
<A>(f: (a: A, i: number) => void): (self: Iterable<A>) => void;
|
|
@@ -3961,37 +3834,40 @@ export declare const forEach: {
|
|
|
3961
3834
|
*
|
|
3962
3835
|
* **Example** (Iterating with side effects)
|
|
3963
3836
|
*
|
|
3964
|
-
* ```ts
|
|
3837
|
+
* ```ts import.meta.vitest
|
|
3965
3838
|
* import { Iterable } from "effect"
|
|
3966
3839
|
*
|
|
3967
|
-
* //
|
|
3840
|
+
* // Collect each visited element
|
|
3968
3841
|
* const numbers = [1, 2, 3, 4, 5]
|
|
3969
|
-
*
|
|
3970
|
-
*
|
|
3842
|
+
* const visited: Array<number> = []
|
|
3843
|
+
* Iterable.forEach(numbers, (n) => visited.push(n))
|
|
3844
|
+
* visited // => [1, 2, 3, 4, 5]
|
|
3971
3845
|
*
|
|
3972
3846
|
* // Use index in the callback
|
|
3973
3847
|
* const letters = ["a", "b", "c"]
|
|
3848
|
+
* const indexed: Array<string> = []
|
|
3974
3849
|
* Iterable.forEach(letters, (letter, i) => {
|
|
3975
|
-
*
|
|
3850
|
+
* indexed.push(`${i}: ${letter}`)
|
|
3976
3851
|
* })
|
|
3977
|
-
* //
|
|
3852
|
+
* indexed // => ["0: a", "1: b", "2: c"]
|
|
3978
3853
|
*
|
|
3979
3854
|
* // Side effects with any iterable
|
|
3980
3855
|
* const results: Array<number> = []
|
|
3981
3856
|
* Iterable.forEach(Iterable.range(1, 5), (n) => {
|
|
3982
3857
|
* results.push(n * n)
|
|
3983
3858
|
* })
|
|
3984
|
-
*
|
|
3859
|
+
* results // => [1, 4, 9, 16, 25]
|
|
3985
3860
|
*
|
|
3986
3861
|
* // Process in chunks
|
|
3987
3862
|
* const data = Iterable.chunksOf([1, 2, 3, 4, 5, 6], 2)
|
|
3863
|
+
* const processed: Array<Array<number>> = []
|
|
3988
3864
|
* Iterable.forEach(data, (chunk) => {
|
|
3989
|
-
*
|
|
3865
|
+
* processed.push(Array.from(chunk))
|
|
3990
3866
|
* })
|
|
3991
|
-
* //
|
|
3867
|
+
* processed // => [[1, 2], [3, 4], [5, 6]]
|
|
3992
3868
|
* ```
|
|
3993
3869
|
*
|
|
3994
|
-
* @category
|
|
3870
|
+
* @category traversing
|
|
3995
3871
|
* @since 2.0.0
|
|
3996
3872
|
*/
|
|
3997
3873
|
<A>(self: Iterable<A>, f: (a: A, i: number) => void): void;
|
|
@@ -4006,18 +3882,17 @@ export declare const forEach: {
|
|
|
4006
3882
|
*
|
|
4007
3883
|
* **Example** (Reducing an iterable)
|
|
4008
3884
|
*
|
|
4009
|
-
* ```ts
|
|
3885
|
+
* ```ts import.meta.vitest
|
|
4010
3886
|
* import { Iterable } from "effect"
|
|
4011
3887
|
*
|
|
4012
3888
|
* // Sum all numbers
|
|
4013
3889
|
* const numbers = [1, 2, 3, 4, 5]
|
|
4014
3890
|
* const sum = Iterable.reduce(numbers, 0, (acc, n) => acc + n)
|
|
4015
|
-
*
|
|
3891
|
+
* sum // => 15
|
|
4016
3892
|
*
|
|
4017
3893
|
* // Find maximum value
|
|
4018
3894
|
* const values = [3, 1, 4, 1, 5, 9, 2]
|
|
4019
|
-
*
|
|
4020
|
-
* console.log(max) // 9
|
|
3895
|
+
* Iterable.reduce(values, -Infinity, (max, value) => Math.max(max, value)) // => 9
|
|
4021
3896
|
*
|
|
4022
3897
|
* // Build an object from key-value pairs
|
|
4023
3898
|
* const pairs = [["a", 1], ["b", 2], ["c", 3]] as const
|
|
@@ -4029,7 +3904,7 @@ export declare const forEach: {
|
|
|
4029
3904
|
* return acc
|
|
4030
3905
|
* }
|
|
4031
3906
|
* )
|
|
4032
|
-
*
|
|
3907
|
+
* obj // => { a: 1, b: 2, c: 3 }
|
|
4033
3908
|
*
|
|
4034
3909
|
* // Use index in the reducer
|
|
4035
3910
|
* const letters = ["a", "b", "c"]
|
|
@@ -4041,7 +3916,7 @@ export declare const forEach: {
|
|
|
4041
3916
|
* return acc
|
|
4042
3917
|
* }
|
|
4043
3918
|
* )
|
|
4044
|
-
*
|
|
3919
|
+
* indexed // => ["0: a", "1: b", "2: c"]
|
|
4045
3920
|
* ```
|
|
4046
3921
|
*
|
|
4047
3922
|
* @category folding
|
|
@@ -4058,18 +3933,17 @@ export declare const reduce: {
|
|
|
4058
3933
|
*
|
|
4059
3934
|
* **Example** (Reducing an iterable)
|
|
4060
3935
|
*
|
|
4061
|
-
* ```ts
|
|
3936
|
+
* ```ts import.meta.vitest
|
|
4062
3937
|
* import { Iterable } from "effect"
|
|
4063
3938
|
*
|
|
4064
3939
|
* // Sum all numbers
|
|
4065
3940
|
* const numbers = [1, 2, 3, 4, 5]
|
|
4066
3941
|
* const sum = Iterable.reduce(numbers, 0, (acc, n) => acc + n)
|
|
4067
|
-
*
|
|
3942
|
+
* sum // => 15
|
|
4068
3943
|
*
|
|
4069
3944
|
* // Find maximum value
|
|
4070
3945
|
* const values = [3, 1, 4, 1, 5, 9, 2]
|
|
4071
|
-
*
|
|
4072
|
-
* console.log(max) // 9
|
|
3946
|
+
* Iterable.reduce(values, -Infinity, (max, value) => Math.max(max, value)) // => 9
|
|
4073
3947
|
*
|
|
4074
3948
|
* // Build an object from key-value pairs
|
|
4075
3949
|
* const pairs = [["a", 1], ["b", 2], ["c", 3]] as const
|
|
@@ -4081,7 +3955,7 @@ export declare const reduce: {
|
|
|
4081
3955
|
* return acc
|
|
4082
3956
|
* }
|
|
4083
3957
|
* )
|
|
4084
|
-
*
|
|
3958
|
+
* obj // => { a: 1, b: 2, c: 3 }
|
|
4085
3959
|
*
|
|
4086
3960
|
* // Use index in the reducer
|
|
4087
3961
|
* const letters = ["a", "b", "c"]
|
|
@@ -4093,7 +3967,7 @@ export declare const reduce: {
|
|
|
4093
3967
|
* return acc
|
|
4094
3968
|
* }
|
|
4095
3969
|
* )
|
|
4096
|
-
*
|
|
3970
|
+
* indexed // => ["0: a", "1: b", "2: c"]
|
|
4097
3971
|
* ```
|
|
4098
3972
|
*
|
|
4099
3973
|
* @category folding
|
|
@@ -4110,18 +3984,17 @@ export declare const reduce: {
|
|
|
4110
3984
|
*
|
|
4111
3985
|
* **Example** (Reducing an iterable)
|
|
4112
3986
|
*
|
|
4113
|
-
* ```ts
|
|
3987
|
+
* ```ts import.meta.vitest
|
|
4114
3988
|
* import { Iterable } from "effect"
|
|
4115
3989
|
*
|
|
4116
3990
|
* // Sum all numbers
|
|
4117
3991
|
* const numbers = [1, 2, 3, 4, 5]
|
|
4118
3992
|
* const sum = Iterable.reduce(numbers, 0, (acc, n) => acc + n)
|
|
4119
|
-
*
|
|
3993
|
+
* sum // => 15
|
|
4120
3994
|
*
|
|
4121
3995
|
* // Find maximum value
|
|
4122
3996
|
* const values = [3, 1, 4, 1, 5, 9, 2]
|
|
4123
|
-
*
|
|
4124
|
-
* console.log(max) // 9
|
|
3997
|
+
* Iterable.reduce(values, -Infinity, (max, value) => Math.max(max, value)) // => 9
|
|
4125
3998
|
*
|
|
4126
3999
|
* // Build an object from key-value pairs
|
|
4127
4000
|
* const pairs = [["a", 1], ["b", 2], ["c", 3]] as const
|
|
@@ -4133,7 +4006,7 @@ export declare const reduce: {
|
|
|
4133
4006
|
* return acc
|
|
4134
4007
|
* }
|
|
4135
4008
|
* )
|
|
4136
|
-
*
|
|
4009
|
+
* obj // => { a: 1, b: 2, c: 3 }
|
|
4137
4010
|
*
|
|
4138
4011
|
* // Use index in the reducer
|
|
4139
4012
|
* const letters = ["a", "b", "c"]
|
|
@@ -4145,7 +4018,7 @@ export declare const reduce: {
|
|
|
4145
4018
|
* return acc
|
|
4146
4019
|
* }
|
|
4147
4020
|
* )
|
|
4148
|
-
*
|
|
4021
|
+
* indexed // => ["0: a", "1: b", "2: c"]
|
|
4149
4022
|
* ```
|
|
4150
4023
|
*
|
|
4151
4024
|
* @category folding
|
|
@@ -4158,20 +4031,20 @@ export declare const reduce: {
|
|
|
4158
4031
|
*
|
|
4159
4032
|
* **Example** (Deduplicating adjacent elements with custom equivalence)
|
|
4160
4033
|
*
|
|
4161
|
-
* ```ts
|
|
4034
|
+
* ```ts import.meta.vitest
|
|
4162
4035
|
* import { Iterable } from "effect"
|
|
4163
4036
|
*
|
|
4164
4037
|
* // Remove adjacent duplicates with custom equality
|
|
4165
4038
|
* const numbers = [1, 1, 2, 2, 3, 1, 1]
|
|
4166
4039
|
* const dedupedNumbers = Iterable.dedupeAdjacentWith(numbers, (a, b) => a === b)
|
|
4167
|
-
*
|
|
4040
|
+
* Array.from(dedupedNumbers) // => [1, 2, 3, 1]
|
|
4168
4041
|
*
|
|
4169
4042
|
* // Case-insensitive deduplication
|
|
4170
4043
|
* const words = ["Hello", "HELLO", "world", "World", "test"]
|
|
4171
4044
|
* const caseInsensitive = (a: string, b: string) =>
|
|
4172
4045
|
* a.toLowerCase() === b.toLowerCase()
|
|
4173
4046
|
* const dedupedWords = Iterable.dedupeAdjacentWith(words, caseInsensitive)
|
|
4174
|
-
*
|
|
4047
|
+
* Array.from(dedupedWords) // => ["Hello", "world", "test"]
|
|
4175
4048
|
*
|
|
4176
4049
|
* // Deduplication by object property
|
|
4177
4050
|
* const users = [
|
|
@@ -4183,13 +4056,13 @@ export declare const reduce: {
|
|
|
4183
4056
|
* ]
|
|
4184
4057
|
* const byId = (a: typeof users[0], b: typeof users[0]) => a.id === b.id
|
|
4185
4058
|
* const dedupedUsers = Iterable.dedupeAdjacentWith(users, byId)
|
|
4186
|
-
*
|
|
4059
|
+
* Array.from(dedupedUsers, (user) => user.id) // => [1, 2, 3]
|
|
4187
4060
|
*
|
|
4188
4061
|
* // Approximate numeric equality
|
|
4189
4062
|
* const floats = [1.0, 1.01, 1.02, 2.0, 2.01, 3.0]
|
|
4190
4063
|
* const approxEqual = (a: number, b: number) => Math.abs(a - b) < 0.1
|
|
4191
4064
|
* const dedupedFloats = Iterable.dedupeAdjacentWith(floats, approxEqual)
|
|
4192
|
-
*
|
|
4065
|
+
* Array.from(dedupedFloats) // => [1, 2, 3]
|
|
4193
4066
|
* ```
|
|
4194
4067
|
*
|
|
4195
4068
|
* @category filtering
|
|
@@ -4201,20 +4074,20 @@ export declare const dedupeAdjacentWith: {
|
|
|
4201
4074
|
*
|
|
4202
4075
|
* **Example** (Deduplicating adjacent elements with custom equivalence)
|
|
4203
4076
|
*
|
|
4204
|
-
* ```ts
|
|
4077
|
+
* ```ts import.meta.vitest
|
|
4205
4078
|
* import { Iterable } from "effect"
|
|
4206
4079
|
*
|
|
4207
4080
|
* // Remove adjacent duplicates with custom equality
|
|
4208
4081
|
* const numbers = [1, 1, 2, 2, 3, 1, 1]
|
|
4209
4082
|
* const dedupedNumbers = Iterable.dedupeAdjacentWith(numbers, (a, b) => a === b)
|
|
4210
|
-
*
|
|
4083
|
+
* Array.from(dedupedNumbers) // => [1, 2, 3, 1]
|
|
4211
4084
|
*
|
|
4212
4085
|
* // Case-insensitive deduplication
|
|
4213
4086
|
* const words = ["Hello", "HELLO", "world", "World", "test"]
|
|
4214
4087
|
* const caseInsensitive = (a: string, b: string) =>
|
|
4215
4088
|
* a.toLowerCase() === b.toLowerCase()
|
|
4216
4089
|
* const dedupedWords = Iterable.dedupeAdjacentWith(words, caseInsensitive)
|
|
4217
|
-
*
|
|
4090
|
+
* Array.from(dedupedWords) // => ["Hello", "world", "test"]
|
|
4218
4091
|
*
|
|
4219
4092
|
* // Deduplication by object property
|
|
4220
4093
|
* const users = [
|
|
@@ -4226,13 +4099,13 @@ export declare const dedupeAdjacentWith: {
|
|
|
4226
4099
|
* ]
|
|
4227
4100
|
* const byId = (a: typeof users[0], b: typeof users[0]) => a.id === b.id
|
|
4228
4101
|
* const dedupedUsers = Iterable.dedupeAdjacentWith(users, byId)
|
|
4229
|
-
*
|
|
4102
|
+
* Array.from(dedupedUsers, (user) => user.id) // => [1, 2, 3]
|
|
4230
4103
|
*
|
|
4231
4104
|
* // Approximate numeric equality
|
|
4232
4105
|
* const floats = [1.0, 1.01, 1.02, 2.0, 2.01, 3.0]
|
|
4233
4106
|
* const approxEqual = (a: number, b: number) => Math.abs(a - b) < 0.1
|
|
4234
4107
|
* const dedupedFloats = Iterable.dedupeAdjacentWith(floats, approxEqual)
|
|
4235
|
-
*
|
|
4108
|
+
* Array.from(dedupedFloats) // => [1, 2, 3]
|
|
4236
4109
|
* ```
|
|
4237
4110
|
*
|
|
4238
4111
|
* @category filtering
|
|
@@ -4244,20 +4117,20 @@ export declare const dedupeAdjacentWith: {
|
|
|
4244
4117
|
*
|
|
4245
4118
|
* **Example** (Deduplicating adjacent elements with custom equivalence)
|
|
4246
4119
|
*
|
|
4247
|
-
* ```ts
|
|
4120
|
+
* ```ts import.meta.vitest
|
|
4248
4121
|
* import { Iterable } from "effect"
|
|
4249
4122
|
*
|
|
4250
4123
|
* // Remove adjacent duplicates with custom equality
|
|
4251
4124
|
* const numbers = [1, 1, 2, 2, 3, 1, 1]
|
|
4252
4125
|
* const dedupedNumbers = Iterable.dedupeAdjacentWith(numbers, (a, b) => a === b)
|
|
4253
|
-
*
|
|
4126
|
+
* Array.from(dedupedNumbers) // => [1, 2, 3, 1]
|
|
4254
4127
|
*
|
|
4255
4128
|
* // Case-insensitive deduplication
|
|
4256
4129
|
* const words = ["Hello", "HELLO", "world", "World", "test"]
|
|
4257
4130
|
* const caseInsensitive = (a: string, b: string) =>
|
|
4258
4131
|
* a.toLowerCase() === b.toLowerCase()
|
|
4259
4132
|
* const dedupedWords = Iterable.dedupeAdjacentWith(words, caseInsensitive)
|
|
4260
|
-
*
|
|
4133
|
+
* Array.from(dedupedWords) // => ["Hello", "world", "test"]
|
|
4261
4134
|
*
|
|
4262
4135
|
* // Deduplication by object property
|
|
4263
4136
|
* const users = [
|
|
@@ -4269,13 +4142,13 @@ export declare const dedupeAdjacentWith: {
|
|
|
4269
4142
|
* ]
|
|
4270
4143
|
* const byId = (a: typeof users[0], b: typeof users[0]) => a.id === b.id
|
|
4271
4144
|
* const dedupedUsers = Iterable.dedupeAdjacentWith(users, byId)
|
|
4272
|
-
*
|
|
4145
|
+
* Array.from(dedupedUsers, (user) => user.id) // => [1, 2, 3]
|
|
4273
4146
|
*
|
|
4274
4147
|
* // Approximate numeric equality
|
|
4275
4148
|
* const floats = [1.0, 1.01, 1.02, 2.0, 2.01, 3.0]
|
|
4276
4149
|
* const approxEqual = (a: number, b: number) => Math.abs(a - b) < 0.1
|
|
4277
4150
|
* const dedupedFloats = Iterable.dedupeAdjacentWith(floats, approxEqual)
|
|
4278
|
-
*
|
|
4151
|
+
* Array.from(dedupedFloats) // => [1, 2, 3]
|
|
4279
4152
|
* ```
|
|
4280
4153
|
*
|
|
4281
4154
|
* @category filtering
|
|
@@ -4288,18 +4161,18 @@ export declare const dedupeAdjacentWith: {
|
|
|
4288
4161
|
*
|
|
4289
4162
|
* **Example** (Deduplicating adjacent elements)
|
|
4290
4163
|
*
|
|
4291
|
-
* ```ts
|
|
4164
|
+
* ```ts import.meta.vitest
|
|
4292
4165
|
* import { Iterable } from "effect"
|
|
4293
4166
|
*
|
|
4294
4167
|
* // Remove adjacent duplicate numbers
|
|
4295
4168
|
* const numbers = [1, 1, 2, 2, 2, 3, 1, 1]
|
|
4296
4169
|
* const deduped = Iterable.dedupeAdjacent(numbers)
|
|
4297
|
-
*
|
|
4170
|
+
* Array.from(deduped) // => [1, 2, 3, 1]
|
|
4298
4171
|
*
|
|
4299
4172
|
* // Remove adjacent duplicate characters
|
|
4300
4173
|
* const letters = "aabbccaa"
|
|
4301
4174
|
* const dedupedLetters = Iterable.dedupeAdjacent(letters)
|
|
4302
|
-
*
|
|
4175
|
+
* Array.from(dedupedLetters) // => ["a", "b", "c", "a"]
|
|
4303
4176
|
*
|
|
4304
4177
|
* // Works with objects using deep equality
|
|
4305
4178
|
* const objects = [
|
|
@@ -4310,12 +4183,12 @@ export declare const dedupeAdjacentWith: {
|
|
|
4310
4183
|
* { type: "A" }
|
|
4311
4184
|
* ]
|
|
4312
4185
|
* const dedupedObjects = Iterable.dedupeAdjacent(objects)
|
|
4313
|
-
*
|
|
4186
|
+
* Array.from(dedupedObjects, (object) => object.type) // => ["A", "B", "A"]
|
|
4314
4187
|
*
|
|
4315
4188
|
* // Clean up streaming data
|
|
4316
4189
|
* const sensorData = [100, 100, 100, 101, 101, 102, 102, 102, 100]
|
|
4317
4190
|
* const cleanedData = Iterable.dedupeAdjacent(sensorData)
|
|
4318
|
-
*
|
|
4191
|
+
* Array.from(cleanedData) // => [100, 101, 102, 100]
|
|
4319
4192
|
* ```
|
|
4320
4193
|
*
|
|
4321
4194
|
* @category filtering
|
|
@@ -4327,14 +4200,14 @@ export declare const dedupeAdjacent: <A>(self: Iterable<A>) => Iterable<A>;
|
|
|
4327
4200
|
*
|
|
4328
4201
|
* **Example** (Combining cartesian products)
|
|
4329
4202
|
*
|
|
4330
|
-
* ```ts
|
|
4203
|
+
* ```ts import.meta.vitest
|
|
4331
4204
|
* import { Iterable } from "effect"
|
|
4332
4205
|
*
|
|
4333
4206
|
* // Create coordinate pairs
|
|
4334
4207
|
* const xs = [1, 2]
|
|
4335
4208
|
* const ys = ["a", "b", "c"]
|
|
4336
4209
|
* const coordinates = Iterable.cartesianWith(xs, ys, (x, y) => `(${x},${y})`)
|
|
4337
|
-
*
|
|
4210
|
+
* Array.from(coordinates) // => ["(1,a)", "(1,b)", "(1,c)", "(2,a)", "(2,b)", "(2,c)"]
|
|
4338
4211
|
*
|
|
4339
4212
|
* // Generate all combinations of options
|
|
4340
4213
|
* const sizes = ["S", "M", "L"]
|
|
@@ -4344,18 +4217,13 @@ export declare const dedupeAdjacent: <A>(self: Iterable<A>) => Iterable<A>;
|
|
|
4344
4217
|
* colors,
|
|
4345
4218
|
* (size, color) => ({ size, color })
|
|
4346
4219
|
* )
|
|
4347
|
-
*
|
|
4348
|
-
* // [
|
|
4349
|
-
* // { size: "S", color: "red" }, { size: "S", color: "blue" },
|
|
4350
|
-
* // { size: "M", color: "red" }, { size: "M", color: "blue" },
|
|
4351
|
-
* // { size: "L", color: "red" }, { size: "L", color: "blue" }
|
|
4352
|
-
* // ]
|
|
4220
|
+
* Array.from(products, ({ color, size }) => `${size}:${color}`) // => ["S:red", "S:blue", "M:red", "M:blue", "L:red", "L:blue"]
|
|
4353
4221
|
*
|
|
4354
4222
|
* // Mathematical operations on all pairs
|
|
4355
4223
|
* const a = [1, 2, 3]
|
|
4356
4224
|
* const b = [10, 20]
|
|
4357
4225
|
* const mathProducts = Iterable.cartesianWith(a, b, (x, y) => x * y)
|
|
4358
|
-
*
|
|
4226
|
+
* Array.from(mathProducts) // => [10, 20, 20, 40, 30, 60]
|
|
4359
4227
|
*
|
|
4360
4228
|
* // Create test data combinations
|
|
4361
4229
|
* const userTypes = ["admin", "user"]
|
|
@@ -4365,11 +4233,10 @@ export declare const dedupeAdjacent: <A>(self: Iterable<A>) => Iterable<A>;
|
|
|
4365
4233
|
* features,
|
|
4366
4234
|
* (user, feature) => `${user}_can_${feature}`
|
|
4367
4235
|
* )
|
|
4368
|
-
*
|
|
4369
|
-
* // ["admin_can_read", "admin_can_write", "admin_can_delete", "user_can_read", "user_can_write", "user_can_delete"]
|
|
4236
|
+
* Array.from(testCases) // => ["admin_can_read", "admin_can_write", "admin_can_delete", "user_can_read", "user_can_write", "user_can_delete"]
|
|
4370
4237
|
* ```
|
|
4371
4238
|
*
|
|
4372
|
-
* @category
|
|
4239
|
+
* @category combining
|
|
4373
4240
|
* @since 2.0.0
|
|
4374
4241
|
*/
|
|
4375
4242
|
export declare const cartesianWith: {
|
|
@@ -4378,14 +4245,14 @@ export declare const cartesianWith: {
|
|
|
4378
4245
|
*
|
|
4379
4246
|
* **Example** (Combining cartesian products)
|
|
4380
4247
|
*
|
|
4381
|
-
* ```ts
|
|
4248
|
+
* ```ts import.meta.vitest
|
|
4382
4249
|
* import { Iterable } from "effect"
|
|
4383
4250
|
*
|
|
4384
4251
|
* // Create coordinate pairs
|
|
4385
4252
|
* const xs = [1, 2]
|
|
4386
4253
|
* const ys = ["a", "b", "c"]
|
|
4387
4254
|
* const coordinates = Iterable.cartesianWith(xs, ys, (x, y) => `(${x},${y})`)
|
|
4388
|
-
*
|
|
4255
|
+
* Array.from(coordinates) // => ["(1,a)", "(1,b)", "(1,c)", "(2,a)", "(2,b)", "(2,c)"]
|
|
4389
4256
|
*
|
|
4390
4257
|
* // Generate all combinations of options
|
|
4391
4258
|
* const sizes = ["S", "M", "L"]
|
|
@@ -4395,18 +4262,13 @@ export declare const cartesianWith: {
|
|
|
4395
4262
|
* colors,
|
|
4396
4263
|
* (size, color) => ({ size, color })
|
|
4397
4264
|
* )
|
|
4398
|
-
*
|
|
4399
|
-
* // [
|
|
4400
|
-
* // { size: "S", color: "red" }, { size: "S", color: "blue" },
|
|
4401
|
-
* // { size: "M", color: "red" }, { size: "M", color: "blue" },
|
|
4402
|
-
* // { size: "L", color: "red" }, { size: "L", color: "blue" }
|
|
4403
|
-
* // ]
|
|
4265
|
+
* Array.from(products, ({ color, size }) => `${size}:${color}`) // => ["S:red", "S:blue", "M:red", "M:blue", "L:red", "L:blue"]
|
|
4404
4266
|
*
|
|
4405
4267
|
* // Mathematical operations on all pairs
|
|
4406
4268
|
* const a = [1, 2, 3]
|
|
4407
4269
|
* const b = [10, 20]
|
|
4408
4270
|
* const mathProducts = Iterable.cartesianWith(a, b, (x, y) => x * y)
|
|
4409
|
-
*
|
|
4271
|
+
* Array.from(mathProducts) // => [10, 20, 20, 40, 30, 60]
|
|
4410
4272
|
*
|
|
4411
4273
|
* // Create test data combinations
|
|
4412
4274
|
* const userTypes = ["admin", "user"]
|
|
@@ -4416,11 +4278,10 @@ export declare const cartesianWith: {
|
|
|
4416
4278
|
* features,
|
|
4417
4279
|
* (user, feature) => `${user}_can_${feature}`
|
|
4418
4280
|
* )
|
|
4419
|
-
*
|
|
4420
|
-
* // ["admin_can_read", "admin_can_write", "admin_can_delete", "user_can_read", "user_can_write", "user_can_delete"]
|
|
4281
|
+
* Array.from(testCases) // => ["admin_can_read", "admin_can_write", "admin_can_delete", "user_can_read", "user_can_write", "user_can_delete"]
|
|
4421
4282
|
* ```
|
|
4422
4283
|
*
|
|
4423
|
-
* @category
|
|
4284
|
+
* @category combining
|
|
4424
4285
|
* @since 2.0.0
|
|
4425
4286
|
*/
|
|
4426
4287
|
<A, B, C>(that: Iterable<B>, f: (a: A, b: B) => C): (self: Iterable<A>) => Iterable<C>;
|
|
@@ -4429,14 +4290,14 @@ export declare const cartesianWith: {
|
|
|
4429
4290
|
*
|
|
4430
4291
|
* **Example** (Combining cartesian products)
|
|
4431
4292
|
*
|
|
4432
|
-
* ```ts
|
|
4293
|
+
* ```ts import.meta.vitest
|
|
4433
4294
|
* import { Iterable } from "effect"
|
|
4434
4295
|
*
|
|
4435
4296
|
* // Create coordinate pairs
|
|
4436
4297
|
* const xs = [1, 2]
|
|
4437
4298
|
* const ys = ["a", "b", "c"]
|
|
4438
4299
|
* const coordinates = Iterable.cartesianWith(xs, ys, (x, y) => `(${x},${y})`)
|
|
4439
|
-
*
|
|
4300
|
+
* Array.from(coordinates) // => ["(1,a)", "(1,b)", "(1,c)", "(2,a)", "(2,b)", "(2,c)"]
|
|
4440
4301
|
*
|
|
4441
4302
|
* // Generate all combinations of options
|
|
4442
4303
|
* const sizes = ["S", "M", "L"]
|
|
@@ -4446,18 +4307,13 @@ export declare const cartesianWith: {
|
|
|
4446
4307
|
* colors,
|
|
4447
4308
|
* (size, color) => ({ size, color })
|
|
4448
4309
|
* )
|
|
4449
|
-
*
|
|
4450
|
-
* // [
|
|
4451
|
-
* // { size: "S", color: "red" }, { size: "S", color: "blue" },
|
|
4452
|
-
* // { size: "M", color: "red" }, { size: "M", color: "blue" },
|
|
4453
|
-
* // { size: "L", color: "red" }, { size: "L", color: "blue" }
|
|
4454
|
-
* // ]
|
|
4310
|
+
* Array.from(products, ({ color, size }) => `${size}:${color}`) // => ["S:red", "S:blue", "M:red", "M:blue", "L:red", "L:blue"]
|
|
4455
4311
|
*
|
|
4456
4312
|
* // Mathematical operations on all pairs
|
|
4457
4313
|
* const a = [1, 2, 3]
|
|
4458
4314
|
* const b = [10, 20]
|
|
4459
4315
|
* const mathProducts = Iterable.cartesianWith(a, b, (x, y) => x * y)
|
|
4460
|
-
*
|
|
4316
|
+
* Array.from(mathProducts) // => [10, 20, 20, 40, 30, 60]
|
|
4461
4317
|
*
|
|
4462
4318
|
* // Create test data combinations
|
|
4463
4319
|
* const userTypes = ["admin", "user"]
|
|
@@ -4467,11 +4323,10 @@ export declare const cartesianWith: {
|
|
|
4467
4323
|
* features,
|
|
4468
4324
|
* (user, feature) => `${user}_can_${feature}`
|
|
4469
4325
|
* )
|
|
4470
|
-
*
|
|
4471
|
-
* // ["admin_can_read", "admin_can_write", "admin_can_delete", "user_can_read", "user_can_write", "user_can_delete"]
|
|
4326
|
+
* Array.from(testCases) // => ["admin_can_read", "admin_can_write", "admin_can_delete", "user_can_read", "user_can_write", "user_can_delete"]
|
|
4472
4327
|
* ```
|
|
4473
4328
|
*
|
|
4474
|
-
* @category
|
|
4329
|
+
* @category combining
|
|
4475
4330
|
* @since 2.0.0
|
|
4476
4331
|
*/
|
|
4477
4332
|
<A, B, C>(self: Iterable<A>, that: Iterable<B>, f: (a: A, b: B) => C): Iterable<C>;
|
|
@@ -4481,40 +4336,34 @@ export declare const cartesianWith: {
|
|
|
4481
4336
|
*
|
|
4482
4337
|
* **Example** (Generating cartesian pairs)
|
|
4483
4338
|
*
|
|
4484
|
-
* ```ts
|
|
4339
|
+
* ```ts import.meta.vitest
|
|
4485
4340
|
* import { Iterable } from "effect"
|
|
4486
4341
|
*
|
|
4487
4342
|
* // All pairs of numbers and letters
|
|
4488
4343
|
* const numbers = [1, 2, 3]
|
|
4489
4344
|
* const letters = ["a", "b"]
|
|
4490
4345
|
* const pairs = Iterable.cartesian(numbers, letters)
|
|
4491
|
-
*
|
|
4492
|
-
* // [[1, "a"], [1, "b"], [2, "a"], [2, "b"], [3, "a"], [3, "b"]]
|
|
4346
|
+
* Array.from(pairs) // => [[1, "a"], [1, "b"], [2, "a"], [2, "b"], [3, "a"], [3, "b"]]
|
|
4493
4347
|
*
|
|
4494
4348
|
* // Generate coordinate grid
|
|
4495
4349
|
* const x = [0, 1, 2]
|
|
4496
4350
|
* const y = [0, 1]
|
|
4497
4351
|
* const grid = Iterable.cartesian(x, y)
|
|
4498
|
-
*
|
|
4499
|
-
* // [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1]]
|
|
4352
|
+
* Array.from(grid) // => [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1]]
|
|
4500
4353
|
*
|
|
4501
4354
|
* // All combinations for testing
|
|
4502
4355
|
* const browsers = ["chrome", "firefox"]
|
|
4503
4356
|
* const devices = ["desktop", "mobile", "tablet"]
|
|
4504
4357
|
* const testMatrix = Iterable.cartesian(browsers, devices)
|
|
4505
|
-
*
|
|
4506
|
-
* // [
|
|
4507
|
-
* // ["chrome", "desktop"], ["chrome", "mobile"], ["chrome", "tablet"],
|
|
4508
|
-
* // ["firefox", "desktop"], ["firefox", "mobile"], ["firefox", "tablet"]
|
|
4509
|
-
* // ]
|
|
4358
|
+
* Array.from(testMatrix, ([browser, device]) => `${browser}:${device}`) // => ["chrome:desktop", "chrome:mobile", "chrome:tablet", "firefox:desktop", "firefox:mobile", "firefox:tablet"]
|
|
4510
4359
|
*
|
|
4511
4360
|
* // Empty iterable results in empty cartesian product
|
|
4512
4361
|
* const empty = Iterable.empty<number>()
|
|
4513
4362
|
* const withEmpty = Iterable.cartesian([1, 2], empty)
|
|
4514
|
-
*
|
|
4363
|
+
* Array.from(withEmpty) // => []
|
|
4515
4364
|
* ```
|
|
4516
4365
|
*
|
|
4517
|
-
* @category
|
|
4366
|
+
* @category combining
|
|
4518
4367
|
* @since 2.0.0
|
|
4519
4368
|
*/
|
|
4520
4369
|
export declare const cartesian: {
|
|
@@ -4523,40 +4372,34 @@ export declare const cartesian: {
|
|
|
4523
4372
|
*
|
|
4524
4373
|
* **Example** (Generating cartesian pairs)
|
|
4525
4374
|
*
|
|
4526
|
-
* ```ts
|
|
4375
|
+
* ```ts import.meta.vitest
|
|
4527
4376
|
* import { Iterable } from "effect"
|
|
4528
4377
|
*
|
|
4529
4378
|
* // All pairs of numbers and letters
|
|
4530
4379
|
* const numbers = [1, 2, 3]
|
|
4531
4380
|
* const letters = ["a", "b"]
|
|
4532
4381
|
* const pairs = Iterable.cartesian(numbers, letters)
|
|
4533
|
-
*
|
|
4534
|
-
* // [[1, "a"], [1, "b"], [2, "a"], [2, "b"], [3, "a"], [3, "b"]]
|
|
4382
|
+
* Array.from(pairs) // => [[1, "a"], [1, "b"], [2, "a"], [2, "b"], [3, "a"], [3, "b"]]
|
|
4535
4383
|
*
|
|
4536
4384
|
* // Generate coordinate grid
|
|
4537
4385
|
* const x = [0, 1, 2]
|
|
4538
4386
|
* const y = [0, 1]
|
|
4539
4387
|
* const grid = Iterable.cartesian(x, y)
|
|
4540
|
-
*
|
|
4541
|
-
* // [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1]]
|
|
4388
|
+
* Array.from(grid) // => [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1]]
|
|
4542
4389
|
*
|
|
4543
4390
|
* // All combinations for testing
|
|
4544
4391
|
* const browsers = ["chrome", "firefox"]
|
|
4545
4392
|
* const devices = ["desktop", "mobile", "tablet"]
|
|
4546
4393
|
* const testMatrix = Iterable.cartesian(browsers, devices)
|
|
4547
|
-
*
|
|
4548
|
-
* // [
|
|
4549
|
-
* // ["chrome", "desktop"], ["chrome", "mobile"], ["chrome", "tablet"],
|
|
4550
|
-
* // ["firefox", "desktop"], ["firefox", "mobile"], ["firefox", "tablet"]
|
|
4551
|
-
* // ]
|
|
4394
|
+
* Array.from(testMatrix, ([browser, device]) => `${browser}:${device}`) // => ["chrome:desktop", "chrome:mobile", "chrome:tablet", "firefox:desktop", "firefox:mobile", "firefox:tablet"]
|
|
4552
4395
|
*
|
|
4553
4396
|
* // Empty iterable results in empty cartesian product
|
|
4554
4397
|
* const empty = Iterable.empty<number>()
|
|
4555
4398
|
* const withEmpty = Iterable.cartesian([1, 2], empty)
|
|
4556
|
-
*
|
|
4399
|
+
* Array.from(withEmpty) // => []
|
|
4557
4400
|
* ```
|
|
4558
4401
|
*
|
|
4559
|
-
* @category
|
|
4402
|
+
* @category combining
|
|
4560
4403
|
* @since 2.0.0
|
|
4561
4404
|
*/
|
|
4562
4405
|
<B>(that: Iterable<B>): <A>(self: Iterable<A>) => Iterable<[A, B]>;
|
|
@@ -4565,40 +4408,34 @@ export declare const cartesian: {
|
|
|
4565
4408
|
*
|
|
4566
4409
|
* **Example** (Generating cartesian pairs)
|
|
4567
4410
|
*
|
|
4568
|
-
* ```ts
|
|
4411
|
+
* ```ts import.meta.vitest
|
|
4569
4412
|
* import { Iterable } from "effect"
|
|
4570
4413
|
*
|
|
4571
4414
|
* // All pairs of numbers and letters
|
|
4572
4415
|
* const numbers = [1, 2, 3]
|
|
4573
4416
|
* const letters = ["a", "b"]
|
|
4574
4417
|
* const pairs = Iterable.cartesian(numbers, letters)
|
|
4575
|
-
*
|
|
4576
|
-
* // [[1, "a"], [1, "b"], [2, "a"], [2, "b"], [3, "a"], [3, "b"]]
|
|
4418
|
+
* Array.from(pairs) // => [[1, "a"], [1, "b"], [2, "a"], [2, "b"], [3, "a"], [3, "b"]]
|
|
4577
4419
|
*
|
|
4578
4420
|
* // Generate coordinate grid
|
|
4579
4421
|
* const x = [0, 1, 2]
|
|
4580
4422
|
* const y = [0, 1]
|
|
4581
4423
|
* const grid = Iterable.cartesian(x, y)
|
|
4582
|
-
*
|
|
4583
|
-
* // [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1]]
|
|
4424
|
+
* Array.from(grid) // => [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1]]
|
|
4584
4425
|
*
|
|
4585
4426
|
* // All combinations for testing
|
|
4586
4427
|
* const browsers = ["chrome", "firefox"]
|
|
4587
4428
|
* const devices = ["desktop", "mobile", "tablet"]
|
|
4588
4429
|
* const testMatrix = Iterable.cartesian(browsers, devices)
|
|
4589
|
-
*
|
|
4590
|
-
* // [
|
|
4591
|
-
* // ["chrome", "desktop"], ["chrome", "mobile"], ["chrome", "tablet"],
|
|
4592
|
-
* // ["firefox", "desktop"], ["firefox", "mobile"], ["firefox", "tablet"]
|
|
4593
|
-
* // ]
|
|
4430
|
+
* Array.from(testMatrix, ([browser, device]) => `${browser}:${device}`) // => ["chrome:desktop", "chrome:mobile", "chrome:tablet", "firefox:desktop", "firefox:mobile", "firefox:tablet"]
|
|
4594
4431
|
*
|
|
4595
4432
|
* // Empty iterable results in empty cartesian product
|
|
4596
4433
|
* const empty = Iterable.empty<number>()
|
|
4597
4434
|
* const withEmpty = Iterable.cartesian([1, 2], empty)
|
|
4598
|
-
*
|
|
4435
|
+
* Array.from(withEmpty) // => []
|
|
4599
4436
|
* ```
|
|
4600
4437
|
*
|
|
4601
|
-
* @category
|
|
4438
|
+
* @category combining
|
|
4602
4439
|
* @since 2.0.0
|
|
4603
4440
|
*/
|
|
4604
4441
|
<A, B>(self: Iterable<A>, that: Iterable<B>): Iterable<[A, B]>;
|
|
@@ -4608,11 +4445,10 @@ export declare const cartesian: {
|
|
|
4608
4445
|
*
|
|
4609
4446
|
* **Example** (Counting matching elements)
|
|
4610
4447
|
*
|
|
4611
|
-
* ```ts
|
|
4448
|
+
* ```ts import.meta.vitest
|
|
4612
4449
|
* import { Iterable } from "effect"
|
|
4613
4450
|
*
|
|
4614
|
-
*
|
|
4615
|
-
* console.log(result) // 2
|
|
4451
|
+
* Iterable.countBy([1, 2, 3, 4, 5], (n) => n % 2 === 0) // => 2
|
|
4616
4452
|
* ```
|
|
4617
4453
|
*
|
|
4618
4454
|
* @category folding
|
|
@@ -4624,11 +4460,10 @@ export declare const countBy: {
|
|
|
4624
4460
|
*
|
|
4625
4461
|
* **Example** (Counting matching elements)
|
|
4626
4462
|
*
|
|
4627
|
-
* ```ts
|
|
4463
|
+
* ```ts import.meta.vitest
|
|
4628
4464
|
* import { Iterable } from "effect"
|
|
4629
4465
|
*
|
|
4630
|
-
*
|
|
4631
|
-
* console.log(result) // 2
|
|
4466
|
+
* Iterable.countBy([1, 2, 3, 4, 5], (n) => n % 2 === 0) // => 2
|
|
4632
4467
|
* ```
|
|
4633
4468
|
*
|
|
4634
4469
|
* @category folding
|
|
@@ -4640,11 +4475,10 @@ export declare const countBy: {
|
|
|
4640
4475
|
*
|
|
4641
4476
|
* **Example** (Counting matching elements)
|
|
4642
4477
|
*
|
|
4643
|
-
* ```ts
|
|
4478
|
+
* ```ts import.meta.vitest
|
|
4644
4479
|
* import { Iterable } from "effect"
|
|
4645
4480
|
*
|
|
4646
|
-
*
|
|
4647
|
-
* console.log(result) // 2
|
|
4481
|
+
* Iterable.countBy([1, 2, 3, 4, 5], (n) => n % 2 === 0) // => 2
|
|
4648
4482
|
* ```
|
|
4649
4483
|
*
|
|
4650
4484
|
* @category folding
|