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/Chunk.d.ts
CHANGED
|
@@ -30,12 +30,12 @@ declare const TypeId = "~effect/collections/Chunk";
|
|
|
30
30
|
*
|
|
31
31
|
* **Example** (Inspecting chunk values)
|
|
32
32
|
*
|
|
33
|
-
* ```ts
|
|
33
|
+
* ```ts import.meta.vitest
|
|
34
34
|
* import { Chunk } from "effect"
|
|
35
35
|
*
|
|
36
36
|
* const chunk: Chunk.Chunk<number> = Chunk.make(1, 2, 3)
|
|
37
|
-
*
|
|
38
|
-
*
|
|
37
|
+
* chunk.length // => 3
|
|
38
|
+
* Chunk.toArray(chunk) // => [1, 2, 3]
|
|
39
39
|
* ```
|
|
40
40
|
*
|
|
41
41
|
* @category models
|
|
@@ -56,12 +56,12 @@ export interface Chunk<out A> extends Iterable<A>, Equal.Equal, Pipeable, Inspec
|
|
|
56
56
|
*
|
|
57
57
|
* **Example** (Working with non-empty chunks)
|
|
58
58
|
*
|
|
59
|
-
* ```ts
|
|
59
|
+
* ```ts import.meta.vitest
|
|
60
60
|
* import { Chunk } from "effect"
|
|
61
61
|
*
|
|
62
62
|
* const nonEmptyChunk: Chunk.NonEmptyChunk<number> = Chunk.make(1, 2, 3)
|
|
63
|
-
*
|
|
64
|
-
*
|
|
63
|
+
* Chunk.headNonEmpty(nonEmptyChunk) // => 1
|
|
64
|
+
* Chunk.lastNonEmpty(nonEmptyChunk) // => 3
|
|
65
65
|
* ```
|
|
66
66
|
*
|
|
67
67
|
* @category models
|
|
@@ -74,7 +74,7 @@ export interface NonEmptyChunk<out A> extends Chunk<A>, NonEmptyIterable<A> {
|
|
|
74
74
|
*
|
|
75
75
|
* **Example** (Applying the Chunk type lambda)
|
|
76
76
|
*
|
|
77
|
-
* ```ts
|
|
77
|
+
* ```ts import.meta.vitest
|
|
78
78
|
* import type { Chunk, HKT } from "effect"
|
|
79
79
|
*
|
|
80
80
|
* // Create a Chunk type using the type lambda
|
|
@@ -82,7 +82,7 @@ export interface NonEmptyChunk<out A> extends Chunk<A>, NonEmptyIterable<A> {
|
|
|
82
82
|
* // Equivalent to: Chunk<number>
|
|
83
83
|
* ```
|
|
84
84
|
*
|
|
85
|
-
* @category
|
|
85
|
+
* @category utility types
|
|
86
86
|
* @since 2.0.0
|
|
87
87
|
*/
|
|
88
88
|
export interface ChunkTypeLambda extends TypeLambda {
|
|
@@ -117,7 +117,7 @@ interface ISlice<A> {
|
|
|
117
117
|
*
|
|
118
118
|
* **Example** (Comparing chunks for equivalence)
|
|
119
119
|
*
|
|
120
|
-
* ```ts
|
|
120
|
+
* ```ts import.meta.vitest
|
|
121
121
|
* import { Chunk, Equivalence } from "effect"
|
|
122
122
|
*
|
|
123
123
|
* const chunk1 = Chunk.make(1, 2, 3)
|
|
@@ -125,8 +125,8 @@ interface ISlice<A> {
|
|
|
125
125
|
* const chunk3 = Chunk.make(1, 2, 4)
|
|
126
126
|
*
|
|
127
127
|
* const eq = Chunk.makeEquivalence(Equivalence.strictEqual<number>())
|
|
128
|
-
*
|
|
129
|
-
*
|
|
128
|
+
* eq(chunk1, chunk2) // => true
|
|
129
|
+
* eq(chunk1, chunk3) // => false
|
|
130
130
|
* ```
|
|
131
131
|
*
|
|
132
132
|
* @category instances
|
|
@@ -138,18 +138,18 @@ export declare const makeEquivalence: <A>(isEquivalent: Equivalence.Equivalence<
|
|
|
138
138
|
*
|
|
139
139
|
* **Example** (Checking for chunks)
|
|
140
140
|
*
|
|
141
|
-
* ```ts
|
|
141
|
+
* ```ts import.meta.vitest
|
|
142
142
|
* import { Chunk } from "effect"
|
|
143
143
|
*
|
|
144
144
|
* const chunk = Chunk.make(1, 2, 3)
|
|
145
145
|
* const array = [1, 2, 3]
|
|
146
146
|
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
147
|
+
* Chunk.isChunk(chunk) // => true
|
|
148
|
+
* Chunk.isChunk(array) // => false
|
|
149
|
+
* Chunk.isChunk("string") // => false
|
|
150
150
|
* ```
|
|
151
151
|
*
|
|
152
|
-
* @category
|
|
152
|
+
* @category guards
|
|
153
153
|
* @since 2.0.0
|
|
154
154
|
*/
|
|
155
155
|
export declare const isChunk: {
|
|
@@ -158,18 +158,18 @@ export declare const isChunk: {
|
|
|
158
158
|
*
|
|
159
159
|
* **Example** (Checking for chunks)
|
|
160
160
|
*
|
|
161
|
-
* ```ts
|
|
161
|
+
* ```ts import.meta.vitest
|
|
162
162
|
* import { Chunk } from "effect"
|
|
163
163
|
*
|
|
164
164
|
* const chunk = Chunk.make(1, 2, 3)
|
|
165
165
|
* const array = [1, 2, 3]
|
|
166
166
|
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
*
|
|
167
|
+
* Chunk.isChunk(chunk) // => true
|
|
168
|
+
* Chunk.isChunk(array) // => false
|
|
169
|
+
* Chunk.isChunk("string") // => false
|
|
170
170
|
* ```
|
|
171
171
|
*
|
|
172
|
-
* @category
|
|
172
|
+
* @category guards
|
|
173
173
|
* @since 2.0.0
|
|
174
174
|
*/
|
|
175
175
|
<A>(u: Iterable<A>): u is Chunk<A>;
|
|
@@ -178,18 +178,18 @@ export declare const isChunk: {
|
|
|
178
178
|
*
|
|
179
179
|
* **Example** (Checking for chunks)
|
|
180
180
|
*
|
|
181
|
-
* ```ts
|
|
181
|
+
* ```ts import.meta.vitest
|
|
182
182
|
* import { Chunk } from "effect"
|
|
183
183
|
*
|
|
184
184
|
* const chunk = Chunk.make(1, 2, 3)
|
|
185
185
|
* const array = [1, 2, 3]
|
|
186
186
|
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
187
|
+
* Chunk.isChunk(chunk) // => true
|
|
188
|
+
* Chunk.isChunk(array) // => false
|
|
189
|
+
* Chunk.isChunk("string") // => false
|
|
190
190
|
* ```
|
|
191
191
|
*
|
|
192
|
-
* @category
|
|
192
|
+
* @category guards
|
|
193
193
|
* @since 2.0.0
|
|
194
194
|
*/
|
|
195
195
|
(u: unknown): u is Chunk<unknown>;
|
|
@@ -199,11 +199,10 @@ export declare const isChunk: {
|
|
|
199
199
|
*
|
|
200
200
|
* **Example** (Creating an empty chunk)
|
|
201
201
|
*
|
|
202
|
-
* ```ts
|
|
202
|
+
* ```ts import.meta.vitest
|
|
203
203
|
* import { Chunk } from "effect"
|
|
204
204
|
*
|
|
205
|
-
*
|
|
206
|
-
* console.log(Chunk.size(emptyChunk)) // 0
|
|
205
|
+
* Chunk.size(Chunk.empty()) // => 0
|
|
207
206
|
* ```
|
|
208
207
|
*
|
|
209
208
|
* @category constructors
|
|
@@ -215,11 +214,10 @@ export declare const empty: <A = never>() => Chunk<A>;
|
|
|
215
214
|
*
|
|
216
215
|
* **Example** (Creating a non-empty chunk)
|
|
217
216
|
*
|
|
218
|
-
* ```ts
|
|
217
|
+
* ```ts import.meta.vitest
|
|
219
218
|
* import { Chunk } from "effect"
|
|
220
219
|
*
|
|
221
|
-
*
|
|
222
|
-
* console.log(Chunk.toArray(chunk)) // [1, 2, 3, 4]
|
|
220
|
+
* Chunk.toArray(Chunk.make(1, 2, 3, 4)) // => [1, 2, 3, 4]
|
|
223
221
|
* ```
|
|
224
222
|
*
|
|
225
223
|
* @category constructors
|
|
@@ -231,11 +229,10 @@ export declare const make: <As extends readonly [any, ...Array<any>]>(...as: As)
|
|
|
231
229
|
*
|
|
232
230
|
* **Example** (Creating a single-element chunk)
|
|
233
231
|
*
|
|
234
|
-
* ```ts
|
|
232
|
+
* ```ts import.meta.vitest
|
|
235
233
|
* import { Chunk } from "effect"
|
|
236
234
|
*
|
|
237
|
-
*
|
|
238
|
-
* console.log(Chunk.toArray(chunk)) // ["hello"]
|
|
235
|
+
* Chunk.toArray(Chunk.of("hello")) // => ["hello"]
|
|
239
236
|
* ```
|
|
240
237
|
*
|
|
241
238
|
* @category constructors
|
|
@@ -247,11 +244,10 @@ export declare const of: <A>(a: A) => NonEmptyChunk<A>;
|
|
|
247
244
|
*
|
|
248
245
|
* **Example** (Creating chunks from iterables)
|
|
249
246
|
*
|
|
250
|
-
* ```ts
|
|
247
|
+
* ```ts import.meta.vitest
|
|
251
248
|
* import { Chunk } from "effect"
|
|
252
249
|
*
|
|
253
|
-
*
|
|
254
|
-
* console.log(Chunk.toArray(chunk)) // [1, 2, 3]
|
|
250
|
+
* Chunk.toArray(Chunk.fromIterable([1, 2, 3])) // => [1, 2, 3]
|
|
255
251
|
* ```
|
|
256
252
|
*
|
|
257
253
|
* @category constructors
|
|
@@ -265,17 +261,16 @@ export declare const fromIterable: <A>(self: Iterable<A>) => Chunk<A>;
|
|
|
265
261
|
*
|
|
266
262
|
* **Example** (Converting chunks to mutable arrays)
|
|
267
263
|
*
|
|
268
|
-
* ```ts
|
|
264
|
+
* ```ts import.meta.vitest
|
|
269
265
|
* import { Chunk } from "effect"
|
|
270
266
|
*
|
|
271
267
|
* const chunk = Chunk.make(1, 2, 3)
|
|
272
268
|
* const array = Chunk.toArray(chunk)
|
|
273
|
-
*
|
|
274
|
-
*
|
|
269
|
+
* array // => [1, 2, 3]
|
|
270
|
+
* Array.isArray(array) // => true
|
|
275
271
|
*
|
|
276
272
|
* // With empty chunk
|
|
277
|
-
*
|
|
278
|
-
* console.log(Chunk.toArray(emptyChunk)) // []
|
|
273
|
+
* Chunk.toArray(Chunk.empty<number>()) // => []
|
|
279
274
|
* ```
|
|
280
275
|
*
|
|
281
276
|
* @category converting
|
|
@@ -289,19 +284,18 @@ export declare const toArray: <S extends Chunk<any>>(self: S) => S extends NonEm
|
|
|
289
284
|
*
|
|
290
285
|
* **Example** (Converting chunks to readonly arrays)
|
|
291
286
|
*
|
|
292
|
-
* ```ts
|
|
287
|
+
* ```ts import.meta.vitest
|
|
293
288
|
* import { Chunk } from "effect"
|
|
294
289
|
*
|
|
295
290
|
* const chunk = Chunk.make(1, 2, 3)
|
|
296
291
|
* const readonlyArray = Chunk.toReadonlyArray(chunk)
|
|
297
|
-
*
|
|
292
|
+
* readonlyArray // => [1, 2, 3]
|
|
298
293
|
*
|
|
299
294
|
* // The result is read-only, modifications would cause TypeScript errors
|
|
300
295
|
* // readonlyArray[0] = 10 // TypeScript error
|
|
301
296
|
*
|
|
302
297
|
* // With empty chunk
|
|
303
|
-
*
|
|
304
|
-
* console.log(Chunk.toReadonlyArray(emptyChunk)) // []
|
|
298
|
+
* Chunk.toReadonlyArray(Chunk.empty<number>()) // => []
|
|
305
299
|
* ```
|
|
306
300
|
*
|
|
307
301
|
* @category converting
|
|
@@ -322,16 +316,14 @@ export declare const toReadonlyArray: <S extends Chunk<any>>(self: S) => S exten
|
|
|
322
316
|
*
|
|
323
317
|
* **Example** (Reversing chunks)
|
|
324
318
|
*
|
|
325
|
-
* ```ts
|
|
319
|
+
* ```ts import.meta.vitest
|
|
326
320
|
* import { Chunk } from "effect"
|
|
327
321
|
*
|
|
328
322
|
* const chunk = Chunk.make(1, 2, 3)
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
* console.log(Chunk.toArray(result)) // [3, 2, 1]
|
|
323
|
+
* Chunk.toArray(Chunk.reverse(chunk)) // => [3, 2, 1]
|
|
332
324
|
* ```
|
|
333
325
|
*
|
|
334
|
-
* @category
|
|
326
|
+
* @category transforming
|
|
335
327
|
* @since 2.0.0
|
|
336
328
|
*/
|
|
337
329
|
export declare const reverse: <S extends Chunk<any>>(self: S) => Chunk.With<S, Chunk.Infer<S>>;
|
|
@@ -341,21 +333,20 @@ export declare const reverse: <S extends Chunk<any>>(self: S) => Chunk.With<S, C
|
|
|
341
333
|
*
|
|
342
334
|
* **Example** (Accessing elements safely)
|
|
343
335
|
*
|
|
344
|
-
* ```ts
|
|
345
|
-
* import { Chunk } from "effect"
|
|
336
|
+
* ```ts import.meta.vitest
|
|
337
|
+
* import { Chunk, Option } from "effect"
|
|
346
338
|
*
|
|
347
339
|
* const chunk = Chunk.make("a", "b", "c", "d")
|
|
348
340
|
*
|
|
349
|
-
*
|
|
350
|
-
*
|
|
351
|
-
*
|
|
341
|
+
* Chunk.get(chunk, 1) // => Option.some("b")
|
|
342
|
+
* Chunk.get(chunk, 10) // => Option.none()
|
|
343
|
+
* Chunk.get(chunk, -1) // => Option.none()
|
|
352
344
|
*
|
|
353
345
|
* // Using pipe syntax
|
|
354
|
-
*
|
|
355
|
-
* console.log(result) // Option.some("c")
|
|
346
|
+
* chunk.pipe(Chunk.get(2)) // => Option.some("c")
|
|
356
347
|
* ```
|
|
357
348
|
*
|
|
358
|
-
* @category
|
|
349
|
+
* @category getters
|
|
359
350
|
* @since 2.0.0
|
|
360
351
|
*/
|
|
361
352
|
export declare const get: {
|
|
@@ -365,21 +356,20 @@ export declare const get: {
|
|
|
365
356
|
*
|
|
366
357
|
* **Example** (Accessing elements safely)
|
|
367
358
|
*
|
|
368
|
-
* ```ts
|
|
369
|
-
* import { Chunk } from "effect"
|
|
359
|
+
* ```ts import.meta.vitest
|
|
360
|
+
* import { Chunk, Option } from "effect"
|
|
370
361
|
*
|
|
371
362
|
* const chunk = Chunk.make("a", "b", "c", "d")
|
|
372
363
|
*
|
|
373
|
-
*
|
|
374
|
-
*
|
|
375
|
-
*
|
|
364
|
+
* Chunk.get(chunk, 1) // => Option.some("b")
|
|
365
|
+
* Chunk.get(chunk, 10) // => Option.none()
|
|
366
|
+
* Chunk.get(chunk, -1) // => Option.none()
|
|
376
367
|
*
|
|
377
368
|
* // Using pipe syntax
|
|
378
|
-
*
|
|
379
|
-
* console.log(result) // Option.some("c")
|
|
369
|
+
* chunk.pipe(Chunk.get(2)) // => Option.some("c")
|
|
380
370
|
* ```
|
|
381
371
|
*
|
|
382
|
-
* @category
|
|
372
|
+
* @category getters
|
|
383
373
|
* @since 2.0.0
|
|
384
374
|
*/
|
|
385
375
|
(index: number): <A>(self: Chunk<A>) => Option<A>;
|
|
@@ -389,21 +379,20 @@ export declare const get: {
|
|
|
389
379
|
*
|
|
390
380
|
* **Example** (Accessing elements safely)
|
|
391
381
|
*
|
|
392
|
-
* ```ts
|
|
393
|
-
* import { Chunk } from "effect"
|
|
382
|
+
* ```ts import.meta.vitest
|
|
383
|
+
* import { Chunk, Option } from "effect"
|
|
394
384
|
*
|
|
395
385
|
* const chunk = Chunk.make("a", "b", "c", "d")
|
|
396
386
|
*
|
|
397
|
-
*
|
|
398
|
-
*
|
|
399
|
-
*
|
|
387
|
+
* Chunk.get(chunk, 1) // => Option.some("b")
|
|
388
|
+
* Chunk.get(chunk, 10) // => Option.none()
|
|
389
|
+
* Chunk.get(chunk, -1) // => Option.none()
|
|
400
390
|
*
|
|
401
391
|
* // Using pipe syntax
|
|
402
|
-
*
|
|
403
|
-
* console.log(result) // Option.some("c")
|
|
392
|
+
* chunk.pipe(Chunk.get(2)) // => Option.some("c")
|
|
404
393
|
* ```
|
|
405
394
|
*
|
|
406
|
-
* @category
|
|
395
|
+
* @category getters
|
|
407
396
|
* @since 2.0.0
|
|
408
397
|
*/
|
|
409
398
|
<A>(self: Chunk<A>, index: number): Option<A>;
|
|
@@ -422,16 +411,16 @@ export declare const get: {
|
|
|
422
411
|
*
|
|
423
412
|
* **Example** (Creating chunks without copying arrays)
|
|
424
413
|
*
|
|
425
|
-
* ```ts
|
|
414
|
+
* ```ts import.meta.vitest
|
|
426
415
|
* import { Chunk } from "effect"
|
|
427
416
|
*
|
|
428
417
|
* const array = [1, 2, 3, 4, 5]
|
|
429
418
|
* const chunk = Chunk.fromArrayUnsafe(array)
|
|
430
|
-
*
|
|
419
|
+
* Chunk.toArray(chunk) // => [1, 2, 3, 4, 5]
|
|
431
420
|
*
|
|
432
421
|
* // Warning: Since this doesn't copy the array, mutations affect the chunk
|
|
433
422
|
* array[0] = 999
|
|
434
|
-
*
|
|
423
|
+
* Chunk.toArray(chunk) // => [999, 2, 3, 4, 5]
|
|
435
424
|
* ```
|
|
436
425
|
*
|
|
437
426
|
* @category unsafe
|
|
@@ -452,15 +441,15 @@ export declare const fromArrayUnsafe: <A>(self: ReadonlyArray<A>) => Chunk<A>;
|
|
|
452
441
|
*
|
|
453
442
|
* **Example** (Creating non-empty chunks without copying arrays)
|
|
454
443
|
*
|
|
455
|
-
* ```ts
|
|
444
|
+
* ```ts import.meta.vitest
|
|
456
445
|
* import { Array, Chunk } from "effect"
|
|
457
446
|
*
|
|
458
447
|
* const nonEmptyArray = Array.make(1, 2, 3, 4, 5)
|
|
459
448
|
* const chunk = Chunk.fromNonEmptyArrayUnsafe(nonEmptyArray)
|
|
460
|
-
*
|
|
449
|
+
* Chunk.toArray(chunk) // => [1, 2, 3, 4, 5]
|
|
461
450
|
*
|
|
462
451
|
* // The result is guaranteed to be non-empty
|
|
463
|
-
*
|
|
452
|
+
* Chunk.isNonEmpty(chunk) // => true
|
|
464
453
|
* ```
|
|
465
454
|
*
|
|
466
455
|
* @category unsafe
|
|
@@ -481,16 +470,16 @@ export declare const fromNonEmptyArrayUnsafe: <A>(self: NonEmptyReadonlyArray<A>
|
|
|
481
470
|
*
|
|
482
471
|
* **Example** (Accessing elements unsafely)
|
|
483
472
|
*
|
|
484
|
-
* ```ts
|
|
473
|
+
* ```ts import.meta.vitest
|
|
485
474
|
* import { Chunk, Option } from "effect"
|
|
486
475
|
*
|
|
487
476
|
* const chunk = Chunk.make("a", "b", "c", "d")
|
|
488
477
|
*
|
|
489
|
-
*
|
|
490
|
-
*
|
|
478
|
+
* Chunk.getUnsafe(chunk, 1) // => "b"
|
|
479
|
+
* Chunk.getUnsafe(chunk, 3) // => "d"
|
|
491
480
|
*
|
|
492
481
|
* // Use Chunk.get when the index may be out of bounds
|
|
493
|
-
*
|
|
482
|
+
* Option.isNone(Chunk.get(chunk, 10)) // => true
|
|
494
483
|
* ```
|
|
495
484
|
*
|
|
496
485
|
* @category unsafe
|
|
@@ -511,16 +500,16 @@ export declare const getUnsafe: {
|
|
|
511
500
|
*
|
|
512
501
|
* **Example** (Accessing elements unsafely)
|
|
513
502
|
*
|
|
514
|
-
* ```ts
|
|
503
|
+
* ```ts import.meta.vitest
|
|
515
504
|
* import { Chunk, Option } from "effect"
|
|
516
505
|
*
|
|
517
506
|
* const chunk = Chunk.make("a", "b", "c", "d")
|
|
518
507
|
*
|
|
519
|
-
*
|
|
520
|
-
*
|
|
508
|
+
* Chunk.getUnsafe(chunk, 1) // => "b"
|
|
509
|
+
* Chunk.getUnsafe(chunk, 3) // => "d"
|
|
521
510
|
*
|
|
522
511
|
* // Use Chunk.get when the index may be out of bounds
|
|
523
|
-
*
|
|
512
|
+
* Option.isNone(Chunk.get(chunk, 10)) // => true
|
|
524
513
|
* ```
|
|
525
514
|
*
|
|
526
515
|
* @category unsafe
|
|
@@ -541,16 +530,16 @@ export declare const getUnsafe: {
|
|
|
541
530
|
*
|
|
542
531
|
* **Example** (Accessing elements unsafely)
|
|
543
532
|
*
|
|
544
|
-
* ```ts
|
|
533
|
+
* ```ts import.meta.vitest
|
|
545
534
|
* import { Chunk, Option } from "effect"
|
|
546
535
|
*
|
|
547
536
|
* const chunk = Chunk.make("a", "b", "c", "d")
|
|
548
537
|
*
|
|
549
|
-
*
|
|
550
|
-
*
|
|
538
|
+
* Chunk.getUnsafe(chunk, 1) // => "b"
|
|
539
|
+
* Chunk.getUnsafe(chunk, 3) // => "d"
|
|
551
540
|
*
|
|
552
541
|
* // Use Chunk.get when the index may be out of bounds
|
|
553
|
-
*
|
|
542
|
+
* Option.isNone(Chunk.get(chunk, 10)) // => true
|
|
554
543
|
* ```
|
|
555
544
|
*
|
|
556
545
|
* @category unsafe
|
|
@@ -568,17 +557,15 @@ export declare const getUnsafe: {
|
|
|
568
557
|
*
|
|
569
558
|
* **Example** (Appending an element)
|
|
570
559
|
*
|
|
571
|
-
* ```ts
|
|
560
|
+
* ```ts import.meta.vitest
|
|
572
561
|
* import { Chunk } from "effect"
|
|
573
562
|
*
|
|
574
563
|
* const chunk = Chunk.make(1, 2, 3)
|
|
575
|
-
*
|
|
576
|
-
* console.log(Chunk.toArray(newChunk)) // [1, 2, 3, 4]
|
|
564
|
+
* Chunk.toArray(Chunk.append(chunk, 4)) // => [1, 2, 3, 4]
|
|
577
565
|
*
|
|
578
566
|
* // Appending to empty chunk
|
|
579
567
|
* const emptyChunk = Chunk.empty<number>()
|
|
580
|
-
*
|
|
581
|
-
* console.log(Chunk.toArray(singleElement)) // [42]
|
|
568
|
+
* Chunk.toArray(Chunk.append(emptyChunk, 42)) // => [42]
|
|
582
569
|
* ```
|
|
583
570
|
*
|
|
584
571
|
* @see {@link prepend} for adding one element before the existing elements
|
|
@@ -598,17 +585,15 @@ export declare const append: {
|
|
|
598
585
|
*
|
|
599
586
|
* **Example** (Appending an element)
|
|
600
587
|
*
|
|
601
|
-
* ```ts
|
|
588
|
+
* ```ts import.meta.vitest
|
|
602
589
|
* import { Chunk } from "effect"
|
|
603
590
|
*
|
|
604
591
|
* const chunk = Chunk.make(1, 2, 3)
|
|
605
|
-
*
|
|
606
|
-
* console.log(Chunk.toArray(newChunk)) // [1, 2, 3, 4]
|
|
592
|
+
* Chunk.toArray(Chunk.append(chunk, 4)) // => [1, 2, 3, 4]
|
|
607
593
|
*
|
|
608
594
|
* // Appending to empty chunk
|
|
609
595
|
* const emptyChunk = Chunk.empty<number>()
|
|
610
|
-
*
|
|
611
|
-
* console.log(Chunk.toArray(singleElement)) // [42]
|
|
596
|
+
* Chunk.toArray(Chunk.append(emptyChunk, 42)) // => [42]
|
|
612
597
|
* ```
|
|
613
598
|
*
|
|
614
599
|
* @see {@link prepend} for adding one element before the existing elements
|
|
@@ -628,17 +613,15 @@ export declare const append: {
|
|
|
628
613
|
*
|
|
629
614
|
* **Example** (Appending an element)
|
|
630
615
|
*
|
|
631
|
-
* ```ts
|
|
616
|
+
* ```ts import.meta.vitest
|
|
632
617
|
* import { Chunk } from "effect"
|
|
633
618
|
*
|
|
634
619
|
* const chunk = Chunk.make(1, 2, 3)
|
|
635
|
-
*
|
|
636
|
-
* console.log(Chunk.toArray(newChunk)) // [1, 2, 3, 4]
|
|
620
|
+
* Chunk.toArray(Chunk.append(chunk, 4)) // => [1, 2, 3, 4]
|
|
637
621
|
*
|
|
638
622
|
* // Appending to empty chunk
|
|
639
623
|
* const emptyChunk = Chunk.empty<number>()
|
|
640
|
-
*
|
|
641
|
-
* console.log(Chunk.toArray(singleElement)) // [42]
|
|
624
|
+
* Chunk.toArray(Chunk.append(emptyChunk, 42)) // => [42]
|
|
642
625
|
* ```
|
|
643
626
|
*
|
|
644
627
|
* @see {@link prepend} for adding one element before the existing elements
|
|
@@ -654,17 +637,15 @@ export declare const append: {
|
|
|
654
637
|
*
|
|
655
638
|
* **Example** (Prepending an element)
|
|
656
639
|
*
|
|
657
|
-
* ```ts
|
|
640
|
+
* ```ts import.meta.vitest
|
|
658
641
|
* import { Chunk } from "effect"
|
|
659
642
|
*
|
|
660
643
|
* const chunk = Chunk.make(2, 3, 4)
|
|
661
|
-
*
|
|
662
|
-
* console.log(Chunk.toArray(newChunk)) // [1, 2, 3, 4]
|
|
644
|
+
* Chunk.toArray(Chunk.prepend(chunk, 1)) // => [1, 2, 3, 4]
|
|
663
645
|
*
|
|
664
646
|
* // Prepending to empty chunk
|
|
665
647
|
* const emptyChunk = Chunk.empty<string>()
|
|
666
|
-
*
|
|
667
|
-
* console.log(Chunk.toArray(singleElement)) // ["first"]
|
|
648
|
+
* Chunk.toArray(Chunk.prepend(emptyChunk, "first")) // => ["first"]
|
|
668
649
|
* ```
|
|
669
650
|
*
|
|
670
651
|
* @category combining
|
|
@@ -676,17 +657,15 @@ export declare const prepend: {
|
|
|
676
657
|
*
|
|
677
658
|
* **Example** (Prepending an element)
|
|
678
659
|
*
|
|
679
|
-
* ```ts
|
|
660
|
+
* ```ts import.meta.vitest
|
|
680
661
|
* import { Chunk } from "effect"
|
|
681
662
|
*
|
|
682
663
|
* const chunk = Chunk.make(2, 3, 4)
|
|
683
|
-
*
|
|
684
|
-
* console.log(Chunk.toArray(newChunk)) // [1, 2, 3, 4]
|
|
664
|
+
* Chunk.toArray(Chunk.prepend(chunk, 1)) // => [1, 2, 3, 4]
|
|
685
665
|
*
|
|
686
666
|
* // Prepending to empty chunk
|
|
687
667
|
* const emptyChunk = Chunk.empty<string>()
|
|
688
|
-
*
|
|
689
|
-
* console.log(Chunk.toArray(singleElement)) // ["first"]
|
|
668
|
+
* Chunk.toArray(Chunk.prepend(emptyChunk, "first")) // => ["first"]
|
|
690
669
|
* ```
|
|
691
670
|
*
|
|
692
671
|
* @category combining
|
|
@@ -698,17 +677,15 @@ export declare const prepend: {
|
|
|
698
677
|
*
|
|
699
678
|
* **Example** (Prepending an element)
|
|
700
679
|
*
|
|
701
|
-
* ```ts
|
|
680
|
+
* ```ts import.meta.vitest
|
|
702
681
|
* import { Chunk } from "effect"
|
|
703
682
|
*
|
|
704
683
|
* const chunk = Chunk.make(2, 3, 4)
|
|
705
|
-
*
|
|
706
|
-
* console.log(Chunk.toArray(newChunk)) // [1, 2, 3, 4]
|
|
684
|
+
* Chunk.toArray(Chunk.prepend(chunk, 1)) // => [1, 2, 3, 4]
|
|
707
685
|
*
|
|
708
686
|
* // Prepending to empty chunk
|
|
709
687
|
* const emptyChunk = Chunk.empty<string>()
|
|
710
|
-
*
|
|
711
|
-
* console.log(Chunk.toArray(singleElement)) // ["first"]
|
|
688
|
+
* Chunk.toArray(Chunk.prepend(emptyChunk, "first")) // => ["first"]
|
|
712
689
|
* ```
|
|
713
690
|
*
|
|
714
691
|
* @category combining
|
|
@@ -721,15 +698,14 @@ export declare const prepend: {
|
|
|
721
698
|
*
|
|
722
699
|
* **Example** (Taking elements from the start)
|
|
723
700
|
*
|
|
724
|
-
* ```ts
|
|
701
|
+
* ```ts import.meta.vitest
|
|
725
702
|
* import { Chunk } from "effect"
|
|
726
703
|
*
|
|
727
704
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
728
|
-
*
|
|
729
|
-
* console.log(Chunk.toArray(result)) // [1, 2, 3]
|
|
705
|
+
* Chunk.toArray(Chunk.take(chunk, 3)) // => [1, 2, 3]
|
|
730
706
|
* ```
|
|
731
707
|
*
|
|
732
|
-
* @category
|
|
708
|
+
* @category filtering
|
|
733
709
|
* @since 2.0.0
|
|
734
710
|
*/
|
|
735
711
|
export declare const take: {
|
|
@@ -738,15 +714,14 @@ export declare const take: {
|
|
|
738
714
|
*
|
|
739
715
|
* **Example** (Taking elements from the start)
|
|
740
716
|
*
|
|
741
|
-
* ```ts
|
|
717
|
+
* ```ts import.meta.vitest
|
|
742
718
|
* import { Chunk } from "effect"
|
|
743
719
|
*
|
|
744
720
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
745
|
-
*
|
|
746
|
-
* console.log(Chunk.toArray(result)) // [1, 2, 3]
|
|
721
|
+
* Chunk.toArray(Chunk.take(chunk, 3)) // => [1, 2, 3]
|
|
747
722
|
* ```
|
|
748
723
|
*
|
|
749
|
-
* @category
|
|
724
|
+
* @category filtering
|
|
750
725
|
* @since 2.0.0
|
|
751
726
|
*/
|
|
752
727
|
(n: number): <A>(self: Chunk<A>) => Chunk<A>;
|
|
@@ -755,15 +730,14 @@ export declare const take: {
|
|
|
755
730
|
*
|
|
756
731
|
* **Example** (Taking elements from the start)
|
|
757
732
|
*
|
|
758
|
-
* ```ts
|
|
733
|
+
* ```ts import.meta.vitest
|
|
759
734
|
* import { Chunk } from "effect"
|
|
760
735
|
*
|
|
761
736
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
762
|
-
*
|
|
763
|
-
* console.log(Chunk.toArray(result)) // [1, 2, 3]
|
|
737
|
+
* Chunk.toArray(Chunk.take(chunk, 3)) // => [1, 2, 3]
|
|
764
738
|
* ```
|
|
765
739
|
*
|
|
766
|
-
* @category
|
|
740
|
+
* @category filtering
|
|
767
741
|
* @since 2.0.0
|
|
768
742
|
*/
|
|
769
743
|
<A>(self: Chunk<A>, n: number): Chunk<A>;
|
|
@@ -773,15 +747,14 @@ export declare const take: {
|
|
|
773
747
|
*
|
|
774
748
|
* **Example** (Dropping elements from the start)
|
|
775
749
|
*
|
|
776
|
-
* ```ts
|
|
750
|
+
* ```ts import.meta.vitest
|
|
777
751
|
* import { Chunk } from "effect"
|
|
778
752
|
*
|
|
779
753
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
780
|
-
*
|
|
781
|
-
* console.log(Chunk.toArray(result)) // [3, 4, 5]
|
|
754
|
+
* Chunk.toArray(Chunk.drop(chunk, 2)) // => [3, 4, 5]
|
|
782
755
|
* ```
|
|
783
756
|
*
|
|
784
|
-
* @category
|
|
757
|
+
* @category filtering
|
|
785
758
|
* @since 2.0.0
|
|
786
759
|
*/
|
|
787
760
|
export declare const drop: {
|
|
@@ -790,15 +763,14 @@ export declare const drop: {
|
|
|
790
763
|
*
|
|
791
764
|
* **Example** (Dropping elements from the start)
|
|
792
765
|
*
|
|
793
|
-
* ```ts
|
|
766
|
+
* ```ts import.meta.vitest
|
|
794
767
|
* import { Chunk } from "effect"
|
|
795
768
|
*
|
|
796
769
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
797
|
-
*
|
|
798
|
-
* console.log(Chunk.toArray(result)) // [3, 4, 5]
|
|
770
|
+
* Chunk.toArray(Chunk.drop(chunk, 2)) // => [3, 4, 5]
|
|
799
771
|
* ```
|
|
800
772
|
*
|
|
801
|
-
* @category
|
|
773
|
+
* @category filtering
|
|
802
774
|
* @since 2.0.0
|
|
803
775
|
*/
|
|
804
776
|
(n: number): <A>(self: Chunk<A>) => Chunk<A>;
|
|
@@ -807,15 +779,14 @@ export declare const drop: {
|
|
|
807
779
|
*
|
|
808
780
|
* **Example** (Dropping elements from the start)
|
|
809
781
|
*
|
|
810
|
-
* ```ts
|
|
782
|
+
* ```ts import.meta.vitest
|
|
811
783
|
* import { Chunk } from "effect"
|
|
812
784
|
*
|
|
813
785
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
814
|
-
*
|
|
815
|
-
* console.log(Chunk.toArray(result)) // [3, 4, 5]
|
|
786
|
+
* Chunk.toArray(Chunk.drop(chunk, 2)) // => [3, 4, 5]
|
|
816
787
|
* ```
|
|
817
788
|
*
|
|
818
|
-
* @category
|
|
789
|
+
* @category filtering
|
|
819
790
|
* @since 2.0.0
|
|
820
791
|
*/
|
|
821
792
|
<A>(self: Chunk<A>, n: number): Chunk<A>;
|
|
@@ -825,15 +796,14 @@ export declare const drop: {
|
|
|
825
796
|
*
|
|
826
797
|
* **Example** (Dropping elements from the end)
|
|
827
798
|
*
|
|
828
|
-
* ```ts
|
|
799
|
+
* ```ts import.meta.vitest
|
|
829
800
|
* import { Chunk } from "effect"
|
|
830
801
|
*
|
|
831
802
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
832
|
-
*
|
|
833
|
-
* console.log(Chunk.toArray(result)) // [1, 2, 3]
|
|
803
|
+
* Chunk.toArray(Chunk.dropRight(chunk, 2)) // => [1, 2, 3]
|
|
834
804
|
* ```
|
|
835
805
|
*
|
|
836
|
-
* @category
|
|
806
|
+
* @category filtering
|
|
837
807
|
* @since 2.0.0
|
|
838
808
|
*/
|
|
839
809
|
export declare const dropRight: {
|
|
@@ -842,15 +812,14 @@ export declare const dropRight: {
|
|
|
842
812
|
*
|
|
843
813
|
* **Example** (Dropping elements from the end)
|
|
844
814
|
*
|
|
845
|
-
* ```ts
|
|
815
|
+
* ```ts import.meta.vitest
|
|
846
816
|
* import { Chunk } from "effect"
|
|
847
817
|
*
|
|
848
818
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
849
|
-
*
|
|
850
|
-
* console.log(Chunk.toArray(result)) // [1, 2, 3]
|
|
819
|
+
* Chunk.toArray(Chunk.dropRight(chunk, 2)) // => [1, 2, 3]
|
|
851
820
|
* ```
|
|
852
821
|
*
|
|
853
|
-
* @category
|
|
822
|
+
* @category filtering
|
|
854
823
|
* @since 2.0.0
|
|
855
824
|
*/
|
|
856
825
|
(n: number): <A>(self: Chunk<A>) => Chunk<A>;
|
|
@@ -859,15 +828,14 @@ export declare const dropRight: {
|
|
|
859
828
|
*
|
|
860
829
|
* **Example** (Dropping elements from the end)
|
|
861
830
|
*
|
|
862
|
-
* ```ts
|
|
831
|
+
* ```ts import.meta.vitest
|
|
863
832
|
* import { Chunk } from "effect"
|
|
864
833
|
*
|
|
865
834
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
866
|
-
*
|
|
867
|
-
* console.log(Chunk.toArray(result)) // [1, 2, 3]
|
|
835
|
+
* Chunk.toArray(Chunk.dropRight(chunk, 2)) // => [1, 2, 3]
|
|
868
836
|
* ```
|
|
869
837
|
*
|
|
870
|
-
* @category
|
|
838
|
+
* @category filtering
|
|
871
839
|
* @since 2.0.0
|
|
872
840
|
*/
|
|
873
841
|
<A>(self: Chunk<A>, n: number): Chunk<A>;
|
|
@@ -877,15 +845,14 @@ export declare const dropRight: {
|
|
|
877
845
|
*
|
|
878
846
|
* **Example** (Dropping elements while a predicate matches)
|
|
879
847
|
*
|
|
880
|
-
* ```ts
|
|
848
|
+
* ```ts import.meta.vitest
|
|
881
849
|
* import { Chunk } from "effect"
|
|
882
850
|
*
|
|
883
851
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
884
|
-
*
|
|
885
|
-
* console.log(Chunk.toArray(result)) // [3, 4, 5]
|
|
852
|
+
* Chunk.toArray(Chunk.dropWhile(chunk, (n) => n < 3)) // => [3, 4, 5]
|
|
886
853
|
* ```
|
|
887
854
|
*
|
|
888
|
-
* @category
|
|
855
|
+
* @category filtering
|
|
889
856
|
* @since 2.0.0
|
|
890
857
|
*/
|
|
891
858
|
export declare const dropWhile: {
|
|
@@ -894,15 +861,14 @@ export declare const dropWhile: {
|
|
|
894
861
|
*
|
|
895
862
|
* **Example** (Dropping elements while a predicate matches)
|
|
896
863
|
*
|
|
897
|
-
* ```ts
|
|
864
|
+
* ```ts import.meta.vitest
|
|
898
865
|
* import { Chunk } from "effect"
|
|
899
866
|
*
|
|
900
867
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
901
|
-
*
|
|
902
|
-
* console.log(Chunk.toArray(result)) // [3, 4, 5]
|
|
868
|
+
* Chunk.toArray(Chunk.dropWhile(chunk, (n) => n < 3)) // => [3, 4, 5]
|
|
903
869
|
* ```
|
|
904
870
|
*
|
|
905
|
-
* @category
|
|
871
|
+
* @category filtering
|
|
906
872
|
* @since 2.0.0
|
|
907
873
|
*/
|
|
908
874
|
<A>(predicate: Predicate<NoInfer<A>>): (self: Chunk<A>) => Chunk<A>;
|
|
@@ -911,15 +877,14 @@ export declare const dropWhile: {
|
|
|
911
877
|
*
|
|
912
878
|
* **Example** (Dropping elements while a predicate matches)
|
|
913
879
|
*
|
|
914
|
-
* ```ts
|
|
880
|
+
* ```ts import.meta.vitest
|
|
915
881
|
* import { Chunk } from "effect"
|
|
916
882
|
*
|
|
917
883
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
918
|
-
*
|
|
919
|
-
* console.log(Chunk.toArray(result)) // [3, 4, 5]
|
|
884
|
+
* Chunk.toArray(Chunk.dropWhile(chunk, (n) => n < 3)) // => [3, 4, 5]
|
|
920
885
|
* ```
|
|
921
886
|
*
|
|
922
|
-
* @category
|
|
887
|
+
* @category filtering
|
|
923
888
|
* @since 2.0.0
|
|
924
889
|
*/
|
|
925
890
|
<A>(self: Chunk<A>, predicate: Predicate<A>): Chunk<A>;
|
|
@@ -930,16 +895,13 @@ export declare const dropWhile: {
|
|
|
930
895
|
*
|
|
931
896
|
* **Example** (Prepending all elements)
|
|
932
897
|
*
|
|
933
|
-
* ```ts
|
|
898
|
+
* ```ts import.meta.vitest
|
|
934
899
|
* import { Chunk } from "effect"
|
|
935
900
|
*
|
|
936
|
-
*
|
|
901
|
+
* Chunk.make(1, 2).pipe(
|
|
937
902
|
* Chunk.prependAll(Chunk.make("a", "b")),
|
|
938
903
|
* Chunk.toArray
|
|
939
|
-
* )
|
|
940
|
-
*
|
|
941
|
-
* console.log(result)
|
|
942
|
-
* // [ "a", "b", 1, 2 ]
|
|
904
|
+
* ) // => ["a", "b", 1, 2]
|
|
943
905
|
* ```
|
|
944
906
|
*
|
|
945
907
|
* @category combining
|
|
@@ -952,16 +914,13 @@ export declare const prependAll: {
|
|
|
952
914
|
*
|
|
953
915
|
* **Example** (Prepending all elements)
|
|
954
916
|
*
|
|
955
|
-
* ```ts
|
|
917
|
+
* ```ts import.meta.vitest
|
|
956
918
|
* import { Chunk } from "effect"
|
|
957
919
|
*
|
|
958
|
-
*
|
|
920
|
+
* Chunk.make(1, 2).pipe(
|
|
959
921
|
* Chunk.prependAll(Chunk.make("a", "b")),
|
|
960
922
|
* Chunk.toArray
|
|
961
|
-
* )
|
|
962
|
-
*
|
|
963
|
-
* console.log(result)
|
|
964
|
-
* // [ "a", "b", 1, 2 ]
|
|
923
|
+
* ) // => ["a", "b", 1, 2]
|
|
965
924
|
* ```
|
|
966
925
|
*
|
|
967
926
|
* @category combining
|
|
@@ -974,16 +933,13 @@ export declare const prependAll: {
|
|
|
974
933
|
*
|
|
975
934
|
* **Example** (Prepending all elements)
|
|
976
935
|
*
|
|
977
|
-
* ```ts
|
|
936
|
+
* ```ts import.meta.vitest
|
|
978
937
|
* import { Chunk } from "effect"
|
|
979
938
|
*
|
|
980
|
-
*
|
|
939
|
+
* Chunk.make(1, 2).pipe(
|
|
981
940
|
* Chunk.prependAll(Chunk.make("a", "b")),
|
|
982
941
|
* Chunk.toArray
|
|
983
|
-
* )
|
|
984
|
-
*
|
|
985
|
-
* console.log(result)
|
|
986
|
-
* // [ "a", "b", 1, 2 ]
|
|
942
|
+
* ) // => ["a", "b", 1, 2]
|
|
987
943
|
* ```
|
|
988
944
|
*
|
|
989
945
|
* @category combining
|
|
@@ -996,16 +952,13 @@ export declare const prependAll: {
|
|
|
996
952
|
*
|
|
997
953
|
* **Example** (Prepending all elements)
|
|
998
954
|
*
|
|
999
|
-
* ```ts
|
|
955
|
+
* ```ts import.meta.vitest
|
|
1000
956
|
* import { Chunk } from "effect"
|
|
1001
957
|
*
|
|
1002
|
-
*
|
|
958
|
+
* Chunk.make(1, 2).pipe(
|
|
1003
959
|
* Chunk.prependAll(Chunk.make("a", "b")),
|
|
1004
960
|
* Chunk.toArray
|
|
1005
|
-
* )
|
|
1006
|
-
*
|
|
1007
|
-
* console.log(result)
|
|
1008
|
-
* // [ "a", "b", 1, 2 ]
|
|
961
|
+
* ) // => ["a", "b", 1, 2]
|
|
1009
962
|
* ```
|
|
1010
963
|
*
|
|
1011
964
|
* @category combining
|
|
@@ -1018,16 +971,13 @@ export declare const prependAll: {
|
|
|
1018
971
|
*
|
|
1019
972
|
* **Example** (Prepending all elements)
|
|
1020
973
|
*
|
|
1021
|
-
* ```ts
|
|
974
|
+
* ```ts import.meta.vitest
|
|
1022
975
|
* import { Chunk } from "effect"
|
|
1023
976
|
*
|
|
1024
|
-
*
|
|
977
|
+
* Chunk.make(1, 2).pipe(
|
|
1025
978
|
* Chunk.prependAll(Chunk.make("a", "b")),
|
|
1026
979
|
* Chunk.toArray
|
|
1027
|
-
* )
|
|
1028
|
-
*
|
|
1029
|
-
* console.log(result)
|
|
1030
|
-
* // [ "a", "b", 1, 2 ]
|
|
980
|
+
* ) // => ["a", "b", 1, 2]
|
|
1031
981
|
* ```
|
|
1032
982
|
*
|
|
1033
983
|
* @category combining
|
|
@@ -1046,16 +996,13 @@ export declare const prependAll: {
|
|
|
1046
996
|
*
|
|
1047
997
|
* **Example** (Appending all elements)
|
|
1048
998
|
*
|
|
1049
|
-
* ```ts
|
|
999
|
+
* ```ts import.meta.vitest
|
|
1050
1000
|
* import { Chunk } from "effect"
|
|
1051
1001
|
*
|
|
1052
|
-
*
|
|
1002
|
+
* Chunk.make(1, 2).pipe(
|
|
1053
1003
|
* Chunk.appendAll(Chunk.make("a", "b")),
|
|
1054
1004
|
* Chunk.toArray
|
|
1055
|
-
* )
|
|
1056
|
-
*
|
|
1057
|
-
* console.log(result)
|
|
1058
|
-
* // [ 1, 2, "a", "b" ]
|
|
1005
|
+
* ) // => [1, 2, "a", "b"]
|
|
1059
1006
|
* ```
|
|
1060
1007
|
*
|
|
1061
1008
|
* @see {@link prependAll} for concatenating chunks in the opposite order
|
|
@@ -1076,16 +1023,13 @@ export declare const appendAll: {
|
|
|
1076
1023
|
*
|
|
1077
1024
|
* **Example** (Appending all elements)
|
|
1078
1025
|
*
|
|
1079
|
-
* ```ts
|
|
1026
|
+
* ```ts import.meta.vitest
|
|
1080
1027
|
* import { Chunk } from "effect"
|
|
1081
1028
|
*
|
|
1082
|
-
*
|
|
1029
|
+
* Chunk.make(1, 2).pipe(
|
|
1083
1030
|
* Chunk.appendAll(Chunk.make("a", "b")),
|
|
1084
1031
|
* Chunk.toArray
|
|
1085
|
-
* )
|
|
1086
|
-
*
|
|
1087
|
-
* console.log(result)
|
|
1088
|
-
* // [ 1, 2, "a", "b" ]
|
|
1032
|
+
* ) // => [1, 2, "a", "b"]
|
|
1089
1033
|
* ```
|
|
1090
1034
|
*
|
|
1091
1035
|
* @see {@link prependAll} for concatenating chunks in the opposite order
|
|
@@ -1106,16 +1050,13 @@ export declare const appendAll: {
|
|
|
1106
1050
|
*
|
|
1107
1051
|
* **Example** (Appending all elements)
|
|
1108
1052
|
*
|
|
1109
|
-
* ```ts
|
|
1053
|
+
* ```ts import.meta.vitest
|
|
1110
1054
|
* import { Chunk } from "effect"
|
|
1111
1055
|
*
|
|
1112
|
-
*
|
|
1056
|
+
* Chunk.make(1, 2).pipe(
|
|
1113
1057
|
* Chunk.appendAll(Chunk.make("a", "b")),
|
|
1114
1058
|
* Chunk.toArray
|
|
1115
|
-
* )
|
|
1116
|
-
*
|
|
1117
|
-
* console.log(result)
|
|
1118
|
-
* // [ 1, 2, "a", "b" ]
|
|
1059
|
+
* ) // => [1, 2, "a", "b"]
|
|
1119
1060
|
* ```
|
|
1120
1061
|
*
|
|
1121
1062
|
* @see {@link prependAll} for concatenating chunks in the opposite order
|
|
@@ -1136,16 +1077,13 @@ export declare const appendAll: {
|
|
|
1136
1077
|
*
|
|
1137
1078
|
* **Example** (Appending all elements)
|
|
1138
1079
|
*
|
|
1139
|
-
* ```ts
|
|
1080
|
+
* ```ts import.meta.vitest
|
|
1140
1081
|
* import { Chunk } from "effect"
|
|
1141
1082
|
*
|
|
1142
|
-
*
|
|
1083
|
+
* Chunk.make(1, 2).pipe(
|
|
1143
1084
|
* Chunk.appendAll(Chunk.make("a", "b")),
|
|
1144
1085
|
* Chunk.toArray
|
|
1145
|
-
* )
|
|
1146
|
-
*
|
|
1147
|
-
* console.log(result)
|
|
1148
|
-
* // [ 1, 2, "a", "b" ]
|
|
1086
|
+
* ) // => [1, 2, "a", "b"]
|
|
1149
1087
|
* ```
|
|
1150
1088
|
*
|
|
1151
1089
|
* @see {@link prependAll} for concatenating chunks in the opposite order
|
|
@@ -1166,16 +1104,13 @@ export declare const appendAll: {
|
|
|
1166
1104
|
*
|
|
1167
1105
|
* **Example** (Appending all elements)
|
|
1168
1106
|
*
|
|
1169
|
-
* ```ts
|
|
1107
|
+
* ```ts import.meta.vitest
|
|
1170
1108
|
* import { Chunk } from "effect"
|
|
1171
1109
|
*
|
|
1172
|
-
*
|
|
1110
|
+
* Chunk.make(1, 2).pipe(
|
|
1173
1111
|
* Chunk.appendAll(Chunk.make("a", "b")),
|
|
1174
1112
|
* Chunk.toArray
|
|
1175
|
-
* )
|
|
1176
|
-
*
|
|
1177
|
-
* console.log(result)
|
|
1178
|
-
* // [ 1, 2, "a", "b" ]
|
|
1113
|
+
* ) // => [1, 2, "a", "b"]
|
|
1179
1114
|
* ```
|
|
1180
1115
|
*
|
|
1181
1116
|
* @see {@link prependAll} for concatenating chunks in the opposite order
|
|
@@ -1191,7 +1126,7 @@ export declare const appendAll: {
|
|
|
1191
1126
|
*
|
|
1192
1127
|
* **Example** (Filtering and mapping values)
|
|
1193
1128
|
*
|
|
1194
|
-
* ```ts
|
|
1129
|
+
* ```ts import.meta.vitest
|
|
1195
1130
|
* import { Chunk, Result } from "effect"
|
|
1196
1131
|
*
|
|
1197
1132
|
* const chunk = Chunk.make("1", "2", "hello", "3", "world")
|
|
@@ -1199,14 +1134,14 @@ export declare const appendAll: {
|
|
|
1199
1134
|
* const num = parseInt(str)
|
|
1200
1135
|
* return isNaN(num) ? Result.failVoid : Result.succeed(num)
|
|
1201
1136
|
* })
|
|
1202
|
-
*
|
|
1137
|
+
* Chunk.toArray(numbers) // => [1, 2, 3]
|
|
1203
1138
|
*
|
|
1204
1139
|
* // With index parameter
|
|
1205
1140
|
* const evenIndexNumbers = Chunk.filterMap(chunk, (str, i) => {
|
|
1206
1141
|
* const num = parseInt(str)
|
|
1207
1142
|
* return isNaN(num) || i % 2 !== 0 ? Result.failVoid : Result.succeed(num)
|
|
1208
1143
|
* })
|
|
1209
|
-
*
|
|
1144
|
+
* Chunk.toArray(evenIndexNumbers) // => [1]
|
|
1210
1145
|
* ```
|
|
1211
1146
|
*
|
|
1212
1147
|
* @category filtering
|
|
@@ -1218,7 +1153,7 @@ export declare const filterMap: {
|
|
|
1218
1153
|
*
|
|
1219
1154
|
* **Example** (Filtering and mapping values)
|
|
1220
1155
|
*
|
|
1221
|
-
* ```ts
|
|
1156
|
+
* ```ts import.meta.vitest
|
|
1222
1157
|
* import { Chunk, Result } from "effect"
|
|
1223
1158
|
*
|
|
1224
1159
|
* const chunk = Chunk.make("1", "2", "hello", "3", "world")
|
|
@@ -1226,14 +1161,14 @@ export declare const filterMap: {
|
|
|
1226
1161
|
* const num = parseInt(str)
|
|
1227
1162
|
* return isNaN(num) ? Result.failVoid : Result.succeed(num)
|
|
1228
1163
|
* })
|
|
1229
|
-
*
|
|
1164
|
+
* Chunk.toArray(numbers) // => [1, 2, 3]
|
|
1230
1165
|
*
|
|
1231
1166
|
* // With index parameter
|
|
1232
1167
|
* const evenIndexNumbers = Chunk.filterMap(chunk, (str, i) => {
|
|
1233
1168
|
* const num = parseInt(str)
|
|
1234
1169
|
* return isNaN(num) || i % 2 !== 0 ? Result.failVoid : Result.succeed(num)
|
|
1235
1170
|
* })
|
|
1236
|
-
*
|
|
1171
|
+
* Chunk.toArray(evenIndexNumbers) // => [1]
|
|
1237
1172
|
* ```
|
|
1238
1173
|
*
|
|
1239
1174
|
* @category filtering
|
|
@@ -1245,7 +1180,7 @@ export declare const filterMap: {
|
|
|
1245
1180
|
*
|
|
1246
1181
|
* **Example** (Filtering and mapping values)
|
|
1247
1182
|
*
|
|
1248
|
-
* ```ts
|
|
1183
|
+
* ```ts import.meta.vitest
|
|
1249
1184
|
* import { Chunk, Result } from "effect"
|
|
1250
1185
|
*
|
|
1251
1186
|
* const chunk = Chunk.make("1", "2", "hello", "3", "world")
|
|
@@ -1253,14 +1188,14 @@ export declare const filterMap: {
|
|
|
1253
1188
|
* const num = parseInt(str)
|
|
1254
1189
|
* return isNaN(num) ? Result.failVoid : Result.succeed(num)
|
|
1255
1190
|
* })
|
|
1256
|
-
*
|
|
1191
|
+
* Chunk.toArray(numbers) // => [1, 2, 3]
|
|
1257
1192
|
*
|
|
1258
1193
|
* // With index parameter
|
|
1259
1194
|
* const evenIndexNumbers = Chunk.filterMap(chunk, (str, i) => {
|
|
1260
1195
|
* const num = parseInt(str)
|
|
1261
1196
|
* return isNaN(num) || i % 2 !== 0 ? Result.failVoid : Result.succeed(num)
|
|
1262
1197
|
* })
|
|
1263
|
-
*
|
|
1198
|
+
* Chunk.toArray(evenIndexNumbers) // => [1]
|
|
1264
1199
|
* ```
|
|
1265
1200
|
*
|
|
1266
1201
|
* @category filtering
|
|
@@ -1273,17 +1208,17 @@ export declare const filterMap: {
|
|
|
1273
1208
|
*
|
|
1274
1209
|
* **Example** (Filtering values)
|
|
1275
1210
|
*
|
|
1276
|
-
* ```ts
|
|
1211
|
+
* ```ts import.meta.vitest
|
|
1277
1212
|
* import { Chunk } from "effect"
|
|
1278
1213
|
*
|
|
1279
1214
|
* const chunk = Chunk.make(1, 2, 3, 4, 5, 6)
|
|
1280
1215
|
* const evenNumbers = Chunk.filter(chunk, (n) => n % 2 === 0)
|
|
1281
|
-
*
|
|
1216
|
+
* Chunk.toArray(evenNumbers) // => [2, 4, 6]
|
|
1282
1217
|
*
|
|
1283
1218
|
* // With refinement
|
|
1284
1219
|
* const mixed = Chunk.make("hello", 42, "world", 100)
|
|
1285
1220
|
* const numbers = Chunk.filter(mixed, (x): x is number => typeof x === "number")
|
|
1286
|
-
*
|
|
1221
|
+
* Chunk.toArray(numbers) // => [42, 100]
|
|
1287
1222
|
* ```
|
|
1288
1223
|
*
|
|
1289
1224
|
* @category filtering
|
|
@@ -1295,17 +1230,17 @@ export declare const filter: {
|
|
|
1295
1230
|
*
|
|
1296
1231
|
* **Example** (Filtering values)
|
|
1297
1232
|
*
|
|
1298
|
-
* ```ts
|
|
1233
|
+
* ```ts import.meta.vitest
|
|
1299
1234
|
* import { Chunk } from "effect"
|
|
1300
1235
|
*
|
|
1301
1236
|
* const chunk = Chunk.make(1, 2, 3, 4, 5, 6)
|
|
1302
1237
|
* const evenNumbers = Chunk.filter(chunk, (n) => n % 2 === 0)
|
|
1303
|
-
*
|
|
1238
|
+
* Chunk.toArray(evenNumbers) // => [2, 4, 6]
|
|
1304
1239
|
*
|
|
1305
1240
|
* // With refinement
|
|
1306
1241
|
* const mixed = Chunk.make("hello", 42, "world", 100)
|
|
1307
1242
|
* const numbers = Chunk.filter(mixed, (x): x is number => typeof x === "number")
|
|
1308
|
-
*
|
|
1243
|
+
* Chunk.toArray(numbers) // => [42, 100]
|
|
1309
1244
|
* ```
|
|
1310
1245
|
*
|
|
1311
1246
|
* @category filtering
|
|
@@ -1317,17 +1252,17 @@ export declare const filter: {
|
|
|
1317
1252
|
*
|
|
1318
1253
|
* **Example** (Filtering values)
|
|
1319
1254
|
*
|
|
1320
|
-
* ```ts
|
|
1255
|
+
* ```ts import.meta.vitest
|
|
1321
1256
|
* import { Chunk } from "effect"
|
|
1322
1257
|
*
|
|
1323
1258
|
* const chunk = Chunk.make(1, 2, 3, 4, 5, 6)
|
|
1324
1259
|
* const evenNumbers = Chunk.filter(chunk, (n) => n % 2 === 0)
|
|
1325
|
-
*
|
|
1260
|
+
* Chunk.toArray(evenNumbers) // => [2, 4, 6]
|
|
1326
1261
|
*
|
|
1327
1262
|
* // With refinement
|
|
1328
1263
|
* const mixed = Chunk.make("hello", 42, "world", 100)
|
|
1329
1264
|
* const numbers = Chunk.filter(mixed, (x): x is number => typeof x === "number")
|
|
1330
|
-
*
|
|
1265
|
+
* Chunk.toArray(numbers) // => [42, 100]
|
|
1331
1266
|
* ```
|
|
1332
1267
|
*
|
|
1333
1268
|
* @category filtering
|
|
@@ -1339,17 +1274,17 @@ export declare const filter: {
|
|
|
1339
1274
|
*
|
|
1340
1275
|
* **Example** (Filtering values)
|
|
1341
1276
|
*
|
|
1342
|
-
* ```ts
|
|
1277
|
+
* ```ts import.meta.vitest
|
|
1343
1278
|
* import { Chunk } from "effect"
|
|
1344
1279
|
*
|
|
1345
1280
|
* const chunk = Chunk.make(1, 2, 3, 4, 5, 6)
|
|
1346
1281
|
* const evenNumbers = Chunk.filter(chunk, (n) => n % 2 === 0)
|
|
1347
|
-
*
|
|
1282
|
+
* Chunk.toArray(evenNumbers) // => [2, 4, 6]
|
|
1348
1283
|
*
|
|
1349
1284
|
* // With refinement
|
|
1350
1285
|
* const mixed = Chunk.make("hello", 42, "world", 100)
|
|
1351
1286
|
* const numbers = Chunk.filter(mixed, (x): x is number => typeof x === "number")
|
|
1352
|
-
*
|
|
1287
|
+
* Chunk.toArray(numbers) // => [42, 100]
|
|
1353
1288
|
* ```
|
|
1354
1289
|
*
|
|
1355
1290
|
* @category filtering
|
|
@@ -1361,17 +1296,17 @@ export declare const filter: {
|
|
|
1361
1296
|
*
|
|
1362
1297
|
* **Example** (Filtering values)
|
|
1363
1298
|
*
|
|
1364
|
-
* ```ts
|
|
1299
|
+
* ```ts import.meta.vitest
|
|
1365
1300
|
* import { Chunk } from "effect"
|
|
1366
1301
|
*
|
|
1367
1302
|
* const chunk = Chunk.make(1, 2, 3, 4, 5, 6)
|
|
1368
1303
|
* const evenNumbers = Chunk.filter(chunk, (n) => n % 2 === 0)
|
|
1369
|
-
*
|
|
1304
|
+
* Chunk.toArray(evenNumbers) // => [2, 4, 6]
|
|
1370
1305
|
*
|
|
1371
1306
|
* // With refinement
|
|
1372
1307
|
* const mixed = Chunk.make("hello", 42, "world", 100)
|
|
1373
1308
|
* const numbers = Chunk.filter(mixed, (x): x is number => typeof x === "number")
|
|
1374
|
-
*
|
|
1309
|
+
* Chunk.toArray(numbers) // => [42, 100]
|
|
1375
1310
|
* ```
|
|
1376
1311
|
*
|
|
1377
1312
|
* @category filtering
|
|
@@ -1384,23 +1319,19 @@ export declare const filter: {
|
|
|
1384
1319
|
*
|
|
1385
1320
|
* **Example** (Filtering and mapping while values match)
|
|
1386
1321
|
*
|
|
1387
|
-
* ```ts
|
|
1322
|
+
* ```ts import.meta.vitest
|
|
1388
1323
|
* import { Chunk, Result } from "effect"
|
|
1389
1324
|
*
|
|
1390
1325
|
* const chunk = Chunk.make("1", "2", "hello", "3", "4")
|
|
1391
|
-
*
|
|
1392
|
-
* const
|
|
1393
|
-
* return isNaN(
|
|
1394
|
-
* })
|
|
1395
|
-
*
|
|
1396
|
-
*
|
|
1397
|
-
*
|
|
1398
|
-
*
|
|
1399
|
-
*
|
|
1400
|
-
* const num = parseInt(s)
|
|
1401
|
-
* return isNaN(num) ? Result.failVoid : Result.succeed(num)
|
|
1402
|
-
* })
|
|
1403
|
-
* console.log(Chunk.toArray(allNumbers)) // [1, 2, 3, 4]
|
|
1326
|
+
* Chunk.toArray(Chunk.filterMapWhile(chunk, (s) => {
|
|
1327
|
+
* const n = Number(s)
|
|
1328
|
+
* return Number.isNaN(n) ? Result.failVoid : Result.succeed(n)
|
|
1329
|
+
* })) // => [1, 2]
|
|
1330
|
+
*
|
|
1331
|
+
* Chunk.toArray(Chunk.filterMap(chunk, (s) => {
|
|
1332
|
+
* const n = Number(s)
|
|
1333
|
+
* return Number.isNaN(n) ? Result.failVoid : Result.succeed(n)
|
|
1334
|
+
* })) // => [1, 2, 3, 4]
|
|
1404
1335
|
* ```
|
|
1405
1336
|
*
|
|
1406
1337
|
* @category filtering
|
|
@@ -1412,23 +1343,19 @@ export declare const filterMapWhile: {
|
|
|
1412
1343
|
*
|
|
1413
1344
|
* **Example** (Filtering and mapping while values match)
|
|
1414
1345
|
*
|
|
1415
|
-
* ```ts
|
|
1346
|
+
* ```ts import.meta.vitest
|
|
1416
1347
|
* import { Chunk, Result } from "effect"
|
|
1417
1348
|
*
|
|
1418
1349
|
* const chunk = Chunk.make("1", "2", "hello", "3", "4")
|
|
1419
|
-
*
|
|
1420
|
-
* const
|
|
1421
|
-
* return isNaN(
|
|
1422
|
-
* })
|
|
1423
|
-
*
|
|
1424
|
-
*
|
|
1425
|
-
*
|
|
1426
|
-
*
|
|
1427
|
-
*
|
|
1428
|
-
* const num = parseInt(s)
|
|
1429
|
-
* return isNaN(num) ? Result.failVoid : Result.succeed(num)
|
|
1430
|
-
* })
|
|
1431
|
-
* console.log(Chunk.toArray(allNumbers)) // [1, 2, 3, 4]
|
|
1350
|
+
* Chunk.toArray(Chunk.filterMapWhile(chunk, (s) => {
|
|
1351
|
+
* const n = Number(s)
|
|
1352
|
+
* return Number.isNaN(n) ? Result.failVoid : Result.succeed(n)
|
|
1353
|
+
* })) // => [1, 2]
|
|
1354
|
+
*
|
|
1355
|
+
* Chunk.toArray(Chunk.filterMap(chunk, (s) => {
|
|
1356
|
+
* const n = Number(s)
|
|
1357
|
+
* return Number.isNaN(n) ? Result.failVoid : Result.succeed(n)
|
|
1358
|
+
* })) // => [1, 2, 3, 4]
|
|
1432
1359
|
* ```
|
|
1433
1360
|
*
|
|
1434
1361
|
* @category filtering
|
|
@@ -1440,23 +1367,19 @@ export declare const filterMapWhile: {
|
|
|
1440
1367
|
*
|
|
1441
1368
|
* **Example** (Filtering and mapping while values match)
|
|
1442
1369
|
*
|
|
1443
|
-
* ```ts
|
|
1370
|
+
* ```ts import.meta.vitest
|
|
1444
1371
|
* import { Chunk, Result } from "effect"
|
|
1445
1372
|
*
|
|
1446
1373
|
* const chunk = Chunk.make("1", "2", "hello", "3", "4")
|
|
1447
|
-
*
|
|
1448
|
-
* const
|
|
1449
|
-
* return isNaN(
|
|
1450
|
-
* })
|
|
1451
|
-
*
|
|
1452
|
-
*
|
|
1453
|
-
*
|
|
1454
|
-
*
|
|
1455
|
-
*
|
|
1456
|
-
* const num = parseInt(s)
|
|
1457
|
-
* return isNaN(num) ? Result.failVoid : Result.succeed(num)
|
|
1458
|
-
* })
|
|
1459
|
-
* console.log(Chunk.toArray(allNumbers)) // [1, 2, 3, 4]
|
|
1374
|
+
* Chunk.toArray(Chunk.filterMapWhile(chunk, (s) => {
|
|
1375
|
+
* const n = Number(s)
|
|
1376
|
+
* return Number.isNaN(n) ? Result.failVoid : Result.succeed(n)
|
|
1377
|
+
* })) // => [1, 2]
|
|
1378
|
+
*
|
|
1379
|
+
* Chunk.toArray(Chunk.filterMap(chunk, (s) => {
|
|
1380
|
+
* const n = Number(s)
|
|
1381
|
+
* return Number.isNaN(n) ? Result.failVoid : Result.succeed(n)
|
|
1382
|
+
* })) // => [1, 2, 3, 4]
|
|
1460
1383
|
* ```
|
|
1461
1384
|
*
|
|
1462
1385
|
* @category filtering
|
|
@@ -1469,12 +1392,11 @@ export declare const filterMapWhile: {
|
|
|
1469
1392
|
*
|
|
1470
1393
|
* **Example** (Compacting optional values)
|
|
1471
1394
|
*
|
|
1472
|
-
* ```ts
|
|
1395
|
+
* ```ts import.meta.vitest
|
|
1473
1396
|
* import { Chunk, Option } from "effect"
|
|
1474
1397
|
*
|
|
1475
1398
|
* const chunk = Chunk.make(Option.some(1), Option.none(), Option.some(3))
|
|
1476
|
-
*
|
|
1477
|
-
* console.log(Chunk.toArray(result)) // [1, 3]
|
|
1399
|
+
* Chunk.toArray(Chunk.compact(chunk)) // => [1, 3]
|
|
1478
1400
|
* ```
|
|
1479
1401
|
*
|
|
1480
1402
|
* @category filtering
|
|
@@ -1486,12 +1408,12 @@ export declare const compact: <A>(self: Chunk<Option<A>>) => Chunk<A>;
|
|
|
1486
1408
|
*
|
|
1487
1409
|
* **Example** (Flat mapping chunks)
|
|
1488
1410
|
*
|
|
1489
|
-
* ```ts
|
|
1411
|
+
* ```ts import.meta.vitest
|
|
1490
1412
|
* import { Chunk } from "effect"
|
|
1491
1413
|
*
|
|
1492
1414
|
* const chunk = Chunk.make(1, 2, 3)
|
|
1493
1415
|
* const duplicated = Chunk.flatMap(chunk, (n) => Chunk.make(n, n))
|
|
1494
|
-
*
|
|
1416
|
+
* Chunk.toArray(duplicated) // => [1, 1, 2, 2, 3, 3]
|
|
1495
1417
|
*
|
|
1496
1418
|
* // Flattening nested arrays
|
|
1497
1419
|
* const words = Chunk.make("hello", "world")
|
|
@@ -1499,11 +1421,11 @@ export declare const compact: <A>(self: Chunk<Option<A>>) => Chunk<A>;
|
|
|
1499
1421
|
* words,
|
|
1500
1422
|
* (word) => Chunk.fromIterable(word.split(""))
|
|
1501
1423
|
* )
|
|
1502
|
-
*
|
|
1424
|
+
* Chunk.toArray(letters).join("") // => "helloworld"
|
|
1503
1425
|
*
|
|
1504
1426
|
* // With index parameter
|
|
1505
1427
|
* const indexed = Chunk.flatMap(chunk, (n, i) => Chunk.make(n + i))
|
|
1506
|
-
*
|
|
1428
|
+
* Chunk.toArray(indexed) // => [1, 3, 5]
|
|
1507
1429
|
* ```
|
|
1508
1430
|
*
|
|
1509
1431
|
* @category sequencing
|
|
@@ -1515,12 +1437,12 @@ export declare const flatMap: {
|
|
|
1515
1437
|
*
|
|
1516
1438
|
* **Example** (Flat mapping chunks)
|
|
1517
1439
|
*
|
|
1518
|
-
* ```ts
|
|
1440
|
+
* ```ts import.meta.vitest
|
|
1519
1441
|
* import { Chunk } from "effect"
|
|
1520
1442
|
*
|
|
1521
1443
|
* const chunk = Chunk.make(1, 2, 3)
|
|
1522
1444
|
* const duplicated = Chunk.flatMap(chunk, (n) => Chunk.make(n, n))
|
|
1523
|
-
*
|
|
1445
|
+
* Chunk.toArray(duplicated) // => [1, 1, 2, 2, 3, 3]
|
|
1524
1446
|
*
|
|
1525
1447
|
* // Flattening nested arrays
|
|
1526
1448
|
* const words = Chunk.make("hello", "world")
|
|
@@ -1528,11 +1450,11 @@ export declare const flatMap: {
|
|
|
1528
1450
|
* words,
|
|
1529
1451
|
* (word) => Chunk.fromIterable(word.split(""))
|
|
1530
1452
|
* )
|
|
1531
|
-
*
|
|
1453
|
+
* Chunk.toArray(letters).join("") // => "helloworld"
|
|
1532
1454
|
*
|
|
1533
1455
|
* // With index parameter
|
|
1534
1456
|
* const indexed = Chunk.flatMap(chunk, (n, i) => Chunk.make(n + i))
|
|
1535
|
-
*
|
|
1457
|
+
* Chunk.toArray(indexed) // => [1, 3, 5]
|
|
1536
1458
|
* ```
|
|
1537
1459
|
*
|
|
1538
1460
|
* @category sequencing
|
|
@@ -1544,12 +1466,12 @@ export declare const flatMap: {
|
|
|
1544
1466
|
*
|
|
1545
1467
|
* **Example** (Flat mapping chunks)
|
|
1546
1468
|
*
|
|
1547
|
-
* ```ts
|
|
1469
|
+
* ```ts import.meta.vitest
|
|
1548
1470
|
* import { Chunk } from "effect"
|
|
1549
1471
|
*
|
|
1550
1472
|
* const chunk = Chunk.make(1, 2, 3)
|
|
1551
1473
|
* const duplicated = Chunk.flatMap(chunk, (n) => Chunk.make(n, n))
|
|
1552
|
-
*
|
|
1474
|
+
* Chunk.toArray(duplicated) // => [1, 1, 2, 2, 3, 3]
|
|
1553
1475
|
*
|
|
1554
1476
|
* // Flattening nested arrays
|
|
1555
1477
|
* const words = Chunk.make("hello", "world")
|
|
@@ -1557,11 +1479,11 @@ export declare const flatMap: {
|
|
|
1557
1479
|
* words,
|
|
1558
1480
|
* (word) => Chunk.fromIterable(word.split(""))
|
|
1559
1481
|
* )
|
|
1560
|
-
*
|
|
1482
|
+
* Chunk.toArray(letters).join("") // => "helloworld"
|
|
1561
1483
|
*
|
|
1562
1484
|
* // With index parameter
|
|
1563
1485
|
* const indexed = Chunk.flatMap(chunk, (n, i) => Chunk.make(n + i))
|
|
1564
|
-
*
|
|
1486
|
+
* Chunk.toArray(indexed) // => [1, 3, 5]
|
|
1565
1487
|
* ```
|
|
1566
1488
|
*
|
|
1567
1489
|
* @category sequencing
|
|
@@ -1573,12 +1495,12 @@ export declare const flatMap: {
|
|
|
1573
1495
|
*
|
|
1574
1496
|
* **Example** (Flat mapping chunks)
|
|
1575
1497
|
*
|
|
1576
|
-
* ```ts
|
|
1498
|
+
* ```ts import.meta.vitest
|
|
1577
1499
|
* import { Chunk } from "effect"
|
|
1578
1500
|
*
|
|
1579
1501
|
* const chunk = Chunk.make(1, 2, 3)
|
|
1580
1502
|
* const duplicated = Chunk.flatMap(chunk, (n) => Chunk.make(n, n))
|
|
1581
|
-
*
|
|
1503
|
+
* Chunk.toArray(duplicated) // => [1, 1, 2, 2, 3, 3]
|
|
1582
1504
|
*
|
|
1583
1505
|
* // Flattening nested arrays
|
|
1584
1506
|
* const words = Chunk.make("hello", "world")
|
|
@@ -1586,11 +1508,11 @@ export declare const flatMap: {
|
|
|
1586
1508
|
* words,
|
|
1587
1509
|
* (word) => Chunk.fromIterable(word.split(""))
|
|
1588
1510
|
* )
|
|
1589
|
-
*
|
|
1511
|
+
* Chunk.toArray(letters).join("") // => "helloworld"
|
|
1590
1512
|
*
|
|
1591
1513
|
* // With index parameter
|
|
1592
1514
|
* const indexed = Chunk.flatMap(chunk, (n, i) => Chunk.make(n + i))
|
|
1593
|
-
*
|
|
1515
|
+
* Chunk.toArray(indexed) // => [1, 3, 5]
|
|
1594
1516
|
* ```
|
|
1595
1517
|
*
|
|
1596
1518
|
* @category sequencing
|
|
@@ -1610,26 +1532,19 @@ export declare const flatMap: {
|
|
|
1610
1532
|
*
|
|
1611
1533
|
* **Example** (Iterating over chunk values)
|
|
1612
1534
|
*
|
|
1613
|
-
* ```ts
|
|
1535
|
+
* ```ts import.meta.vitest
|
|
1614
1536
|
* import { Chunk } from "effect"
|
|
1615
1537
|
*
|
|
1616
1538
|
* const chunk = Chunk.make(1, 2, 3, 4)
|
|
1617
1539
|
*
|
|
1618
|
-
*
|
|
1619
|
-
* Chunk.forEach(chunk, (n) =>
|
|
1620
|
-
* //
|
|
1621
|
-
* // Value: 1
|
|
1622
|
-
* // Value: 2
|
|
1623
|
-
* // Value: 3
|
|
1624
|
-
* // Value: 4
|
|
1540
|
+
* const values: Array<string> = []
|
|
1541
|
+
* Chunk.forEach(chunk, (n) => values.push(`Value: ${n}`))
|
|
1542
|
+
* values // => ["Value: 1", "Value: 2", "Value: 3", "Value: 4"]
|
|
1625
1543
|
*
|
|
1626
1544
|
* // With index parameter
|
|
1627
|
-
*
|
|
1628
|
-
*
|
|
1629
|
-
* // Index 0: 1
|
|
1630
|
-
* // Index 1: 2
|
|
1631
|
-
* // Index 2: 3
|
|
1632
|
-
* // Index 3: 4
|
|
1545
|
+
* const indexed: Array<string> = []
|
|
1546
|
+
* Chunk.forEach(chunk, (n, i) => indexed.push(`Index ${i}: ${n}`))
|
|
1547
|
+
* indexed // => ["Index 0: 1", "Index 1: 2", "Index 2: 3", "Index 3: 4"]
|
|
1633
1548
|
* ```
|
|
1634
1549
|
*
|
|
1635
1550
|
* @category combinators
|
|
@@ -1648,26 +1563,19 @@ export declare const forEach: {
|
|
|
1648
1563
|
*
|
|
1649
1564
|
* **Example** (Iterating over chunk values)
|
|
1650
1565
|
*
|
|
1651
|
-
* ```ts
|
|
1566
|
+
* ```ts import.meta.vitest
|
|
1652
1567
|
* import { Chunk } from "effect"
|
|
1653
1568
|
*
|
|
1654
1569
|
* const chunk = Chunk.make(1, 2, 3, 4)
|
|
1655
1570
|
*
|
|
1656
|
-
*
|
|
1657
|
-
* Chunk.forEach(chunk, (n) =>
|
|
1658
|
-
* //
|
|
1659
|
-
* // Value: 1
|
|
1660
|
-
* // Value: 2
|
|
1661
|
-
* // Value: 3
|
|
1662
|
-
* // Value: 4
|
|
1571
|
+
* const values: Array<string> = []
|
|
1572
|
+
* Chunk.forEach(chunk, (n) => values.push(`Value: ${n}`))
|
|
1573
|
+
* values // => ["Value: 1", "Value: 2", "Value: 3", "Value: 4"]
|
|
1663
1574
|
*
|
|
1664
1575
|
* // With index parameter
|
|
1665
|
-
*
|
|
1666
|
-
*
|
|
1667
|
-
* // Index 0: 1
|
|
1668
|
-
* // Index 1: 2
|
|
1669
|
-
* // Index 2: 3
|
|
1670
|
-
* // Index 3: 4
|
|
1576
|
+
* const indexed: Array<string> = []
|
|
1577
|
+
* Chunk.forEach(chunk, (n, i) => indexed.push(`Index ${i}: ${n}`))
|
|
1578
|
+
* indexed // => ["Index 0: 1", "Index 1: 2", "Index 2: 3", "Index 3: 4"]
|
|
1671
1579
|
* ```
|
|
1672
1580
|
*
|
|
1673
1581
|
* @category combinators
|
|
@@ -1686,26 +1594,19 @@ export declare const forEach: {
|
|
|
1686
1594
|
*
|
|
1687
1595
|
* **Example** (Iterating over chunk values)
|
|
1688
1596
|
*
|
|
1689
|
-
* ```ts
|
|
1597
|
+
* ```ts import.meta.vitest
|
|
1690
1598
|
* import { Chunk } from "effect"
|
|
1691
1599
|
*
|
|
1692
1600
|
* const chunk = Chunk.make(1, 2, 3, 4)
|
|
1693
1601
|
*
|
|
1694
|
-
*
|
|
1695
|
-
* Chunk.forEach(chunk, (n) =>
|
|
1696
|
-
* //
|
|
1697
|
-
* // Value: 1
|
|
1698
|
-
* // Value: 2
|
|
1699
|
-
* // Value: 3
|
|
1700
|
-
* // Value: 4
|
|
1602
|
+
* const values: Array<string> = []
|
|
1603
|
+
* Chunk.forEach(chunk, (n) => values.push(`Value: ${n}`))
|
|
1604
|
+
* values // => ["Value: 1", "Value: 2", "Value: 3", "Value: 4"]
|
|
1701
1605
|
*
|
|
1702
1606
|
* // With index parameter
|
|
1703
|
-
*
|
|
1704
|
-
*
|
|
1705
|
-
* // Index 0: 1
|
|
1706
|
-
* // Index 1: 2
|
|
1707
|
-
* // Index 2: 3
|
|
1708
|
-
* // Index 3: 4
|
|
1607
|
+
* const indexed: Array<string> = []
|
|
1608
|
+
* Chunk.forEach(chunk, (n, i) => indexed.push(`Index ${i}: ${n}`))
|
|
1609
|
+
* indexed // => ["Index 0: 1", "Index 1: 2", "Index 2: 3", "Index 3: 4"]
|
|
1709
1610
|
* ```
|
|
1710
1611
|
*
|
|
1711
1612
|
* @category combinators
|
|
@@ -1718,7 +1619,7 @@ export declare const forEach: {
|
|
|
1718
1619
|
*
|
|
1719
1620
|
* **Example** (Flattening nested chunks)
|
|
1720
1621
|
*
|
|
1721
|
-
* ```ts
|
|
1622
|
+
* ```ts import.meta.vitest
|
|
1722
1623
|
* import { Chunk } from "effect"
|
|
1723
1624
|
*
|
|
1724
1625
|
* const nested = Chunk.make(
|
|
@@ -1726,8 +1627,7 @@ export declare const forEach: {
|
|
|
1726
1627
|
* Chunk.make(3, 4, 5),
|
|
1727
1628
|
* Chunk.make(6)
|
|
1728
1629
|
* )
|
|
1729
|
-
*
|
|
1730
|
-
* console.log(Chunk.toArray(flattened)) // [1, 2, 3, 4, 5, 6]
|
|
1630
|
+
* Chunk.toArray(Chunk.flatten(nested)) // => [1, 2, 3, 4, 5, 6]
|
|
1731
1631
|
*
|
|
1732
1632
|
* // With empty chunks
|
|
1733
1633
|
* const withEmpty = Chunk.make(
|
|
@@ -1735,7 +1635,7 @@ export declare const forEach: {
|
|
|
1735
1635
|
* Chunk.empty<number>(),
|
|
1736
1636
|
* Chunk.make(3, 4)
|
|
1737
1637
|
* )
|
|
1738
|
-
*
|
|
1638
|
+
* Chunk.toArray(Chunk.flatten(withEmpty)) // => [1, 2, 3, 4]
|
|
1739
1639
|
* ```
|
|
1740
1640
|
*
|
|
1741
1641
|
* @category sequencing
|
|
@@ -1761,25 +1661,23 @@ export declare const flatten: <S extends Chunk<Chunk<any>>>(self: S) => Chunk.Fl
|
|
|
1761
1661
|
*
|
|
1762
1662
|
* **Example** (Splitting into fixed-size chunks)
|
|
1763
1663
|
*
|
|
1764
|
-
* ```ts
|
|
1664
|
+
* ```ts import.meta.vitest
|
|
1765
1665
|
* import { Chunk } from "effect"
|
|
1766
1666
|
*
|
|
1767
1667
|
* const chunk = Chunk.make(1, 2, 3, 4, 5, 6, 7, 8, 9)
|
|
1768
1668
|
* const chunked = Chunk.chunksOf(chunk, 3)
|
|
1769
1669
|
*
|
|
1770
|
-
*
|
|
1771
|
-
* // [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
|
|
1670
|
+
* Chunk.toArray(chunked).map(Chunk.toArray) // => [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
|
|
1772
1671
|
*
|
|
1773
1672
|
* // When length is not evenly divisible
|
|
1774
1673
|
* const chunk2 = Chunk.make(1, 2, 3, 4, 5)
|
|
1775
1674
|
* const chunked2 = Chunk.chunksOf(chunk2, 2)
|
|
1776
|
-
*
|
|
1777
|
-
* // [[1, 2], [3, 4], [5]]
|
|
1675
|
+
* Chunk.toArray(chunked2).map(Chunk.toArray) // => [[1, 2], [3, 4], [5]]
|
|
1778
1676
|
* ```
|
|
1779
1677
|
*
|
|
1780
1678
|
* @see {@link split} for splitting into a target number of chunks instead of a fixed chunk size
|
|
1781
1679
|
*
|
|
1782
|
-
* @category
|
|
1680
|
+
* @category splitting
|
|
1783
1681
|
* @since 2.0.0
|
|
1784
1682
|
*/
|
|
1785
1683
|
export declare const chunksOf: {
|
|
@@ -1802,25 +1700,23 @@ export declare const chunksOf: {
|
|
|
1802
1700
|
*
|
|
1803
1701
|
* **Example** (Splitting into fixed-size chunks)
|
|
1804
1702
|
*
|
|
1805
|
-
* ```ts
|
|
1703
|
+
* ```ts import.meta.vitest
|
|
1806
1704
|
* import { Chunk } from "effect"
|
|
1807
1705
|
*
|
|
1808
1706
|
* const chunk = Chunk.make(1, 2, 3, 4, 5, 6, 7, 8, 9)
|
|
1809
1707
|
* const chunked = Chunk.chunksOf(chunk, 3)
|
|
1810
1708
|
*
|
|
1811
|
-
*
|
|
1812
|
-
* // [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
|
|
1709
|
+
* Chunk.toArray(chunked).map(Chunk.toArray) // => [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
|
|
1813
1710
|
*
|
|
1814
1711
|
* // When length is not evenly divisible
|
|
1815
1712
|
* const chunk2 = Chunk.make(1, 2, 3, 4, 5)
|
|
1816
1713
|
* const chunked2 = Chunk.chunksOf(chunk2, 2)
|
|
1817
|
-
*
|
|
1818
|
-
* // [[1, 2], [3, 4], [5]]
|
|
1714
|
+
* Chunk.toArray(chunked2).map(Chunk.toArray) // => [[1, 2], [3, 4], [5]]
|
|
1819
1715
|
* ```
|
|
1820
1716
|
*
|
|
1821
1717
|
* @see {@link split} for splitting into a target number of chunks instead of a fixed chunk size
|
|
1822
1718
|
*
|
|
1823
|
-
* @category
|
|
1719
|
+
* @category splitting
|
|
1824
1720
|
* @since 2.0.0
|
|
1825
1721
|
*/
|
|
1826
1722
|
(n: number): <A>(self: Chunk<A>) => Chunk<Chunk<A>>;
|
|
@@ -1843,25 +1739,23 @@ export declare const chunksOf: {
|
|
|
1843
1739
|
*
|
|
1844
1740
|
* **Example** (Splitting into fixed-size chunks)
|
|
1845
1741
|
*
|
|
1846
|
-
* ```ts
|
|
1742
|
+
* ```ts import.meta.vitest
|
|
1847
1743
|
* import { Chunk } from "effect"
|
|
1848
1744
|
*
|
|
1849
1745
|
* const chunk = Chunk.make(1, 2, 3, 4, 5, 6, 7, 8, 9)
|
|
1850
1746
|
* const chunked = Chunk.chunksOf(chunk, 3)
|
|
1851
1747
|
*
|
|
1852
|
-
*
|
|
1853
|
-
* // [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
|
|
1748
|
+
* Chunk.toArray(chunked).map(Chunk.toArray) // => [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
|
|
1854
1749
|
*
|
|
1855
1750
|
* // When length is not evenly divisible
|
|
1856
1751
|
* const chunk2 = Chunk.make(1, 2, 3, 4, 5)
|
|
1857
1752
|
* const chunked2 = Chunk.chunksOf(chunk2, 2)
|
|
1858
|
-
*
|
|
1859
|
-
* // [[1, 2], [3, 4], [5]]
|
|
1753
|
+
* Chunk.toArray(chunked2).map(Chunk.toArray) // => [[1, 2], [3, 4], [5]]
|
|
1860
1754
|
* ```
|
|
1861
1755
|
*
|
|
1862
1756
|
* @see {@link split} for splitting into a target number of chunks instead of a fixed chunk size
|
|
1863
1757
|
*
|
|
1864
|
-
* @category
|
|
1758
|
+
* @category splitting
|
|
1865
1759
|
* @since 2.0.0
|
|
1866
1760
|
*/
|
|
1867
1761
|
<A>(self: Chunk<A>, n: number): Chunk<Chunk<A>>;
|
|
@@ -1875,26 +1769,25 @@ export declare const chunksOf: {
|
|
|
1875
1769
|
*
|
|
1876
1770
|
* **Example** (Intersecting chunks)
|
|
1877
1771
|
*
|
|
1878
|
-
* ```ts
|
|
1772
|
+
* ```ts import.meta.vitest
|
|
1879
1773
|
* import { Chunk } from "effect"
|
|
1880
1774
|
*
|
|
1881
1775
|
* const chunk1 = Chunk.make(1, 2, 3, 4)
|
|
1882
1776
|
* const chunk2 = Chunk.make(3, 4, 5, 6)
|
|
1883
|
-
*
|
|
1884
|
-
* console.log(Chunk.toArray(result)) // [3, 4]
|
|
1777
|
+
* Chunk.toArray(Chunk.intersection(chunk1, chunk2)) // => [3, 4]
|
|
1885
1778
|
*
|
|
1886
1779
|
* // With strings
|
|
1887
1780
|
* const words1 = Chunk.make("hello", "world", "foo")
|
|
1888
1781
|
* const words2 = Chunk.make("world", "bar", "foo")
|
|
1889
|
-
*
|
|
1782
|
+
* Chunk.toArray(Chunk.intersection(words1, words2)) // => ["world", "foo"]
|
|
1890
1783
|
*
|
|
1891
1784
|
* // No intersection
|
|
1892
1785
|
* const chunk3 = Chunk.make(1, 2)
|
|
1893
1786
|
* const chunk4 = Chunk.make(3, 4)
|
|
1894
|
-
*
|
|
1787
|
+
* Chunk.toArray(Chunk.intersection(chunk3, chunk4)) // => []
|
|
1895
1788
|
* ```
|
|
1896
1789
|
*
|
|
1897
|
-
* @category
|
|
1790
|
+
* @category set operations
|
|
1898
1791
|
* @since 2.0.0
|
|
1899
1792
|
*/
|
|
1900
1793
|
export declare const intersection: {
|
|
@@ -1907,26 +1800,25 @@ export declare const intersection: {
|
|
|
1907
1800
|
*
|
|
1908
1801
|
* **Example** (Intersecting chunks)
|
|
1909
1802
|
*
|
|
1910
|
-
* ```ts
|
|
1803
|
+
* ```ts import.meta.vitest
|
|
1911
1804
|
* import { Chunk } from "effect"
|
|
1912
1805
|
*
|
|
1913
1806
|
* const chunk1 = Chunk.make(1, 2, 3, 4)
|
|
1914
1807
|
* const chunk2 = Chunk.make(3, 4, 5, 6)
|
|
1915
|
-
*
|
|
1916
|
-
* console.log(Chunk.toArray(result)) // [3, 4]
|
|
1808
|
+
* Chunk.toArray(Chunk.intersection(chunk1, chunk2)) // => [3, 4]
|
|
1917
1809
|
*
|
|
1918
1810
|
* // With strings
|
|
1919
1811
|
* const words1 = Chunk.make("hello", "world", "foo")
|
|
1920
1812
|
* const words2 = Chunk.make("world", "bar", "foo")
|
|
1921
|
-
*
|
|
1813
|
+
* Chunk.toArray(Chunk.intersection(words1, words2)) // => ["world", "foo"]
|
|
1922
1814
|
*
|
|
1923
1815
|
* // No intersection
|
|
1924
1816
|
* const chunk3 = Chunk.make(1, 2)
|
|
1925
1817
|
* const chunk4 = Chunk.make(3, 4)
|
|
1926
|
-
*
|
|
1818
|
+
* Chunk.toArray(Chunk.intersection(chunk3, chunk4)) // => []
|
|
1927
1819
|
* ```
|
|
1928
1820
|
*
|
|
1929
|
-
* @category
|
|
1821
|
+
* @category set operations
|
|
1930
1822
|
* @since 2.0.0
|
|
1931
1823
|
*/
|
|
1932
1824
|
<A>(that: Chunk<A>): <B>(self: Chunk<B>) => Chunk<A & B>;
|
|
@@ -1939,26 +1831,25 @@ export declare const intersection: {
|
|
|
1939
1831
|
*
|
|
1940
1832
|
* **Example** (Intersecting chunks)
|
|
1941
1833
|
*
|
|
1942
|
-
* ```ts
|
|
1834
|
+
* ```ts import.meta.vitest
|
|
1943
1835
|
* import { Chunk } from "effect"
|
|
1944
1836
|
*
|
|
1945
1837
|
* const chunk1 = Chunk.make(1, 2, 3, 4)
|
|
1946
1838
|
* const chunk2 = Chunk.make(3, 4, 5, 6)
|
|
1947
|
-
*
|
|
1948
|
-
* console.log(Chunk.toArray(result)) // [3, 4]
|
|
1839
|
+
* Chunk.toArray(Chunk.intersection(chunk1, chunk2)) // => [3, 4]
|
|
1949
1840
|
*
|
|
1950
1841
|
* // With strings
|
|
1951
1842
|
* const words1 = Chunk.make("hello", "world", "foo")
|
|
1952
1843
|
* const words2 = Chunk.make("world", "bar", "foo")
|
|
1953
|
-
*
|
|
1844
|
+
* Chunk.toArray(Chunk.intersection(words1, words2)) // => ["world", "foo"]
|
|
1954
1845
|
*
|
|
1955
1846
|
* // No intersection
|
|
1956
1847
|
* const chunk3 = Chunk.make(1, 2)
|
|
1957
1848
|
* const chunk4 = Chunk.make(3, 4)
|
|
1958
|
-
*
|
|
1849
|
+
* Chunk.toArray(Chunk.intersection(chunk3, chunk4)) // => []
|
|
1959
1850
|
* ```
|
|
1960
1851
|
*
|
|
1961
|
-
* @category
|
|
1852
|
+
* @category set operations
|
|
1962
1853
|
* @since 2.0.0
|
|
1963
1854
|
*/
|
|
1964
1855
|
<A, B>(self: Chunk<A>, that: Chunk<B>): Chunk<A & B>;
|
|
@@ -1968,14 +1859,14 @@ export declare const intersection: {
|
|
|
1968
1859
|
*
|
|
1969
1860
|
* **Example** (Checking for empty chunks)
|
|
1970
1861
|
*
|
|
1971
|
-
* ```ts
|
|
1862
|
+
* ```ts import.meta.vitest
|
|
1972
1863
|
* import { Chunk } from "effect"
|
|
1973
1864
|
*
|
|
1974
|
-
*
|
|
1975
|
-
*
|
|
1865
|
+
* Chunk.isEmpty(Chunk.empty()) // => true
|
|
1866
|
+
* Chunk.isEmpty(Chunk.make(1, 2, 3)) // => false
|
|
1976
1867
|
* ```
|
|
1977
1868
|
*
|
|
1978
|
-
* @category
|
|
1869
|
+
* @category predicates
|
|
1979
1870
|
* @since 2.0.0
|
|
1980
1871
|
*/
|
|
1981
1872
|
export declare const isEmpty: <A>(self: Chunk<A>) => boolean;
|
|
@@ -1984,14 +1875,14 @@ export declare const isEmpty: <A>(self: Chunk<A>) => boolean;
|
|
|
1984
1875
|
*
|
|
1985
1876
|
* **Example** (Checking for non-empty chunks)
|
|
1986
1877
|
*
|
|
1987
|
-
* ```ts
|
|
1878
|
+
* ```ts import.meta.vitest
|
|
1988
1879
|
* import { Chunk } from "effect"
|
|
1989
1880
|
*
|
|
1990
|
-
*
|
|
1991
|
-
*
|
|
1881
|
+
* Chunk.isNonEmpty(Chunk.empty()) // => false
|
|
1882
|
+
* Chunk.isNonEmpty(Chunk.make(1, 2, 3)) // => true
|
|
1992
1883
|
* ```
|
|
1993
1884
|
*
|
|
1994
|
-
* @category
|
|
1885
|
+
* @category guards
|
|
1995
1886
|
* @since 2.0.0
|
|
1996
1887
|
*/
|
|
1997
1888
|
export declare const isNonEmpty: <A>(self: Chunk<A>) => self is NonEmptyChunk<A>;
|
|
@@ -2000,14 +1891,14 @@ export declare const isNonEmpty: <A>(self: Chunk<A>) => self is NonEmptyChunk<A>
|
|
|
2000
1891
|
*
|
|
2001
1892
|
* **Example** (Getting the first element)
|
|
2002
1893
|
*
|
|
2003
|
-
* ```ts
|
|
2004
|
-
* import { Chunk } from "effect"
|
|
1894
|
+
* ```ts import.meta.vitest
|
|
1895
|
+
* import { Chunk, Option } from "effect"
|
|
2005
1896
|
*
|
|
2006
|
-
*
|
|
2007
|
-
*
|
|
1897
|
+
* Chunk.head(Chunk.empty()) // => Option.none()
|
|
1898
|
+
* Chunk.head(Chunk.make(1, 2, 3)) // => Option.some(1)
|
|
2008
1899
|
* ```
|
|
2009
1900
|
*
|
|
2010
|
-
* @category
|
|
1901
|
+
* @category getters
|
|
2011
1902
|
* @since 2.0.0
|
|
2012
1903
|
*/
|
|
2013
1904
|
export declare const head: <A>(self: Chunk<A>) => Option<A>;
|
|
@@ -2025,17 +1916,17 @@ export declare const head: <A>(self: Chunk<A>) => Option<A>;
|
|
|
2025
1916
|
*
|
|
2026
1917
|
* **Example** (Getting the first element unsafely)
|
|
2027
1918
|
*
|
|
2028
|
-
* ```ts
|
|
1919
|
+
* ```ts import.meta.vitest
|
|
2029
1920
|
* import { Chunk, Option } from "effect"
|
|
2030
1921
|
*
|
|
2031
1922
|
* const chunk = Chunk.make(1, 2, 3, 4)
|
|
2032
|
-
*
|
|
1923
|
+
* Chunk.headUnsafe(chunk) // => 1
|
|
2033
1924
|
*
|
|
2034
1925
|
* const singleElement = Chunk.make("hello")
|
|
2035
|
-
*
|
|
1926
|
+
* Chunk.headUnsafe(singleElement) // => "hello"
|
|
2036
1927
|
*
|
|
2037
1928
|
* // Use Chunk.head when the chunk may be empty
|
|
2038
|
-
*
|
|
1929
|
+
* Option.isNone(Chunk.head(Chunk.empty())) // => true
|
|
2039
1930
|
* ```
|
|
2040
1931
|
*
|
|
2041
1932
|
* @category unsafe
|
|
@@ -2047,20 +1938,20 @@ export declare const headUnsafe: <A>(self: Chunk<A>) => A;
|
|
|
2047
1938
|
*
|
|
2048
1939
|
* **Example** (Getting the first element of a non-empty chunk)
|
|
2049
1940
|
*
|
|
2050
|
-
* ```ts
|
|
1941
|
+
* ```ts import.meta.vitest
|
|
2051
1942
|
* import { Chunk } from "effect"
|
|
2052
1943
|
*
|
|
2053
1944
|
* const nonEmptyChunk = Chunk.make(1, 2, 3, 4)
|
|
2054
|
-
*
|
|
1945
|
+
* Chunk.headNonEmpty(nonEmptyChunk) // => 1
|
|
2055
1946
|
*
|
|
2056
1947
|
* const singleElement = Chunk.make("hello")
|
|
2057
|
-
*
|
|
1948
|
+
* Chunk.headNonEmpty(singleElement) // => "hello"
|
|
2058
1949
|
*
|
|
2059
1950
|
* // Type safety: this function only accepts NonEmptyChunk
|
|
2060
1951
|
* // Chunk.headNonEmpty(Chunk.empty()) // TypeScript error
|
|
2061
1952
|
* ```
|
|
2062
1953
|
*
|
|
2063
|
-
* @category
|
|
1954
|
+
* @category getters
|
|
2064
1955
|
* @since 2.0.0
|
|
2065
1956
|
*/
|
|
2066
1957
|
export declare const headNonEmpty: <A>(self: NonEmptyChunk<A>) => A;
|
|
@@ -2069,14 +1960,14 @@ export declare const headNonEmpty: <A>(self: NonEmptyChunk<A>) => A;
|
|
|
2069
1960
|
*
|
|
2070
1961
|
* **Example** (Getting the last element)
|
|
2071
1962
|
*
|
|
2072
|
-
* ```ts
|
|
2073
|
-
* import { Chunk } from "effect"
|
|
1963
|
+
* ```ts import.meta.vitest
|
|
1964
|
+
* import { Chunk, Option } from "effect"
|
|
2074
1965
|
*
|
|
2075
|
-
*
|
|
2076
|
-
*
|
|
1966
|
+
* Chunk.last(Chunk.empty()) // => Option.none()
|
|
1967
|
+
* Chunk.last(Chunk.make(1, 2, 3)) // => Option.some(3)
|
|
2077
1968
|
* ```
|
|
2078
1969
|
*
|
|
2079
|
-
* @category
|
|
1970
|
+
* @category getters
|
|
2080
1971
|
* @since 2.0.0
|
|
2081
1972
|
*/
|
|
2082
1973
|
export declare const last: <A>(self: Chunk<A>) => Option<A>;
|
|
@@ -2094,17 +1985,17 @@ export declare const last: <A>(self: Chunk<A>) => Option<A>;
|
|
|
2094
1985
|
*
|
|
2095
1986
|
* **Example** (Getting the last element unsafely)
|
|
2096
1987
|
*
|
|
2097
|
-
* ```ts
|
|
1988
|
+
* ```ts import.meta.vitest
|
|
2098
1989
|
* import { Chunk, Option } from "effect"
|
|
2099
1990
|
*
|
|
2100
1991
|
* const chunk = Chunk.make(1, 2, 3, 4)
|
|
2101
|
-
*
|
|
1992
|
+
* Chunk.lastUnsafe(chunk) // => 4
|
|
2102
1993
|
*
|
|
2103
1994
|
* const singleElement = Chunk.make("hello")
|
|
2104
|
-
*
|
|
1995
|
+
* Chunk.lastUnsafe(singleElement) // => "hello"
|
|
2105
1996
|
*
|
|
2106
1997
|
* // Use Chunk.last when the chunk may be empty
|
|
2107
|
-
*
|
|
1998
|
+
* Option.isNone(Chunk.last(Chunk.empty())) // => true
|
|
2108
1999
|
* ```
|
|
2109
2000
|
*
|
|
2110
2001
|
* @category unsafe
|
|
@@ -2116,20 +2007,20 @@ export declare const lastUnsafe: <A>(self: Chunk<A>) => A;
|
|
|
2116
2007
|
*
|
|
2117
2008
|
* **Example** (Getting the last element of a non-empty chunk)
|
|
2118
2009
|
*
|
|
2119
|
-
* ```ts
|
|
2010
|
+
* ```ts import.meta.vitest
|
|
2120
2011
|
* import { Chunk } from "effect"
|
|
2121
2012
|
*
|
|
2122
2013
|
* const nonEmptyChunk = Chunk.make(1, 2, 3, 4)
|
|
2123
|
-
*
|
|
2014
|
+
* Chunk.lastNonEmpty(nonEmptyChunk) // => 4
|
|
2124
2015
|
*
|
|
2125
2016
|
* const singleElement = Chunk.make("hello")
|
|
2126
|
-
*
|
|
2017
|
+
* Chunk.lastNonEmpty(singleElement) // => "hello"
|
|
2127
2018
|
*
|
|
2128
2019
|
* // Type safety: this function only accepts NonEmptyChunk
|
|
2129
2020
|
* // Chunk.lastNonEmpty(Chunk.empty()) // TypeScript error
|
|
2130
2021
|
* ```
|
|
2131
2022
|
*
|
|
2132
|
-
* @category
|
|
2023
|
+
* @category getters
|
|
2133
2024
|
* @since 3.4.0
|
|
2134
2025
|
*/
|
|
2135
2026
|
export declare const lastNonEmpty: <A>(self: NonEmptyChunk<A>) => A;
|
|
@@ -2138,7 +2029,7 @@ export declare const lastNonEmpty: <A>(self: NonEmptyChunk<A>) => A;
|
|
|
2138
2029
|
*
|
|
2139
2030
|
* **Example** (Working with Chunk utility types)
|
|
2140
2031
|
*
|
|
2141
|
-
* ```ts
|
|
2032
|
+
* ```ts import.meta.vitest
|
|
2142
2033
|
* import type { Chunk } from "effect"
|
|
2143
2034
|
*
|
|
2144
2035
|
* // Extract the element type from a Chunk
|
|
@@ -2158,7 +2049,7 @@ export declare namespace Chunk {
|
|
|
2158
2049
|
*
|
|
2159
2050
|
* **Example** (Inferring element types)
|
|
2160
2051
|
*
|
|
2161
|
-
* ```ts
|
|
2052
|
+
* ```ts import.meta.vitest
|
|
2162
2053
|
* import type { Chunk } from "effect"
|
|
2163
2054
|
*
|
|
2164
2055
|
* declare const numberChunk: Chunk.Chunk<number>
|
|
@@ -2168,7 +2059,7 @@ export declare namespace Chunk {
|
|
|
2168
2059
|
* type StringType = Chunk.Chunk.Infer<typeof stringChunk> // string
|
|
2169
2060
|
* ```
|
|
2170
2061
|
*
|
|
2171
|
-
* @category types
|
|
2062
|
+
* @category utility types
|
|
2172
2063
|
* @since 2.0.0
|
|
2173
2064
|
*/
|
|
2174
2065
|
type Infer<S extends Chunk<any>> = S extends Chunk<infer A> ? A : never;
|
|
@@ -2177,7 +2068,7 @@ export declare namespace Chunk {
|
|
|
2177
2068
|
*
|
|
2178
2069
|
* **Example** (Preserving non-emptiness)
|
|
2179
2070
|
*
|
|
2180
|
-
* ```ts
|
|
2071
|
+
* ```ts import.meta.vitest
|
|
2181
2072
|
* import type { Chunk } from "effect"
|
|
2182
2073
|
*
|
|
2183
2074
|
* declare const regularChunk: Chunk.Chunk<number>
|
|
@@ -2187,7 +2078,7 @@ export declare namespace Chunk {
|
|
|
2187
2078
|
* type WithString2 = Chunk.Chunk.With<typeof nonEmptyChunk, string> // Chunk.NonEmptyChunk<string>
|
|
2188
2079
|
* ```
|
|
2189
2080
|
*
|
|
2190
|
-
* @category types
|
|
2081
|
+
* @category utility types
|
|
2191
2082
|
* @since 2.0.0
|
|
2192
2083
|
*/
|
|
2193
2084
|
type With<S extends Chunk<any>, A> = S extends NonEmptyChunk<any> ? NonEmptyChunk<A> : Chunk<A>;
|
|
@@ -2196,7 +2087,7 @@ export declare namespace Chunk {
|
|
|
2196
2087
|
*
|
|
2197
2088
|
* **Example** (Preserving non-emptiness from either input)
|
|
2198
2089
|
*
|
|
2199
|
-
* ```ts
|
|
2090
|
+
* ```ts import.meta.vitest
|
|
2200
2091
|
* import type { Chunk } from "effect"
|
|
2201
2092
|
*
|
|
2202
2093
|
* declare const emptyChunk: Chunk.Chunk<number>
|
|
@@ -2219,7 +2110,7 @@ export declare namespace Chunk {
|
|
|
2219
2110
|
* > // Chunk.NonEmptyChunk<string>
|
|
2220
2111
|
* ```
|
|
2221
2112
|
*
|
|
2222
|
-
* @category types
|
|
2113
|
+
* @category utility types
|
|
2223
2114
|
* @since 2.0.0
|
|
2224
2115
|
*/
|
|
2225
2116
|
type OrNonEmpty<S extends Chunk<any>, T extends Chunk<any>, A> = S extends NonEmptyChunk<any> ? NonEmptyChunk<A> : T extends NonEmptyChunk<any> ? NonEmptyChunk<A> : Chunk<A>;
|
|
@@ -2228,7 +2119,7 @@ export declare namespace Chunk {
|
|
|
2228
2119
|
*
|
|
2229
2120
|
* **Example** (Requiring non-emptiness from both inputs)
|
|
2230
2121
|
*
|
|
2231
|
-
* ```ts
|
|
2122
|
+
* ```ts import.meta.vitest
|
|
2232
2123
|
* import type { Chunk } from "effect"
|
|
2233
2124
|
*
|
|
2234
2125
|
* declare const emptyChunk: Chunk.Chunk<number>
|
|
@@ -2251,7 +2142,7 @@ export declare namespace Chunk {
|
|
|
2251
2142
|
* > // Chunk.NonEmptyChunk<string>
|
|
2252
2143
|
* ```
|
|
2253
2144
|
*
|
|
2254
|
-
* @category types
|
|
2145
|
+
* @category utility types
|
|
2255
2146
|
* @since 2.0.0
|
|
2256
2147
|
*/
|
|
2257
2148
|
type AndNonEmpty<S extends Chunk<any>, T extends Chunk<any>, A> = S extends NonEmptyChunk<any> ? T extends NonEmptyChunk<any> ? NonEmptyChunk<A> : Chunk<A> : Chunk<A>;
|
|
@@ -2260,7 +2151,7 @@ export declare namespace Chunk {
|
|
|
2260
2151
|
*
|
|
2261
2152
|
* **Example** (Flattening nested chunk types)
|
|
2262
2153
|
*
|
|
2263
|
-
* ```ts
|
|
2154
|
+
* ```ts import.meta.vitest
|
|
2264
2155
|
* import type { Chunk } from "effect"
|
|
2265
2156
|
*
|
|
2266
2157
|
* declare const nestedChunk: Chunk.Chunk<Chunk.Chunk<number>>
|
|
@@ -2270,7 +2161,7 @@ export declare namespace Chunk {
|
|
|
2270
2161
|
* type Flattened2 = Chunk.Chunk.Flatten<typeof nestedNonEmpty> // Chunk.NonEmptyChunk<string>
|
|
2271
2162
|
* ```
|
|
2272
2163
|
*
|
|
2273
|
-
* @category types
|
|
2164
|
+
* @category utility types
|
|
2274
2165
|
* @since 2.0.0
|
|
2275
2166
|
*/
|
|
2276
2167
|
type Flatten<T extends Chunk<Chunk<any>>> = T extends NonEmptyChunk<NonEmptyChunk<infer A>> ? NonEmptyChunk<A> : T extends Chunk<Chunk<infer A>> ? Chunk<A> : never;
|
|
@@ -2281,12 +2172,10 @@ export declare namespace Chunk {
|
|
|
2281
2172
|
*
|
|
2282
2173
|
* **Example** (Mapping values)
|
|
2283
2174
|
*
|
|
2284
|
-
* ```ts
|
|
2175
|
+
* ```ts import.meta.vitest
|
|
2285
2176
|
* import { Chunk } from "effect"
|
|
2286
2177
|
*
|
|
2287
|
-
*
|
|
2288
|
-
*
|
|
2289
|
-
* console.log(Chunk.toArray(result)) // [2, 3]
|
|
2178
|
+
* Chunk.toArray(Chunk.map(Chunk.make(1, 2), (n) => n + 1)) // => [2, 3]
|
|
2290
2179
|
* ```
|
|
2291
2180
|
*
|
|
2292
2181
|
* @category mapping
|
|
@@ -2299,12 +2188,10 @@ export declare const map: {
|
|
|
2299
2188
|
*
|
|
2300
2189
|
* **Example** (Mapping values)
|
|
2301
2190
|
*
|
|
2302
|
-
* ```ts
|
|
2191
|
+
* ```ts import.meta.vitest
|
|
2303
2192
|
* import { Chunk } from "effect"
|
|
2304
2193
|
*
|
|
2305
|
-
*
|
|
2306
|
-
*
|
|
2307
|
-
* console.log(Chunk.toArray(result)) // [2, 3]
|
|
2194
|
+
* Chunk.toArray(Chunk.map(Chunk.make(1, 2), (n) => n + 1)) // => [2, 3]
|
|
2308
2195
|
* ```
|
|
2309
2196
|
*
|
|
2310
2197
|
* @category mapping
|
|
@@ -2317,12 +2204,10 @@ export declare const map: {
|
|
|
2317
2204
|
*
|
|
2318
2205
|
* **Example** (Mapping values)
|
|
2319
2206
|
*
|
|
2320
|
-
* ```ts
|
|
2207
|
+
* ```ts import.meta.vitest
|
|
2321
2208
|
* import { Chunk } from "effect"
|
|
2322
2209
|
*
|
|
2323
|
-
*
|
|
2324
|
-
*
|
|
2325
|
-
* console.log(Chunk.toArray(result)) // [2, 3]
|
|
2210
|
+
* Chunk.toArray(Chunk.map(Chunk.make(1, 2), (n) => n + 1)) // => [2, 3]
|
|
2326
2211
|
* ```
|
|
2327
2212
|
*
|
|
2328
2213
|
* @category mapping
|
|
@@ -2335,12 +2220,10 @@ export declare const map: {
|
|
|
2335
2220
|
*
|
|
2336
2221
|
* **Example** (Mapping values)
|
|
2337
2222
|
*
|
|
2338
|
-
* ```ts
|
|
2223
|
+
* ```ts import.meta.vitest
|
|
2339
2224
|
* import { Chunk } from "effect"
|
|
2340
2225
|
*
|
|
2341
|
-
*
|
|
2342
|
-
*
|
|
2343
|
-
* console.log(Chunk.toArray(result)) // [2, 3]
|
|
2226
|
+
* Chunk.toArray(Chunk.map(Chunk.make(1, 2), (n) => n + 1)) // => [2, 3]
|
|
2344
2227
|
* ```
|
|
2345
2228
|
*
|
|
2346
2229
|
* @category mapping
|
|
@@ -2353,7 +2236,7 @@ export declare const map: {
|
|
|
2353
2236
|
*
|
|
2354
2237
|
* **Example** (Mapping with accumulated state)
|
|
2355
2238
|
*
|
|
2356
|
-
* ```ts
|
|
2239
|
+
* ```ts import.meta.vitest
|
|
2357
2240
|
* import { Chunk } from "effect"
|
|
2358
2241
|
*
|
|
2359
2242
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
@@ -2362,8 +2245,8 @@ export declare const map: {
|
|
|
2362
2245
|
* state + current // output running sum
|
|
2363
2246
|
* ])
|
|
2364
2247
|
*
|
|
2365
|
-
*
|
|
2366
|
-
*
|
|
2248
|
+
* finalState // => 15
|
|
2249
|
+
* Chunk.toArray(mapped) // => [1, 3, 6, 10, 15]
|
|
2367
2250
|
*
|
|
2368
2251
|
* // Building a string with indices
|
|
2369
2252
|
* const words = Chunk.make("hello", "world", "effect")
|
|
@@ -2371,8 +2254,8 @@ export declare const map: {
|
|
|
2371
2254
|
* index + 1,
|
|
2372
2255
|
* `${index}: ${word}`
|
|
2373
2256
|
* ])
|
|
2374
|
-
*
|
|
2375
|
-
*
|
|
2257
|
+
* count // => 3
|
|
2258
|
+
* Chunk.toArray(indexed) // => ["0: hello", "1: world", "2: effect"]
|
|
2376
2259
|
* ```
|
|
2377
2260
|
*
|
|
2378
2261
|
* @category folding
|
|
@@ -2384,7 +2267,7 @@ export declare const mapAccum: {
|
|
|
2384
2267
|
*
|
|
2385
2268
|
* **Example** (Mapping with accumulated state)
|
|
2386
2269
|
*
|
|
2387
|
-
* ```ts
|
|
2270
|
+
* ```ts import.meta.vitest
|
|
2388
2271
|
* import { Chunk } from "effect"
|
|
2389
2272
|
*
|
|
2390
2273
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
@@ -2393,8 +2276,8 @@ export declare const mapAccum: {
|
|
|
2393
2276
|
* state + current // output running sum
|
|
2394
2277
|
* ])
|
|
2395
2278
|
*
|
|
2396
|
-
*
|
|
2397
|
-
*
|
|
2279
|
+
* finalState // => 15
|
|
2280
|
+
* Chunk.toArray(mapped) // => [1, 3, 6, 10, 15]
|
|
2398
2281
|
*
|
|
2399
2282
|
* // Building a string with indices
|
|
2400
2283
|
* const words = Chunk.make("hello", "world", "effect")
|
|
@@ -2402,8 +2285,8 @@ export declare const mapAccum: {
|
|
|
2402
2285
|
* index + 1,
|
|
2403
2286
|
* `${index}: ${word}`
|
|
2404
2287
|
* ])
|
|
2405
|
-
*
|
|
2406
|
-
*
|
|
2288
|
+
* count // => 3
|
|
2289
|
+
* Chunk.toArray(indexed) // => ["0: hello", "1: world", "2: effect"]
|
|
2407
2290
|
* ```
|
|
2408
2291
|
*
|
|
2409
2292
|
* @category folding
|
|
@@ -2415,7 +2298,7 @@ export declare const mapAccum: {
|
|
|
2415
2298
|
*
|
|
2416
2299
|
* **Example** (Mapping with accumulated state)
|
|
2417
2300
|
*
|
|
2418
|
-
* ```ts
|
|
2301
|
+
* ```ts import.meta.vitest
|
|
2419
2302
|
* import { Chunk } from "effect"
|
|
2420
2303
|
*
|
|
2421
2304
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
@@ -2424,8 +2307,8 @@ export declare const mapAccum: {
|
|
|
2424
2307
|
* state + current // output running sum
|
|
2425
2308
|
* ])
|
|
2426
2309
|
*
|
|
2427
|
-
*
|
|
2428
|
-
*
|
|
2310
|
+
* finalState // => 15
|
|
2311
|
+
* Chunk.toArray(mapped) // => [1, 3, 6, 10, 15]
|
|
2429
2312
|
*
|
|
2430
2313
|
* // Building a string with indices
|
|
2431
2314
|
* const words = Chunk.make("hello", "world", "effect")
|
|
@@ -2433,8 +2316,8 @@ export declare const mapAccum: {
|
|
|
2433
2316
|
* index + 1,
|
|
2434
2317
|
* `${index}: ${word}`
|
|
2435
2318
|
* ])
|
|
2436
|
-
*
|
|
2437
|
-
*
|
|
2319
|
+
* count // => 3
|
|
2320
|
+
* Chunk.toArray(indexed) // => ["0: hello", "1: world", "2: effect"]
|
|
2438
2321
|
* ```
|
|
2439
2322
|
*
|
|
2440
2323
|
* @category folding
|
|
@@ -2451,15 +2334,15 @@ export declare const mapAccum: {
|
|
|
2451
2334
|
*
|
|
2452
2335
|
* **Example** (Partitioning with a Result)
|
|
2453
2336
|
*
|
|
2454
|
-
* ```ts
|
|
2337
|
+
* ```ts import.meta.vitest
|
|
2455
2338
|
* import { Chunk, Result } from "effect"
|
|
2456
2339
|
*
|
|
2457
2340
|
* const [excluded, satisfying] = Chunk.partition(Chunk.make(1, -2, 3), (n, i) =>
|
|
2458
2341
|
* n > 0 ? Result.succeed(n + i) : Result.fail(`negative:${n}`)
|
|
2459
2342
|
* )
|
|
2460
2343
|
*
|
|
2461
|
-
*
|
|
2462
|
-
*
|
|
2344
|
+
* Chunk.toArray(excluded) // => ["negative:-2"]
|
|
2345
|
+
* Chunk.toArray(satisfying) // => [1, 5]
|
|
2463
2346
|
* ```
|
|
2464
2347
|
*
|
|
2465
2348
|
* @category filtering
|
|
@@ -2475,15 +2358,15 @@ export declare const partition: {
|
|
|
2475
2358
|
*
|
|
2476
2359
|
* **Example** (Partitioning with a Result)
|
|
2477
2360
|
*
|
|
2478
|
-
* ```ts
|
|
2361
|
+
* ```ts import.meta.vitest
|
|
2479
2362
|
* import { Chunk, Result } from "effect"
|
|
2480
2363
|
*
|
|
2481
2364
|
* const [excluded, satisfying] = Chunk.partition(Chunk.make(1, -2, 3), (n, i) =>
|
|
2482
2365
|
* n > 0 ? Result.succeed(n + i) : Result.fail(`negative:${n}`)
|
|
2483
2366
|
* )
|
|
2484
2367
|
*
|
|
2485
|
-
*
|
|
2486
|
-
*
|
|
2368
|
+
* Chunk.toArray(excluded) // => ["negative:-2"]
|
|
2369
|
+
* Chunk.toArray(satisfying) // => [1, 5]
|
|
2487
2370
|
* ```
|
|
2488
2371
|
*
|
|
2489
2372
|
* @category filtering
|
|
@@ -2499,15 +2382,15 @@ export declare const partition: {
|
|
|
2499
2382
|
*
|
|
2500
2383
|
* **Example** (Partitioning with a Result)
|
|
2501
2384
|
*
|
|
2502
|
-
* ```ts
|
|
2385
|
+
* ```ts import.meta.vitest
|
|
2503
2386
|
* import { Chunk, Result } from "effect"
|
|
2504
2387
|
*
|
|
2505
2388
|
* const [excluded, satisfying] = Chunk.partition(Chunk.make(1, -2, 3), (n, i) =>
|
|
2506
2389
|
* n > 0 ? Result.succeed(n + i) : Result.fail(`negative:${n}`)
|
|
2507
2390
|
* )
|
|
2508
2391
|
*
|
|
2509
|
-
*
|
|
2510
|
-
*
|
|
2392
|
+
* Chunk.toArray(excluded) // => ["negative:-2"]
|
|
2393
|
+
* Chunk.toArray(satisfying) // => [1, 5]
|
|
2511
2394
|
* ```
|
|
2512
2395
|
*
|
|
2513
2396
|
* @category filtering
|
|
@@ -2526,7 +2409,7 @@ export declare const partition: {
|
|
|
2526
2409
|
*
|
|
2527
2410
|
* **Example** (Separating failures and successes)
|
|
2528
2411
|
*
|
|
2529
|
-
* ```ts
|
|
2412
|
+
* ```ts import.meta.vitest
|
|
2530
2413
|
* import { Chunk, Result } from "effect"
|
|
2531
2414
|
*
|
|
2532
2415
|
* const chunk = Chunk.make(
|
|
@@ -2538,14 +2421,14 @@ export declare const partition: {
|
|
|
2538
2421
|
* )
|
|
2539
2422
|
*
|
|
2540
2423
|
* const [errors, values] = Chunk.separate(chunk)
|
|
2541
|
-
*
|
|
2542
|
-
*
|
|
2424
|
+
* Chunk.toArray(errors) // => ["error1", "error2"]
|
|
2425
|
+
* Chunk.toArray(values) // => [1, 2, 3]
|
|
2543
2426
|
*
|
|
2544
2427
|
* // All successes
|
|
2545
2428
|
* const allSuccesses = Chunk.make(Result.succeed(1), Result.succeed(2))
|
|
2546
2429
|
* const [noErrors, allValues] = Chunk.separate(allSuccesses)
|
|
2547
|
-
*
|
|
2548
|
-
*
|
|
2430
|
+
* Chunk.toArray(noErrors) // => []
|
|
2431
|
+
* Chunk.toArray(allValues) // => [1, 2]
|
|
2549
2432
|
* ```
|
|
2550
2433
|
*
|
|
2551
2434
|
* @category filtering
|
|
@@ -2557,14 +2440,13 @@ export declare const separate: <A, B>(self: Chunk<Result<B, A>>) => [Chunk<A>, C
|
|
|
2557
2440
|
*
|
|
2558
2441
|
* **Example** (Getting chunk size)
|
|
2559
2442
|
*
|
|
2560
|
-
* ```ts
|
|
2443
|
+
* ```ts import.meta.vitest
|
|
2561
2444
|
* import { Chunk } from "effect"
|
|
2562
2445
|
*
|
|
2563
|
-
*
|
|
2564
|
-
* console.log(Chunk.size(chunk)) // 3
|
|
2446
|
+
* Chunk.size(Chunk.make(1, 2, 3)) // => 3
|
|
2565
2447
|
* ```
|
|
2566
2448
|
*
|
|
2567
|
-
* @category
|
|
2449
|
+
* @category getters
|
|
2568
2450
|
* @since 2.0.0
|
|
2569
2451
|
*/
|
|
2570
2452
|
export declare const size: <A>(self: Chunk<A>) => number;
|
|
@@ -2573,21 +2455,18 @@ export declare const size: <A>(self: Chunk<A>) => number;
|
|
|
2573
2455
|
*
|
|
2574
2456
|
* **Example** (Sorting chunks)
|
|
2575
2457
|
*
|
|
2576
|
-
* ```ts
|
|
2458
|
+
* ```ts import.meta.vitest
|
|
2577
2459
|
* import { Chunk, Order } from "effect"
|
|
2578
2460
|
*
|
|
2579
2461
|
* const numbers = Chunk.make(3, 1, 4, 1, 5, 9, 2, 6)
|
|
2580
|
-
*
|
|
2581
|
-
* console.log(Chunk.toArray(sorted)) // [1, 1, 2, 3, 4, 5, 6, 9]
|
|
2462
|
+
* Chunk.toArray(Chunk.sort(numbers, Order.Number)) // => [1, 1, 2, 3, 4, 5, 6, 9]
|
|
2582
2463
|
*
|
|
2583
2464
|
* // Reverse order
|
|
2584
|
-
*
|
|
2585
|
-
* console.log(Chunk.toArray(reverseSorted)) // [9, 6, 5, 4, 3, 2, 1, 1]
|
|
2465
|
+
* Chunk.toArray(Chunk.sort(numbers, Order.flip(Order.Number))) // => [9, 6, 5, 4, 3, 2, 1, 1]
|
|
2586
2466
|
*
|
|
2587
2467
|
* // String sorting
|
|
2588
2468
|
* const words = Chunk.make("banana", "apple", "cherry")
|
|
2589
|
-
*
|
|
2590
|
-
* console.log(Chunk.toArray(sortedWords)) // ["apple", "banana", "cherry"]
|
|
2469
|
+
* Chunk.toArray(Chunk.sort(words, Order.String)) // => ["apple", "banana", "cherry"]
|
|
2591
2470
|
* ```
|
|
2592
2471
|
*
|
|
2593
2472
|
* @category sorting
|
|
@@ -2599,21 +2478,18 @@ export declare const sort: {
|
|
|
2599
2478
|
*
|
|
2600
2479
|
* **Example** (Sorting chunks)
|
|
2601
2480
|
*
|
|
2602
|
-
* ```ts
|
|
2481
|
+
* ```ts import.meta.vitest
|
|
2603
2482
|
* import { Chunk, Order } from "effect"
|
|
2604
2483
|
*
|
|
2605
2484
|
* const numbers = Chunk.make(3, 1, 4, 1, 5, 9, 2, 6)
|
|
2606
|
-
*
|
|
2607
|
-
* console.log(Chunk.toArray(sorted)) // [1, 1, 2, 3, 4, 5, 6, 9]
|
|
2485
|
+
* Chunk.toArray(Chunk.sort(numbers, Order.Number)) // => [1, 1, 2, 3, 4, 5, 6, 9]
|
|
2608
2486
|
*
|
|
2609
2487
|
* // Reverse order
|
|
2610
|
-
*
|
|
2611
|
-
* console.log(Chunk.toArray(reverseSorted)) // [9, 6, 5, 4, 3, 2, 1, 1]
|
|
2488
|
+
* Chunk.toArray(Chunk.sort(numbers, Order.flip(Order.Number))) // => [9, 6, 5, 4, 3, 2, 1, 1]
|
|
2612
2489
|
*
|
|
2613
2490
|
* // String sorting
|
|
2614
2491
|
* const words = Chunk.make("banana", "apple", "cherry")
|
|
2615
|
-
*
|
|
2616
|
-
* console.log(Chunk.toArray(sortedWords)) // ["apple", "banana", "cherry"]
|
|
2492
|
+
* Chunk.toArray(Chunk.sort(words, Order.String)) // => ["apple", "banana", "cherry"]
|
|
2617
2493
|
* ```
|
|
2618
2494
|
*
|
|
2619
2495
|
* @category sorting
|
|
@@ -2625,21 +2501,18 @@ export declare const sort: {
|
|
|
2625
2501
|
*
|
|
2626
2502
|
* **Example** (Sorting chunks)
|
|
2627
2503
|
*
|
|
2628
|
-
* ```ts
|
|
2504
|
+
* ```ts import.meta.vitest
|
|
2629
2505
|
* import { Chunk, Order } from "effect"
|
|
2630
2506
|
*
|
|
2631
2507
|
* const numbers = Chunk.make(3, 1, 4, 1, 5, 9, 2, 6)
|
|
2632
|
-
*
|
|
2633
|
-
* console.log(Chunk.toArray(sorted)) // [1, 1, 2, 3, 4, 5, 6, 9]
|
|
2508
|
+
* Chunk.toArray(Chunk.sort(numbers, Order.Number)) // => [1, 1, 2, 3, 4, 5, 6, 9]
|
|
2634
2509
|
*
|
|
2635
2510
|
* // Reverse order
|
|
2636
|
-
*
|
|
2637
|
-
* console.log(Chunk.toArray(reverseSorted)) // [9, 6, 5, 4, 3, 2, 1, 1]
|
|
2511
|
+
* Chunk.toArray(Chunk.sort(numbers, Order.flip(Order.Number))) // => [9, 6, 5, 4, 3, 2, 1, 1]
|
|
2638
2512
|
*
|
|
2639
2513
|
* // String sorting
|
|
2640
2514
|
* const words = Chunk.make("banana", "apple", "cherry")
|
|
2641
|
-
*
|
|
2642
|
-
* console.log(Chunk.toArray(sortedWords)) // ["apple", "banana", "cherry"]
|
|
2515
|
+
* Chunk.toArray(Chunk.sort(words, Order.String)) // => ["apple", "banana", "cherry"]
|
|
2643
2516
|
* ```
|
|
2644
2517
|
*
|
|
2645
2518
|
* @category sorting
|
|
@@ -2652,7 +2525,7 @@ export declare const sort: {
|
|
|
2652
2525
|
*
|
|
2653
2526
|
* **Example** (Sorting chunks by a derived value)
|
|
2654
2527
|
*
|
|
2655
|
-
* ```ts
|
|
2528
|
+
* ```ts import.meta.vitest
|
|
2656
2529
|
* import { Chunk, Order } from "effect"
|
|
2657
2530
|
*
|
|
2658
2531
|
* const people = Chunk.make(
|
|
@@ -2663,18 +2536,15 @@ export declare const sort: {
|
|
|
2663
2536
|
*
|
|
2664
2537
|
* // Sort by age
|
|
2665
2538
|
* const byAge = Chunk.sortWith(people, (person) => person.age, Order.Number)
|
|
2666
|
-
*
|
|
2667
|
-
* // [{ name: "Bob", age: 25 }, { name: "Alice", age: 30 }, { name: "Charlie", age: 35 }]
|
|
2539
|
+
* Chunk.toArray(byAge).map((person) => person.name) // => ["Bob", "Alice", "Charlie"]
|
|
2668
2540
|
*
|
|
2669
2541
|
* // Sort by name
|
|
2670
2542
|
* const byName = Chunk.sortWith(people, (person) => person.name, Order.String)
|
|
2671
|
-
*
|
|
2672
|
-
* // [{ name: "Alice", age: 30 }, { name: "Bob", age: 25 }, { name: "Charlie", age: 35 }]
|
|
2543
|
+
* Chunk.toArray(byName).map((person) => person.name) // => ["Alice", "Bob", "Charlie"]
|
|
2673
2544
|
*
|
|
2674
2545
|
* // Sort by string length
|
|
2675
2546
|
* const words = Chunk.make("a", "abc", "ab")
|
|
2676
|
-
*
|
|
2677
|
-
* console.log(Chunk.toArray(byLength)) // ["a", "ab", "abc"]
|
|
2547
|
+
* Chunk.toArray(Chunk.sortWith(words, (word) => word.length, Order.Number)) // => ["a", "ab", "abc"]
|
|
2678
2548
|
* ```
|
|
2679
2549
|
*
|
|
2680
2550
|
* @category sorting
|
|
@@ -2686,7 +2556,7 @@ export declare const sortWith: {
|
|
|
2686
2556
|
*
|
|
2687
2557
|
* **Example** (Sorting chunks by a derived value)
|
|
2688
2558
|
*
|
|
2689
|
-
* ```ts
|
|
2559
|
+
* ```ts import.meta.vitest
|
|
2690
2560
|
* import { Chunk, Order } from "effect"
|
|
2691
2561
|
*
|
|
2692
2562
|
* const people = Chunk.make(
|
|
@@ -2697,18 +2567,15 @@ export declare const sortWith: {
|
|
|
2697
2567
|
*
|
|
2698
2568
|
* // Sort by age
|
|
2699
2569
|
* const byAge = Chunk.sortWith(people, (person) => person.age, Order.Number)
|
|
2700
|
-
*
|
|
2701
|
-
* // [{ name: "Bob", age: 25 }, { name: "Alice", age: 30 }, { name: "Charlie", age: 35 }]
|
|
2570
|
+
* Chunk.toArray(byAge).map((person) => person.name) // => ["Bob", "Alice", "Charlie"]
|
|
2702
2571
|
*
|
|
2703
2572
|
* // Sort by name
|
|
2704
2573
|
* const byName = Chunk.sortWith(people, (person) => person.name, Order.String)
|
|
2705
|
-
*
|
|
2706
|
-
* // [{ name: "Alice", age: 30 }, { name: "Bob", age: 25 }, { name: "Charlie", age: 35 }]
|
|
2574
|
+
* Chunk.toArray(byName).map((person) => person.name) // => ["Alice", "Bob", "Charlie"]
|
|
2707
2575
|
*
|
|
2708
2576
|
* // Sort by string length
|
|
2709
2577
|
* const words = Chunk.make("a", "abc", "ab")
|
|
2710
|
-
*
|
|
2711
|
-
* console.log(Chunk.toArray(byLength)) // ["a", "ab", "abc"]
|
|
2578
|
+
* Chunk.toArray(Chunk.sortWith(words, (word) => word.length, Order.Number)) // => ["a", "ab", "abc"]
|
|
2712
2579
|
* ```
|
|
2713
2580
|
*
|
|
2714
2581
|
* @category sorting
|
|
@@ -2720,7 +2587,7 @@ export declare const sortWith: {
|
|
|
2720
2587
|
*
|
|
2721
2588
|
* **Example** (Sorting chunks by a derived value)
|
|
2722
2589
|
*
|
|
2723
|
-
* ```ts
|
|
2590
|
+
* ```ts import.meta.vitest
|
|
2724
2591
|
* import { Chunk, Order } from "effect"
|
|
2725
2592
|
*
|
|
2726
2593
|
* const people = Chunk.make(
|
|
@@ -2731,18 +2598,15 @@ export declare const sortWith: {
|
|
|
2731
2598
|
*
|
|
2732
2599
|
* // Sort by age
|
|
2733
2600
|
* const byAge = Chunk.sortWith(people, (person) => person.age, Order.Number)
|
|
2734
|
-
*
|
|
2735
|
-
* // [{ name: "Bob", age: 25 }, { name: "Alice", age: 30 }, { name: "Charlie", age: 35 }]
|
|
2601
|
+
* Chunk.toArray(byAge).map((person) => person.name) // => ["Bob", "Alice", "Charlie"]
|
|
2736
2602
|
*
|
|
2737
2603
|
* // Sort by name
|
|
2738
2604
|
* const byName = Chunk.sortWith(people, (person) => person.name, Order.String)
|
|
2739
|
-
*
|
|
2740
|
-
* // [{ name: "Alice", age: 30 }, { name: "Bob", age: 25 }, { name: "Charlie", age: 35 }]
|
|
2605
|
+
* Chunk.toArray(byName).map((person) => person.name) // => ["Alice", "Bob", "Charlie"]
|
|
2741
2606
|
*
|
|
2742
2607
|
* // Sort by string length
|
|
2743
2608
|
* const words = Chunk.make("a", "abc", "ab")
|
|
2744
|
-
*
|
|
2745
|
-
* console.log(Chunk.toArray(byLength)) // ["a", "ab", "abc"]
|
|
2609
|
+
* Chunk.toArray(Chunk.sortWith(words, (word) => word.length, Order.Number)) // => ["a", "ab", "abc"]
|
|
2746
2610
|
* ```
|
|
2747
2611
|
*
|
|
2748
2612
|
* @category sorting
|
|
@@ -2755,23 +2619,23 @@ export declare const sortWith: {
|
|
|
2755
2619
|
*
|
|
2756
2620
|
* **Example** (Splitting at an index)
|
|
2757
2621
|
*
|
|
2758
|
-
* ```ts
|
|
2622
|
+
* ```ts import.meta.vitest
|
|
2759
2623
|
* import { Chunk } from "effect"
|
|
2760
2624
|
*
|
|
2761
2625
|
* const chunk = Chunk.make(1, 2, 3, 4, 5, 6)
|
|
2762
2626
|
* const [before, after] = Chunk.splitAt(chunk, 3)
|
|
2763
|
-
*
|
|
2764
|
-
*
|
|
2627
|
+
* Chunk.toArray(before) // => [1, 2, 3]
|
|
2628
|
+
* Chunk.toArray(after) // => [4, 5, 6]
|
|
2765
2629
|
*
|
|
2766
2630
|
* // Split at index 0
|
|
2767
2631
|
* const [empty, all] = Chunk.splitAt(chunk, 0)
|
|
2768
|
-
*
|
|
2769
|
-
*
|
|
2632
|
+
* Chunk.toArray(empty) // => []
|
|
2633
|
+
* Chunk.toArray(all) // => [1, 2, 3, 4, 5, 6]
|
|
2770
2634
|
*
|
|
2771
2635
|
* // Split beyond length
|
|
2772
2636
|
* const [allElements, empty2] = Chunk.splitAt(chunk, 10)
|
|
2773
|
-
*
|
|
2774
|
-
*
|
|
2637
|
+
* Chunk.toArray(allElements) // => [1, 2, 3, 4, 5, 6]
|
|
2638
|
+
* Chunk.toArray(empty2) // => []
|
|
2775
2639
|
* ```
|
|
2776
2640
|
*
|
|
2777
2641
|
* @category splitting
|
|
@@ -2783,23 +2647,23 @@ export declare const splitAt: {
|
|
|
2783
2647
|
*
|
|
2784
2648
|
* **Example** (Splitting at an index)
|
|
2785
2649
|
*
|
|
2786
|
-
* ```ts
|
|
2650
|
+
* ```ts import.meta.vitest
|
|
2787
2651
|
* import { Chunk } from "effect"
|
|
2788
2652
|
*
|
|
2789
2653
|
* const chunk = Chunk.make(1, 2, 3, 4, 5, 6)
|
|
2790
2654
|
* const [before, after] = Chunk.splitAt(chunk, 3)
|
|
2791
|
-
*
|
|
2792
|
-
*
|
|
2655
|
+
* Chunk.toArray(before) // => [1, 2, 3]
|
|
2656
|
+
* Chunk.toArray(after) // => [4, 5, 6]
|
|
2793
2657
|
*
|
|
2794
2658
|
* // Split at index 0
|
|
2795
2659
|
* const [empty, all] = Chunk.splitAt(chunk, 0)
|
|
2796
|
-
*
|
|
2797
|
-
*
|
|
2660
|
+
* Chunk.toArray(empty) // => []
|
|
2661
|
+
* Chunk.toArray(all) // => [1, 2, 3, 4, 5, 6]
|
|
2798
2662
|
*
|
|
2799
2663
|
* // Split beyond length
|
|
2800
2664
|
* const [allElements, empty2] = Chunk.splitAt(chunk, 10)
|
|
2801
|
-
*
|
|
2802
|
-
*
|
|
2665
|
+
* Chunk.toArray(allElements) // => [1, 2, 3, 4, 5, 6]
|
|
2666
|
+
* Chunk.toArray(empty2) // => []
|
|
2803
2667
|
* ```
|
|
2804
2668
|
*
|
|
2805
2669
|
* @category splitting
|
|
@@ -2811,23 +2675,23 @@ export declare const splitAt: {
|
|
|
2811
2675
|
*
|
|
2812
2676
|
* **Example** (Splitting at an index)
|
|
2813
2677
|
*
|
|
2814
|
-
* ```ts
|
|
2678
|
+
* ```ts import.meta.vitest
|
|
2815
2679
|
* import { Chunk } from "effect"
|
|
2816
2680
|
*
|
|
2817
2681
|
* const chunk = Chunk.make(1, 2, 3, 4, 5, 6)
|
|
2818
2682
|
* const [before, after] = Chunk.splitAt(chunk, 3)
|
|
2819
|
-
*
|
|
2820
|
-
*
|
|
2683
|
+
* Chunk.toArray(before) // => [1, 2, 3]
|
|
2684
|
+
* Chunk.toArray(after) // => [4, 5, 6]
|
|
2821
2685
|
*
|
|
2822
2686
|
* // Split at index 0
|
|
2823
2687
|
* const [empty, all] = Chunk.splitAt(chunk, 0)
|
|
2824
|
-
*
|
|
2825
|
-
*
|
|
2688
|
+
* Chunk.toArray(empty) // => []
|
|
2689
|
+
* Chunk.toArray(all) // => [1, 2, 3, 4, 5, 6]
|
|
2826
2690
|
*
|
|
2827
2691
|
* // Split beyond length
|
|
2828
2692
|
* const [allElements, empty2] = Chunk.splitAt(chunk, 10)
|
|
2829
|
-
*
|
|
2830
|
-
*
|
|
2693
|
+
* Chunk.toArray(allElements) // => [1, 2, 3, 4, 5, 6]
|
|
2694
|
+
* Chunk.toArray(empty2) // => []
|
|
2831
2695
|
* ```
|
|
2832
2696
|
*
|
|
2833
2697
|
* @category splitting
|
|
@@ -2847,18 +2711,18 @@ export declare const splitAt: {
|
|
|
2847
2711
|
*
|
|
2848
2712
|
* **Example** (Splitting non-empty chunks at an index)
|
|
2849
2713
|
*
|
|
2850
|
-
* ```ts
|
|
2714
|
+
* ```ts import.meta.vitest
|
|
2851
2715
|
* import { Chunk } from "effect"
|
|
2852
2716
|
*
|
|
2853
2717
|
* const nonEmptyChunk = Chunk.make(1, 2, 3, 4, 5, 6)
|
|
2854
2718
|
* const [before, after] = Chunk.splitNonEmptyAt(nonEmptyChunk, 3)
|
|
2855
|
-
*
|
|
2856
|
-
*
|
|
2719
|
+
* Chunk.toArray(before) // => [1, 2, 3]
|
|
2720
|
+
* Chunk.toArray(after) // => [4, 5, 6]
|
|
2857
2721
|
*
|
|
2858
2722
|
* // Split at 1 (minimum)
|
|
2859
2723
|
* const [first, rest] = Chunk.splitNonEmptyAt(nonEmptyChunk, 1)
|
|
2860
|
-
*
|
|
2861
|
-
*
|
|
2724
|
+
* Chunk.toArray(first) // => [1]
|
|
2725
|
+
* Chunk.toArray(rest) // => [2, 3, 4, 5, 6]
|
|
2862
2726
|
*
|
|
2863
2727
|
* // The first part is guaranteed to be NonEmptyChunk
|
|
2864
2728
|
* // while the second part may be empty
|
|
@@ -2880,18 +2744,18 @@ export declare const splitNonEmptyAt: {
|
|
|
2880
2744
|
*
|
|
2881
2745
|
* **Example** (Splitting non-empty chunks at an index)
|
|
2882
2746
|
*
|
|
2883
|
-
* ```ts
|
|
2747
|
+
* ```ts import.meta.vitest
|
|
2884
2748
|
* import { Chunk } from "effect"
|
|
2885
2749
|
*
|
|
2886
2750
|
* const nonEmptyChunk = Chunk.make(1, 2, 3, 4, 5, 6)
|
|
2887
2751
|
* const [before, after] = Chunk.splitNonEmptyAt(nonEmptyChunk, 3)
|
|
2888
|
-
*
|
|
2889
|
-
*
|
|
2752
|
+
* Chunk.toArray(before) // => [1, 2, 3]
|
|
2753
|
+
* Chunk.toArray(after) // => [4, 5, 6]
|
|
2890
2754
|
*
|
|
2891
2755
|
* // Split at 1 (minimum)
|
|
2892
2756
|
* const [first, rest] = Chunk.splitNonEmptyAt(nonEmptyChunk, 1)
|
|
2893
|
-
*
|
|
2894
|
-
*
|
|
2757
|
+
* Chunk.toArray(first) // => [1]
|
|
2758
|
+
* Chunk.toArray(rest) // => [2, 3, 4, 5, 6]
|
|
2895
2759
|
*
|
|
2896
2760
|
* // The first part is guaranteed to be NonEmptyChunk
|
|
2897
2761
|
* // while the second part may be empty
|
|
@@ -2913,18 +2777,18 @@ export declare const splitNonEmptyAt: {
|
|
|
2913
2777
|
*
|
|
2914
2778
|
* **Example** (Splitting non-empty chunks at an index)
|
|
2915
2779
|
*
|
|
2916
|
-
* ```ts
|
|
2780
|
+
* ```ts import.meta.vitest
|
|
2917
2781
|
* import { Chunk } from "effect"
|
|
2918
2782
|
*
|
|
2919
2783
|
* const nonEmptyChunk = Chunk.make(1, 2, 3, 4, 5, 6)
|
|
2920
2784
|
* const [before, after] = Chunk.splitNonEmptyAt(nonEmptyChunk, 3)
|
|
2921
|
-
*
|
|
2922
|
-
*
|
|
2785
|
+
* Chunk.toArray(before) // => [1, 2, 3]
|
|
2786
|
+
* Chunk.toArray(after) // => [4, 5, 6]
|
|
2923
2787
|
*
|
|
2924
2788
|
* // Split at 1 (minimum)
|
|
2925
2789
|
* const [first, rest] = Chunk.splitNonEmptyAt(nonEmptyChunk, 1)
|
|
2926
|
-
*
|
|
2927
|
-
*
|
|
2790
|
+
* Chunk.toArray(first) // => [1]
|
|
2791
|
+
* Chunk.toArray(rest) // => [2, 3, 4, 5, 6]
|
|
2928
2792
|
*
|
|
2929
2793
|
* // The first part is guaranteed to be NonEmptyChunk
|
|
2930
2794
|
* // while the second part may be empty
|
|
@@ -2945,24 +2809,21 @@ export declare const splitNonEmptyAt: {
|
|
|
2945
2809
|
*
|
|
2946
2810
|
* **Example** (Splitting chunks into groups)
|
|
2947
2811
|
*
|
|
2948
|
-
* ```ts
|
|
2812
|
+
* ```ts import.meta.vitest
|
|
2949
2813
|
* import { Chunk } from "effect"
|
|
2950
2814
|
*
|
|
2951
2815
|
* const chunk = Chunk.make(1, 2, 3, 4, 5, 6, 7, 8, 9)
|
|
2952
2816
|
* const chunks = Chunk.split(chunk, 3)
|
|
2953
|
-
*
|
|
2954
|
-
* // [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
|
|
2817
|
+
* Chunk.toArray(chunks).map(Chunk.toArray) // => [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
|
|
2955
2818
|
*
|
|
2956
2819
|
* // Uneven split
|
|
2957
2820
|
* const chunk2 = Chunk.make(1, 2, 3, 4, 5, 6, 7, 8)
|
|
2958
2821
|
* const chunks2 = Chunk.split(chunk2, 3)
|
|
2959
|
-
*
|
|
2960
|
-
* // [[1, 2, 3], [4, 5, 6], [7, 8]]
|
|
2822
|
+
* Chunk.toArray(chunks2).map(Chunk.toArray) // => [[1, 2, 3], [4, 5, 6], [7, 8]]
|
|
2961
2823
|
*
|
|
2962
2824
|
* // Split into 1 chunk
|
|
2963
2825
|
* const chunks3 = Chunk.split(chunk, 1)
|
|
2964
|
-
*
|
|
2965
|
-
* // [[1, 2, 3, 4, 5, 6, 7, 8, 9]]
|
|
2826
|
+
* Chunk.toArray(chunks3).map(Chunk.toArray) // => [[1, 2, 3, 4, 5, 6, 7, 8, 9]]
|
|
2966
2827
|
* ```
|
|
2967
2828
|
*
|
|
2968
2829
|
* @category splitting
|
|
@@ -2979,24 +2840,21 @@ export declare const split: {
|
|
|
2979
2840
|
*
|
|
2980
2841
|
* **Example** (Splitting chunks into groups)
|
|
2981
2842
|
*
|
|
2982
|
-
* ```ts
|
|
2843
|
+
* ```ts import.meta.vitest
|
|
2983
2844
|
* import { Chunk } from "effect"
|
|
2984
2845
|
*
|
|
2985
2846
|
* const chunk = Chunk.make(1, 2, 3, 4, 5, 6, 7, 8, 9)
|
|
2986
2847
|
* const chunks = Chunk.split(chunk, 3)
|
|
2987
|
-
*
|
|
2988
|
-
* // [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
|
|
2848
|
+
* Chunk.toArray(chunks).map(Chunk.toArray) // => [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
|
|
2989
2849
|
*
|
|
2990
2850
|
* // Uneven split
|
|
2991
2851
|
* const chunk2 = Chunk.make(1, 2, 3, 4, 5, 6, 7, 8)
|
|
2992
2852
|
* const chunks2 = Chunk.split(chunk2, 3)
|
|
2993
|
-
*
|
|
2994
|
-
* // [[1, 2, 3], [4, 5, 6], [7, 8]]
|
|
2853
|
+
* Chunk.toArray(chunks2).map(Chunk.toArray) // => [[1, 2, 3], [4, 5, 6], [7, 8]]
|
|
2995
2854
|
*
|
|
2996
2855
|
* // Split into 1 chunk
|
|
2997
2856
|
* const chunks3 = Chunk.split(chunk, 1)
|
|
2998
|
-
*
|
|
2999
|
-
* // [[1, 2, 3, 4, 5, 6, 7, 8, 9]]
|
|
2857
|
+
* Chunk.toArray(chunks3).map(Chunk.toArray) // => [[1, 2, 3, 4, 5, 6, 7, 8, 9]]
|
|
3000
2858
|
* ```
|
|
3001
2859
|
*
|
|
3002
2860
|
* @category splitting
|
|
@@ -3013,24 +2871,21 @@ export declare const split: {
|
|
|
3013
2871
|
*
|
|
3014
2872
|
* **Example** (Splitting chunks into groups)
|
|
3015
2873
|
*
|
|
3016
|
-
* ```ts
|
|
2874
|
+
* ```ts import.meta.vitest
|
|
3017
2875
|
* import { Chunk } from "effect"
|
|
3018
2876
|
*
|
|
3019
2877
|
* const chunk = Chunk.make(1, 2, 3, 4, 5, 6, 7, 8, 9)
|
|
3020
2878
|
* const chunks = Chunk.split(chunk, 3)
|
|
3021
|
-
*
|
|
3022
|
-
* // [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
|
|
2879
|
+
* Chunk.toArray(chunks).map(Chunk.toArray) // => [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
|
|
3023
2880
|
*
|
|
3024
2881
|
* // Uneven split
|
|
3025
2882
|
* const chunk2 = Chunk.make(1, 2, 3, 4, 5, 6, 7, 8)
|
|
3026
2883
|
* const chunks2 = Chunk.split(chunk2, 3)
|
|
3027
|
-
*
|
|
3028
|
-
* // [[1, 2, 3], [4, 5, 6], [7, 8]]
|
|
2884
|
+
* Chunk.toArray(chunks2).map(Chunk.toArray) // => [[1, 2, 3], [4, 5, 6], [7, 8]]
|
|
3029
2885
|
*
|
|
3030
2886
|
* // Split into 1 chunk
|
|
3031
2887
|
* const chunks3 = Chunk.split(chunk, 1)
|
|
3032
|
-
*
|
|
3033
|
-
* // [[1, 2, 3, 4, 5, 6, 7, 8, 9]]
|
|
2888
|
+
* Chunk.toArray(chunks3).map(Chunk.toArray) // => [[1, 2, 3, 4, 5, 6, 7, 8, 9]]
|
|
3034
2889
|
* ```
|
|
3035
2890
|
*
|
|
3036
2891
|
* @category splitting
|
|
@@ -3044,23 +2899,23 @@ export declare const split: {
|
|
|
3044
2899
|
*
|
|
3045
2900
|
* **Example** (Splitting at a matching element)
|
|
3046
2901
|
*
|
|
3047
|
-
* ```ts
|
|
2902
|
+
* ```ts import.meta.vitest
|
|
3048
2903
|
* import { Chunk } from "effect"
|
|
3049
2904
|
*
|
|
3050
2905
|
* const chunk = Chunk.make(1, 2, 3, 4, 5, 6)
|
|
3051
2906
|
* const [before, fromMatch] = Chunk.splitWhere(chunk, (n) => n > 3)
|
|
3052
|
-
*
|
|
3053
|
-
*
|
|
2907
|
+
* Chunk.toArray(before) // => [1, 2, 3]
|
|
2908
|
+
* Chunk.toArray(fromMatch) // => [4, 5, 6]
|
|
3054
2909
|
*
|
|
3055
2910
|
* // No match found
|
|
3056
2911
|
* const [all, empty] = Chunk.splitWhere(chunk, (n) => n > 10)
|
|
3057
|
-
*
|
|
3058
|
-
*
|
|
2912
|
+
* Chunk.toArray(all) // => [1, 2, 3, 4, 5, 6]
|
|
2913
|
+
* Chunk.toArray(empty) // => []
|
|
3059
2914
|
*
|
|
3060
2915
|
* // Match on first element
|
|
3061
2916
|
* const [emptyBefore, allFromFirst] = Chunk.splitWhere(chunk, (n) => n === 1)
|
|
3062
|
-
*
|
|
3063
|
-
*
|
|
2917
|
+
* Chunk.toArray(emptyBefore) // => []
|
|
2918
|
+
* Chunk.toArray(allFromFirst) // => [1, 2, 3, 4, 5, 6]
|
|
3064
2919
|
* ```
|
|
3065
2920
|
*
|
|
3066
2921
|
* @category splitting
|
|
@@ -3073,23 +2928,23 @@ export declare const splitWhere: {
|
|
|
3073
2928
|
*
|
|
3074
2929
|
* **Example** (Splitting at a matching element)
|
|
3075
2930
|
*
|
|
3076
|
-
* ```ts
|
|
2931
|
+
* ```ts import.meta.vitest
|
|
3077
2932
|
* import { Chunk } from "effect"
|
|
3078
2933
|
*
|
|
3079
2934
|
* const chunk = Chunk.make(1, 2, 3, 4, 5, 6)
|
|
3080
2935
|
* const [before, fromMatch] = Chunk.splitWhere(chunk, (n) => n > 3)
|
|
3081
|
-
*
|
|
3082
|
-
*
|
|
2936
|
+
* Chunk.toArray(before) // => [1, 2, 3]
|
|
2937
|
+
* Chunk.toArray(fromMatch) // => [4, 5, 6]
|
|
3083
2938
|
*
|
|
3084
2939
|
* // No match found
|
|
3085
2940
|
* const [all, empty] = Chunk.splitWhere(chunk, (n) => n > 10)
|
|
3086
|
-
*
|
|
3087
|
-
*
|
|
2941
|
+
* Chunk.toArray(all) // => [1, 2, 3, 4, 5, 6]
|
|
2942
|
+
* Chunk.toArray(empty) // => []
|
|
3088
2943
|
*
|
|
3089
2944
|
* // Match on first element
|
|
3090
2945
|
* const [emptyBefore, allFromFirst] = Chunk.splitWhere(chunk, (n) => n === 1)
|
|
3091
|
-
*
|
|
3092
|
-
*
|
|
2946
|
+
* Chunk.toArray(emptyBefore) // => []
|
|
2947
|
+
* Chunk.toArray(allFromFirst) // => [1, 2, 3, 4, 5, 6]
|
|
3093
2948
|
* ```
|
|
3094
2949
|
*
|
|
3095
2950
|
* @category splitting
|
|
@@ -3102,23 +2957,23 @@ export declare const splitWhere: {
|
|
|
3102
2957
|
*
|
|
3103
2958
|
* **Example** (Splitting at a matching element)
|
|
3104
2959
|
*
|
|
3105
|
-
* ```ts
|
|
2960
|
+
* ```ts import.meta.vitest
|
|
3106
2961
|
* import { Chunk } from "effect"
|
|
3107
2962
|
*
|
|
3108
2963
|
* const chunk = Chunk.make(1, 2, 3, 4, 5, 6)
|
|
3109
2964
|
* const [before, fromMatch] = Chunk.splitWhere(chunk, (n) => n > 3)
|
|
3110
|
-
*
|
|
3111
|
-
*
|
|
2965
|
+
* Chunk.toArray(before) // => [1, 2, 3]
|
|
2966
|
+
* Chunk.toArray(fromMatch) // => [4, 5, 6]
|
|
3112
2967
|
*
|
|
3113
2968
|
* // No match found
|
|
3114
2969
|
* const [all, empty] = Chunk.splitWhere(chunk, (n) => n > 10)
|
|
3115
|
-
*
|
|
3116
|
-
*
|
|
2970
|
+
* Chunk.toArray(all) // => [1, 2, 3, 4, 5, 6]
|
|
2971
|
+
* Chunk.toArray(empty) // => []
|
|
3117
2972
|
*
|
|
3118
2973
|
* // Match on first element
|
|
3119
2974
|
* const [emptyBefore, allFromFirst] = Chunk.splitWhere(chunk, (n) => n === 1)
|
|
3120
|
-
*
|
|
3121
|
-
*
|
|
2975
|
+
* Chunk.toArray(emptyBefore) // => []
|
|
2976
|
+
* Chunk.toArray(allFromFirst) // => [1, 2, 3, 4, 5, 6]
|
|
3122
2977
|
* ```
|
|
3123
2978
|
*
|
|
3124
2979
|
* @category splitting
|
|
@@ -3131,20 +2986,19 @@ export declare const splitWhere: {
|
|
|
3131
2986
|
*
|
|
3132
2987
|
* **Example** (Getting the tail safely)
|
|
3133
2988
|
*
|
|
3134
|
-
* ```ts
|
|
3135
|
-
* import { Chunk } from "effect"
|
|
2989
|
+
* ```ts import.meta.vitest
|
|
2990
|
+
* import { Chunk, Option } from "effect"
|
|
3136
2991
|
*
|
|
3137
2992
|
* const chunk = Chunk.make(1, 2, 3, 4)
|
|
3138
|
-
*
|
|
2993
|
+
* Chunk.tail(chunk) // => Option.some(Chunk.make(2, 3, 4))
|
|
3139
2994
|
*
|
|
3140
2995
|
* const singleElement = Chunk.make(1)
|
|
3141
|
-
*
|
|
2996
|
+
* Chunk.tail(singleElement) // => Option.some(Chunk.empty())
|
|
3142
2997
|
*
|
|
3143
|
-
*
|
|
3144
|
-
* console.log(Chunk.tail(empty)) // Option.none()
|
|
2998
|
+
* Chunk.tail(Chunk.empty<number>()) // => Option.none()
|
|
3145
2999
|
* ```
|
|
3146
3000
|
*
|
|
3147
|
-
* @category
|
|
3001
|
+
* @category getters
|
|
3148
3002
|
* @since 2.0.0
|
|
3149
3003
|
*/
|
|
3150
3004
|
export declare const tail: <A>(self: Chunk<A>) => O.Option<Chunk<A>>;
|
|
@@ -3153,22 +3007,20 @@ export declare const tail: <A>(self: Chunk<A>) => O.Option<Chunk<A>>;
|
|
|
3153
3007
|
*
|
|
3154
3008
|
* **Example** (Getting the tail of a non-empty chunk)
|
|
3155
3009
|
*
|
|
3156
|
-
* ```ts
|
|
3010
|
+
* ```ts import.meta.vitest
|
|
3157
3011
|
* import { Chunk } from "effect"
|
|
3158
3012
|
*
|
|
3159
3013
|
* const nonEmptyChunk = Chunk.make(1, 2, 3, 4)
|
|
3160
|
-
*
|
|
3161
|
-
* console.log(Chunk.toArray(result)) // [2, 3, 4]
|
|
3014
|
+
* Chunk.toArray(Chunk.tailNonEmpty(nonEmptyChunk)) // => [2, 3, 4]
|
|
3162
3015
|
*
|
|
3163
3016
|
* const singleElement = Chunk.make(1)
|
|
3164
|
-
*
|
|
3165
|
-
* console.log(Chunk.toArray(resultSingle)) // []
|
|
3017
|
+
* Chunk.toArray(Chunk.tailNonEmpty(singleElement)) // => []
|
|
3166
3018
|
*
|
|
3167
3019
|
* // Type safety: this function only accepts NonEmptyChunk
|
|
3168
3020
|
* // Chunk.tailNonEmpty(Chunk.empty()) // TypeScript error
|
|
3169
3021
|
* ```
|
|
3170
3022
|
*
|
|
3171
|
-
* @category
|
|
3023
|
+
* @category getters
|
|
3172
3024
|
* @since 2.0.0
|
|
3173
3025
|
*/
|
|
3174
3026
|
export declare const tailNonEmpty: <A>(self: NonEmptyChunk<A>) => Chunk<A>;
|
|
@@ -3177,23 +3029,20 @@ export declare const tailNonEmpty: <A>(self: NonEmptyChunk<A>) => Chunk<A>;
|
|
|
3177
3029
|
*
|
|
3178
3030
|
* **Example** (Taking elements from the end)
|
|
3179
3031
|
*
|
|
3180
|
-
* ```ts
|
|
3032
|
+
* ```ts import.meta.vitest
|
|
3181
3033
|
* import { Chunk } from "effect"
|
|
3182
3034
|
*
|
|
3183
3035
|
* const chunk = Chunk.make(1, 2, 3, 4, 5, 6)
|
|
3184
|
-
*
|
|
3185
|
-
* console.log(Chunk.toArray(lastThree)) // [4, 5, 6]
|
|
3036
|
+
* Chunk.toArray(Chunk.takeRight(chunk, 3)) // => [4, 5, 6]
|
|
3186
3037
|
*
|
|
3187
3038
|
* // Take more than available
|
|
3188
|
-
*
|
|
3189
|
-
* console.log(Chunk.toArray(all)) // [1, 2, 3, 4, 5, 6]
|
|
3039
|
+
* Chunk.toArray(Chunk.takeRight(chunk, 10)) // => [1, 2, 3, 4, 5, 6]
|
|
3190
3040
|
*
|
|
3191
3041
|
* // Take zero
|
|
3192
|
-
*
|
|
3193
|
-
* console.log(Chunk.toArray(none)) // []
|
|
3042
|
+
* Chunk.toArray(Chunk.takeRight(chunk, 0)) // => []
|
|
3194
3043
|
* ```
|
|
3195
3044
|
*
|
|
3196
|
-
* @category
|
|
3045
|
+
* @category filtering
|
|
3197
3046
|
* @since 2.0.0
|
|
3198
3047
|
*/
|
|
3199
3048
|
export declare const takeRight: {
|
|
@@ -3202,23 +3051,20 @@ export declare const takeRight: {
|
|
|
3202
3051
|
*
|
|
3203
3052
|
* **Example** (Taking elements from the end)
|
|
3204
3053
|
*
|
|
3205
|
-
* ```ts
|
|
3054
|
+
* ```ts import.meta.vitest
|
|
3206
3055
|
* import { Chunk } from "effect"
|
|
3207
3056
|
*
|
|
3208
3057
|
* const chunk = Chunk.make(1, 2, 3, 4, 5, 6)
|
|
3209
|
-
*
|
|
3210
|
-
* console.log(Chunk.toArray(lastThree)) // [4, 5, 6]
|
|
3058
|
+
* Chunk.toArray(Chunk.takeRight(chunk, 3)) // => [4, 5, 6]
|
|
3211
3059
|
*
|
|
3212
3060
|
* // Take more than available
|
|
3213
|
-
*
|
|
3214
|
-
* console.log(Chunk.toArray(all)) // [1, 2, 3, 4, 5, 6]
|
|
3061
|
+
* Chunk.toArray(Chunk.takeRight(chunk, 10)) // => [1, 2, 3, 4, 5, 6]
|
|
3215
3062
|
*
|
|
3216
3063
|
* // Take zero
|
|
3217
|
-
*
|
|
3218
|
-
* console.log(Chunk.toArray(none)) // []
|
|
3064
|
+
* Chunk.toArray(Chunk.takeRight(chunk, 0)) // => []
|
|
3219
3065
|
* ```
|
|
3220
3066
|
*
|
|
3221
|
-
* @category
|
|
3067
|
+
* @category filtering
|
|
3222
3068
|
* @since 2.0.0
|
|
3223
3069
|
*/
|
|
3224
3070
|
(n: number): <A>(self: Chunk<A>) => Chunk<A>;
|
|
@@ -3227,23 +3073,20 @@ export declare const takeRight: {
|
|
|
3227
3073
|
*
|
|
3228
3074
|
* **Example** (Taking elements from the end)
|
|
3229
3075
|
*
|
|
3230
|
-
* ```ts
|
|
3076
|
+
* ```ts import.meta.vitest
|
|
3231
3077
|
* import { Chunk } from "effect"
|
|
3232
3078
|
*
|
|
3233
3079
|
* const chunk = Chunk.make(1, 2, 3, 4, 5, 6)
|
|
3234
|
-
*
|
|
3235
|
-
* console.log(Chunk.toArray(lastThree)) // [4, 5, 6]
|
|
3080
|
+
* Chunk.toArray(Chunk.takeRight(chunk, 3)) // => [4, 5, 6]
|
|
3236
3081
|
*
|
|
3237
3082
|
* // Take more than available
|
|
3238
|
-
*
|
|
3239
|
-
* console.log(Chunk.toArray(all)) // [1, 2, 3, 4, 5, 6]
|
|
3083
|
+
* Chunk.toArray(Chunk.takeRight(chunk, 10)) // => [1, 2, 3, 4, 5, 6]
|
|
3240
3084
|
*
|
|
3241
3085
|
* // Take zero
|
|
3242
|
-
*
|
|
3243
|
-
* console.log(Chunk.toArray(none)) // []
|
|
3086
|
+
* Chunk.toArray(Chunk.takeRight(chunk, 0)) // => []
|
|
3244
3087
|
* ```
|
|
3245
3088
|
*
|
|
3246
|
-
* @category
|
|
3089
|
+
* @category filtering
|
|
3247
3090
|
* @since 2.0.0
|
|
3248
3091
|
*/
|
|
3249
3092
|
<A>(self: Chunk<A>, n: number): Chunk<A>;
|
|
@@ -3253,24 +3096,21 @@ export declare const takeRight: {
|
|
|
3253
3096
|
*
|
|
3254
3097
|
* **Example** (Taking elements while a predicate matches)
|
|
3255
3098
|
*
|
|
3256
|
-
* ```ts
|
|
3099
|
+
* ```ts import.meta.vitest
|
|
3257
3100
|
* import { Chunk } from "effect"
|
|
3258
3101
|
*
|
|
3259
3102
|
* const chunk = Chunk.make(1, 2, 3, 4, 3, 2, 1)
|
|
3260
|
-
*
|
|
3261
|
-
* console.log(Chunk.toArray(result)) // [1, 2, 3]
|
|
3103
|
+
* Chunk.toArray(Chunk.takeWhile(chunk, (n) => n < 4)) // => [1, 2, 3]
|
|
3262
3104
|
*
|
|
3263
3105
|
* // Empty if first element doesn't match
|
|
3264
|
-
*
|
|
3265
|
-
* console.log(Chunk.toArray(none)) // []
|
|
3106
|
+
* Chunk.toArray(Chunk.takeWhile(chunk, (n) => n > 5)) // => []
|
|
3266
3107
|
*
|
|
3267
3108
|
* // Takes all if all match
|
|
3268
3109
|
* const small = Chunk.make(1, 2, 3)
|
|
3269
|
-
*
|
|
3270
|
-
* console.log(Chunk.toArray(all)) // [1, 2, 3]
|
|
3110
|
+
* Chunk.toArray(Chunk.takeWhile(small, (n) => n < 10)) // => [1, 2, 3]
|
|
3271
3111
|
* ```
|
|
3272
3112
|
*
|
|
3273
|
-
* @category
|
|
3113
|
+
* @category filtering
|
|
3274
3114
|
* @since 2.0.0
|
|
3275
3115
|
*/
|
|
3276
3116
|
export declare const takeWhile: {
|
|
@@ -3279,24 +3119,21 @@ export declare const takeWhile: {
|
|
|
3279
3119
|
*
|
|
3280
3120
|
* **Example** (Taking elements while a predicate matches)
|
|
3281
3121
|
*
|
|
3282
|
-
* ```ts
|
|
3122
|
+
* ```ts import.meta.vitest
|
|
3283
3123
|
* import { Chunk } from "effect"
|
|
3284
3124
|
*
|
|
3285
3125
|
* const chunk = Chunk.make(1, 2, 3, 4, 3, 2, 1)
|
|
3286
|
-
*
|
|
3287
|
-
* console.log(Chunk.toArray(result)) // [1, 2, 3]
|
|
3126
|
+
* Chunk.toArray(Chunk.takeWhile(chunk, (n) => n < 4)) // => [1, 2, 3]
|
|
3288
3127
|
*
|
|
3289
3128
|
* // Empty if first element doesn't match
|
|
3290
|
-
*
|
|
3291
|
-
* console.log(Chunk.toArray(none)) // []
|
|
3129
|
+
* Chunk.toArray(Chunk.takeWhile(chunk, (n) => n > 5)) // => []
|
|
3292
3130
|
*
|
|
3293
3131
|
* // Takes all if all match
|
|
3294
3132
|
* const small = Chunk.make(1, 2, 3)
|
|
3295
|
-
*
|
|
3296
|
-
* console.log(Chunk.toArray(all)) // [1, 2, 3]
|
|
3133
|
+
* Chunk.toArray(Chunk.takeWhile(small, (n) => n < 10)) // => [1, 2, 3]
|
|
3297
3134
|
* ```
|
|
3298
3135
|
*
|
|
3299
|
-
* @category
|
|
3136
|
+
* @category filtering
|
|
3300
3137
|
* @since 2.0.0
|
|
3301
3138
|
*/
|
|
3302
3139
|
<A, B extends A>(refinement: Refinement<NoInfer<A>, B>): (self: Chunk<A>) => Chunk<B>;
|
|
@@ -3305,24 +3142,21 @@ export declare const takeWhile: {
|
|
|
3305
3142
|
*
|
|
3306
3143
|
* **Example** (Taking elements while a predicate matches)
|
|
3307
3144
|
*
|
|
3308
|
-
* ```ts
|
|
3145
|
+
* ```ts import.meta.vitest
|
|
3309
3146
|
* import { Chunk } from "effect"
|
|
3310
3147
|
*
|
|
3311
3148
|
* const chunk = Chunk.make(1, 2, 3, 4, 3, 2, 1)
|
|
3312
|
-
*
|
|
3313
|
-
* console.log(Chunk.toArray(result)) // [1, 2, 3]
|
|
3149
|
+
* Chunk.toArray(Chunk.takeWhile(chunk, (n) => n < 4)) // => [1, 2, 3]
|
|
3314
3150
|
*
|
|
3315
3151
|
* // Empty if first element doesn't match
|
|
3316
|
-
*
|
|
3317
|
-
* console.log(Chunk.toArray(none)) // []
|
|
3152
|
+
* Chunk.toArray(Chunk.takeWhile(chunk, (n) => n > 5)) // => []
|
|
3318
3153
|
*
|
|
3319
3154
|
* // Takes all if all match
|
|
3320
3155
|
* const small = Chunk.make(1, 2, 3)
|
|
3321
|
-
*
|
|
3322
|
-
* console.log(Chunk.toArray(all)) // [1, 2, 3]
|
|
3156
|
+
* Chunk.toArray(Chunk.takeWhile(small, (n) => n < 10)) // => [1, 2, 3]
|
|
3323
3157
|
* ```
|
|
3324
3158
|
*
|
|
3325
|
-
* @category
|
|
3159
|
+
* @category filtering
|
|
3326
3160
|
* @since 2.0.0
|
|
3327
3161
|
*/
|
|
3328
3162
|
<A>(predicate: Predicate<NoInfer<A>>): (self: Chunk<A>) => Chunk<A>;
|
|
@@ -3331,24 +3165,21 @@ export declare const takeWhile: {
|
|
|
3331
3165
|
*
|
|
3332
3166
|
* **Example** (Taking elements while a predicate matches)
|
|
3333
3167
|
*
|
|
3334
|
-
* ```ts
|
|
3168
|
+
* ```ts import.meta.vitest
|
|
3335
3169
|
* import { Chunk } from "effect"
|
|
3336
3170
|
*
|
|
3337
3171
|
* const chunk = Chunk.make(1, 2, 3, 4, 3, 2, 1)
|
|
3338
|
-
*
|
|
3339
|
-
* console.log(Chunk.toArray(result)) // [1, 2, 3]
|
|
3172
|
+
* Chunk.toArray(Chunk.takeWhile(chunk, (n) => n < 4)) // => [1, 2, 3]
|
|
3340
3173
|
*
|
|
3341
3174
|
* // Empty if first element doesn't match
|
|
3342
|
-
*
|
|
3343
|
-
* console.log(Chunk.toArray(none)) // []
|
|
3175
|
+
* Chunk.toArray(Chunk.takeWhile(chunk, (n) => n > 5)) // => []
|
|
3344
3176
|
*
|
|
3345
3177
|
* // Takes all if all match
|
|
3346
3178
|
* const small = Chunk.make(1, 2, 3)
|
|
3347
|
-
*
|
|
3348
|
-
* console.log(Chunk.toArray(all)) // [1, 2, 3]
|
|
3179
|
+
* Chunk.toArray(Chunk.takeWhile(small, (n) => n < 10)) // => [1, 2, 3]
|
|
3349
3180
|
* ```
|
|
3350
3181
|
*
|
|
3351
|
-
* @category
|
|
3182
|
+
* @category filtering
|
|
3352
3183
|
* @since 2.0.0
|
|
3353
3184
|
*/
|
|
3354
3185
|
<A, B extends A>(self: Chunk<A>, refinement: Refinement<A, B>): Chunk<B>;
|
|
@@ -3357,24 +3188,21 @@ export declare const takeWhile: {
|
|
|
3357
3188
|
*
|
|
3358
3189
|
* **Example** (Taking elements while a predicate matches)
|
|
3359
3190
|
*
|
|
3360
|
-
* ```ts
|
|
3191
|
+
* ```ts import.meta.vitest
|
|
3361
3192
|
* import { Chunk } from "effect"
|
|
3362
3193
|
*
|
|
3363
3194
|
* const chunk = Chunk.make(1, 2, 3, 4, 3, 2, 1)
|
|
3364
|
-
*
|
|
3365
|
-
* console.log(Chunk.toArray(result)) // [1, 2, 3]
|
|
3195
|
+
* Chunk.toArray(Chunk.takeWhile(chunk, (n) => n < 4)) // => [1, 2, 3]
|
|
3366
3196
|
*
|
|
3367
3197
|
* // Empty if first element doesn't match
|
|
3368
|
-
*
|
|
3369
|
-
* console.log(Chunk.toArray(none)) // []
|
|
3198
|
+
* Chunk.toArray(Chunk.takeWhile(chunk, (n) => n > 5)) // => []
|
|
3370
3199
|
*
|
|
3371
3200
|
* // Takes all if all match
|
|
3372
3201
|
* const small = Chunk.make(1, 2, 3)
|
|
3373
|
-
*
|
|
3374
|
-
* console.log(Chunk.toArray(all)) // [1, 2, 3]
|
|
3202
|
+
* Chunk.toArray(Chunk.takeWhile(small, (n) => n < 10)) // => [1, 2, 3]
|
|
3375
3203
|
* ```
|
|
3376
3204
|
*
|
|
3377
|
-
* @category
|
|
3205
|
+
* @category filtering
|
|
3378
3206
|
* @since 2.0.0
|
|
3379
3207
|
*/
|
|
3380
3208
|
<A>(self: Chunk<A>, predicate: Predicate<A>): Chunk<A>;
|
|
@@ -3384,22 +3212,20 @@ export declare const takeWhile: {
|
|
|
3384
3212
|
*
|
|
3385
3213
|
* **Example** (Unioning chunks)
|
|
3386
3214
|
*
|
|
3387
|
-
* ```ts
|
|
3215
|
+
* ```ts import.meta.vitest
|
|
3388
3216
|
* import { Chunk } from "effect"
|
|
3389
3217
|
*
|
|
3390
3218
|
* const chunk1 = Chunk.make(1, 2, 3)
|
|
3391
3219
|
* const chunk2 = Chunk.make(3, 4, 5)
|
|
3392
|
-
*
|
|
3393
|
-
* console.log(Chunk.toArray(result)) // [1, 2, 3, 4, 5]
|
|
3220
|
+
* Chunk.toArray(Chunk.union(chunk1, chunk2)) // => [1, 2, 3, 4, 5]
|
|
3394
3221
|
*
|
|
3395
3222
|
* // Handles duplicates within the same chunk
|
|
3396
3223
|
* const withDupes1 = Chunk.make(1, 1, 2)
|
|
3397
3224
|
* const withDupes2 = Chunk.make(2, 3, 3)
|
|
3398
|
-
*
|
|
3399
|
-
* console.log(Chunk.toArray(unified)) // [1, 2, 3]
|
|
3225
|
+
* Chunk.toArray(Chunk.union(withDupes1, withDupes2)) // => [1, 2, 3]
|
|
3400
3226
|
* ```
|
|
3401
3227
|
*
|
|
3402
|
-
* @category
|
|
3228
|
+
* @category set operations
|
|
3403
3229
|
* @since 2.0.0
|
|
3404
3230
|
*/
|
|
3405
3231
|
export declare const union: {
|
|
@@ -3408,22 +3234,20 @@ export declare const union: {
|
|
|
3408
3234
|
*
|
|
3409
3235
|
* **Example** (Unioning chunks)
|
|
3410
3236
|
*
|
|
3411
|
-
* ```ts
|
|
3237
|
+
* ```ts import.meta.vitest
|
|
3412
3238
|
* import { Chunk } from "effect"
|
|
3413
3239
|
*
|
|
3414
3240
|
* const chunk1 = Chunk.make(1, 2, 3)
|
|
3415
3241
|
* const chunk2 = Chunk.make(3, 4, 5)
|
|
3416
|
-
*
|
|
3417
|
-
* console.log(Chunk.toArray(result)) // [1, 2, 3, 4, 5]
|
|
3242
|
+
* Chunk.toArray(Chunk.union(chunk1, chunk2)) // => [1, 2, 3, 4, 5]
|
|
3418
3243
|
*
|
|
3419
3244
|
* // Handles duplicates within the same chunk
|
|
3420
3245
|
* const withDupes1 = Chunk.make(1, 1, 2)
|
|
3421
3246
|
* const withDupes2 = Chunk.make(2, 3, 3)
|
|
3422
|
-
*
|
|
3423
|
-
* console.log(Chunk.toArray(unified)) // [1, 2, 3]
|
|
3247
|
+
* Chunk.toArray(Chunk.union(withDupes1, withDupes2)) // => [1, 2, 3]
|
|
3424
3248
|
* ```
|
|
3425
3249
|
*
|
|
3426
|
-
* @category
|
|
3250
|
+
* @category set operations
|
|
3427
3251
|
* @since 2.0.0
|
|
3428
3252
|
*/
|
|
3429
3253
|
<A>(that: Chunk<A>): <B>(self: Chunk<B>) => Chunk<A | B>;
|
|
@@ -3432,22 +3256,20 @@ export declare const union: {
|
|
|
3432
3256
|
*
|
|
3433
3257
|
* **Example** (Unioning chunks)
|
|
3434
3258
|
*
|
|
3435
|
-
* ```ts
|
|
3259
|
+
* ```ts import.meta.vitest
|
|
3436
3260
|
* import { Chunk } from "effect"
|
|
3437
3261
|
*
|
|
3438
3262
|
* const chunk1 = Chunk.make(1, 2, 3)
|
|
3439
3263
|
* const chunk2 = Chunk.make(3, 4, 5)
|
|
3440
|
-
*
|
|
3441
|
-
* console.log(Chunk.toArray(result)) // [1, 2, 3, 4, 5]
|
|
3264
|
+
* Chunk.toArray(Chunk.union(chunk1, chunk2)) // => [1, 2, 3, 4, 5]
|
|
3442
3265
|
*
|
|
3443
3266
|
* // Handles duplicates within the same chunk
|
|
3444
3267
|
* const withDupes1 = Chunk.make(1, 1, 2)
|
|
3445
3268
|
* const withDupes2 = Chunk.make(2, 3, 3)
|
|
3446
|
-
*
|
|
3447
|
-
* console.log(Chunk.toArray(unified)) // [1, 2, 3]
|
|
3269
|
+
* Chunk.toArray(Chunk.union(withDupes1, withDupes2)) // => [1, 2, 3]
|
|
3448
3270
|
* ```
|
|
3449
3271
|
*
|
|
3450
|
-
* @category
|
|
3272
|
+
* @category set operations
|
|
3451
3273
|
* @since 2.0.0
|
|
3452
3274
|
*/
|
|
3453
3275
|
<A, B>(self: Chunk<A>, that: Chunk<B>): Chunk<A | B>;
|
|
@@ -3458,25 +3280,22 @@ export declare const union: {
|
|
|
3458
3280
|
*
|
|
3459
3281
|
* **Example** (Removing duplicate values)
|
|
3460
3282
|
*
|
|
3461
|
-
* ```ts
|
|
3283
|
+
* ```ts import.meta.vitest
|
|
3462
3284
|
* import { Chunk } from "effect"
|
|
3463
3285
|
*
|
|
3464
3286
|
* const chunk = Chunk.make(1, 2, 2, 3, 1, 4, 3)
|
|
3465
|
-
*
|
|
3466
|
-
* console.log(Chunk.toArray(result)) // [1, 2, 3, 4]
|
|
3287
|
+
* Chunk.toArray(Chunk.dedupe(chunk)) // => [1, 2, 3, 4]
|
|
3467
3288
|
*
|
|
3468
3289
|
* // Empty chunk
|
|
3469
3290
|
* const empty = Chunk.empty<number>()
|
|
3470
|
-
*
|
|
3471
|
-
* console.log(Chunk.toArray(emptyDeduped)) // []
|
|
3291
|
+
* Chunk.toArray(Chunk.dedupe(empty)) // => []
|
|
3472
3292
|
*
|
|
3473
3293
|
* // No duplicates
|
|
3474
3294
|
* const unique = Chunk.make(1, 2, 3)
|
|
3475
|
-
*
|
|
3476
|
-
* console.log(Chunk.toArray(uniqueDeduped)) // [1, 2, 3]
|
|
3295
|
+
* Chunk.toArray(Chunk.dedupe(unique)) // => [1, 2, 3]
|
|
3477
3296
|
* ```
|
|
3478
3297
|
*
|
|
3479
|
-
* @category
|
|
3298
|
+
* @category deduplication
|
|
3480
3299
|
* @since 2.0.0
|
|
3481
3300
|
*/
|
|
3482
3301
|
export declare const dedupe: <A>(self: Chunk<A>) => Chunk<A>;
|
|
@@ -3485,17 +3304,15 @@ export declare const dedupe: <A>(self: Chunk<A>) => Chunk<A>;
|
|
|
3485
3304
|
*
|
|
3486
3305
|
* **Example** (Removing adjacent duplicates)
|
|
3487
3306
|
*
|
|
3488
|
-
* ```ts
|
|
3307
|
+
* ```ts import.meta.vitest
|
|
3489
3308
|
* import { Chunk } from "effect"
|
|
3490
3309
|
*
|
|
3491
3310
|
* const chunk = Chunk.make(1, 1, 2, 2, 2, 3, 1, 1)
|
|
3492
|
-
*
|
|
3493
|
-
* console.log(Chunk.toArray(result)) // [1, 2, 3, 1]
|
|
3311
|
+
* Chunk.toArray(Chunk.dedupeAdjacent(chunk)) // => [1, 2, 3, 1]
|
|
3494
3312
|
*
|
|
3495
3313
|
* // Only removes adjacent duplicates, not all duplicates
|
|
3496
3314
|
* const mixed = Chunk.make("a", "a", "b", "a", "a")
|
|
3497
|
-
*
|
|
3498
|
-
* console.log(Chunk.toArray(mixedResult)) // ["a", "b", "a"]
|
|
3315
|
+
* Chunk.toArray(Chunk.dedupeAdjacent(mixed)) // => ["a", "b", "a"]
|
|
3499
3316
|
* ```
|
|
3500
3317
|
*
|
|
3501
3318
|
* @category filtering
|
|
@@ -3511,7 +3328,7 @@ export declare const dedupeAdjacent: <A>(self: Chunk<A>) => Chunk<A>;
|
|
|
3511
3328
|
*
|
|
3512
3329
|
* **Example** (Unzipping pairs)
|
|
3513
3330
|
*
|
|
3514
|
-
* ```ts
|
|
3331
|
+
* ```ts import.meta.vitest
|
|
3515
3332
|
* import { Chunk } from "effect"
|
|
3516
3333
|
*
|
|
3517
3334
|
* const pairs = Chunk.make(
|
|
@@ -3520,17 +3337,17 @@ export declare const dedupeAdjacent: <A>(self: Chunk<A>) => Chunk<A>;
|
|
|
3520
3337
|
* [3, "c"] as const
|
|
3521
3338
|
* )
|
|
3522
3339
|
* const [numbers, letters] = Chunk.unzip(pairs)
|
|
3523
|
-
*
|
|
3524
|
-
*
|
|
3340
|
+
* Chunk.toArray(numbers) // => [1, 2, 3]
|
|
3341
|
+
* Chunk.toArray(letters) // => ["a", "b", "c"]
|
|
3525
3342
|
*
|
|
3526
3343
|
* // Empty chunk
|
|
3527
3344
|
* const empty = Chunk.empty<[number, string]>()
|
|
3528
3345
|
* const [emptyNums, emptyStrs] = Chunk.unzip(empty)
|
|
3529
|
-
*
|
|
3530
|
-
*
|
|
3346
|
+
* Chunk.toArray(emptyNums) // => []
|
|
3347
|
+
* Chunk.toArray(emptyStrs) // => []
|
|
3531
3348
|
* ```
|
|
3532
3349
|
*
|
|
3533
|
-
* @category
|
|
3350
|
+
* @category splitting
|
|
3534
3351
|
* @since 2.0.0
|
|
3535
3352
|
*/
|
|
3536
3353
|
export declare const unzip: <A, B>(self: Chunk<readonly [A, B]>) => [Chunk<A>, Chunk<B>];
|
|
@@ -3539,19 +3356,17 @@ export declare const unzip: <A, B>(self: Chunk<readonly [A, B]>) => [Chunk<A>, C
|
|
|
3539
3356
|
*
|
|
3540
3357
|
* **Example** (Zipping chunks with a function)
|
|
3541
3358
|
*
|
|
3542
|
-
* ```ts
|
|
3359
|
+
* ```ts import.meta.vitest
|
|
3543
3360
|
* import { Chunk } from "effect"
|
|
3544
3361
|
*
|
|
3545
3362
|
* const numbers = Chunk.make(1, 2, 3)
|
|
3546
3363
|
* const letters = Chunk.make("a", "b", "c")
|
|
3547
|
-
*
|
|
3548
|
-
* console.log(Chunk.toArray(result)) // ["1-a", "2-b", "3-c"]
|
|
3364
|
+
* Chunk.toArray(Chunk.zipWith(numbers, letters, (n, l) => `${n}-${l}`)) // => ["1-a", "2-b", "3-c"]
|
|
3549
3365
|
*
|
|
3550
3366
|
* // Different lengths - takes minimum
|
|
3551
3367
|
* const short = Chunk.make(1, 2)
|
|
3552
3368
|
* const long = Chunk.make("a", "b", "c", "d")
|
|
3553
|
-
*
|
|
3554
|
-
* console.log(Chunk.toArray(mixed)) // [[1, "a"], [2, "b"]]
|
|
3369
|
+
* Chunk.toArray(Chunk.zipWith(short, long, (n, l) => [n, l])) // => [[1, "a"], [2, "b"]]
|
|
3555
3370
|
* ```
|
|
3556
3371
|
*
|
|
3557
3372
|
* @category zipping
|
|
@@ -3563,19 +3378,17 @@ export declare const zipWith: {
|
|
|
3563
3378
|
*
|
|
3564
3379
|
* **Example** (Zipping chunks with a function)
|
|
3565
3380
|
*
|
|
3566
|
-
* ```ts
|
|
3381
|
+
* ```ts import.meta.vitest
|
|
3567
3382
|
* import { Chunk } from "effect"
|
|
3568
3383
|
*
|
|
3569
3384
|
* const numbers = Chunk.make(1, 2, 3)
|
|
3570
3385
|
* const letters = Chunk.make("a", "b", "c")
|
|
3571
|
-
*
|
|
3572
|
-
* console.log(Chunk.toArray(result)) // ["1-a", "2-b", "3-c"]
|
|
3386
|
+
* Chunk.toArray(Chunk.zipWith(numbers, letters, (n, l) => `${n}-${l}`)) // => ["1-a", "2-b", "3-c"]
|
|
3573
3387
|
*
|
|
3574
3388
|
* // Different lengths - takes minimum
|
|
3575
3389
|
* const short = Chunk.make(1, 2)
|
|
3576
3390
|
* const long = Chunk.make("a", "b", "c", "d")
|
|
3577
|
-
*
|
|
3578
|
-
* console.log(Chunk.toArray(mixed)) // [[1, "a"], [2, "b"]]
|
|
3391
|
+
* Chunk.toArray(Chunk.zipWith(short, long, (n, l) => [n, l])) // => [[1, "a"], [2, "b"]]
|
|
3579
3392
|
* ```
|
|
3580
3393
|
*
|
|
3581
3394
|
* @category zipping
|
|
@@ -3587,19 +3400,17 @@ export declare const zipWith: {
|
|
|
3587
3400
|
*
|
|
3588
3401
|
* **Example** (Zipping chunks with a function)
|
|
3589
3402
|
*
|
|
3590
|
-
* ```ts
|
|
3403
|
+
* ```ts import.meta.vitest
|
|
3591
3404
|
* import { Chunk } from "effect"
|
|
3592
3405
|
*
|
|
3593
3406
|
* const numbers = Chunk.make(1, 2, 3)
|
|
3594
3407
|
* const letters = Chunk.make("a", "b", "c")
|
|
3595
|
-
*
|
|
3596
|
-
* console.log(Chunk.toArray(result)) // ["1-a", "2-b", "3-c"]
|
|
3408
|
+
* Chunk.toArray(Chunk.zipWith(numbers, letters, (n, l) => `${n}-${l}`)) // => ["1-a", "2-b", "3-c"]
|
|
3597
3409
|
*
|
|
3598
3410
|
* // Different lengths - takes minimum
|
|
3599
3411
|
* const short = Chunk.make(1, 2)
|
|
3600
3412
|
* const long = Chunk.make("a", "b", "c", "d")
|
|
3601
|
-
*
|
|
3602
|
-
* console.log(Chunk.toArray(mixed)) // [[1, "a"], [2, "b"]]
|
|
3413
|
+
* Chunk.toArray(Chunk.zipWith(short, long, (n, l) => [n, l])) // => [[1, "a"], [2, "b"]]
|
|
3603
3414
|
* ```
|
|
3604
3415
|
*
|
|
3605
3416
|
* @category zipping
|
|
@@ -3612,19 +3423,17 @@ export declare const zipWith: {
|
|
|
3612
3423
|
*
|
|
3613
3424
|
* **Example** (Zipping chunks)
|
|
3614
3425
|
*
|
|
3615
|
-
* ```ts
|
|
3426
|
+
* ```ts import.meta.vitest
|
|
3616
3427
|
* import { Chunk } from "effect"
|
|
3617
3428
|
*
|
|
3618
3429
|
* const numbers = Chunk.make(1, 2, 3)
|
|
3619
3430
|
* const letters = Chunk.make("a", "b", "c")
|
|
3620
|
-
*
|
|
3621
|
-
* console.log(Chunk.toArray(result)) // [[1, "a"], [2, "b"], [3, "c"]]
|
|
3431
|
+
* Chunk.toArray(Chunk.zip(numbers, letters)) // => [[1, "a"], [2, "b"], [3, "c"]]
|
|
3622
3432
|
*
|
|
3623
3433
|
* // Different lengths - takes minimum length
|
|
3624
3434
|
* const short = Chunk.make(1, 2)
|
|
3625
3435
|
* const long = Chunk.make("a", "b", "c", "d")
|
|
3626
|
-
*
|
|
3627
|
-
* console.log(Chunk.toArray(zipped)) // [[1, "a"], [2, "b"]]
|
|
3436
|
+
* Chunk.toArray(Chunk.zip(short, long)) // => [[1, "a"], [2, "b"]]
|
|
3628
3437
|
* ```
|
|
3629
3438
|
*
|
|
3630
3439
|
* @category zipping
|
|
@@ -3636,19 +3445,17 @@ export declare const zip: {
|
|
|
3636
3445
|
*
|
|
3637
3446
|
* **Example** (Zipping chunks)
|
|
3638
3447
|
*
|
|
3639
|
-
* ```ts
|
|
3448
|
+
* ```ts import.meta.vitest
|
|
3640
3449
|
* import { Chunk } from "effect"
|
|
3641
3450
|
*
|
|
3642
3451
|
* const numbers = Chunk.make(1, 2, 3)
|
|
3643
3452
|
* const letters = Chunk.make("a", "b", "c")
|
|
3644
|
-
*
|
|
3645
|
-
* console.log(Chunk.toArray(result)) // [[1, "a"], [2, "b"], [3, "c"]]
|
|
3453
|
+
* Chunk.toArray(Chunk.zip(numbers, letters)) // => [[1, "a"], [2, "b"], [3, "c"]]
|
|
3646
3454
|
*
|
|
3647
3455
|
* // Different lengths - takes minimum length
|
|
3648
3456
|
* const short = Chunk.make(1, 2)
|
|
3649
3457
|
* const long = Chunk.make("a", "b", "c", "d")
|
|
3650
|
-
*
|
|
3651
|
-
* console.log(Chunk.toArray(zipped)) // [[1, "a"], [2, "b"]]
|
|
3458
|
+
* Chunk.toArray(Chunk.zip(short, long)) // => [[1, "a"], [2, "b"]]
|
|
3652
3459
|
* ```
|
|
3653
3460
|
*
|
|
3654
3461
|
* @category zipping
|
|
@@ -3660,19 +3467,17 @@ export declare const zip: {
|
|
|
3660
3467
|
*
|
|
3661
3468
|
* **Example** (Zipping chunks)
|
|
3662
3469
|
*
|
|
3663
|
-
* ```ts
|
|
3470
|
+
* ```ts import.meta.vitest
|
|
3664
3471
|
* import { Chunk } from "effect"
|
|
3665
3472
|
*
|
|
3666
3473
|
* const numbers = Chunk.make(1, 2, 3)
|
|
3667
3474
|
* const letters = Chunk.make("a", "b", "c")
|
|
3668
|
-
*
|
|
3669
|
-
* console.log(Chunk.toArray(result)) // [[1, "a"], [2, "b"], [3, "c"]]
|
|
3475
|
+
* Chunk.toArray(Chunk.zip(numbers, letters)) // => [[1, "a"], [2, "b"], [3, "c"]]
|
|
3670
3476
|
*
|
|
3671
3477
|
* // Different lengths - takes minimum length
|
|
3672
3478
|
* const short = Chunk.make(1, 2)
|
|
3673
3479
|
* const long = Chunk.make("a", "b", "c", "d")
|
|
3674
|
-
*
|
|
3675
|
-
* console.log(Chunk.toArray(zipped)) // [[1, "a"], [2, "b"]]
|
|
3480
|
+
* Chunk.toArray(Chunk.zip(short, long)) // => [[1, "a"], [2, "b"]]
|
|
3676
3481
|
* ```
|
|
3677
3482
|
*
|
|
3678
3483
|
* @category zipping
|
|
@@ -3685,23 +3490,20 @@ export declare const zip: {
|
|
|
3685
3490
|
*
|
|
3686
3491
|
* **Example** (Removing an element)
|
|
3687
3492
|
*
|
|
3688
|
-
* ```ts
|
|
3493
|
+
* ```ts import.meta.vitest
|
|
3689
3494
|
* import { Chunk } from "effect"
|
|
3690
3495
|
*
|
|
3691
3496
|
* const chunk = Chunk.make("a", "b", "c", "d")
|
|
3692
|
-
*
|
|
3693
|
-
* console.log(Chunk.toArray(result)) // ["a", "c", "d"]
|
|
3497
|
+
* Chunk.toArray(Chunk.remove(chunk, 1)) // => ["a", "c", "d"]
|
|
3694
3498
|
*
|
|
3695
3499
|
* // Remove first element
|
|
3696
|
-
*
|
|
3697
|
-
* console.log(Chunk.toArray(removeFirst)) // ["b", "c", "d"]
|
|
3500
|
+
* Chunk.toArray(Chunk.remove(chunk, 0)) // => ["b", "c", "d"]
|
|
3698
3501
|
*
|
|
3699
3502
|
* // Index out of bounds returns same chunk
|
|
3700
|
-
*
|
|
3701
|
-
* console.log(Chunk.toArray(outOfBounds)) // ["a", "b", "c", "d"]
|
|
3503
|
+
* Chunk.toArray(Chunk.remove(chunk, 10)) // => ["a", "b", "c", "d"]
|
|
3702
3504
|
* ```
|
|
3703
3505
|
*
|
|
3704
|
-
* @category
|
|
3506
|
+
* @category transforming
|
|
3705
3507
|
* @since 2.0.0
|
|
3706
3508
|
*/
|
|
3707
3509
|
export declare const remove: {
|
|
@@ -3710,23 +3512,20 @@ export declare const remove: {
|
|
|
3710
3512
|
*
|
|
3711
3513
|
* **Example** (Removing an element)
|
|
3712
3514
|
*
|
|
3713
|
-
* ```ts
|
|
3515
|
+
* ```ts import.meta.vitest
|
|
3714
3516
|
* import { Chunk } from "effect"
|
|
3715
3517
|
*
|
|
3716
3518
|
* const chunk = Chunk.make("a", "b", "c", "d")
|
|
3717
|
-
*
|
|
3718
|
-
* console.log(Chunk.toArray(result)) // ["a", "c", "d"]
|
|
3519
|
+
* Chunk.toArray(Chunk.remove(chunk, 1)) // => ["a", "c", "d"]
|
|
3719
3520
|
*
|
|
3720
3521
|
* // Remove first element
|
|
3721
|
-
*
|
|
3722
|
-
* console.log(Chunk.toArray(removeFirst)) // ["b", "c", "d"]
|
|
3522
|
+
* Chunk.toArray(Chunk.remove(chunk, 0)) // => ["b", "c", "d"]
|
|
3723
3523
|
*
|
|
3724
3524
|
* // Index out of bounds returns same chunk
|
|
3725
|
-
*
|
|
3726
|
-
* console.log(Chunk.toArray(outOfBounds)) // ["a", "b", "c", "d"]
|
|
3525
|
+
* Chunk.toArray(Chunk.remove(chunk, 10)) // => ["a", "b", "c", "d"]
|
|
3727
3526
|
* ```
|
|
3728
3527
|
*
|
|
3729
|
-
* @category
|
|
3528
|
+
* @category transforming
|
|
3730
3529
|
* @since 2.0.0
|
|
3731
3530
|
*/
|
|
3732
3531
|
(i: number): <A>(self: Chunk<A>) => Chunk<A>;
|
|
@@ -3735,23 +3534,20 @@ export declare const remove: {
|
|
|
3735
3534
|
*
|
|
3736
3535
|
* **Example** (Removing an element)
|
|
3737
3536
|
*
|
|
3738
|
-
* ```ts
|
|
3537
|
+
* ```ts import.meta.vitest
|
|
3739
3538
|
* import { Chunk } from "effect"
|
|
3740
3539
|
*
|
|
3741
3540
|
* const chunk = Chunk.make("a", "b", "c", "d")
|
|
3742
|
-
*
|
|
3743
|
-
* console.log(Chunk.toArray(result)) // ["a", "c", "d"]
|
|
3541
|
+
* Chunk.toArray(Chunk.remove(chunk, 1)) // => ["a", "c", "d"]
|
|
3744
3542
|
*
|
|
3745
3543
|
* // Remove first element
|
|
3746
|
-
*
|
|
3747
|
-
* console.log(Chunk.toArray(removeFirst)) // ["b", "c", "d"]
|
|
3544
|
+
* Chunk.toArray(Chunk.remove(chunk, 0)) // => ["b", "c", "d"]
|
|
3748
3545
|
*
|
|
3749
3546
|
* // Index out of bounds returns same chunk
|
|
3750
|
-
*
|
|
3751
|
-
* console.log(Chunk.toArray(outOfBounds)) // ["a", "b", "c", "d"]
|
|
3547
|
+
* Chunk.toArray(Chunk.remove(chunk, 10)) // => ["a", "b", "c", "d"]
|
|
3752
3548
|
* ```
|
|
3753
3549
|
*
|
|
3754
|
-
* @category
|
|
3550
|
+
* @category transforming
|
|
3755
3551
|
* @since 2.0.0
|
|
3756
3552
|
*/
|
|
3757
3553
|
<A>(self: Chunk<A>, i: number): Chunk<A>;
|
|
@@ -3762,23 +3558,20 @@ export declare const remove: {
|
|
|
3762
3558
|
*
|
|
3763
3559
|
* **Example** (Modifying an element)
|
|
3764
3560
|
*
|
|
3765
|
-
* ```ts
|
|
3766
|
-
* import { Chunk } from "effect"
|
|
3561
|
+
* ```ts import.meta.vitest
|
|
3562
|
+
* import { Chunk, Option } from "effect"
|
|
3767
3563
|
*
|
|
3768
3564
|
* const chunk = Chunk.make(1, 2, 3, 4)
|
|
3769
|
-
*
|
|
3770
|
-
* console.log(result) // Option.some(Chunk.make(1, 20, 3, 4))
|
|
3565
|
+
* Chunk.modify(chunk, 1, (n) => n * 10) // => Option.some(Chunk.make(1, 20, 3, 4))
|
|
3771
3566
|
*
|
|
3772
3567
|
* // Index out of bounds returns None
|
|
3773
|
-
*
|
|
3774
|
-
* console.log(outOfBounds) // Option.none()
|
|
3568
|
+
* chunk.pipe(Chunk.modify(10, (n) => n * 10)) // => Option.none()
|
|
3775
3569
|
*
|
|
3776
3570
|
* // Negative index returns None
|
|
3777
|
-
*
|
|
3778
|
-
* console.log(negative) // Option.none()
|
|
3571
|
+
* chunk.pipe(Chunk.modify(-1, (n) => n * 10)) // => Option.none()
|
|
3779
3572
|
* ```
|
|
3780
3573
|
*
|
|
3781
|
-
* @category
|
|
3574
|
+
* @category transforming
|
|
3782
3575
|
* @since 2.0.0
|
|
3783
3576
|
*/
|
|
3784
3577
|
export declare const modify: {
|
|
@@ -3788,23 +3581,20 @@ export declare const modify: {
|
|
|
3788
3581
|
*
|
|
3789
3582
|
* **Example** (Modifying an element)
|
|
3790
3583
|
*
|
|
3791
|
-
* ```ts
|
|
3792
|
-
* import { Chunk } from "effect"
|
|
3584
|
+
* ```ts import.meta.vitest
|
|
3585
|
+
* import { Chunk, Option } from "effect"
|
|
3793
3586
|
*
|
|
3794
3587
|
* const chunk = Chunk.make(1, 2, 3, 4)
|
|
3795
|
-
*
|
|
3796
|
-
* console.log(result) // Option.some(Chunk.make(1, 20, 3, 4))
|
|
3588
|
+
* Chunk.modify(chunk, 1, (n) => n * 10) // => Option.some(Chunk.make(1, 20, 3, 4))
|
|
3797
3589
|
*
|
|
3798
3590
|
* // Index out of bounds returns None
|
|
3799
|
-
*
|
|
3800
|
-
* console.log(outOfBounds) // Option.none()
|
|
3591
|
+
* chunk.pipe(Chunk.modify(10, (n) => n * 10)) // => Option.none()
|
|
3801
3592
|
*
|
|
3802
3593
|
* // Negative index returns None
|
|
3803
|
-
*
|
|
3804
|
-
* console.log(negative) // Option.none()
|
|
3594
|
+
* chunk.pipe(Chunk.modify(-1, (n) => n * 10)) // => Option.none()
|
|
3805
3595
|
* ```
|
|
3806
3596
|
*
|
|
3807
|
-
* @category
|
|
3597
|
+
* @category transforming
|
|
3808
3598
|
* @since 2.0.0
|
|
3809
3599
|
*/
|
|
3810
3600
|
<A, B>(i: number, f: (a: A) => B): (self: Chunk<A>) => O.Option<Chunk<A | B>>;
|
|
@@ -3814,23 +3604,20 @@ export declare const modify: {
|
|
|
3814
3604
|
*
|
|
3815
3605
|
* **Example** (Modifying an element)
|
|
3816
3606
|
*
|
|
3817
|
-
* ```ts
|
|
3818
|
-
* import { Chunk } from "effect"
|
|
3607
|
+
* ```ts import.meta.vitest
|
|
3608
|
+
* import { Chunk, Option } from "effect"
|
|
3819
3609
|
*
|
|
3820
3610
|
* const chunk = Chunk.make(1, 2, 3, 4)
|
|
3821
|
-
*
|
|
3822
|
-
* console.log(result) // Option.some(Chunk.make(1, 20, 3, 4))
|
|
3611
|
+
* Chunk.modify(chunk, 1, (n) => n * 10) // => Option.some(Chunk.make(1, 20, 3, 4))
|
|
3823
3612
|
*
|
|
3824
3613
|
* // Index out of bounds returns None
|
|
3825
|
-
*
|
|
3826
|
-
* console.log(outOfBounds) // Option.none()
|
|
3614
|
+
* chunk.pipe(Chunk.modify(10, (n) => n * 10)) // => Option.none()
|
|
3827
3615
|
*
|
|
3828
3616
|
* // Negative index returns None
|
|
3829
|
-
*
|
|
3830
|
-
* console.log(negative) // Option.none()
|
|
3617
|
+
* chunk.pipe(Chunk.modify(-1, (n) => n * 10)) // => Option.none()
|
|
3831
3618
|
* ```
|
|
3832
3619
|
*
|
|
3833
|
-
* @category
|
|
3620
|
+
* @category transforming
|
|
3834
3621
|
* @since 2.0.0
|
|
3835
3622
|
*/
|
|
3836
3623
|
<A, B>(self: Chunk<A>, i: number, f: (a: A) => B): O.Option<Chunk<A | B>>;
|
|
@@ -3841,23 +3628,20 @@ export declare const modify: {
|
|
|
3841
3628
|
*
|
|
3842
3629
|
* **Example** (Replacing an element)
|
|
3843
3630
|
*
|
|
3844
|
-
* ```ts
|
|
3845
|
-
* import { Chunk } from "effect"
|
|
3631
|
+
* ```ts import.meta.vitest
|
|
3632
|
+
* import { Chunk, Option } from "effect"
|
|
3846
3633
|
*
|
|
3847
3634
|
* const chunk = Chunk.make("a", "b", "c", "d")
|
|
3848
|
-
*
|
|
3849
|
-
* console.log(result) // Option.some(Chunk.make("a", "X", "c", "d"))
|
|
3635
|
+
* Chunk.replace(chunk, 1, "X") // => Option.some(Chunk.make("a", "X", "c", "d"))
|
|
3850
3636
|
*
|
|
3851
3637
|
* // Index out of bounds returns None
|
|
3852
|
-
*
|
|
3853
|
-
* console.log(outOfBounds) // Option.none()
|
|
3638
|
+
* chunk.pipe(Chunk.replace(10, "Y")) // => Option.none()
|
|
3854
3639
|
*
|
|
3855
3640
|
* // Negative index returns None
|
|
3856
|
-
*
|
|
3857
|
-
* console.log(negative) // Option.none()
|
|
3641
|
+
* chunk.pipe(Chunk.replace(-1, "Z")) // => Option.none()
|
|
3858
3642
|
* ```
|
|
3859
3643
|
*
|
|
3860
|
-
* @category
|
|
3644
|
+
* @category transforming
|
|
3861
3645
|
* @since 2.0.0
|
|
3862
3646
|
*/
|
|
3863
3647
|
export declare const replace: {
|
|
@@ -3867,23 +3651,20 @@ export declare const replace: {
|
|
|
3867
3651
|
*
|
|
3868
3652
|
* **Example** (Replacing an element)
|
|
3869
3653
|
*
|
|
3870
|
-
* ```ts
|
|
3871
|
-
* import { Chunk } from "effect"
|
|
3654
|
+
* ```ts import.meta.vitest
|
|
3655
|
+
* import { Chunk, Option } from "effect"
|
|
3872
3656
|
*
|
|
3873
3657
|
* const chunk = Chunk.make("a", "b", "c", "d")
|
|
3874
|
-
*
|
|
3875
|
-
* console.log(result) // Option.some(Chunk.make("a", "X", "c", "d"))
|
|
3658
|
+
* Chunk.replace(chunk, 1, "X") // => Option.some(Chunk.make("a", "X", "c", "d"))
|
|
3876
3659
|
*
|
|
3877
3660
|
* // Index out of bounds returns None
|
|
3878
|
-
*
|
|
3879
|
-
* console.log(outOfBounds) // Option.none()
|
|
3661
|
+
* chunk.pipe(Chunk.replace(10, "Y")) // => Option.none()
|
|
3880
3662
|
*
|
|
3881
3663
|
* // Negative index returns None
|
|
3882
|
-
*
|
|
3883
|
-
* console.log(negative) // Option.none()
|
|
3664
|
+
* chunk.pipe(Chunk.replace(-1, "Z")) // => Option.none()
|
|
3884
3665
|
* ```
|
|
3885
3666
|
*
|
|
3886
|
-
* @category
|
|
3667
|
+
* @category transforming
|
|
3887
3668
|
* @since 2.0.0
|
|
3888
3669
|
*/
|
|
3889
3670
|
<B>(i: number, b: B): <A>(self: Chunk<A>) => O.Option<Chunk<B | A>>;
|
|
@@ -3893,23 +3674,20 @@ export declare const replace: {
|
|
|
3893
3674
|
*
|
|
3894
3675
|
* **Example** (Replacing an element)
|
|
3895
3676
|
*
|
|
3896
|
-
* ```ts
|
|
3897
|
-
* import { Chunk } from "effect"
|
|
3677
|
+
* ```ts import.meta.vitest
|
|
3678
|
+
* import { Chunk, Option } from "effect"
|
|
3898
3679
|
*
|
|
3899
3680
|
* const chunk = Chunk.make("a", "b", "c", "d")
|
|
3900
|
-
*
|
|
3901
|
-
* console.log(result) // Option.some(Chunk.make("a", "X", "c", "d"))
|
|
3681
|
+
* Chunk.replace(chunk, 1, "X") // => Option.some(Chunk.make("a", "X", "c", "d"))
|
|
3902
3682
|
*
|
|
3903
3683
|
* // Index out of bounds returns None
|
|
3904
|
-
*
|
|
3905
|
-
* console.log(outOfBounds) // Option.none()
|
|
3684
|
+
* chunk.pipe(Chunk.replace(10, "Y")) // => Option.none()
|
|
3906
3685
|
*
|
|
3907
3686
|
* // Negative index returns None
|
|
3908
|
-
*
|
|
3909
|
-
* console.log(negative) // Option.none()
|
|
3687
|
+
* chunk.pipe(Chunk.replace(-1, "Z")) // => Option.none()
|
|
3910
3688
|
* ```
|
|
3911
3689
|
*
|
|
3912
|
-
* @category
|
|
3690
|
+
* @category transforming
|
|
3913
3691
|
* @since 2.0.0
|
|
3914
3692
|
*/
|
|
3915
3693
|
<A, B>(self: Chunk<A>, i: number, b: B): O.Option<Chunk<B | A>>;
|
|
@@ -3923,11 +3701,10 @@ export declare const replace: {
|
|
|
3923
3701
|
*
|
|
3924
3702
|
* **Example** (Generating chunks from indices)
|
|
3925
3703
|
*
|
|
3926
|
-
* ```ts
|
|
3704
|
+
* ```ts import.meta.vitest
|
|
3927
3705
|
* import { Chunk } from "effect"
|
|
3928
3706
|
*
|
|
3929
|
-
*
|
|
3930
|
-
* console.log(Chunk.toArray(chunk)) // [0, 2, 4, 6, 8]
|
|
3707
|
+
* Chunk.toArray(Chunk.makeBy(5, (i) => i * 2)) // => [0, 2, 4, 6, 8]
|
|
3931
3708
|
* ```
|
|
3932
3709
|
*
|
|
3933
3710
|
* @category constructors
|
|
@@ -3943,11 +3720,10 @@ export declare const makeBy: {
|
|
|
3943
3720
|
*
|
|
3944
3721
|
* **Example** (Generating chunks from indices)
|
|
3945
3722
|
*
|
|
3946
|
-
* ```ts
|
|
3723
|
+
* ```ts import.meta.vitest
|
|
3947
3724
|
* import { Chunk } from "effect"
|
|
3948
3725
|
*
|
|
3949
|
-
*
|
|
3950
|
-
* console.log(Chunk.toArray(chunk)) // [0, 2, 4, 6, 8]
|
|
3726
|
+
* Chunk.toArray(Chunk.makeBy(5, (i) => i * 2)) // => [0, 2, 4, 6, 8]
|
|
3951
3727
|
* ```
|
|
3952
3728
|
*
|
|
3953
3729
|
* @category constructors
|
|
@@ -3963,11 +3739,10 @@ export declare const makeBy: {
|
|
|
3963
3739
|
*
|
|
3964
3740
|
* **Example** (Generating chunks from indices)
|
|
3965
3741
|
*
|
|
3966
|
-
* ```ts
|
|
3742
|
+
* ```ts import.meta.vitest
|
|
3967
3743
|
* import { Chunk } from "effect"
|
|
3968
3744
|
*
|
|
3969
|
-
*
|
|
3970
|
-
* console.log(Chunk.toArray(chunk)) // [0, 2, 4, 6, 8]
|
|
3745
|
+
* Chunk.toArray(Chunk.makeBy(5, (i) => i * 2)) // => [0, 2, 4, 6, 8]
|
|
3971
3746
|
* ```
|
|
3972
3747
|
*
|
|
3973
3748
|
* @category constructors
|
|
@@ -3986,11 +3761,10 @@ export declare const makeBy: {
|
|
|
3986
3761
|
*
|
|
3987
3762
|
* **Example** (Creating a range)
|
|
3988
3763
|
*
|
|
3989
|
-
* ```ts
|
|
3764
|
+
* ```ts import.meta.vitest
|
|
3990
3765
|
* import { Chunk } from "effect"
|
|
3991
3766
|
*
|
|
3992
|
-
*
|
|
3993
|
-
* console.log(Chunk.toArray(chunk)) // [1, 2, 3, 4, 5]
|
|
3767
|
+
* Chunk.toArray(Chunk.range(1, 5)) // => [1, 2, 3, 4, 5]
|
|
3994
3768
|
* ```
|
|
3995
3769
|
*
|
|
3996
3770
|
* @category constructors
|
|
@@ -4002,24 +3776,23 @@ export declare const range: (start: number, end: number) => NonEmptyChunk<number
|
|
|
4002
3776
|
*
|
|
4003
3777
|
* **Example** (Checking membership)
|
|
4004
3778
|
*
|
|
4005
|
-
* ```ts
|
|
3779
|
+
* ```ts import.meta.vitest
|
|
4006
3780
|
* import { Chunk } from "effect"
|
|
4007
3781
|
*
|
|
4008
3782
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4009
|
-
*
|
|
4010
|
-
*
|
|
3783
|
+
* Chunk.contains(chunk, 3) // => true
|
|
3784
|
+
* Chunk.contains(chunk, 6) // => false
|
|
4011
3785
|
*
|
|
4012
3786
|
* // Works with strings
|
|
4013
3787
|
* const words = Chunk.make("apple", "banana", "cherry")
|
|
4014
|
-
*
|
|
4015
|
-
*
|
|
3788
|
+
* Chunk.contains(words, "banana") // => true
|
|
3789
|
+
* Chunk.contains(words, "grape") // => false
|
|
4016
3790
|
*
|
|
4017
3791
|
* // Empty chunk
|
|
4018
|
-
*
|
|
4019
|
-
* console.log(Chunk.contains(empty, 1)) // false
|
|
3792
|
+
* Chunk.contains(Chunk.empty<number>(), 1) // => false
|
|
4020
3793
|
* ```
|
|
4021
3794
|
*
|
|
4022
|
-
* @category
|
|
3795
|
+
* @category predicates
|
|
4023
3796
|
* @since 2.0.0
|
|
4024
3797
|
*/
|
|
4025
3798
|
export declare const contains: {
|
|
@@ -4028,24 +3801,23 @@ export declare const contains: {
|
|
|
4028
3801
|
*
|
|
4029
3802
|
* **Example** (Checking membership)
|
|
4030
3803
|
*
|
|
4031
|
-
* ```ts
|
|
3804
|
+
* ```ts import.meta.vitest
|
|
4032
3805
|
* import { Chunk } from "effect"
|
|
4033
3806
|
*
|
|
4034
3807
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4035
|
-
*
|
|
4036
|
-
*
|
|
3808
|
+
* Chunk.contains(chunk, 3) // => true
|
|
3809
|
+
* Chunk.contains(chunk, 6) // => false
|
|
4037
3810
|
*
|
|
4038
3811
|
* // Works with strings
|
|
4039
3812
|
* const words = Chunk.make("apple", "banana", "cherry")
|
|
4040
|
-
*
|
|
4041
|
-
*
|
|
3813
|
+
* Chunk.contains(words, "banana") // => true
|
|
3814
|
+
* Chunk.contains(words, "grape") // => false
|
|
4042
3815
|
*
|
|
4043
3816
|
* // Empty chunk
|
|
4044
|
-
*
|
|
4045
|
-
* console.log(Chunk.contains(empty, 1)) // false
|
|
3817
|
+
* Chunk.contains(Chunk.empty<number>(), 1) // => false
|
|
4046
3818
|
* ```
|
|
4047
3819
|
*
|
|
4048
|
-
* @category
|
|
3820
|
+
* @category predicates
|
|
4049
3821
|
* @since 2.0.0
|
|
4050
3822
|
*/
|
|
4051
3823
|
<A>(a: A): (self: Chunk<A>) => boolean;
|
|
@@ -4054,24 +3826,23 @@ export declare const contains: {
|
|
|
4054
3826
|
*
|
|
4055
3827
|
* **Example** (Checking membership)
|
|
4056
3828
|
*
|
|
4057
|
-
* ```ts
|
|
3829
|
+
* ```ts import.meta.vitest
|
|
4058
3830
|
* import { Chunk } from "effect"
|
|
4059
3831
|
*
|
|
4060
3832
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4061
|
-
*
|
|
4062
|
-
*
|
|
3833
|
+
* Chunk.contains(chunk, 3) // => true
|
|
3834
|
+
* Chunk.contains(chunk, 6) // => false
|
|
4063
3835
|
*
|
|
4064
3836
|
* // Works with strings
|
|
4065
3837
|
* const words = Chunk.make("apple", "banana", "cherry")
|
|
4066
|
-
*
|
|
4067
|
-
*
|
|
3838
|
+
* Chunk.contains(words, "banana") // => true
|
|
3839
|
+
* Chunk.contains(words, "grape") // => false
|
|
4068
3840
|
*
|
|
4069
3841
|
* // Empty chunk
|
|
4070
|
-
*
|
|
4071
|
-
* console.log(Chunk.contains(empty, 1)) // false
|
|
3842
|
+
* Chunk.contains(Chunk.empty<number>(), 1) // => false
|
|
4072
3843
|
* ```
|
|
4073
3844
|
*
|
|
4074
|
-
* @category
|
|
3845
|
+
* @category predicates
|
|
4075
3846
|
* @since 2.0.0
|
|
4076
3847
|
*/
|
|
4077
3848
|
<A>(self: Chunk<A>, a: A): boolean;
|
|
@@ -4081,7 +3852,7 @@ export declare const contains: {
|
|
|
4081
3852
|
*
|
|
4082
3853
|
* **Example** (Checking membership with custom equivalence)
|
|
4083
3854
|
*
|
|
4084
|
-
* ```ts
|
|
3855
|
+
* ```ts import.meta.vitest
|
|
4085
3856
|
* import { Chunk } from "effect"
|
|
4086
3857
|
*
|
|
4087
3858
|
* const chunk = Chunk.make({ id: 1, name: "Alice" }, { id: 2, name: "Bob" })
|
|
@@ -4090,19 +3861,19 @@ export declare const contains: {
|
|
|
4090
3861
|
* const containsById = Chunk.containsWith<{ id: number; name: string }>((a, b) =>
|
|
4091
3862
|
* a.id === b.id
|
|
4092
3863
|
* )
|
|
4093
|
-
*
|
|
4094
|
-
*
|
|
3864
|
+
* containsById(chunk, { id: 1, name: "Different" }) // => true
|
|
3865
|
+
* containsById(chunk, { id: 3, name: "Charlie" }) // => false
|
|
4095
3866
|
*
|
|
4096
3867
|
* // Case-insensitive string comparison
|
|
4097
3868
|
* const words = Chunk.make("Apple", "Banana", "Cherry")
|
|
4098
3869
|
* const containsCaseInsensitive = Chunk.containsWith<string>((a, b) =>
|
|
4099
3870
|
* a.toLowerCase() === b.toLowerCase()
|
|
4100
3871
|
* )
|
|
4101
|
-
*
|
|
4102
|
-
*
|
|
3872
|
+
* containsCaseInsensitive(words, "apple") // => true
|
|
3873
|
+
* containsCaseInsensitive(words, "grape") // => false
|
|
4103
3874
|
* ```
|
|
4104
3875
|
*
|
|
4105
|
-
* @category
|
|
3876
|
+
* @category predicates
|
|
4106
3877
|
* @since 2.0.0
|
|
4107
3878
|
*/
|
|
4108
3879
|
export declare const containsWith: <A>(isEquivalent: (self: A, that: A) => boolean) => {
|
|
@@ -4115,17 +3886,14 @@ export declare const containsWith: <A>(isEquivalent: (self: A, that: A) => boole
|
|
|
4115
3886
|
*
|
|
4116
3887
|
* **Example** (Finding the first matching element)
|
|
4117
3888
|
*
|
|
4118
|
-
* ```ts
|
|
3889
|
+
* ```ts import.meta.vitest
|
|
4119
3890
|
* import { Chunk, Option } from "effect"
|
|
4120
3891
|
*
|
|
4121
3892
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4122
|
-
*
|
|
4123
|
-
* console.log(Option.isSome(result)) // true
|
|
4124
|
-
* console.log(Option.getOrElse(result, () => 0)) // 4
|
|
3893
|
+
* Chunk.findFirst(chunk, (n) => n > 3) // => Option.some(4)
|
|
4125
3894
|
*
|
|
4126
3895
|
* // No match found
|
|
4127
|
-
*
|
|
4128
|
-
* console.log(Option.isNone(notFound)) // true
|
|
3896
|
+
* Chunk.findFirst(chunk, (n) => n > 10) // => Option.none()
|
|
4129
3897
|
*
|
|
4130
3898
|
* // With type refinement
|
|
4131
3899
|
* const mixed = Chunk.make(1, "hello", 2, "world", 3)
|
|
@@ -4133,10 +3901,10 @@ export declare const containsWith: <A>(isEquivalent: (self: A, that: A) => boole
|
|
|
4133
3901
|
* mixed,
|
|
4134
3902
|
* (x): x is string => typeof x === "string"
|
|
4135
3903
|
* )
|
|
4136
|
-
*
|
|
3904
|
+
* firstString // => Option.some("hello")
|
|
4137
3905
|
* ```
|
|
4138
3906
|
*
|
|
4139
|
-
* @category
|
|
3907
|
+
* @category searching
|
|
4140
3908
|
* @since 2.0.0
|
|
4141
3909
|
*/
|
|
4142
3910
|
export declare const findFirst: {
|
|
@@ -4146,17 +3914,14 @@ export declare const findFirst: {
|
|
|
4146
3914
|
*
|
|
4147
3915
|
* **Example** (Finding the first matching element)
|
|
4148
3916
|
*
|
|
4149
|
-
* ```ts
|
|
3917
|
+
* ```ts import.meta.vitest
|
|
4150
3918
|
* import { Chunk, Option } from "effect"
|
|
4151
3919
|
*
|
|
4152
3920
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4153
|
-
*
|
|
4154
|
-
* console.log(Option.isSome(result)) // true
|
|
4155
|
-
* console.log(Option.getOrElse(result, () => 0)) // 4
|
|
3921
|
+
* Chunk.findFirst(chunk, (n) => n > 3) // => Option.some(4)
|
|
4156
3922
|
*
|
|
4157
3923
|
* // No match found
|
|
4158
|
-
*
|
|
4159
|
-
* console.log(Option.isNone(notFound)) // true
|
|
3924
|
+
* Chunk.findFirst(chunk, (n) => n > 10) // => Option.none()
|
|
4160
3925
|
*
|
|
4161
3926
|
* // With type refinement
|
|
4162
3927
|
* const mixed = Chunk.make(1, "hello", 2, "world", 3)
|
|
@@ -4164,10 +3929,10 @@ export declare const findFirst: {
|
|
|
4164
3929
|
* mixed,
|
|
4165
3930
|
* (x): x is string => typeof x === "string"
|
|
4166
3931
|
* )
|
|
4167
|
-
*
|
|
3932
|
+
* firstString // => Option.some("hello")
|
|
4168
3933
|
* ```
|
|
4169
3934
|
*
|
|
4170
|
-
* @category
|
|
3935
|
+
* @category searching
|
|
4171
3936
|
* @since 2.0.0
|
|
4172
3937
|
*/
|
|
4173
3938
|
<A, B extends A>(refinement: Refinement<NoInfer<A>, B>): (self: Chunk<A>) => Option<B>;
|
|
@@ -4177,17 +3942,14 @@ export declare const findFirst: {
|
|
|
4177
3942
|
*
|
|
4178
3943
|
* **Example** (Finding the first matching element)
|
|
4179
3944
|
*
|
|
4180
|
-
* ```ts
|
|
3945
|
+
* ```ts import.meta.vitest
|
|
4181
3946
|
* import { Chunk, Option } from "effect"
|
|
4182
3947
|
*
|
|
4183
3948
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4184
|
-
*
|
|
4185
|
-
* console.log(Option.isSome(result)) // true
|
|
4186
|
-
* console.log(Option.getOrElse(result, () => 0)) // 4
|
|
3949
|
+
* Chunk.findFirst(chunk, (n) => n > 3) // => Option.some(4)
|
|
4187
3950
|
*
|
|
4188
3951
|
* // No match found
|
|
4189
|
-
*
|
|
4190
|
-
* console.log(Option.isNone(notFound)) // true
|
|
3952
|
+
* Chunk.findFirst(chunk, (n) => n > 10) // => Option.none()
|
|
4191
3953
|
*
|
|
4192
3954
|
* // With type refinement
|
|
4193
3955
|
* const mixed = Chunk.make(1, "hello", 2, "world", 3)
|
|
@@ -4195,10 +3957,10 @@ export declare const findFirst: {
|
|
|
4195
3957
|
* mixed,
|
|
4196
3958
|
* (x): x is string => typeof x === "string"
|
|
4197
3959
|
* )
|
|
4198
|
-
*
|
|
3960
|
+
* firstString // => Option.some("hello")
|
|
4199
3961
|
* ```
|
|
4200
3962
|
*
|
|
4201
|
-
* @category
|
|
3963
|
+
* @category searching
|
|
4202
3964
|
* @since 2.0.0
|
|
4203
3965
|
*/
|
|
4204
3966
|
<A>(predicate: Predicate<NoInfer<A>>): (self: Chunk<A>) => Option<A>;
|
|
@@ -4208,17 +3970,14 @@ export declare const findFirst: {
|
|
|
4208
3970
|
*
|
|
4209
3971
|
* **Example** (Finding the first matching element)
|
|
4210
3972
|
*
|
|
4211
|
-
* ```ts
|
|
3973
|
+
* ```ts import.meta.vitest
|
|
4212
3974
|
* import { Chunk, Option } from "effect"
|
|
4213
3975
|
*
|
|
4214
3976
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4215
|
-
*
|
|
4216
|
-
* console.log(Option.isSome(result)) // true
|
|
4217
|
-
* console.log(Option.getOrElse(result, () => 0)) // 4
|
|
3977
|
+
* Chunk.findFirst(chunk, (n) => n > 3) // => Option.some(4)
|
|
4218
3978
|
*
|
|
4219
3979
|
* // No match found
|
|
4220
|
-
*
|
|
4221
|
-
* console.log(Option.isNone(notFound)) // true
|
|
3980
|
+
* Chunk.findFirst(chunk, (n) => n > 10) // => Option.none()
|
|
4222
3981
|
*
|
|
4223
3982
|
* // With type refinement
|
|
4224
3983
|
* const mixed = Chunk.make(1, "hello", 2, "world", 3)
|
|
@@ -4226,10 +3985,10 @@ export declare const findFirst: {
|
|
|
4226
3985
|
* mixed,
|
|
4227
3986
|
* (x): x is string => typeof x === "string"
|
|
4228
3987
|
* )
|
|
4229
|
-
*
|
|
3988
|
+
* firstString // => Option.some("hello")
|
|
4230
3989
|
* ```
|
|
4231
3990
|
*
|
|
4232
|
-
* @category
|
|
3991
|
+
* @category searching
|
|
4233
3992
|
* @since 2.0.0
|
|
4234
3993
|
*/
|
|
4235
3994
|
<A, B extends A>(self: Chunk<A>, refinement: Refinement<A, B>): Option<B>;
|
|
@@ -4239,17 +3998,14 @@ export declare const findFirst: {
|
|
|
4239
3998
|
*
|
|
4240
3999
|
* **Example** (Finding the first matching element)
|
|
4241
4000
|
*
|
|
4242
|
-
* ```ts
|
|
4001
|
+
* ```ts import.meta.vitest
|
|
4243
4002
|
* import { Chunk, Option } from "effect"
|
|
4244
4003
|
*
|
|
4245
4004
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4246
|
-
*
|
|
4247
|
-
* console.log(Option.isSome(result)) // true
|
|
4248
|
-
* console.log(Option.getOrElse(result, () => 0)) // 4
|
|
4005
|
+
* Chunk.findFirst(chunk, (n) => n > 3) // => Option.some(4)
|
|
4249
4006
|
*
|
|
4250
4007
|
* // No match found
|
|
4251
|
-
*
|
|
4252
|
-
* console.log(Option.isNone(notFound)) // true
|
|
4008
|
+
* Chunk.findFirst(chunk, (n) => n > 10) // => Option.none()
|
|
4253
4009
|
*
|
|
4254
4010
|
* // With type refinement
|
|
4255
4011
|
* const mixed = Chunk.make(1, "hello", 2, "world", 3)
|
|
@@ -4257,10 +4013,10 @@ export declare const findFirst: {
|
|
|
4257
4013
|
* mixed,
|
|
4258
4014
|
* (x): x is string => typeof x === "string"
|
|
4259
4015
|
* )
|
|
4260
|
-
*
|
|
4016
|
+
* firstString // => Option.some("hello")
|
|
4261
4017
|
* ```
|
|
4262
4018
|
*
|
|
4263
|
-
* @category
|
|
4019
|
+
* @category searching
|
|
4264
4020
|
* @since 2.0.0
|
|
4265
4021
|
*/
|
|
4266
4022
|
<A>(self: Chunk<A>, predicate: Predicate<A>): Option<A>;
|
|
@@ -4270,23 +4026,20 @@ export declare const findFirst: {
|
|
|
4270
4026
|
*
|
|
4271
4027
|
* **Example** (Finding the first matching index)
|
|
4272
4028
|
*
|
|
4273
|
-
* ```ts
|
|
4274
|
-
* import { Chunk } from "effect"
|
|
4029
|
+
* ```ts import.meta.vitest
|
|
4030
|
+
* import { Chunk, Option } from "effect"
|
|
4275
4031
|
*
|
|
4276
4032
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4277
|
-
*
|
|
4278
|
-
* console.log(result) // Option.some(3)
|
|
4033
|
+
* Chunk.findFirstIndex(chunk, (n) => n > 3) // => Option.some(3)
|
|
4279
4034
|
*
|
|
4280
4035
|
* // No match found
|
|
4281
|
-
*
|
|
4282
|
-
* console.log(notFound) // Option.none()
|
|
4036
|
+
* Chunk.findFirstIndex(chunk, (n) => n > 10) // => Option.none()
|
|
4283
4037
|
*
|
|
4284
4038
|
* // Find first even number
|
|
4285
|
-
*
|
|
4286
|
-
* console.log(firstEven) // Option.some(1)
|
|
4039
|
+
* Chunk.findFirstIndex(chunk, (n) => n % 2 === 0) // => Option.some(1)
|
|
4287
4040
|
* ```
|
|
4288
4041
|
*
|
|
4289
|
-
* @category
|
|
4042
|
+
* @category searching
|
|
4290
4043
|
* @since 2.0.0
|
|
4291
4044
|
*/
|
|
4292
4045
|
export declare const findFirstIndex: {
|
|
@@ -4295,23 +4048,20 @@ export declare const findFirstIndex: {
|
|
|
4295
4048
|
*
|
|
4296
4049
|
* **Example** (Finding the first matching index)
|
|
4297
4050
|
*
|
|
4298
|
-
* ```ts
|
|
4299
|
-
* import { Chunk } from "effect"
|
|
4051
|
+
* ```ts import.meta.vitest
|
|
4052
|
+
* import { Chunk, Option } from "effect"
|
|
4300
4053
|
*
|
|
4301
4054
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4302
|
-
*
|
|
4303
|
-
* console.log(result) // Option.some(3)
|
|
4055
|
+
* Chunk.findFirstIndex(chunk, (n) => n > 3) // => Option.some(3)
|
|
4304
4056
|
*
|
|
4305
4057
|
* // No match found
|
|
4306
|
-
*
|
|
4307
|
-
* console.log(notFound) // Option.none()
|
|
4058
|
+
* Chunk.findFirstIndex(chunk, (n) => n > 10) // => Option.none()
|
|
4308
4059
|
*
|
|
4309
4060
|
* // Find first even number
|
|
4310
|
-
*
|
|
4311
|
-
* console.log(firstEven) // Option.some(1)
|
|
4061
|
+
* Chunk.findFirstIndex(chunk, (n) => n % 2 === 0) // => Option.some(1)
|
|
4312
4062
|
* ```
|
|
4313
4063
|
*
|
|
4314
|
-
* @category
|
|
4064
|
+
* @category searching
|
|
4315
4065
|
* @since 2.0.0
|
|
4316
4066
|
*/
|
|
4317
4067
|
<A>(predicate: Predicate<A>): (self: Chunk<A>) => O.Option<number>;
|
|
@@ -4320,23 +4070,20 @@ export declare const findFirstIndex: {
|
|
|
4320
4070
|
*
|
|
4321
4071
|
* **Example** (Finding the first matching index)
|
|
4322
4072
|
*
|
|
4323
|
-
* ```ts
|
|
4324
|
-
* import { Chunk } from "effect"
|
|
4073
|
+
* ```ts import.meta.vitest
|
|
4074
|
+
* import { Chunk, Option } from "effect"
|
|
4325
4075
|
*
|
|
4326
4076
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4327
|
-
*
|
|
4328
|
-
* console.log(result) // Option.some(3)
|
|
4077
|
+
* Chunk.findFirstIndex(chunk, (n) => n > 3) // => Option.some(3)
|
|
4329
4078
|
*
|
|
4330
4079
|
* // No match found
|
|
4331
|
-
*
|
|
4332
|
-
* console.log(notFound) // Option.none()
|
|
4080
|
+
* Chunk.findFirstIndex(chunk, (n) => n > 10) // => Option.none()
|
|
4333
4081
|
*
|
|
4334
4082
|
* // Find first even number
|
|
4335
|
-
*
|
|
4336
|
-
* console.log(firstEven) // Option.some(1)
|
|
4083
|
+
* Chunk.findFirstIndex(chunk, (n) => n % 2 === 0) // => Option.some(1)
|
|
4337
4084
|
* ```
|
|
4338
4085
|
*
|
|
4339
|
-
* @category
|
|
4086
|
+
* @category searching
|
|
4340
4087
|
* @since 2.0.0
|
|
4341
4088
|
*/
|
|
4342
4089
|
<A>(self: Chunk<A>, predicate: Predicate<A>): O.Option<number>;
|
|
@@ -4346,24 +4093,20 @@ export declare const findFirstIndex: {
|
|
|
4346
4093
|
*
|
|
4347
4094
|
* **Example** (Finding the last matching element)
|
|
4348
4095
|
*
|
|
4349
|
-
* ```ts
|
|
4096
|
+
* ```ts import.meta.vitest
|
|
4350
4097
|
* import { Chunk, Option } from "effect"
|
|
4351
4098
|
*
|
|
4352
4099
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4353
|
-
*
|
|
4354
|
-
* console.log(Option.isSome(result)) // true
|
|
4355
|
-
* console.log(Option.getOrElse(result, () => 0)) // 3
|
|
4100
|
+
* Chunk.findLast(chunk, (n) => n < 4) // => Option.some(3)
|
|
4356
4101
|
*
|
|
4357
4102
|
* // No match found
|
|
4358
|
-
*
|
|
4359
|
-
* console.log(Option.isNone(notFound)) // true
|
|
4103
|
+
* Chunk.findLast(chunk, (n) => n > 10) // => Option.none()
|
|
4360
4104
|
*
|
|
4361
4105
|
* // Find last even number
|
|
4362
|
-
*
|
|
4363
|
-
* console.log(Option.getOrElse(lastEven, () => 0)) // 4
|
|
4106
|
+
* Chunk.findLast(chunk, (n) => n % 2 === 0) // => Option.some(4)
|
|
4364
4107
|
* ```
|
|
4365
4108
|
*
|
|
4366
|
-
* @category
|
|
4109
|
+
* @category searching
|
|
4367
4110
|
* @since 2.0.0
|
|
4368
4111
|
*/
|
|
4369
4112
|
export declare const findLast: {
|
|
@@ -4372,24 +4115,20 @@ export declare const findLast: {
|
|
|
4372
4115
|
*
|
|
4373
4116
|
* **Example** (Finding the last matching element)
|
|
4374
4117
|
*
|
|
4375
|
-
* ```ts
|
|
4118
|
+
* ```ts import.meta.vitest
|
|
4376
4119
|
* import { Chunk, Option } from "effect"
|
|
4377
4120
|
*
|
|
4378
4121
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4379
|
-
*
|
|
4380
|
-
* console.log(Option.isSome(result)) // true
|
|
4381
|
-
* console.log(Option.getOrElse(result, () => 0)) // 3
|
|
4122
|
+
* Chunk.findLast(chunk, (n) => n < 4) // => Option.some(3)
|
|
4382
4123
|
*
|
|
4383
4124
|
* // No match found
|
|
4384
|
-
*
|
|
4385
|
-
* console.log(Option.isNone(notFound)) // true
|
|
4125
|
+
* Chunk.findLast(chunk, (n) => n > 10) // => Option.none()
|
|
4386
4126
|
*
|
|
4387
4127
|
* // Find last even number
|
|
4388
|
-
*
|
|
4389
|
-
* console.log(Option.getOrElse(lastEven, () => 0)) // 4
|
|
4128
|
+
* Chunk.findLast(chunk, (n) => n % 2 === 0) // => Option.some(4)
|
|
4390
4129
|
* ```
|
|
4391
4130
|
*
|
|
4392
|
-
* @category
|
|
4131
|
+
* @category searching
|
|
4393
4132
|
* @since 2.0.0
|
|
4394
4133
|
*/
|
|
4395
4134
|
<A, B extends A>(refinement: Refinement<NoInfer<A>, B>): (self: Chunk<A>) => Option<B>;
|
|
@@ -4398,24 +4137,20 @@ export declare const findLast: {
|
|
|
4398
4137
|
*
|
|
4399
4138
|
* **Example** (Finding the last matching element)
|
|
4400
4139
|
*
|
|
4401
|
-
* ```ts
|
|
4140
|
+
* ```ts import.meta.vitest
|
|
4402
4141
|
* import { Chunk, Option } from "effect"
|
|
4403
4142
|
*
|
|
4404
4143
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4405
|
-
*
|
|
4406
|
-
* console.log(Option.isSome(result)) // true
|
|
4407
|
-
* console.log(Option.getOrElse(result, () => 0)) // 3
|
|
4144
|
+
* Chunk.findLast(chunk, (n) => n < 4) // => Option.some(3)
|
|
4408
4145
|
*
|
|
4409
4146
|
* // No match found
|
|
4410
|
-
*
|
|
4411
|
-
* console.log(Option.isNone(notFound)) // true
|
|
4147
|
+
* Chunk.findLast(chunk, (n) => n > 10) // => Option.none()
|
|
4412
4148
|
*
|
|
4413
4149
|
* // Find last even number
|
|
4414
|
-
*
|
|
4415
|
-
* console.log(Option.getOrElse(lastEven, () => 0)) // 4
|
|
4150
|
+
* Chunk.findLast(chunk, (n) => n % 2 === 0) // => Option.some(4)
|
|
4416
4151
|
* ```
|
|
4417
4152
|
*
|
|
4418
|
-
* @category
|
|
4153
|
+
* @category searching
|
|
4419
4154
|
* @since 2.0.0
|
|
4420
4155
|
*/
|
|
4421
4156
|
<A>(predicate: Predicate<NoInfer<A>>): (self: Chunk<A>) => Option<A>;
|
|
@@ -4424,24 +4159,20 @@ export declare const findLast: {
|
|
|
4424
4159
|
*
|
|
4425
4160
|
* **Example** (Finding the last matching element)
|
|
4426
4161
|
*
|
|
4427
|
-
* ```ts
|
|
4162
|
+
* ```ts import.meta.vitest
|
|
4428
4163
|
* import { Chunk, Option } from "effect"
|
|
4429
4164
|
*
|
|
4430
4165
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4431
|
-
*
|
|
4432
|
-
* console.log(Option.isSome(result)) // true
|
|
4433
|
-
* console.log(Option.getOrElse(result, () => 0)) // 3
|
|
4166
|
+
* Chunk.findLast(chunk, (n) => n < 4) // => Option.some(3)
|
|
4434
4167
|
*
|
|
4435
4168
|
* // No match found
|
|
4436
|
-
*
|
|
4437
|
-
* console.log(Option.isNone(notFound)) // true
|
|
4169
|
+
* Chunk.findLast(chunk, (n) => n > 10) // => Option.none()
|
|
4438
4170
|
*
|
|
4439
4171
|
* // Find last even number
|
|
4440
|
-
*
|
|
4441
|
-
* console.log(Option.getOrElse(lastEven, () => 0)) // 4
|
|
4172
|
+
* Chunk.findLast(chunk, (n) => n % 2 === 0) // => Option.some(4)
|
|
4442
4173
|
* ```
|
|
4443
4174
|
*
|
|
4444
|
-
* @category
|
|
4175
|
+
* @category searching
|
|
4445
4176
|
* @since 2.0.0
|
|
4446
4177
|
*/
|
|
4447
4178
|
<A, B extends A>(self: Chunk<A>, refinement: Refinement<A, B>): Option<B>;
|
|
@@ -4450,24 +4181,20 @@ export declare const findLast: {
|
|
|
4450
4181
|
*
|
|
4451
4182
|
* **Example** (Finding the last matching element)
|
|
4452
4183
|
*
|
|
4453
|
-
* ```ts
|
|
4184
|
+
* ```ts import.meta.vitest
|
|
4454
4185
|
* import { Chunk, Option } from "effect"
|
|
4455
4186
|
*
|
|
4456
4187
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4457
|
-
*
|
|
4458
|
-
* console.log(Option.isSome(result)) // true
|
|
4459
|
-
* console.log(Option.getOrElse(result, () => 0)) // 3
|
|
4188
|
+
* Chunk.findLast(chunk, (n) => n < 4) // => Option.some(3)
|
|
4460
4189
|
*
|
|
4461
4190
|
* // No match found
|
|
4462
|
-
*
|
|
4463
|
-
* console.log(Option.isNone(notFound)) // true
|
|
4191
|
+
* Chunk.findLast(chunk, (n) => n > 10) // => Option.none()
|
|
4464
4192
|
*
|
|
4465
4193
|
* // Find last even number
|
|
4466
|
-
*
|
|
4467
|
-
* console.log(Option.getOrElse(lastEven, () => 0)) // 4
|
|
4194
|
+
* Chunk.findLast(chunk, (n) => n % 2 === 0) // => Option.some(4)
|
|
4468
4195
|
* ```
|
|
4469
4196
|
*
|
|
4470
|
-
* @category
|
|
4197
|
+
* @category searching
|
|
4471
4198
|
* @since 2.0.0
|
|
4472
4199
|
*/
|
|
4473
4200
|
<A>(self: Chunk<A>, predicate: Predicate<A>): Option<A>;
|
|
@@ -4477,23 +4204,20 @@ export declare const findLast: {
|
|
|
4477
4204
|
*
|
|
4478
4205
|
* **Example** (Finding the last matching index)
|
|
4479
4206
|
*
|
|
4480
|
-
* ```ts
|
|
4481
|
-
* import { Chunk } from "effect"
|
|
4207
|
+
* ```ts import.meta.vitest
|
|
4208
|
+
* import { Chunk, Option } from "effect"
|
|
4482
4209
|
*
|
|
4483
4210
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4484
|
-
*
|
|
4485
|
-
* console.log(result) // Option.some(2)
|
|
4211
|
+
* Chunk.findLastIndex(chunk, (n) => n < 4) // => Option.some(2)
|
|
4486
4212
|
*
|
|
4487
4213
|
* // No match found
|
|
4488
|
-
*
|
|
4489
|
-
* console.log(notFound) // Option.none()
|
|
4214
|
+
* Chunk.findLastIndex(chunk, (n) => n > 10) // => Option.none()
|
|
4490
4215
|
*
|
|
4491
4216
|
* // Find last even number index
|
|
4492
|
-
*
|
|
4493
|
-
* console.log(lastEven) // Option.some(3)
|
|
4217
|
+
* Chunk.findLastIndex(chunk, (n) => n % 2 === 0) // => Option.some(3)
|
|
4494
4218
|
* ```
|
|
4495
4219
|
*
|
|
4496
|
-
* @category
|
|
4220
|
+
* @category searching
|
|
4497
4221
|
* @since 2.0.0
|
|
4498
4222
|
*/
|
|
4499
4223
|
export declare const findLastIndex: {
|
|
@@ -4502,23 +4226,20 @@ export declare const findLastIndex: {
|
|
|
4502
4226
|
*
|
|
4503
4227
|
* **Example** (Finding the last matching index)
|
|
4504
4228
|
*
|
|
4505
|
-
* ```ts
|
|
4506
|
-
* import { Chunk } from "effect"
|
|
4229
|
+
* ```ts import.meta.vitest
|
|
4230
|
+
* import { Chunk, Option } from "effect"
|
|
4507
4231
|
*
|
|
4508
4232
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4509
|
-
*
|
|
4510
|
-
* console.log(result) // Option.some(2)
|
|
4233
|
+
* Chunk.findLastIndex(chunk, (n) => n < 4) // => Option.some(2)
|
|
4511
4234
|
*
|
|
4512
4235
|
* // No match found
|
|
4513
|
-
*
|
|
4514
|
-
* console.log(notFound) // Option.none()
|
|
4236
|
+
* Chunk.findLastIndex(chunk, (n) => n > 10) // => Option.none()
|
|
4515
4237
|
*
|
|
4516
4238
|
* // Find last even number index
|
|
4517
|
-
*
|
|
4518
|
-
* console.log(lastEven) // Option.some(3)
|
|
4239
|
+
* Chunk.findLastIndex(chunk, (n) => n % 2 === 0) // => Option.some(3)
|
|
4519
4240
|
* ```
|
|
4520
4241
|
*
|
|
4521
|
-
* @category
|
|
4242
|
+
* @category searching
|
|
4522
4243
|
* @since 2.0.0
|
|
4523
4244
|
*/
|
|
4524
4245
|
<A>(predicate: Predicate<A>): (self: Chunk<A>) => O.Option<number>;
|
|
@@ -4527,23 +4248,20 @@ export declare const findLastIndex: {
|
|
|
4527
4248
|
*
|
|
4528
4249
|
* **Example** (Finding the last matching index)
|
|
4529
4250
|
*
|
|
4530
|
-
* ```ts
|
|
4531
|
-
* import { Chunk } from "effect"
|
|
4251
|
+
* ```ts import.meta.vitest
|
|
4252
|
+
* import { Chunk, Option } from "effect"
|
|
4532
4253
|
*
|
|
4533
4254
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4534
|
-
*
|
|
4535
|
-
* console.log(result) // Option.some(2)
|
|
4255
|
+
* Chunk.findLastIndex(chunk, (n) => n < 4) // => Option.some(2)
|
|
4536
4256
|
*
|
|
4537
4257
|
* // No match found
|
|
4538
|
-
*
|
|
4539
|
-
* console.log(notFound) // Option.none()
|
|
4258
|
+
* Chunk.findLastIndex(chunk, (n) => n > 10) // => Option.none()
|
|
4540
4259
|
*
|
|
4541
4260
|
* // Find last even number index
|
|
4542
|
-
*
|
|
4543
|
-
* console.log(lastEven) // Option.some(3)
|
|
4261
|
+
* Chunk.findLastIndex(chunk, (n) => n % 2 === 0) // => Option.some(3)
|
|
4544
4262
|
* ```
|
|
4545
4263
|
*
|
|
4546
|
-
* @category
|
|
4264
|
+
* @category searching
|
|
4547
4265
|
* @since 2.0.0
|
|
4548
4266
|
*/
|
|
4549
4267
|
<A>(self: Chunk<A>, predicate: Predicate<A>): O.Option<number>;
|
|
@@ -4553,26 +4271,24 @@ export declare const findLastIndex: {
|
|
|
4553
4271
|
*
|
|
4554
4272
|
* **Example** (Checking every element)
|
|
4555
4273
|
*
|
|
4556
|
-
* ```ts
|
|
4274
|
+
* ```ts import.meta.vitest
|
|
4557
4275
|
* import { Chunk } from "effect"
|
|
4558
4276
|
*
|
|
4559
4277
|
* const allPositive = Chunk.make(1, 2, 3, 4, 5)
|
|
4560
|
-
*
|
|
4561
|
-
*
|
|
4278
|
+
* Chunk.every(allPositive, (n) => n > 0) // => true
|
|
4279
|
+
* Chunk.every(allPositive, (n) => n > 3) // => false
|
|
4562
4280
|
*
|
|
4563
4281
|
* // Empty chunk returns true
|
|
4564
|
-
*
|
|
4565
|
-
* console.log(Chunk.every(empty, (n) => n > 0)) // true
|
|
4282
|
+
* Chunk.every(Chunk.empty<number>(), (n) => n > 0) // => true
|
|
4566
4283
|
*
|
|
4567
4284
|
* // Type refinement
|
|
4568
4285
|
* const mixed = Chunk.make(1, 2, 3)
|
|
4569
4286
|
* if (Chunk.every(mixed, (x): x is number => typeof x === "number")) {
|
|
4570
4287
|
* // mixed is now typed as Chunk<number>
|
|
4571
|
-
* console.log("All elements are numbers")
|
|
4572
4288
|
* }
|
|
4573
4289
|
* ```
|
|
4574
4290
|
*
|
|
4575
|
-
* @category
|
|
4291
|
+
* @category guards
|
|
4576
4292
|
* @since 2.0.0
|
|
4577
4293
|
*/
|
|
4578
4294
|
export declare const every: {
|
|
@@ -4581,26 +4297,24 @@ export declare const every: {
|
|
|
4581
4297
|
*
|
|
4582
4298
|
* **Example** (Checking every element)
|
|
4583
4299
|
*
|
|
4584
|
-
* ```ts
|
|
4300
|
+
* ```ts import.meta.vitest
|
|
4585
4301
|
* import { Chunk } from "effect"
|
|
4586
4302
|
*
|
|
4587
4303
|
* const allPositive = Chunk.make(1, 2, 3, 4, 5)
|
|
4588
|
-
*
|
|
4589
|
-
*
|
|
4304
|
+
* Chunk.every(allPositive, (n) => n > 0) // => true
|
|
4305
|
+
* Chunk.every(allPositive, (n) => n > 3) // => false
|
|
4590
4306
|
*
|
|
4591
4307
|
* // Empty chunk returns true
|
|
4592
|
-
*
|
|
4593
|
-
* console.log(Chunk.every(empty, (n) => n > 0)) // true
|
|
4308
|
+
* Chunk.every(Chunk.empty<number>(), (n) => n > 0) // => true
|
|
4594
4309
|
*
|
|
4595
4310
|
* // Type refinement
|
|
4596
4311
|
* const mixed = Chunk.make(1, 2, 3)
|
|
4597
4312
|
* if (Chunk.every(mixed, (x): x is number => typeof x === "number")) {
|
|
4598
4313
|
* // mixed is now typed as Chunk<number>
|
|
4599
|
-
* console.log("All elements are numbers")
|
|
4600
4314
|
* }
|
|
4601
4315
|
* ```
|
|
4602
4316
|
*
|
|
4603
|
-
* @category
|
|
4317
|
+
* @category guards
|
|
4604
4318
|
* @since 2.0.0
|
|
4605
4319
|
*/
|
|
4606
4320
|
<A, B extends A>(refinement: Refinement<NoInfer<A>, B>): (self: Chunk<A>) => self is Chunk<B>;
|
|
@@ -4609,26 +4323,24 @@ export declare const every: {
|
|
|
4609
4323
|
*
|
|
4610
4324
|
* **Example** (Checking every element)
|
|
4611
4325
|
*
|
|
4612
|
-
* ```ts
|
|
4326
|
+
* ```ts import.meta.vitest
|
|
4613
4327
|
* import { Chunk } from "effect"
|
|
4614
4328
|
*
|
|
4615
4329
|
* const allPositive = Chunk.make(1, 2, 3, 4, 5)
|
|
4616
|
-
*
|
|
4617
|
-
*
|
|
4330
|
+
* Chunk.every(allPositive, (n) => n > 0) // => true
|
|
4331
|
+
* Chunk.every(allPositive, (n) => n > 3) // => false
|
|
4618
4332
|
*
|
|
4619
4333
|
* // Empty chunk returns true
|
|
4620
|
-
*
|
|
4621
|
-
* console.log(Chunk.every(empty, (n) => n > 0)) // true
|
|
4334
|
+
* Chunk.every(Chunk.empty<number>(), (n) => n > 0) // => true
|
|
4622
4335
|
*
|
|
4623
4336
|
* // Type refinement
|
|
4624
4337
|
* const mixed = Chunk.make(1, 2, 3)
|
|
4625
4338
|
* if (Chunk.every(mixed, (x): x is number => typeof x === "number")) {
|
|
4626
4339
|
* // mixed is now typed as Chunk<number>
|
|
4627
|
-
* console.log("All elements are numbers")
|
|
4628
4340
|
* }
|
|
4629
4341
|
* ```
|
|
4630
4342
|
*
|
|
4631
|
-
* @category
|
|
4343
|
+
* @category guards
|
|
4632
4344
|
* @since 2.0.0
|
|
4633
4345
|
*/
|
|
4634
4346
|
<A>(predicate: Predicate<A>): (self: Chunk<A>) => boolean;
|
|
@@ -4637,26 +4349,24 @@ export declare const every: {
|
|
|
4637
4349
|
*
|
|
4638
4350
|
* **Example** (Checking every element)
|
|
4639
4351
|
*
|
|
4640
|
-
* ```ts
|
|
4352
|
+
* ```ts import.meta.vitest
|
|
4641
4353
|
* import { Chunk } from "effect"
|
|
4642
4354
|
*
|
|
4643
4355
|
* const allPositive = Chunk.make(1, 2, 3, 4, 5)
|
|
4644
|
-
*
|
|
4645
|
-
*
|
|
4356
|
+
* Chunk.every(allPositive, (n) => n > 0) // => true
|
|
4357
|
+
* Chunk.every(allPositive, (n) => n > 3) // => false
|
|
4646
4358
|
*
|
|
4647
4359
|
* // Empty chunk returns true
|
|
4648
|
-
*
|
|
4649
|
-
* console.log(Chunk.every(empty, (n) => n > 0)) // true
|
|
4360
|
+
* Chunk.every(Chunk.empty<number>(), (n) => n > 0) // => true
|
|
4650
4361
|
*
|
|
4651
4362
|
* // Type refinement
|
|
4652
4363
|
* const mixed = Chunk.make(1, 2, 3)
|
|
4653
4364
|
* if (Chunk.every(mixed, (x): x is number => typeof x === "number")) {
|
|
4654
4365
|
* // mixed is now typed as Chunk<number>
|
|
4655
|
-
* console.log("All elements are numbers")
|
|
4656
4366
|
* }
|
|
4657
4367
|
* ```
|
|
4658
4368
|
*
|
|
4659
|
-
* @category
|
|
4369
|
+
* @category guards
|
|
4660
4370
|
* @since 2.0.0
|
|
4661
4371
|
*/
|
|
4662
4372
|
<A, B extends A>(self: Chunk<A>, refinement: Refinement<A, B>): self is Chunk<B>;
|
|
@@ -4665,26 +4375,24 @@ export declare const every: {
|
|
|
4665
4375
|
*
|
|
4666
4376
|
* **Example** (Checking every element)
|
|
4667
4377
|
*
|
|
4668
|
-
* ```ts
|
|
4378
|
+
* ```ts import.meta.vitest
|
|
4669
4379
|
* import { Chunk } from "effect"
|
|
4670
4380
|
*
|
|
4671
4381
|
* const allPositive = Chunk.make(1, 2, 3, 4, 5)
|
|
4672
|
-
*
|
|
4673
|
-
*
|
|
4382
|
+
* Chunk.every(allPositive, (n) => n > 0) // => true
|
|
4383
|
+
* Chunk.every(allPositive, (n) => n > 3) // => false
|
|
4674
4384
|
*
|
|
4675
4385
|
* // Empty chunk returns true
|
|
4676
|
-
*
|
|
4677
|
-
* console.log(Chunk.every(empty, (n) => n > 0)) // true
|
|
4386
|
+
* Chunk.every(Chunk.empty<number>(), (n) => n > 0) // => true
|
|
4678
4387
|
*
|
|
4679
4388
|
* // Type refinement
|
|
4680
4389
|
* const mixed = Chunk.make(1, 2, 3)
|
|
4681
4390
|
* if (Chunk.every(mixed, (x): x is number => typeof x === "number")) {
|
|
4682
4391
|
* // mixed is now typed as Chunk<number>
|
|
4683
|
-
* console.log("All elements are numbers")
|
|
4684
4392
|
* }
|
|
4685
4393
|
* ```
|
|
4686
4394
|
*
|
|
4687
|
-
* @category
|
|
4395
|
+
* @category guards
|
|
4688
4396
|
* @since 2.0.0
|
|
4689
4397
|
*/
|
|
4690
4398
|
<A>(self: Chunk<A>, predicate: Predicate<A>): boolean;
|
|
@@ -4694,23 +4402,22 @@ export declare const every: {
|
|
|
4694
4402
|
*
|
|
4695
4403
|
* **Example** (Checking for some matching element)
|
|
4696
4404
|
*
|
|
4697
|
-
* ```ts
|
|
4405
|
+
* ```ts import.meta.vitest
|
|
4698
4406
|
* import { Chunk } from "effect"
|
|
4699
4407
|
*
|
|
4700
4408
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4701
|
-
*
|
|
4702
|
-
*
|
|
4409
|
+
* Chunk.some(chunk, (n) => n > 4) // => true
|
|
4410
|
+
* Chunk.some(chunk, (n) => n > 10) // => false
|
|
4703
4411
|
*
|
|
4704
4412
|
* // Empty chunk returns false
|
|
4705
|
-
*
|
|
4706
|
-
* console.log(Chunk.some(empty, (n) => n > 0)) // false
|
|
4413
|
+
* Chunk.some(Chunk.empty<number>(), (n) => n > 0) // => false
|
|
4707
4414
|
*
|
|
4708
4415
|
* // Check for specific value
|
|
4709
4416
|
* const words = Chunk.make("apple", "banana", "cherry")
|
|
4710
|
-
*
|
|
4417
|
+
* Chunk.some(words, (word) => word.includes("ban")) // => true
|
|
4711
4418
|
* ```
|
|
4712
4419
|
*
|
|
4713
|
-
* @category
|
|
4420
|
+
* @category guards
|
|
4714
4421
|
* @since 2.0.0
|
|
4715
4422
|
*/
|
|
4716
4423
|
export declare const some: {
|
|
@@ -4719,23 +4426,22 @@ export declare const some: {
|
|
|
4719
4426
|
*
|
|
4720
4427
|
* **Example** (Checking for some matching element)
|
|
4721
4428
|
*
|
|
4722
|
-
* ```ts
|
|
4429
|
+
* ```ts import.meta.vitest
|
|
4723
4430
|
* import { Chunk } from "effect"
|
|
4724
4431
|
*
|
|
4725
4432
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4726
|
-
*
|
|
4727
|
-
*
|
|
4433
|
+
* Chunk.some(chunk, (n) => n > 4) // => true
|
|
4434
|
+
* Chunk.some(chunk, (n) => n > 10) // => false
|
|
4728
4435
|
*
|
|
4729
4436
|
* // Empty chunk returns false
|
|
4730
|
-
*
|
|
4731
|
-
* console.log(Chunk.some(empty, (n) => n > 0)) // false
|
|
4437
|
+
* Chunk.some(Chunk.empty<number>(), (n) => n > 0) // => false
|
|
4732
4438
|
*
|
|
4733
4439
|
* // Check for specific value
|
|
4734
4440
|
* const words = Chunk.make("apple", "banana", "cherry")
|
|
4735
|
-
*
|
|
4441
|
+
* Chunk.some(words, (word) => word.includes("ban")) // => true
|
|
4736
4442
|
* ```
|
|
4737
4443
|
*
|
|
4738
|
-
* @category
|
|
4444
|
+
* @category guards
|
|
4739
4445
|
* @since 2.0.0
|
|
4740
4446
|
*/
|
|
4741
4447
|
<A>(predicate: Predicate<NoInfer<A>>): (self: Chunk<A>) => self is NonEmptyChunk<A>;
|
|
@@ -4744,23 +4450,22 @@ export declare const some: {
|
|
|
4744
4450
|
*
|
|
4745
4451
|
* **Example** (Checking for some matching element)
|
|
4746
4452
|
*
|
|
4747
|
-
* ```ts
|
|
4453
|
+
* ```ts import.meta.vitest
|
|
4748
4454
|
* import { Chunk } from "effect"
|
|
4749
4455
|
*
|
|
4750
4456
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4751
|
-
*
|
|
4752
|
-
*
|
|
4457
|
+
* Chunk.some(chunk, (n) => n > 4) // => true
|
|
4458
|
+
* Chunk.some(chunk, (n) => n > 10) // => false
|
|
4753
4459
|
*
|
|
4754
4460
|
* // Empty chunk returns false
|
|
4755
|
-
*
|
|
4756
|
-
* console.log(Chunk.some(empty, (n) => n > 0)) // false
|
|
4461
|
+
* Chunk.some(Chunk.empty<number>(), (n) => n > 0) // => false
|
|
4757
4462
|
*
|
|
4758
4463
|
* // Check for specific value
|
|
4759
4464
|
* const words = Chunk.make("apple", "banana", "cherry")
|
|
4760
|
-
*
|
|
4465
|
+
* Chunk.some(words, (word) => word.includes("ban")) // => true
|
|
4761
4466
|
* ```
|
|
4762
4467
|
*
|
|
4763
|
-
* @category
|
|
4468
|
+
* @category guards
|
|
4764
4469
|
* @since 2.0.0
|
|
4765
4470
|
*/
|
|
4766
4471
|
<A>(self: Chunk<A>, predicate: Predicate<A>): self is NonEmptyChunk<A>;
|
|
@@ -4770,24 +4475,20 @@ export declare const some: {
|
|
|
4770
4475
|
*
|
|
4771
4476
|
* **Example** (Joining chunks into a string)
|
|
4772
4477
|
*
|
|
4773
|
-
* ```ts
|
|
4478
|
+
* ```ts import.meta.vitest
|
|
4774
4479
|
* import { Chunk } from "effect"
|
|
4775
4480
|
*
|
|
4776
4481
|
* const chunk = Chunk.make("apple", "banana", "cherry")
|
|
4777
|
-
*
|
|
4778
|
-
* console.log(result) // "apple, banana, cherry"
|
|
4482
|
+
* Chunk.join(chunk, ", ") // => "apple, banana, cherry"
|
|
4779
4483
|
*
|
|
4780
4484
|
* // With different separator
|
|
4781
|
-
*
|
|
4782
|
-
* console.log(withPipe) // "apple | banana | cherry"
|
|
4485
|
+
* Chunk.join(chunk, " | ") // => "apple | banana | cherry"
|
|
4783
4486
|
*
|
|
4784
4487
|
* // Empty chunk
|
|
4785
|
-
*
|
|
4786
|
-
* console.log(Chunk.join(empty, ", ")) // ""
|
|
4488
|
+
* Chunk.join(Chunk.empty<string>(), ", ") // => ""
|
|
4787
4489
|
*
|
|
4788
4490
|
* // Single element
|
|
4789
|
-
*
|
|
4790
|
-
* console.log(Chunk.join(single, ", ")) // "hello"
|
|
4491
|
+
* Chunk.join(Chunk.make("hello"), ", ") // => "hello"
|
|
4791
4492
|
* ```
|
|
4792
4493
|
*
|
|
4793
4494
|
* @category folding
|
|
@@ -4799,24 +4500,20 @@ export declare const join: {
|
|
|
4799
4500
|
*
|
|
4800
4501
|
* **Example** (Joining chunks into a string)
|
|
4801
4502
|
*
|
|
4802
|
-
* ```ts
|
|
4503
|
+
* ```ts import.meta.vitest
|
|
4803
4504
|
* import { Chunk } from "effect"
|
|
4804
4505
|
*
|
|
4805
4506
|
* const chunk = Chunk.make("apple", "banana", "cherry")
|
|
4806
|
-
*
|
|
4807
|
-
* console.log(result) // "apple, banana, cherry"
|
|
4507
|
+
* Chunk.join(chunk, ", ") // => "apple, banana, cherry"
|
|
4808
4508
|
*
|
|
4809
4509
|
* // With different separator
|
|
4810
|
-
*
|
|
4811
|
-
* console.log(withPipe) // "apple | banana | cherry"
|
|
4510
|
+
* Chunk.join(chunk, " | ") // => "apple | banana | cherry"
|
|
4812
4511
|
*
|
|
4813
4512
|
* // Empty chunk
|
|
4814
|
-
*
|
|
4815
|
-
* console.log(Chunk.join(empty, ", ")) // ""
|
|
4513
|
+
* Chunk.join(Chunk.empty<string>(), ", ") // => ""
|
|
4816
4514
|
*
|
|
4817
4515
|
* // Single element
|
|
4818
|
-
*
|
|
4819
|
-
* console.log(Chunk.join(single, ", ")) // "hello"
|
|
4516
|
+
* Chunk.join(Chunk.make("hello"), ", ") // => "hello"
|
|
4820
4517
|
* ```
|
|
4821
4518
|
*
|
|
4822
4519
|
* @category folding
|
|
@@ -4828,24 +4525,20 @@ export declare const join: {
|
|
|
4828
4525
|
*
|
|
4829
4526
|
* **Example** (Joining chunks into a string)
|
|
4830
4527
|
*
|
|
4831
|
-
* ```ts
|
|
4528
|
+
* ```ts import.meta.vitest
|
|
4832
4529
|
* import { Chunk } from "effect"
|
|
4833
4530
|
*
|
|
4834
4531
|
* const chunk = Chunk.make("apple", "banana", "cherry")
|
|
4835
|
-
*
|
|
4836
|
-
* console.log(result) // "apple, banana, cherry"
|
|
4532
|
+
* Chunk.join(chunk, ", ") // => "apple, banana, cherry"
|
|
4837
4533
|
*
|
|
4838
4534
|
* // With different separator
|
|
4839
|
-
*
|
|
4840
|
-
* console.log(withPipe) // "apple | banana | cherry"
|
|
4535
|
+
* Chunk.join(chunk, " | ") // => "apple | banana | cherry"
|
|
4841
4536
|
*
|
|
4842
4537
|
* // Empty chunk
|
|
4843
|
-
*
|
|
4844
|
-
* console.log(Chunk.join(empty, ", ")) // ""
|
|
4538
|
+
* Chunk.join(Chunk.empty<string>(), ", ") // => ""
|
|
4845
4539
|
*
|
|
4846
4540
|
* // Single element
|
|
4847
|
-
*
|
|
4848
|
-
* console.log(Chunk.join(single, ", ")) // "hello"
|
|
4541
|
+
* Chunk.join(Chunk.make("hello"), ", ") // => "hello"
|
|
4849
4542
|
* ```
|
|
4850
4543
|
*
|
|
4851
4544
|
* @category folding
|
|
@@ -4858,21 +4551,18 @@ export declare const join: {
|
|
|
4858
4551
|
*
|
|
4859
4552
|
* **Example** (Reducing from the left)
|
|
4860
4553
|
*
|
|
4861
|
-
* ```ts
|
|
4554
|
+
* ```ts import.meta.vitest
|
|
4862
4555
|
* import { Chunk } from "effect"
|
|
4863
4556
|
*
|
|
4864
4557
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4865
|
-
*
|
|
4866
|
-
* console.log(sum) // 15
|
|
4558
|
+
* Chunk.reduce(chunk, 0, (acc, n) => acc + n) // => 15
|
|
4867
4559
|
*
|
|
4868
4560
|
* // String concatenation with index
|
|
4869
4561
|
* const words = Chunk.make("a", "b", "c")
|
|
4870
|
-
*
|
|
4871
|
-
* console.log(result) // "0:a 1:b 2:c "
|
|
4562
|
+
* Chunk.reduce(words, "", (acc, word, i) => acc + `${i}:${word} `).trimEnd() // => "0:a 1:b 2:c"
|
|
4872
4563
|
*
|
|
4873
4564
|
* // Find maximum
|
|
4874
|
-
*
|
|
4875
|
-
* console.log(max) // 5
|
|
4565
|
+
* Chunk.reduce(chunk, -Infinity, (acc, n) => Math.max(acc, n)) // => 5
|
|
4876
4566
|
* ```
|
|
4877
4567
|
*
|
|
4878
4568
|
* @category folding
|
|
@@ -4884,21 +4574,18 @@ export declare const reduce: {
|
|
|
4884
4574
|
*
|
|
4885
4575
|
* **Example** (Reducing from the left)
|
|
4886
4576
|
*
|
|
4887
|
-
* ```ts
|
|
4577
|
+
* ```ts import.meta.vitest
|
|
4888
4578
|
* import { Chunk } from "effect"
|
|
4889
4579
|
*
|
|
4890
4580
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4891
|
-
*
|
|
4892
|
-
* console.log(sum) // 15
|
|
4581
|
+
* Chunk.reduce(chunk, 0, (acc, n) => acc + n) // => 15
|
|
4893
4582
|
*
|
|
4894
4583
|
* // String concatenation with index
|
|
4895
4584
|
* const words = Chunk.make("a", "b", "c")
|
|
4896
|
-
*
|
|
4897
|
-
* console.log(result) // "0:a 1:b 2:c "
|
|
4585
|
+
* Chunk.reduce(words, "", (acc, word, i) => acc + `${i}:${word} `).trimEnd() // => "0:a 1:b 2:c"
|
|
4898
4586
|
*
|
|
4899
4587
|
* // Find maximum
|
|
4900
|
-
*
|
|
4901
|
-
* console.log(max) // 5
|
|
4588
|
+
* Chunk.reduce(chunk, -Infinity, (acc, n) => Math.max(acc, n)) // => 5
|
|
4902
4589
|
* ```
|
|
4903
4590
|
*
|
|
4904
4591
|
* @category folding
|
|
@@ -4910,21 +4597,18 @@ export declare const reduce: {
|
|
|
4910
4597
|
*
|
|
4911
4598
|
* **Example** (Reducing from the left)
|
|
4912
4599
|
*
|
|
4913
|
-
* ```ts
|
|
4600
|
+
* ```ts import.meta.vitest
|
|
4914
4601
|
* import { Chunk } from "effect"
|
|
4915
4602
|
*
|
|
4916
4603
|
* const chunk = Chunk.make(1, 2, 3, 4, 5)
|
|
4917
|
-
*
|
|
4918
|
-
* console.log(sum) // 15
|
|
4604
|
+
* Chunk.reduce(chunk, 0, (acc, n) => acc + n) // => 15
|
|
4919
4605
|
*
|
|
4920
4606
|
* // String concatenation with index
|
|
4921
4607
|
* const words = Chunk.make("a", "b", "c")
|
|
4922
|
-
*
|
|
4923
|
-
* console.log(result) // "0:a 1:b 2:c "
|
|
4608
|
+
* Chunk.reduce(words, "", (acc, word, i) => acc + `${i}:${word} `).trimEnd() // => "0:a 1:b 2:c"
|
|
4924
4609
|
*
|
|
4925
4610
|
* // Find maximum
|
|
4926
|
-
*
|
|
4927
|
-
* console.log(max) // 5
|
|
4611
|
+
* Chunk.reduce(chunk, -Infinity, (acc, n) => Math.max(acc, n)) // => 5
|
|
4928
4612
|
* ```
|
|
4929
4613
|
*
|
|
4930
4614
|
* @category folding
|
|
@@ -4937,25 +4621,22 @@ export declare const reduce: {
|
|
|
4937
4621
|
*
|
|
4938
4622
|
* **Example** (Reducing from the right)
|
|
4939
4623
|
*
|
|
4940
|
-
* ```ts
|
|
4624
|
+
* ```ts import.meta.vitest
|
|
4941
4625
|
* import { Chunk } from "effect"
|
|
4942
4626
|
*
|
|
4943
4627
|
* const chunk = Chunk.make(1, 2, 3, 4)
|
|
4944
|
-
*
|
|
4945
|
-
* console.log(result) // 10
|
|
4628
|
+
* Chunk.reduceRight(chunk, 0, (acc, n) => acc + n) // => 10
|
|
4946
4629
|
*
|
|
4947
4630
|
* // String building (right to left)
|
|
4948
4631
|
* const words = Chunk.make("a", "b", "c")
|
|
4949
|
-
*
|
|
4632
|
+
* Chunk.reduceRight(
|
|
4950
4633
|
* words,
|
|
4951
4634
|
* "",
|
|
4952
4635
|
* (acc, word, i) => acc + `${i}:${word} `
|
|
4953
|
-
* )
|
|
4954
|
-
* console.log(reversed) // "2:c 1:b 0:a "
|
|
4636
|
+
* ).trim() // => "2:c 1:b 0:a"
|
|
4955
4637
|
*
|
|
4956
4638
|
* // Subtract from right to left
|
|
4957
|
-
*
|
|
4958
|
-
* console.log(subtraction) // -2 (4 - (3 - (2 - (1 - 0))))
|
|
4639
|
+
* Chunk.reduceRight(chunk, 0, (acc, n) => n - acc) // => -2
|
|
4959
4640
|
* ```
|
|
4960
4641
|
*
|
|
4961
4642
|
* @category folding
|
|
@@ -4967,25 +4648,22 @@ export declare const reduceRight: {
|
|
|
4967
4648
|
*
|
|
4968
4649
|
* **Example** (Reducing from the right)
|
|
4969
4650
|
*
|
|
4970
|
-
* ```ts
|
|
4651
|
+
* ```ts import.meta.vitest
|
|
4971
4652
|
* import { Chunk } from "effect"
|
|
4972
4653
|
*
|
|
4973
4654
|
* const chunk = Chunk.make(1, 2, 3, 4)
|
|
4974
|
-
*
|
|
4975
|
-
* console.log(result) // 10
|
|
4655
|
+
* Chunk.reduceRight(chunk, 0, (acc, n) => acc + n) // => 10
|
|
4976
4656
|
*
|
|
4977
4657
|
* // String building (right to left)
|
|
4978
4658
|
* const words = Chunk.make("a", "b", "c")
|
|
4979
|
-
*
|
|
4659
|
+
* Chunk.reduceRight(
|
|
4980
4660
|
* words,
|
|
4981
4661
|
* "",
|
|
4982
4662
|
* (acc, word, i) => acc + `${i}:${word} `
|
|
4983
|
-
* )
|
|
4984
|
-
* console.log(reversed) // "2:c 1:b 0:a "
|
|
4663
|
+
* ).trim() // => "2:c 1:b 0:a"
|
|
4985
4664
|
*
|
|
4986
4665
|
* // Subtract from right to left
|
|
4987
|
-
*
|
|
4988
|
-
* console.log(subtraction) // -2 (4 - (3 - (2 - (1 - 0))))
|
|
4666
|
+
* Chunk.reduceRight(chunk, 0, (acc, n) => n - acc) // => -2
|
|
4989
4667
|
* ```
|
|
4990
4668
|
*
|
|
4991
4669
|
* @category folding
|
|
@@ -4997,25 +4675,22 @@ export declare const reduceRight: {
|
|
|
4997
4675
|
*
|
|
4998
4676
|
* **Example** (Reducing from the right)
|
|
4999
4677
|
*
|
|
5000
|
-
* ```ts
|
|
4678
|
+
* ```ts import.meta.vitest
|
|
5001
4679
|
* import { Chunk } from "effect"
|
|
5002
4680
|
*
|
|
5003
4681
|
* const chunk = Chunk.make(1, 2, 3, 4)
|
|
5004
|
-
*
|
|
5005
|
-
* console.log(result) // 10
|
|
4682
|
+
* Chunk.reduceRight(chunk, 0, (acc, n) => acc + n) // => 10
|
|
5006
4683
|
*
|
|
5007
4684
|
* // String building (right to left)
|
|
5008
4685
|
* const words = Chunk.make("a", "b", "c")
|
|
5009
|
-
*
|
|
4686
|
+
* Chunk.reduceRight(
|
|
5010
4687
|
* words,
|
|
5011
4688
|
* "",
|
|
5012
4689
|
* (acc, word, i) => acc + `${i}:${word} `
|
|
5013
|
-
* )
|
|
5014
|
-
* console.log(reversed) // "2:c 1:b 0:a "
|
|
4690
|
+
* ).trim() // => "2:c 1:b 0:a"
|
|
5015
4691
|
*
|
|
5016
4692
|
* // Subtract from right to left
|
|
5017
|
-
*
|
|
5018
|
-
* console.log(subtraction) // -2 (4 - (3 - (2 - (1 - 0))))
|
|
4693
|
+
* Chunk.reduceRight(chunk, 0, (acc, n) => n - acc) // => -2
|
|
5019
4694
|
* ```
|
|
5020
4695
|
*
|
|
5021
4696
|
* @category folding
|
|
@@ -5029,7 +4704,7 @@ export declare const reduceRight: {
|
|
|
5029
4704
|
*
|
|
5030
4705
|
* **Example** (Computing difference with custom equivalence)
|
|
5031
4706
|
*
|
|
5032
|
-
* ```ts
|
|
4707
|
+
* ```ts import.meta.vitest
|
|
5033
4708
|
* import { Chunk } from "effect"
|
|
5034
4709
|
*
|
|
5035
4710
|
* const chunk1 = Chunk.make({ id: 1, name: "Alice" }, { id: 2, name: "Bob" })
|
|
@@ -5039,8 +4714,7 @@ export declare const reduceRight: {
|
|
|
5039
4714
|
* const byId = Chunk.differenceWith<{ id: number; name: string }>((a, b) =>
|
|
5040
4715
|
* a.id === b.id
|
|
5041
4716
|
* )
|
|
5042
|
-
*
|
|
5043
|
-
* console.log(Chunk.toArray(result)) // [{ id: 2, name: "Bob" }]
|
|
4717
|
+
* Chunk.toArray(byId(chunk1, chunk2)) // => [{ id: 2, name: "Bob" }]
|
|
5044
4718
|
*
|
|
5045
4719
|
* // String comparison case-insensitive
|
|
5046
4720
|
* const words1 = Chunk.make("Apple", "Banana", "Cherry")
|
|
@@ -5048,8 +4722,7 @@ export declare const reduceRight: {
|
|
|
5048
4722
|
* const caseInsensitive = Chunk.differenceWith<string>((a, b) =>
|
|
5049
4723
|
* a.toLowerCase() === b.toLowerCase()
|
|
5050
4724
|
* )
|
|
5051
|
-
*
|
|
5052
|
-
* console.log(Chunk.toArray(wordDiff)) // ["Banana", "Cherry"]
|
|
4725
|
+
* Chunk.toArray(caseInsensitive(words1, words2)) // => ["Banana", "Cherry"]
|
|
5053
4726
|
* ```
|
|
5054
4727
|
*
|
|
5055
4728
|
* @category filtering
|
|
@@ -5065,24 +4738,20 @@ export declare const differenceWith: <A>(isEquivalent: (self: A, that: A) => boo
|
|
|
5065
4738
|
*
|
|
5066
4739
|
* **Example** (Computing chunk difference)
|
|
5067
4740
|
*
|
|
5068
|
-
* ```ts
|
|
4741
|
+
* ```ts import.meta.vitest
|
|
5069
4742
|
* import { Chunk } from "effect"
|
|
5070
4743
|
*
|
|
5071
4744
|
* const chunk1 = Chunk.make(1, 2, 3, 4, 5)
|
|
5072
4745
|
* const chunk2 = Chunk.make(3, 4, 6, 7)
|
|
5073
|
-
*
|
|
5074
|
-
* console.log(Chunk.toArray(result)) // [1, 2, 5]
|
|
4746
|
+
* Chunk.toArray(Chunk.difference(chunk1, chunk2)) // => [1, 2, 5]
|
|
5075
4747
|
*
|
|
5076
4748
|
* // String difference
|
|
5077
4749
|
* const words1 = Chunk.make("apple", "banana", "cherry")
|
|
5078
4750
|
* const words2 = Chunk.make("banana", "grape")
|
|
5079
|
-
*
|
|
5080
|
-
* console.log(Chunk.toArray(wordDiff)) // ["apple", "cherry"]
|
|
4751
|
+
* Chunk.toArray(Chunk.difference(words1, words2)) // => ["apple", "cherry"]
|
|
5081
4752
|
*
|
|
5082
4753
|
* // Empty second chunk returns original
|
|
5083
|
-
*
|
|
5084
|
-
* const unchanged = Chunk.difference(chunk1, empty)
|
|
5085
|
-
* console.log(Chunk.toArray(unchanged)) // [1, 2, 3, 4, 5]
|
|
4754
|
+
* Chunk.toArray(Chunk.difference(chunk1, Chunk.empty<number>())) // => [1, 2, 3, 4, 5]
|
|
5086
4755
|
* ```
|
|
5087
4756
|
*
|
|
5088
4757
|
* @category filtering
|
|
@@ -5095,24 +4764,20 @@ export declare const difference: {
|
|
|
5095
4764
|
*
|
|
5096
4765
|
* **Example** (Computing chunk difference)
|
|
5097
4766
|
*
|
|
5098
|
-
* ```ts
|
|
4767
|
+
* ```ts import.meta.vitest
|
|
5099
4768
|
* import { Chunk } from "effect"
|
|
5100
4769
|
*
|
|
5101
4770
|
* const chunk1 = Chunk.make(1, 2, 3, 4, 5)
|
|
5102
4771
|
* const chunk2 = Chunk.make(3, 4, 6, 7)
|
|
5103
|
-
*
|
|
5104
|
-
* console.log(Chunk.toArray(result)) // [1, 2, 5]
|
|
4772
|
+
* Chunk.toArray(Chunk.difference(chunk1, chunk2)) // => [1, 2, 5]
|
|
5105
4773
|
*
|
|
5106
4774
|
* // String difference
|
|
5107
4775
|
* const words1 = Chunk.make("apple", "banana", "cherry")
|
|
5108
4776
|
* const words2 = Chunk.make("banana", "grape")
|
|
5109
|
-
*
|
|
5110
|
-
* console.log(Chunk.toArray(wordDiff)) // ["apple", "cherry"]
|
|
4777
|
+
* Chunk.toArray(Chunk.difference(words1, words2)) // => ["apple", "cherry"]
|
|
5111
4778
|
*
|
|
5112
4779
|
* // Empty second chunk returns original
|
|
5113
|
-
*
|
|
5114
|
-
* const unchanged = Chunk.difference(chunk1, empty)
|
|
5115
|
-
* console.log(Chunk.toArray(unchanged)) // [1, 2, 3, 4, 5]
|
|
4780
|
+
* Chunk.toArray(Chunk.difference(chunk1, Chunk.empty<number>())) // => [1, 2, 3, 4, 5]
|
|
5116
4781
|
* ```
|
|
5117
4782
|
*
|
|
5118
4783
|
* @category filtering
|
|
@@ -5125,24 +4790,20 @@ export declare const difference: {
|
|
|
5125
4790
|
*
|
|
5126
4791
|
* **Example** (Computing chunk difference)
|
|
5127
4792
|
*
|
|
5128
|
-
* ```ts
|
|
4793
|
+
* ```ts import.meta.vitest
|
|
5129
4794
|
* import { Chunk } from "effect"
|
|
5130
4795
|
*
|
|
5131
4796
|
* const chunk1 = Chunk.make(1, 2, 3, 4, 5)
|
|
5132
4797
|
* const chunk2 = Chunk.make(3, 4, 6, 7)
|
|
5133
|
-
*
|
|
5134
|
-
* console.log(Chunk.toArray(result)) // [1, 2, 5]
|
|
4798
|
+
* Chunk.toArray(Chunk.difference(chunk1, chunk2)) // => [1, 2, 5]
|
|
5135
4799
|
*
|
|
5136
4800
|
* // String difference
|
|
5137
4801
|
* const words1 = Chunk.make("apple", "banana", "cherry")
|
|
5138
4802
|
* const words2 = Chunk.make("banana", "grape")
|
|
5139
|
-
*
|
|
5140
|
-
* console.log(Chunk.toArray(wordDiff)) // ["apple", "cherry"]
|
|
4803
|
+
* Chunk.toArray(Chunk.difference(words1, words2)) // => ["apple", "cherry"]
|
|
5141
4804
|
*
|
|
5142
4805
|
* // Empty second chunk returns original
|
|
5143
|
-
*
|
|
5144
|
-
* const unchanged = Chunk.difference(chunk1, empty)
|
|
5145
|
-
* console.log(Chunk.toArray(unchanged)) // [1, 2, 3, 4, 5]
|
|
4806
|
+
* Chunk.toArray(Chunk.difference(chunk1, Chunk.empty<number>())) // => [1, 2, 3, 4, 5]
|
|
5146
4807
|
* ```
|
|
5147
4808
|
*
|
|
5148
4809
|
* @category filtering
|