effect 4.0.0-beta.70 → 4.0.0-beta.71
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 +1428 -138
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +595 -126
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +594 -8
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +307 -8
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +457 -3
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +279 -3
- package/dist/BigInt.js.map +1 -1
- package/dist/Boolean.d.ts +229 -7
- package/dist/Boolean.d.ts.map +1 -1
- package/dist/Boolean.js +155 -5
- package/dist/Boolean.js.map +1 -1
- package/dist/Brand.d.ts +51 -5
- package/dist/Brand.d.ts.map +1 -1
- package/dist/Brand.js +80 -8
- package/dist/Brand.js.map +1 -1
- package/dist/Cache.d.ts +64 -3
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +50 -12
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +475 -183
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +336 -114
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +398 -59
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +166 -47
- package/dist/Channel.js.map +1 -1
- package/dist/ChannelSchema.d.ts +78 -3
- package/dist/ChannelSchema.d.ts.map +1 -1
- package/dist/ChannelSchema.js +44 -3
- package/dist/ChannelSchema.js.map +1 -1
- package/dist/Chunk.d.ts +112 -0
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +32 -0
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +57 -0
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js +30 -0
- package/dist/Clock.js.map +1 -1
- package/dist/Combiner.d.ts +15 -11
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +8 -8
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +126 -40
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +102 -29
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +48 -25
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +17 -17
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +22 -1
- package/dist/Console.d.ts.map +1 -1
- package/dist/Console.js +22 -1
- package/dist/Console.js.map +1 -1
- package/dist/Context.d.ts +491 -36
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +185 -11
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +110 -1
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +86 -1
- package/dist/Cron.js.map +1 -1
- package/dist/Crypto.d.ts +29 -0
- package/dist/Crypto.d.ts.map +1 -1
- package/dist/Crypto.js +29 -0
- package/dist/Crypto.js.map +1 -1
- package/dist/Data.d.ts +77 -26
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +10 -7
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +149 -6
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +81 -2
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +340 -74
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +128 -9
- package/dist/Deferred.js.map +1 -1
- package/dist/Differ.d.ts +5 -0
- package/dist/Differ.d.ts.map +1 -1
- package/dist/Duration.d.ts +164 -11
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +91 -11
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +1822 -537
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +684 -224
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.d.ts +14 -0
- package/dist/Effectable.d.ts.map +1 -1
- package/dist/Effectable.js +14 -0
- package/dist/Effectable.js.map +1 -1
- package/dist/Encoding.d.ts +89 -0
- package/dist/Encoding.d.ts.map +1 -1
- package/dist/Encoding.js +131 -1
- package/dist/Encoding.js.map +1 -1
- package/dist/Equal.d.ts +7 -7
- package/dist/Equal.js +5 -5
- package/dist/Equivalence.d.ts +41 -24
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +38 -21
- package/dist/Equivalence.js.map +1 -1
- package/dist/ErrorReporter.d.ts +123 -5
- package/dist/ErrorReporter.d.ts.map +1 -1
- package/dist/ErrorReporter.js +85 -5
- package/dist/ErrorReporter.js.map +1 -1
- package/dist/ExecutionPlan.d.ts +89 -24
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +21 -0
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Exit.d.ts +128 -82
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js +106 -69
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +317 -68
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js +150 -1
- package/dist/Fiber.js.map +1 -1
- package/dist/FileSystem.d.ts +69 -10
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +85 -29
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts +221 -2
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +155 -2
- package/dist/Filter.js.map +1 -1
- package/dist/Formatter.d.ts +3 -3
- package/dist/Formatter.js +2 -2
- package/dist/Function.d.ts +152 -6
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +104 -3
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +275 -3
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +63 -0
- package/dist/Graph.js.map +1 -1
- package/dist/HKT.d.ts +55 -23
- package/dist/HKT.d.ts.map +1 -1
- package/dist/Hash.d.ts +92 -16
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +116 -14
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +2 -2
- package/dist/HashMap.js +2 -2
- package/dist/HashRing.d.ts +203 -0
- package/dist/HashRing.d.ts.map +1 -1
- package/dist/HashRing.js +92 -0
- package/dist/HashRing.js.map +1 -1
- package/dist/Inspectable.d.ts +43 -0
- package/dist/Inspectable.d.ts.map +1 -1
- package/dist/Inspectable.js +70 -13
- package/dist/Inspectable.js.map +1 -1
- package/dist/Iterable.d.ts +179 -25
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +95 -23
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonPatch.d.ts +33 -18
- package/dist/JsonPatch.d.ts.map +1 -1
- package/dist/JsonPatch.js +51 -43
- package/dist/JsonPatch.js.map +1 -1
- package/dist/JsonPointer.d.ts +2 -2
- package/dist/JsonPointer.js +2 -2
- package/dist/JsonSchema.d.ts +64 -10
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +32 -8
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Latch.d.ts +156 -11
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +77 -2
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +250 -74
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +71 -21
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +8 -0
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js.map +1 -1
- package/dist/LogLevel.d.ts +93 -18
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/LogLevel.js +65 -6
- package/dist/LogLevel.js.map +1 -1
- package/dist/Logger.d.ts +19 -5
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +24 -11
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +81 -9
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +32 -1
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Match.d.ts +185 -7
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +212 -24
- package/dist/Match.js.map +1 -1
- package/dist/Metric.d.ts +33 -20
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +26 -13
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +272 -21
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +123 -0
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableHashSet.d.ts +107 -0
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableHashSet.js +96 -37
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/MutableList.d.ts +10 -2
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +10 -2
- package/dist/MutableList.js.map +1 -1
- package/dist/MutableRef.d.ts +136 -0
- package/dist/MutableRef.d.ts.map +1 -1
- package/dist/MutableRef.js +70 -0
- package/dist/MutableRef.js.map +1 -1
- package/dist/Newtype.d.ts +20 -11
- package/dist/Newtype.d.ts.map +1 -1
- package/dist/Newtype.js +6 -6
- package/dist/Newtype.js.map +1 -1
- package/dist/NonEmptyIterable.d.ts +20 -4
- package/dist/NonEmptyIterable.d.ts.map +1 -1
- package/dist/NonEmptyIterable.js +5 -0
- package/dist/NonEmptyIterable.js.map +1 -1
- package/dist/Number.d.ts +417 -2
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +255 -2
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts +17 -17
- package/dist/Optic.js +12 -12
- package/dist/Option.d.ts +168 -129
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +67 -63
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +82 -82
- package/dist/Order.d.ts.map +1 -1
- package/dist/Order.js +138 -109
- package/dist/Order.js.map +1 -1
- package/dist/Ordering.d.ts +32 -0
- package/dist/Ordering.d.ts.map +1 -1
- package/dist/Ordering.js +19 -0
- package/dist/Ordering.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts +238 -11
- package/dist/PartitionedSemaphore.d.ts.map +1 -1
- package/dist/PartitionedSemaphore.js +107 -5
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Path.d.ts +35 -4
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +21 -4
- package/dist/Path.js.map +1 -1
- package/dist/Pipeable.d.ts +27 -2
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/Pipeable.js +14 -2
- package/dist/Pipeable.js.map +1 -1
- package/dist/PlatformError.d.ts +53 -4
- package/dist/PlatformError.d.ts.map +1 -1
- package/dist/PlatformError.js +45 -4
- package/dist/PlatformError.js.map +1 -1
- package/dist/Pool.d.ts +140 -14
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +63 -8
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts +96 -87
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/Predicate.js +107 -73
- package/dist/Predicate.js.map +1 -1
- package/dist/PrimaryKey.d.ts +74 -8
- package/dist/PrimaryKey.d.ts.map +1 -1
- package/dist/PrimaryKey.js +69 -8
- package/dist/PrimaryKey.js.map +1 -1
- package/dist/PubSub.d.ts +94 -20
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +94 -20
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts +147 -2
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Pull.js +68 -1
- package/dist/Pull.js.map +1 -1
- package/dist/Queue.d.ts +127 -35
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +127 -35
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +71 -16
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +35 -0
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +168 -6
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +48 -2
- package/dist/RcMap.js.map +1 -1
- package/dist/RcRef.d.ts +73 -18
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/RcRef.js +23 -3
- package/dist/RcRef.js.map +1 -1
- package/dist/Record.d.ts +95 -1
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +95 -1
- package/dist/Record.js.map +1 -1
- package/dist/Redactable.d.ts +20 -16
- package/dist/Redactable.d.ts.map +1 -1
- package/dist/Redactable.js +15 -11
- package/dist/Redactable.js.map +1 -1
- package/dist/Redacted.d.ts +82 -4
- package/dist/Redacted.d.ts.map +1 -1
- package/dist/Redacted.js +64 -4
- package/dist/Redacted.js.map +1 -1
- package/dist/Reducer.d.ts +17 -5
- package/dist/Reducer.d.ts.map +1 -1
- package/dist/Reducer.js +2 -2
- package/dist/Reducer.js.map +1 -1
- package/dist/Ref.d.ts +156 -20
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +125 -20
- package/dist/Ref.js.map +1 -1
- package/dist/References.d.ts +208 -12
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +144 -5
- package/dist/References.js.map +1 -1
- package/dist/RegExp.d.ts +13 -0
- package/dist/RegExp.d.ts.map +1 -1
- package/dist/RegExp.js +47 -1
- package/dist/RegExp.js.map +1 -1
- package/dist/Request.d.ts +215 -32
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +54 -7
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +202 -15
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +94 -5
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Resource.d.ts +62 -3
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +52 -3
- package/dist/Resource.js.map +1 -1
- package/dist/Result.d.ts +328 -23
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +132 -12
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +123 -13
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +149 -24
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +418 -93
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +334 -97
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +50 -1
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +39 -0
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +467 -42
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +248 -48
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +205 -2
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +205 -2
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +123 -123
- package/dist/SchemaGetter.js +111 -111
- package/dist/SchemaIssue.d.ts +25 -24
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +19 -19
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +238 -3
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +279 -21
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +61 -17
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +58 -14
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +76 -38
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +73 -35
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/SchemaUtils.d.ts +9 -0
- package/dist/SchemaUtils.d.ts.map +1 -1
- package/dist/SchemaUtils.js +38 -11
- package/dist/SchemaUtils.js.map +1 -1
- package/dist/Scope.d.ts +79 -14
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +63 -14
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.d.ts +352 -7
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +151 -3
- package/dist/ScopedCache.js.map +1 -1
- package/dist/ScopedRef.d.ts +67 -5
- package/dist/ScopedRef.d.ts.map +1 -1
- package/dist/ScopedRef.js +47 -3
- package/dist/ScopedRef.js.map +1 -1
- package/dist/Semaphore.d.ts +347 -28
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +102 -7
- package/dist/Semaphore.js.map +1 -1
- package/dist/Sink.d.ts +307 -4
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +173 -2
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +69 -15
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stdio.js +60 -15
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +516 -65
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +234 -33
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +173 -2
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +149 -2
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +19 -10
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +13 -4
- package/dist/Struct.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +73 -14
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +72 -13
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/Symbol.d.ts +24 -6
- package/dist/Symbol.d.ts.map +1 -1
- package/dist/Symbol.js +24 -6
- package/dist/Symbol.js.map +1 -1
- package/dist/SynchronizedRef.d.ts +502 -2
- package/dist/SynchronizedRef.d.ts.map +1 -1
- package/dist/SynchronizedRef.js +184 -2
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Take.d.ts +36 -13
- package/dist/Take.d.ts.map +1 -1
- package/dist/Take.js +5 -0
- package/dist/Take.js.map +1 -1
- package/dist/Terminal.d.ts +68 -17
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Terminal.js +33 -2
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +49 -0
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +49 -0
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +48 -9
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js.map +1 -1
- package/dist/Tuple.d.ts +70 -35
- package/dist/Tuple.d.ts.map +1 -1
- package/dist/Tuple.js +32 -21
- package/dist/Tuple.js.map +1 -1
- package/dist/TxChunk.d.ts +40 -7
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +40 -7
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +85 -2
- package/dist/TxDeferred.d.ts.map +1 -1
- package/dist/TxDeferred.js +56 -2
- package/dist/TxDeferred.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +29 -2
- package/dist/TxPriorityQueue.d.ts.map +1 -1
- package/dist/TxPriorityQueue.js +29 -2
- package/dist/TxPriorityQueue.js.map +1 -1
- package/dist/TxPubSub.d.ts +94 -4
- package/dist/TxPubSub.d.ts.map +1 -1
- package/dist/TxPubSub.js +66 -4
- package/dist/TxPubSub.js.map +1 -1
- package/dist/TxQueue.d.ts +48 -7
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +40 -4
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +40 -4
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/TxRef.d.ts +112 -7
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +81 -7
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +173 -14
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +130 -14
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +205 -2
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.js +110 -2
- package/dist/TxSubscriptionRef.js.map +1 -1
- package/dist/Types.d.ts +60 -6
- package/dist/Types.d.ts.map +1 -1
- package/dist/UndefinedOr.d.ts +171 -30
- package/dist/UndefinedOr.d.ts.map +1 -1
- package/dist/UndefinedOr.js +115 -30
- package/dist/UndefinedOr.js.map +1 -1
- package/dist/Unify.d.ts +120 -12
- package/dist/Unify.d.ts.map +1 -1
- package/dist/Unify.js +36 -12
- package/dist/Unify.js.map +1 -1
- package/dist/Utils.d.ts +20 -14
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +13 -4
- package/dist/Utils.js.map +1 -1
- package/dist/index.d.ts +0 -5205
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -5205
- package/dist/index.js.map +1 -1
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/request.js +3 -1
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/schema/arbitrary.js +11 -1
- package/dist/internal/schema/arbitrary.js.map +1 -1
- package/dist/internal/schema/representation.js +21 -12
- package/dist/internal/schema/representation.js.map +1 -1
- package/dist/testing/TestConsole.d.ts +69 -0
- package/dist/testing/TestConsole.d.ts.map +1 -1
- package/dist/testing/TestConsole.js +73 -9
- package/dist/testing/TestConsole.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +81 -24
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +71 -25
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/testing/index.d.ts +0 -107
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +0 -107
- package/dist/testing/index.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +24 -1
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +24 -1
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +9 -0
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +43 -11
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +25 -1
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +53 -28
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.d.ts +100 -5
- package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.js +100 -5
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
- package/dist/unstable/ai/IdGenerator.d.ts +1 -1
- package/dist/unstable/ai/IdGenerator.js +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +41 -2
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +40 -1
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +10 -2
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +10 -2
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +59 -1
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +59 -1
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +35 -13
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +34 -12
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +48 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +23 -2
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +22 -1
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +71 -13
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +35 -1
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.d.ts +34 -12
- package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.js +33 -11
- package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
- package/dist/unstable/ai/Telemetry.d.ts +40 -27
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +34 -26
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts +34 -23
- package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
- package/dist/unstable/ai/Tokenizer.js +34 -23
- package/dist/unstable/ai/Tokenizer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +82 -21
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +81 -20
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +1 -1
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +1 -1
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/index.d.ts +0 -560
- package/dist/unstable/ai/index.d.ts.map +1 -1
- package/dist/unstable/ai/index.js +0 -560
- package/dist/unstable/ai/index.js.map +1 -1
- package/dist/unstable/cli/Argument.js +1 -1
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +133 -5
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +49 -3
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.d.ts +13 -0
- package/dist/unstable/cli/Completions.d.ts.map +1 -1
- package/dist/unstable/cli/Completions.js +41 -1
- package/dist/unstable/cli/Completions.js.map +1 -1
- package/dist/unstable/cli/Flag.d.ts +15 -3
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +15 -3
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +28 -4
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
- package/dist/unstable/cli/GlobalFlag.js +28 -4
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/Param.d.ts +126 -0
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +57 -5
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +2 -2
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +58 -9
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.d.ts +26 -1
- package/dist/unstable/cli/Prompt.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.js +25 -0
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/index.d.ts +0 -220
- package/dist/unstable/cli/index.d.ts.map +1 -1
- package/dist/unstable/cli/index.js +0 -220
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.d.ts +1 -1
- package/dist/unstable/cluster/ClusterError.d.ts +61 -22
- package/dist/unstable/cluster/ClusterError.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterError.js +61 -22
- package/dist/unstable/cluster/ClusterError.js.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.d.ts +53 -0
- package/dist/unstable/cluster/ClusterMetrics.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.js +53 -0
- package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts +76 -24
- package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.js +76 -24
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +18 -1
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +17 -0
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityAddress.d.ts +19 -0
- package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityAddress.js +19 -0
- package/dist/unstable/cluster/EntityAddress.js.map +1 -1
- package/dist/unstable/cluster/EntityId.d.ts +44 -7
- package/dist/unstable/cluster/EntityId.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityId.js +44 -7
- package/dist/unstable/cluster/EntityId.js.map +1 -1
- package/dist/unstable/cluster/EntityType.d.ts +19 -0
- package/dist/unstable/cluster/EntityType.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityType.js +19 -0
- package/dist/unstable/cluster/EntityType.js.map +1 -1
- package/dist/unstable/cluster/HttpRunner.d.ts +26 -14
- package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/HttpRunner.js +26 -14
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.d.ts +33 -14
- package/dist/unstable/cluster/K8sHttpClient.d.ts.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/MachineId.d.ts +35 -9
- package/dist/unstable/cluster/MachineId.d.ts.map +1 -1
- package/dist/unstable/cluster/MachineId.js +35 -9
- package/dist/unstable/cluster/MachineId.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +1 -1
- package/dist/unstable/cluster/Message.js +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +31 -17
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +31 -17
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Runner.d.ts +46 -13
- package/dist/unstable/cluster/Runner.d.ts.map +1 -1
- package/dist/unstable/cluster/Runner.js +46 -13
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.d.ts +45 -9
- package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.js +45 -9
- package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts +30 -13
- package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.js +30 -13
- package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts +15 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +15 -1
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +24 -0
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +24 -0
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/ShardId.d.ts +22 -0
- package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardId.js +22 -0
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts +19 -0
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +55 -17
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +57 -13
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +58 -14
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts +26 -12
- package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingRegistrationEvent.js +27 -13
- package/dist/unstable/cluster/ShardingRegistrationEvent.js.map +1 -1
- package/dist/unstable/cluster/SingleRunner.d.ts +25 -0
- package/dist/unstable/cluster/SingleRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/SingleRunner.js +25 -0
- package/dist/unstable/cluster/SingleRunner.js.map +1 -1
- package/dist/unstable/cluster/Singleton.d.ts +51 -9
- package/dist/unstable/cluster/Singleton.d.ts.map +1 -1
- package/dist/unstable/cluster/Singleton.js +51 -9
- package/dist/unstable/cluster/Singleton.js.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts +27 -13
- package/dist/unstable/cluster/SingletonAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.js +27 -13
- package/dist/unstable/cluster/SingletonAddress.js.map +1 -1
- package/dist/unstable/cluster/Snowflake.d.ts +13 -0
- package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
- package/dist/unstable/cluster/Snowflake.js +13 -0
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/SocketRunner.d.ts +21 -0
- package/dist/unstable/cluster/SocketRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/SocketRunner.js +21 -0
- package/dist/unstable/cluster/SocketRunner.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts +38 -0
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +73 -13
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts +20 -0
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +20 -0
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/TestRunner.d.ts +27 -16
- package/dist/unstable/cluster/TestRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/TestRunner.js +27 -16
- package/dist/unstable/cluster/TestRunner.js.map +1 -1
- package/dist/unstable/cluster/index.d.ts +0 -790
- package/dist/unstable/cluster/index.d.ts.map +1 -1
- package/dist/unstable/cluster/index.js +0 -790
- package/dist/unstable/cluster/index.js.map +1 -1
- package/dist/unstable/devtools/DevTools.d.ts +41 -11
- package/dist/unstable/devtools/DevTools.d.ts.map +1 -1
- package/dist/unstable/devtools/DevTools.js +41 -11
- package/dist/unstable/devtools/DevTools.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.d.ts +38 -0
- package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js +68 -11
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js +24 -16
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/devtools/DevToolsServer.d.ts +20 -13
- package/dist/unstable/devtools/DevToolsServer.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsServer.js +20 -13
- package/dist/unstable/devtools/DevToolsServer.js.map +1 -1
- package/dist/unstable/devtools/index.d.ts +0 -58
- package/dist/unstable/devtools/index.d.ts.map +1 -1
- package/dist/unstable/devtools/index.js +0 -58
- 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 +30 -15
- package/dist/unstable/encoding/Msgpack.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +28 -14
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Ndjson.js +28 -14
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +35 -14
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/encoding/index.d.ts +0 -49
- package/dist/unstable/encoding/index.d.ts.map +1 -1
- package/dist/unstable/encoding/index.js +0 -49
- package/dist/unstable/encoding/index.js.map +1 -1
- package/dist/unstable/eventlog/Event.d.ts.map +1 -1
- package/dist/unstable/eventlog/Event.js +28 -13
- package/dist/unstable/eventlog/Event.js.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts +22 -14
- package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventGroup.js +21 -13
- package/dist/unstable/eventlog/EventGroup.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js +31 -14
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +52 -15
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +52 -15
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +21 -12
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +17 -0
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.js +17 -0
- package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +45 -0
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +82 -15
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js +33 -15
- package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.d.ts +21 -0
- package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js +50 -14
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts +39 -15
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js +39 -15
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +30 -11
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/index.d.ts +0 -240
- package/dist/unstable/eventlog/index.d.ts.map +1 -1
- package/dist/unstable/eventlog/index.js +0 -240
- package/dist/unstable/eventlog/index.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +59 -13
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +59 -13
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts +43 -13
- package/dist/unstable/http/Etag.d.ts.map +1 -1
- package/dist/unstable/http/Etag.js +43 -13
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.d.ts +53 -16
- package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/unstable/http/FetchHttpClient.js +53 -16
- package/dist/unstable/http/FetchHttpClient.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +52 -15
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +52 -15
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpBody.js +53 -13
- package/dist/unstable/http/HttpBody.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +37 -21
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +2 -2
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientError.js +27 -11
- package/dist/unstable/http/HttpClientError.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts +38 -17
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +38 -17
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +35 -16
- package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js +33 -14
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts +30 -15
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMethod.js +30 -15
- package/dist/unstable/http/HttpMethod.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +1 -1
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +40 -17
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts +30 -17
- package/dist/unstable/http/HttpServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpServer.js +30 -17
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +32 -19
- package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerError.js +32 -19
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +33 -16
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js +28 -14
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +49 -27
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +43 -21
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +30 -13
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpStaticServer.js +29 -12
- package/dist/unstable/http/HttpStaticServer.js.map +1 -1
- package/dist/unstable/http/HttpTraceContext.d.ts +28 -15
- package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js +28 -15
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +37 -17
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +37 -17
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/Template.d.ts +27 -14
- package/dist/unstable/http/Template.d.ts.map +1 -1
- package/dist/unstable/http/Template.js +25 -12
- package/dist/unstable/http/Template.js.map +1 -1
- package/dist/unstable/http/Url.d.ts +29 -13
- package/dist/unstable/http/Url.d.ts.map +1 -1
- package/dist/unstable/http/Url.js +29 -13
- package/dist/unstable/http/Url.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +33 -18
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +34 -19
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/http/index.d.ts +0 -452
- package/dist/unstable/http/index.d.ts.map +1 -1
- package/dist/unstable/http/index.js +0 -452
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.d.ts +48 -24
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +1 -1
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +37 -23
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +28 -16
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +51 -23
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +36 -16
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +34 -23
- package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +49 -25
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +49 -25
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +4 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js +28 -16
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +39 -36
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +39 -36
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts +54 -24
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.js +54 -24
- package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.js +28 -16
- package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +36 -24
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/httpapi/index.d.ts +0 -311
- package/dist/unstable/httpapi/index.d.ts.map +1 -1
- package/dist/unstable/httpapi/index.js +0 -311
- package/dist/unstable/httpapi/index.js.map +1 -1
- package/dist/unstable/observability/Otlp.d.ts +31 -16
- package/dist/unstable/observability/Otlp.d.ts.map +1 -1
- package/dist/unstable/observability/Otlp.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +30 -14
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpResource.js +33 -15
- package/dist/unstable/observability/OtlpResource.js.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.d.ts +27 -16
- package/dist/unstable/observability/OtlpSerialization.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.js +27 -16
- package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +1 -1
- package/dist/unstable/observability/index.d.ts +0 -183
- package/dist/unstable/observability/index.d.ts.map +1 -1
- package/dist/unstable/observability/index.js +0 -183
- package/dist/unstable/observability/index.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +4 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +4 -1
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.d.ts +29 -16
- package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js +27 -14
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts.map +1 -1
- package/dist/unstable/persistence/Redis.js +33 -15
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/persistence/index.d.ts +0 -147
- package/dist/unstable/persistence/index.d.ts.map +1 -1
- package/dist/unstable/persistence/index.js +0 -147
- package/dist/unstable/persistence/index.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +15 -3
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +15 -3
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/process/index.d.ts +0 -45
- package/dist/unstable/process/index.d.ts.map +1 -1
- package/dist/unstable/process/index.js +0 -45
- package/dist/unstable/process/index.js.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.d.ts +40 -19
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.js +40 -19
- package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +36 -22
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +36 -22
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomRef.d.ts +32 -16
- package/dist/unstable/reactivity/AtomRef.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRef.js +52 -25
- package/dist/unstable/reactivity/AtomRef.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.d.ts +74 -18
- package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +74 -18
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/Hydration.d.ts.map +1 -1
- package/dist/unstable/reactivity/Hydration.js +29 -14
- package/dist/unstable/reactivity/Hydration.js.map +1 -1
- package/dist/unstable/reactivity/Reactivity.d.ts +38 -20
- package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js +38 -20
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/reactivity/index.d.ts +0 -166
- package/dist/unstable/reactivity/index.d.ts.map +1 -1
- package/dist/unstable/reactivity/index.js +0 -166
- package/dist/unstable/reactivity/index.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +29 -18
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.d.ts +29 -15
- package/dist/unstable/rpc/RpcClientError.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClientError.js +29 -15
- package/dist/unstable/rpc/RpcClientError.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts +29 -18
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMessage.d.ts +34 -16
- package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +31 -21
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js +31 -21
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +29 -19
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.js +29 -19
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +33 -23
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +31 -21
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/RpcTest.d.ts +31 -15
- package/dist/unstable/rpc/RpcTest.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcTest.js +31 -15
- package/dist/unstable/rpc/RpcTest.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts +29 -14
- package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcWorker.js.map +1 -1
- package/dist/unstable/rpc/index.d.ts +0 -272
- package/dist/unstable/rpc/index.d.ts.map +1 -1
- package/dist/unstable/rpc/index.js +0 -272
- package/dist/unstable/rpc/index.js.map +1 -1
- package/dist/unstable/schema/index.d.ts +0 -37
- package/dist/unstable/schema/index.d.ts.map +1 -1
- package/dist/unstable/schema/index.js +0 -37
- package/dist/unstable/schema/index.js.map +1 -1
- package/dist/unstable/socket/index.d.ts +0 -44
- package/dist/unstable/socket/index.d.ts.map +1 -1
- package/dist/unstable/socket/index.js +0 -44
- package/dist/unstable/socket/index.js.map +1 -1
- package/dist/unstable/sql/Migrator.d.ts.map +1 -1
- package/dist/unstable/sql/Migrator.js +39 -18
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/SqlError.d.ts.map +1 -1
- package/dist/unstable/sql/SqlError.js +31 -15
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.d.ts +30 -15
- package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
- package/dist/unstable/sql/SqlSchema.js +30 -15
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +1 -1
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +34 -14
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/sql/index.d.ts +0 -178
- package/dist/unstable/sql/index.d.ts.map +1 -1
- package/dist/unstable/sql/index.js +0 -178
- package/dist/unstable/sql/index.js.map +1 -1
- package/dist/unstable/workers/Transferable.d.ts +29 -15
- package/dist/unstable/workers/Transferable.d.ts.map +1 -1
- package/dist/unstable/workers/Transferable.js +29 -15
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts +36 -23
- package/dist/unstable/workers/Worker.d.ts.map +1 -1
- package/dist/unstable/workers/Worker.js +34 -21
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workers/WorkerError.d.ts.map +1 -1
- package/dist/unstable/workers/WorkerError.js +32 -16
- package/dist/unstable/workers/WorkerError.js.map +1 -1
- package/dist/unstable/workers/WorkerRunner.d.ts +31 -20
- package/dist/unstable/workers/WorkerRunner.d.ts.map +1 -1
- package/dist/unstable/workers/WorkerRunner.js +31 -20
- package/dist/unstable/workers/WorkerRunner.js.map +1 -1
- package/dist/unstable/workers/index.d.ts +0 -80
- package/dist/unstable/workers/index.d.ts.map +1 -1
- package/dist/unstable/workers/index.js +0 -80
- package/dist/unstable/workers/index.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableClock.js +23 -11
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableQueue.d.ts +33 -15
- package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableQueue.js +33 -15
- package/dist/unstable/workflow/DurableQueue.js.map +1 -1
- package/dist/unstable/workflow/index.d.ts +0 -160
- package/dist/unstable/workflow/index.d.ts.map +1 -1
- package/dist/unstable/workflow/index.js +0 -160
- package/dist/unstable/workflow/index.js.map +1 -1
- package/package.json +1 -1
- package/src/Array.ts +1504 -211
- package/src/BigDecimal.ts +594 -8
- package/src/BigInt.ts +457 -3
- package/src/Boolean.ts +229 -7
- package/src/Brand.ts +100 -8
- package/src/Cache.ts +87 -15
- package/src/Cause.ts +475 -183
- package/src/Channel.ts +498 -84
- package/src/ChannelSchema.ts +96 -3
- package/src/Chunk.ts +120 -0
- package/src/Clock.ts +57 -0
- package/src/Combiner.ts +15 -11
- package/src/Config.ts +126 -40
- package/src/ConfigProvider.ts +48 -25
- package/src/Console.ts +22 -1
- package/src/Context.ts +503 -37
- package/src/Cron.ts +110 -1
- package/src/Crypto.ts +29 -0
- package/src/Data.ts +77 -26
- package/src/DateTime.ts +149 -6
- package/src/Deferred.ts +340 -74
- package/src/Differ.ts +5 -0
- package/src/Duration.ts +164 -11
- package/src/Effect.ts +1860 -543
- package/src/Effectable.ts +14 -0
- package/src/Encoding.ts +135 -1
- package/src/Equal.ts +7 -7
- package/src/Equivalence.ts +44 -27
- package/src/ErrorReporter.ts +123 -5
- package/src/ExecutionPlan.ts +89 -24
- package/src/Exit.ts +128 -82
- package/src/Fiber.ts +317 -68
- package/src/FileSystem.ts +109 -33
- package/src/Filter.ts +221 -2
- package/src/Formatter.ts +3 -3
- package/src/Function.ts +152 -6
- package/src/Graph.ts +275 -3
- package/src/HKT.ts +55 -23
- package/src/Hash.ts +140 -20
- package/src/HashMap.ts +2 -2
- package/src/HashRing.ts +203 -0
- package/src/Inspectable.ts +82 -13
- package/src/Iterable.ts +179 -25
- package/src/JsonPatch.ts +78 -55
- package/src/JsonPointer.ts +2 -2
- package/src/JsonSchema.ts +64 -10
- package/src/Latch.ts +162 -11
- package/src/Layer.ts +250 -74
- package/src/LayerMap.ts +8 -0
- package/src/LogLevel.ts +93 -18
- package/src/Logger.ts +25 -9
- package/src/ManagedRuntime.ts +81 -9
- package/src/Match.ts +220 -24
- package/src/Metric.ts +33 -20
- package/src/MutableHashMap.ts +360 -21
- package/src/MutableHashSet.ts +141 -37
- package/src/MutableList.ts +10 -2
- package/src/MutableRef.ts +136 -0
- package/src/Newtype.ts +20 -11
- package/src/NonEmptyIterable.ts +20 -4
- package/src/Number.ts +417 -2
- package/src/Optic.ts +17 -17
- package/src/Option.ts +168 -129
- package/src/Order.ts +152 -123
- package/src/Ordering.ts +32 -0
- package/src/PartitionedSemaphore.ts +238 -11
- package/src/Path.ts +35 -4
- package/src/Pipeable.ts +27 -2
- package/src/PlatformError.ts +53 -4
- package/src/Pool.ts +174 -32
- package/src/Predicate.ts +149 -115
- package/src/PrimaryKey.ts +74 -8
- package/src/PubSub.ts +94 -20
- package/src/Pull.ts +147 -2
- package/src/Queue.ts +127 -35
- package/src/Random.ts +71 -16
- package/src/RcMap.ts +168 -6
- package/src/RcRef.ts +73 -18
- package/src/Record.ts +95 -1
- package/src/Redactable.ts +20 -16
- package/src/Redacted.ts +82 -4
- package/src/Reducer.ts +17 -5
- package/src/Ref.ts +300 -22
- package/src/References.ts +208 -12
- package/src/RegExp.ts +47 -1
- package/src/Request.ts +215 -32
- package/src/RequestResolver.ts +257 -22
- package/src/Resource.ts +62 -3
- package/src/Result.ts +328 -23
- package/src/Runtime.ts +171 -31
- package/src/Schedule.ts +484 -111
- package/src/Scheduler.ts +50 -1
- package/src/Schema.ts +508 -67
- package/src/SchemaAST.ts +205 -2
- package/src/SchemaGetter.ts +123 -123
- package/src/SchemaIssue.ts +25 -24
- package/src/SchemaParser.ts +279 -21
- package/src/SchemaRepresentation.ts +61 -17
- package/src/SchemaTransformation.ts +76 -38
- package/src/SchemaUtils.ts +38 -11
- package/src/Scope.ts +79 -14
- package/src/ScopedCache.ts +404 -7
- package/src/ScopedRef.ts +67 -5
- package/src/Semaphore.ts +347 -28
- package/src/Sink.ts +307 -4
- package/src/Stdio.ts +69 -15
- package/src/Stream.ts +611 -72
- package/src/String.ts +173 -2
- package/src/Struct.ts +19 -10
- package/src/SubscriptionRef.ts +73 -14
- package/src/Symbol.ts +24 -6
- package/src/SynchronizedRef.ts +502 -2
- package/src/Take.ts +36 -13
- package/src/Terminal.ts +68 -17
- package/src/Tracer.ts +49 -0
- package/src/Trie.ts +48 -9
- package/src/Tuple.ts +70 -35
- package/src/TxChunk.ts +40 -7
- package/src/TxDeferred.ts +85 -2
- package/src/TxPriorityQueue.ts +29 -2
- package/src/TxPubSub.ts +94 -4
- package/src/TxQueue.ts +48 -7
- package/src/TxReentrantLock.ts +40 -4
- package/src/TxRef.ts +112 -7
- package/src/TxSemaphore.ts +173 -14
- package/src/TxSubscriptionRef.ts +205 -2
- package/src/Types.ts +60 -6
- package/src/UndefinedOr.ts +171 -30
- package/src/Unify.ts +120 -12
- package/src/Utils.ts +20 -14
- package/src/index.ts +0 -5205
- package/src/internal/effect.ts +59 -29
- package/src/internal/request.ts +3 -1
- package/src/internal/schema/arbitrary.ts +14 -1
- package/src/internal/schema/representation.ts +37 -14
- package/src/testing/TestConsole.ts +105 -9
- package/src/testing/TestSchema.ts +83 -25
- package/src/testing/index.ts +0 -107
- package/src/unstable/ai/AiError.ts +24 -1
- package/src/unstable/ai/AnthropicStructuredOutput.ts +43 -11
- package/src/unstable/ai/Chat.ts +62 -28
- package/src/unstable/ai/EmbeddingModel.ts +100 -5
- package/src/unstable/ai/IdGenerator.ts +1 -1
- package/src/unstable/ai/LanguageModel.ts +41 -2
- package/src/unstable/ai/McpSchema.ts +10 -2
- package/src/unstable/ai/McpServer.ts +59 -1
- package/src/unstable/ai/Model.ts +35 -13
- package/src/unstable/ai/OpenAiStructuredOutput.ts +48 -1
- package/src/unstable/ai/Prompt.ts +23 -2
- package/src/unstable/ai/Response.ts +71 -13
- package/src/unstable/ai/ResponseIdTracker.ts +34 -12
- package/src/unstable/ai/Telemetry.ts +40 -27
- package/src/unstable/ai/Tokenizer.ts +34 -23
- package/src/unstable/ai/Tool.ts +82 -21
- package/src/unstable/ai/Toolkit.ts +32 -4
- package/src/unstable/ai/index.ts +0 -560
- package/src/unstable/cli/Argument.ts +1 -1
- package/src/unstable/cli/Command.ts +133 -5
- package/src/unstable/cli/Completions.ts +41 -1
- package/src/unstable/cli/Flag.ts +15 -3
- package/src/unstable/cli/GlobalFlag.ts +28 -4
- package/src/unstable/cli/Param.ts +135 -9
- package/src/unstable/cli/Primitive.ts +58 -9
- package/src/unstable/cli/Prompt.ts +26 -1
- package/src/unstable/cli/index.ts +0 -220
- package/src/unstable/cluster/ClusterCron.ts +1 -1
- package/src/unstable/cluster/ClusterError.ts +61 -22
- package/src/unstable/cluster/ClusterMetrics.ts +53 -0
- package/src/unstable/cluster/ClusterSchema.ts +76 -24
- package/src/unstable/cluster/Entity.ts +18 -1
- package/src/unstable/cluster/EntityAddress.ts +19 -0
- package/src/unstable/cluster/EntityId.ts +44 -7
- package/src/unstable/cluster/EntityType.ts +19 -0
- package/src/unstable/cluster/HttpRunner.ts +26 -14
- package/src/unstable/cluster/K8sHttpClient.ts +32 -13
- package/src/unstable/cluster/MachineId.ts +35 -9
- package/src/unstable/cluster/Message.ts +1 -1
- package/src/unstable/cluster/MessageStorage.ts +31 -17
- package/src/unstable/cluster/Runner.ts +46 -13
- package/src/unstable/cluster/RunnerAddress.ts +45 -9
- package/src/unstable/cluster/RunnerHealth.ts +30 -13
- package/src/unstable/cluster/RunnerServer.ts +15 -1
- package/src/unstable/cluster/Runners.ts +24 -0
- package/src/unstable/cluster/ShardId.ts +22 -0
- package/src/unstable/cluster/Sharding.ts +55 -17
- package/src/unstable/cluster/ShardingConfig.ts +57 -13
- package/src/unstable/cluster/ShardingRegistrationEvent.ts +26 -12
- package/src/unstable/cluster/SingleRunner.ts +25 -0
- package/src/unstable/cluster/Singleton.ts +51 -9
- package/src/unstable/cluster/SingletonAddress.ts +27 -13
- package/src/unstable/cluster/Snowflake.ts +13 -0
- package/src/unstable/cluster/SocketRunner.ts +21 -0
- package/src/unstable/cluster/SqlMessageStorage.ts +73 -13
- package/src/unstable/cluster/SqlRunnerStorage.ts +20 -0
- package/src/unstable/cluster/TestRunner.ts +27 -16
- package/src/unstable/cluster/index.ts +0 -790
- package/src/unstable/devtools/DevTools.ts +41 -11
- package/src/unstable/devtools/DevToolsClient.ts +68 -11
- package/src/unstable/devtools/DevToolsSchema.ts +24 -16
- package/src/unstable/devtools/DevToolsServer.ts +18 -11
- package/src/unstable/devtools/index.ts +0 -58
- package/src/unstable/encoding/Msgpack.ts +30 -15
- package/src/unstable/encoding/Ndjson.ts +28 -14
- package/src/unstable/encoding/Sse.ts +35 -14
- package/src/unstable/encoding/index.ts +0 -49
- package/src/unstable/eventlog/Event.ts +30 -15
- package/src/unstable/eventlog/EventGroup.ts +22 -14
- package/src/unstable/eventlog/EventJournal.ts +31 -14
- package/src/unstable/eventlog/EventLog.ts +52 -15
- package/src/unstable/eventlog/EventLogMessage.ts +21 -12
- package/src/unstable/eventlog/EventLogServer.ts +27 -13
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +17 -0
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +82 -15
- package/src/unstable/eventlog/EventLogSessionAuth.ts +35 -17
- package/src/unstable/eventlog/SqlEventJournal.ts +50 -14
- package/src/unstable/eventlog/SqlEventLogServerEncrypted.ts +39 -15
- package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +30 -11
- package/src/unstable/eventlog/index.ts +0 -240
- package/src/unstable/http/Cookies.ts +59 -13
- package/src/unstable/http/Etag.ts +43 -13
- package/src/unstable/http/FetchHttpClient.ts +53 -16
- package/src/unstable/http/Headers.ts +52 -15
- package/src/unstable/http/HttpBody.ts +53 -13
- package/src/unstable/http/HttpClient.ts +88 -22
- package/src/unstable/http/HttpClientError.ts +26 -10
- package/src/unstable/http/HttpClientRequest.ts +36 -15
- package/src/unstable/http/HttpClientResponse.ts +33 -14
- package/src/unstable/http/HttpEffect.ts +32 -15
- package/src/unstable/http/HttpMethod.ts +30 -15
- package/src/unstable/http/HttpRouter.ts +40 -17
- package/src/unstable/http/HttpServer.ts +30 -17
- package/src/unstable/http/HttpServerError.ts +32 -19
- package/src/unstable/http/HttpServerRequest.ts +31 -14
- package/src/unstable/http/HttpServerRespondable.ts +28 -14
- package/src/unstable/http/HttpServerResponse.ts +51 -29
- package/src/unstable/http/HttpStaticServer.ts +29 -12
- package/src/unstable/http/HttpTraceContext.ts +28 -15
- package/src/unstable/http/Multipart.ts +37 -17
- package/src/unstable/http/Template.ts +25 -12
- package/src/unstable/http/Url.ts +29 -13
- package/src/unstable/http/UrlParams.ts +33 -18
- package/src/unstable/http/index.ts +0 -452
- package/src/unstable/httpapi/HttpApi.ts +46 -22
- package/src/unstable/httpapi/HttpApiBuilder.ts +37 -23
- package/src/unstable/httpapi/HttpApiClient.ts +28 -16
- package/src/unstable/httpapi/HttpApiEndpoint.ts +51 -23
- package/src/unstable/httpapi/HttpApiError.ts +36 -16
- package/src/unstable/httpapi/HttpApiGroup.ts +34 -23
- package/src/unstable/httpapi/HttpApiMiddleware.ts +49 -25
- package/src/unstable/httpapi/HttpApiScalar.ts +32 -17
- package/src/unstable/httpapi/HttpApiSchema.ts +39 -36
- package/src/unstable/httpapi/HttpApiSecurity.ts +54 -24
- package/src/unstable/httpapi/HttpApiSwagger.ts +28 -16
- package/src/unstable/httpapi/OpenApi.ts +38 -26
- package/src/unstable/httpapi/index.ts +0 -311
- package/src/unstable/observability/Otlp.ts +31 -16
- package/src/unstable/observability/OtlpLogger.ts +30 -14
- package/src/unstable/observability/OtlpResource.ts +33 -15
- package/src/unstable/observability/OtlpSerialization.ts +25 -14
- package/src/unstable/observability/PrometheusMetrics.ts +1 -1
- package/src/unstable/observability/index.ts +0 -183
- package/src/unstable/persistence/KeyValueStore.ts +4 -1
- package/src/unstable/persistence/PersistedCache.ts +27 -14
- package/src/unstable/persistence/Redis.ts +33 -15
- package/src/unstable/persistence/index.ts +0 -147
- package/src/unstable/process/ChildProcessSpawner.ts +15 -3
- package/src/unstable/process/index.ts +0 -45
- package/src/unstable/reactivity/AsyncResult.ts +38 -17
- package/src/unstable/reactivity/Atom.ts +36 -22
- package/src/unstable/reactivity/AtomRef.ts +58 -25
- package/src/unstable/reactivity/AtomRegistry.ts +72 -16
- package/src/unstable/reactivity/Hydration.ts +31 -16
- package/src/unstable/reactivity/Reactivity.ts +36 -18
- package/src/unstable/reactivity/index.ts +0 -166
- package/src/unstable/rpc/Rpc.ts +29 -18
- package/src/unstable/rpc/RpcClient.ts +31 -22
- package/src/unstable/rpc/RpcClientError.ts +27 -13
- package/src/unstable/rpc/RpcGroup.ts +28 -17
- package/src/unstable/rpc/RpcMessage.ts +34 -16
- package/src/unstable/rpc/RpcMiddleware.ts +31 -21
- package/src/unstable/rpc/RpcSchema.ts +29 -19
- package/src/unstable/rpc/RpcSerialization.ts +31 -21
- package/src/unstable/rpc/RpcServer.ts +31 -23
- package/src/unstable/rpc/RpcTest.ts +29 -13
- package/src/unstable/rpc/RpcWorker.ts +29 -14
- package/src/unstable/rpc/index.ts +0 -272
- package/src/unstable/schema/index.ts +0 -37
- package/src/unstable/socket/index.ts +0 -44
- package/src/unstable/sql/Migrator.ts +39 -18
- package/src/unstable/sql/SqlError.ts +31 -15
- package/src/unstable/sql/SqlSchema.ts +30 -15
- package/src/unstable/sql/Statement.ts +35 -15
- package/src/unstable/sql/index.ts +0 -178
- package/src/unstable/workers/Transferable.ts +29 -15
- package/src/unstable/workers/Worker.ts +34 -21
- package/src/unstable/workers/WorkerError.ts +34 -18
- package/src/unstable/workers/WorkerRunner.ts +29 -18
- package/src/unstable/workers/index.ts +0 -80
- package/src/unstable/workflow/DurableClock.ts +23 -11
- package/src/unstable/workflow/DurableQueue.ts +31 -13
- package/src/unstable/workflow/index.ts +0 -160
package/src/Array.ts
CHANGED
|
@@ -1,79 +1,82 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* -
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* -
|
|
14
|
-
*
|
|
15
|
-
* `
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* {@link
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* -
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* -
|
|
37
|
-
*
|
|
38
|
-
* -
|
|
39
|
-
*
|
|
40
|
-
* -
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* - {@link
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
2
|
+
* The `Array` module provides functional operations for JavaScript arrays,
|
|
3
|
+
* readonly arrays, and arrays that are known to contain at least one element.
|
|
4
|
+
* Operations that transform, reorder, or update collections allocate new arrays
|
|
5
|
+
* instead of mutating their inputs, while preserving useful type information
|
|
6
|
+
* such as non-emptiness when the operation can prove it.
|
|
7
|
+
*
|
|
8
|
+
* **Mental model**
|
|
9
|
+
*
|
|
10
|
+
* - A regular `Array<A>` is still the built-in JavaScript array type; this
|
|
11
|
+
* module supplies functional constructors, combinators, searches, folds,
|
|
12
|
+
* grouping, sorting, and set-like operations around it.
|
|
13
|
+
* - {@link NonEmptyReadonlyArray} and {@link NonEmptyArray} encode
|
|
14
|
+
* non-emptiness at the type level. APIs with `NonEmpty` in the name can avoid
|
|
15
|
+
* `Option` because an element is guaranteed to exist.
|
|
16
|
+
* - Most functions are dual. You can call them data-first, such as
|
|
17
|
+
* `Array.map(values, f)`, or data-last in a pipeline, such as
|
|
18
|
+
* `pipe(values, Array.map(f))`.
|
|
19
|
+
* - Safe element access returns {@link Option}; unsafe or `NonEmpty` variants
|
|
20
|
+
* are for code that already has a proof an index or element exists.
|
|
21
|
+
* - Set-like operations such as {@link union}, {@link intersection}, and
|
|
22
|
+
* {@link difference} use the {@link Equal} protocol by default. Use the
|
|
23
|
+
* `*With` variants when equality is domain-specific.
|
|
24
|
+
*
|
|
25
|
+
* **Common tasks**
|
|
26
|
+
*
|
|
27
|
+
* - Create arrays with {@link make}, {@link of}, {@link empty},
|
|
28
|
+
* {@link fromIterable}, {@link range}, {@link makeBy}, {@link replicate}, and
|
|
29
|
+
* {@link unfold}.
|
|
30
|
+
* - Access edges or indexes with {@link head}, {@link last}, {@link get},
|
|
31
|
+
* {@link tail}, and {@link init}.
|
|
32
|
+
* - Transform and flatten with {@link map}, {@link flatMap}, and
|
|
33
|
+
* {@link flatten}.
|
|
34
|
+
* - Keep, split, or deduplicate values with {@link filter}, {@link partition},
|
|
35
|
+
* {@link dedupe}, and {@link dedupeAdjacent}.
|
|
36
|
+
* - Combine collections with {@link append}, {@link prepend}, {@link appendAll},
|
|
37
|
+
* {@link prependAll}, {@link zip}, and {@link cartesian}.
|
|
38
|
+
* - Chunk, window, and slice with {@link splitAt}, {@link chunksOf},
|
|
39
|
+
* {@link span}, and {@link window}.
|
|
40
|
+
* - Sort with {@link sort}, {@link sortWith}, and {@link sortBy}.
|
|
41
|
+
* - Fold or aggregate with {@link reduce}, {@link scan}, {@link join}, and
|
|
42
|
+
* {@link countBy}.
|
|
43
|
+
* - Match empty and non-empty cases with {@link match}, {@link matchLeft}, and
|
|
44
|
+
* {@link matchRight}.
|
|
45
|
+
*
|
|
46
|
+
* **Gotchas**
|
|
47
|
+
*
|
|
48
|
+
* - {@link fromIterable} returns the original array reference when the input is
|
|
49
|
+
* already an array. Use {@link copy} when you need a fresh shallow copy.
|
|
50
|
+
* - {@link sort}, {@link reverse}, {@link rotate}, and update operations
|
|
51
|
+
* allocate new arrays; they do not mutate the input.
|
|
52
|
+
* - {@link makeBy}, {@link range}, and {@link replicate} always return
|
|
53
|
+
* non-empty arrays. `range(start, end)` is inclusive and returns `[start]`
|
|
54
|
+
* when `start > end`.
|
|
55
|
+
* - Functions returning {@link Option}, such as {@link head} and
|
|
56
|
+
* {@link findFirst}, return `Option.none()` for empty inputs instead of
|
|
57
|
+
* throwing.
|
|
58
|
+
* - `NonEmpty` return types describe what the function can prove, not what may
|
|
59
|
+
* happen for a particular runtime value after filtering.
|
|
60
|
+
*
|
|
61
|
+
* **Example** (Filtering and transforming)
|
|
62
|
+
*
|
|
63
|
+
* ```ts
|
|
64
|
+
* import { Array, Option, pipe } from "effect"
|
|
65
|
+
*
|
|
66
|
+
* const numbers = [1, 2, 3, 4, 5]
|
|
67
|
+
*
|
|
68
|
+
* const doubledEvens = pipe(
|
|
69
|
+
* numbers,
|
|
70
|
+
* Array.filter((n) => n % 2 === 0),
|
|
71
|
+
* Array.map((n) => n * 2)
|
|
72
|
+
* )
|
|
71
73
|
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
+
* console.log(doubledEvens)
|
|
75
|
+
* // [4, 8]
|
|
74
76
|
*
|
|
75
|
-
* const
|
|
76
|
-
* console.log(
|
|
77
|
+
* const first = Array.head(doubledEvens)
|
|
78
|
+
* console.log(Option.getOrElse(first, () => 0))
|
|
79
|
+
* // 4
|
|
77
80
|
* ```
|
|
78
81
|
*
|
|
79
82
|
* @see {@link make} — create a non-empty array from elements
|
|
@@ -105,7 +108,7 @@ import type { NoInfer, TupleOf } from "./Types.ts"
|
|
|
105
108
|
*
|
|
106
109
|
* **When to use**
|
|
107
110
|
*
|
|
108
|
-
* Use
|
|
111
|
+
* Use when you need the native `Array` constructor while the `Array`
|
|
109
112
|
* namespace is in scope (e.g. `Array.Array.isArray`, `Array.Array.from`).
|
|
110
113
|
*
|
|
111
114
|
* **Example** (Using the Array constructor)
|
|
@@ -137,7 +140,7 @@ export interface ReadonlyArrayTypeLambda extends TypeLambda {
|
|
|
137
140
|
*
|
|
138
141
|
* **When to use**
|
|
139
142
|
*
|
|
140
|
-
* Use this type when you need to ensure non-emptiness at the type level while
|
|
143
|
+
* Use when you use this type when you need to ensure non-emptiness at the type level while
|
|
141
144
|
* preventing mutation. Many Array module functions accept or return this type.
|
|
142
145
|
*
|
|
143
146
|
* **Example** (Typing a non-empty array)
|
|
@@ -160,6 +163,11 @@ export type NonEmptyReadonlyArray<A> = readonly [A, ...Array<A>]
|
|
|
160
163
|
/**
|
|
161
164
|
* A mutable array guaranteed to have at least one element.
|
|
162
165
|
*
|
|
166
|
+
* **When to use**
|
|
167
|
+
*
|
|
168
|
+
* Use when mutation is acceptable and non-emptiness must be tracked at the type
|
|
169
|
+
* level.
|
|
170
|
+
*
|
|
163
171
|
* **Details**
|
|
164
172
|
*
|
|
165
173
|
* This is the mutable counterpart of {@link NonEmptyReadonlyArray}. Most Array
|
|
@@ -188,7 +196,7 @@ export type NonEmptyArray<A> = [A, ...Array<A>]
|
|
|
188
196
|
*
|
|
189
197
|
* **When to use**
|
|
190
198
|
*
|
|
191
|
-
*
|
|
199
|
+
* Use when you have literal values and want a typed non-empty array.
|
|
192
200
|
* - The element type is inferred as the union of all arguments.
|
|
193
201
|
* - Always returns a `NonEmptyArray` since at least one argument is required.
|
|
194
202
|
*
|
|
@@ -216,7 +224,7 @@ export const make = <Elements extends NonEmptyArray<unknown>>(
|
|
|
216
224
|
*
|
|
217
225
|
* **When to use**
|
|
218
226
|
*
|
|
219
|
-
*
|
|
227
|
+
* Use when you need a pre-sized array and will fill it imperatively.
|
|
220
228
|
* - Elements are typed as `A | undefined` since slots are empty.
|
|
221
229
|
* - Prefer {@link makeBy} when you can compute each element from its index.
|
|
222
230
|
*
|
|
@@ -241,7 +249,7 @@ export const allocate = <A = never>(n: number): Array<A | undefined> => new Arra
|
|
|
241
249
|
*
|
|
242
250
|
* **When to use**
|
|
243
251
|
*
|
|
244
|
-
*
|
|
252
|
+
* Use when you need an array whose values depend on the index.
|
|
245
253
|
* - `n` is normalized to an integer >= 1 — always returns at least one element.
|
|
246
254
|
* - Dual: `Array.makeBy(5, f)` or `pipe(5, Array.makeBy(f))`.
|
|
247
255
|
*
|
|
@@ -266,7 +274,7 @@ export const makeBy: {
|
|
|
266
274
|
*
|
|
267
275
|
* **When to use**
|
|
268
276
|
*
|
|
269
|
-
*
|
|
277
|
+
* Use when you need an array whose values depend on the index.
|
|
270
278
|
* - `n` is normalized to an integer >= 1 — always returns at least one element.
|
|
271
279
|
* - Dual: `Array.makeBy(5, f)` or `pipe(5, Array.makeBy(f))`.
|
|
272
280
|
*
|
|
@@ -291,7 +299,7 @@ export const makeBy: {
|
|
|
291
299
|
*
|
|
292
300
|
* **When to use**
|
|
293
301
|
*
|
|
294
|
-
*
|
|
302
|
+
* Use when you need an array whose values depend on the index.
|
|
295
303
|
* - `n` is normalized to an integer >= 1 — always returns at least one element.
|
|
296
304
|
* - Dual: `Array.makeBy(5, f)` or `pipe(5, Array.makeBy(f))`.
|
|
297
305
|
*
|
|
@@ -326,7 +334,7 @@ export const makeBy: {
|
|
|
326
334
|
*
|
|
327
335
|
* **When to use**
|
|
328
336
|
*
|
|
329
|
-
*
|
|
337
|
+
* Use when you need a sequence of consecutive integers.
|
|
330
338
|
* - If `start > end`, returns `[start]`.
|
|
331
339
|
* - Always returns a `NonEmptyArray`.
|
|
332
340
|
*
|
|
@@ -352,7 +360,7 @@ export const range = (start: number, end: number): NonEmptyArray<number> =>
|
|
|
352
360
|
*
|
|
353
361
|
* **When to use**
|
|
354
362
|
*
|
|
355
|
-
*
|
|
363
|
+
* Use when you need multiple copies of the same value.
|
|
356
364
|
* - `n` is normalized to an integer >= 1 — always returns at least one element.
|
|
357
365
|
* - Dual: `Array.replicate("a", 3)` or `pipe("a", Array.replicate(3))`.
|
|
358
366
|
*
|
|
@@ -376,7 +384,7 @@ export const replicate: {
|
|
|
376
384
|
*
|
|
377
385
|
* **When to use**
|
|
378
386
|
*
|
|
379
|
-
*
|
|
387
|
+
* Use when you need multiple copies of the same value.
|
|
380
388
|
* - `n` is normalized to an integer >= 1 — always returns at least one element.
|
|
381
389
|
* - Dual: `Array.replicate("a", 3)` or `pipe("a", Array.replicate(3))`.
|
|
382
390
|
*
|
|
@@ -400,7 +408,7 @@ export const replicate: {
|
|
|
400
408
|
*
|
|
401
409
|
* **When to use**
|
|
402
410
|
*
|
|
403
|
-
*
|
|
411
|
+
* Use when you need multiple copies of the same value.
|
|
404
412
|
* - `n` is normalized to an integer >= 1 — always returns at least one element.
|
|
405
413
|
* - Dual: `Array.replicate("a", 3)` or `pipe("a", Array.replicate(3))`.
|
|
406
414
|
*
|
|
@@ -424,6 +432,10 @@ export const replicate: {
|
|
|
424
432
|
/**
|
|
425
433
|
* Converts an `Iterable` to an `Array`.
|
|
426
434
|
*
|
|
435
|
+
* **When to use**
|
|
436
|
+
*
|
|
437
|
+
* Use to convert any `Iterable` (Set, Generator, etc.) into an array.
|
|
438
|
+
*
|
|
427
439
|
* **Details**
|
|
428
440
|
*
|
|
429
441
|
* - If the input is already an array, returns it **by reference** (no copy).
|
|
@@ -452,6 +464,11 @@ export const fromIterable = <A>(collection: Iterable<A>): Array<A> =>
|
|
|
452
464
|
/**
|
|
453
465
|
* Normalizes a value that is either a single element or an array into an array.
|
|
454
466
|
*
|
|
467
|
+
* **When to use**
|
|
468
|
+
*
|
|
469
|
+
* Use to normalize input that may be a single value or an array into a consistent
|
|
470
|
+
* array.
|
|
471
|
+
*
|
|
455
472
|
* **Details**
|
|
456
473
|
*
|
|
457
474
|
* - If the input is already an array, returns it by reference.
|
|
@@ -478,6 +495,11 @@ export const ensure = <A>(self: ReadonlyArray<A> | A): Array<A> => Array.isArray
|
|
|
478
495
|
/**
|
|
479
496
|
* Converts a record into an array of `[key, value]` tuples.
|
|
480
497
|
*
|
|
498
|
+
* **When to use**
|
|
499
|
+
*
|
|
500
|
+
* Use to convert a record into an array of key-value tuples for iteration or
|
|
501
|
+
* transformation.
|
|
502
|
+
*
|
|
481
503
|
* **Details**
|
|
482
504
|
*
|
|
483
505
|
* - Key order follows `Object.entries` semantics.
|
|
@@ -492,6 +514,9 @@ export const ensure = <A>(self: ReadonlyArray<A> | A): Array<A> => Array.isArray
|
|
|
492
514
|
* console.log(result) // [["a", 1], ["b", 2], ["c", 3]]
|
|
493
515
|
* ```
|
|
494
516
|
*
|
|
517
|
+
* @see {@link Record.toEntries} the equivalent function from the Record module
|
|
518
|
+
* @see {@link Record.fromEntries} to build a record from an array of tuples
|
|
519
|
+
*
|
|
495
520
|
* @category converting
|
|
496
521
|
* @since 2.0.0
|
|
497
522
|
*/
|
|
@@ -500,6 +525,10 @@ export const fromRecord: <K extends string, A>(self: Readonly<Record<K, A>>) =>
|
|
|
500
525
|
/**
|
|
501
526
|
* Converts an `Option` to an array: `Some(a)` becomes `[a]`, `None` becomes `[]`.
|
|
502
527
|
*
|
|
528
|
+
* **When to use**
|
|
529
|
+
*
|
|
530
|
+
* Use to convert a single `Option` into an array for downstream array operations.
|
|
531
|
+
*
|
|
503
532
|
* **Example** (Option to array)
|
|
504
533
|
*
|
|
505
534
|
* ```ts
|
|
@@ -521,7 +550,7 @@ export const fromOption: <A>(self: Option.Option<A>) => Array<A> = Option.toArra
|
|
|
521
550
|
*
|
|
522
551
|
* **When to use**
|
|
523
552
|
*
|
|
524
|
-
*
|
|
553
|
+
* Use when you need to branch on whether an array has elements.
|
|
525
554
|
* - `onNonEmpty` receives a `NonEmptyReadonlyArray`.
|
|
526
555
|
* - Dual: data-first or data-last.
|
|
527
556
|
*
|
|
@@ -550,7 +579,7 @@ export const match: {
|
|
|
550
579
|
*
|
|
551
580
|
* **When to use**
|
|
552
581
|
*
|
|
553
|
-
*
|
|
582
|
+
* Use when you need to branch on whether an array has elements.
|
|
554
583
|
* - `onNonEmpty` receives a `NonEmptyReadonlyArray`.
|
|
555
584
|
* - Dual: data-first or data-last.
|
|
556
585
|
*
|
|
@@ -584,7 +613,7 @@ export const match: {
|
|
|
584
613
|
*
|
|
585
614
|
* **When to use**
|
|
586
615
|
*
|
|
587
|
-
*
|
|
616
|
+
* Use when you need to branch on whether an array has elements.
|
|
588
617
|
* - `onNonEmpty` receives a `NonEmptyReadonlyArray`.
|
|
589
618
|
* - Dual: data-first or data-last.
|
|
590
619
|
*
|
|
@@ -626,10 +655,14 @@ export const match: {
|
|
|
626
655
|
* Pattern-matches on an array from the left, providing the first element and
|
|
627
656
|
* the remaining elements separately.
|
|
628
657
|
*
|
|
658
|
+
* **When to use**
|
|
659
|
+
*
|
|
660
|
+
* Use to pattern-match when you need the first element and remaining elements as
|
|
661
|
+
* separate values.
|
|
662
|
+
*
|
|
629
663
|
* **Details**
|
|
630
664
|
*
|
|
631
|
-
*
|
|
632
|
-
* - Use when you want to process the first element differently from the rest.
|
|
665
|
+
* `onNonEmpty` receives `(head, tail)` where `tail` is the rest of the array.
|
|
633
666
|
*
|
|
634
667
|
* **Example** (Head and tail destructuring)
|
|
635
668
|
*
|
|
@@ -655,10 +688,14 @@ export const matchLeft: {
|
|
|
655
688
|
* Pattern-matches on an array from the left, providing the first element and
|
|
656
689
|
* the remaining elements separately.
|
|
657
690
|
*
|
|
691
|
+
* **When to use**
|
|
692
|
+
*
|
|
693
|
+
* Use to pattern-match when you need the first element and remaining elements as
|
|
694
|
+
* separate values.
|
|
695
|
+
*
|
|
658
696
|
* **Details**
|
|
659
697
|
*
|
|
660
|
-
*
|
|
661
|
-
* - Use when you want to process the first element differently from the rest.
|
|
698
|
+
* `onNonEmpty` receives `(head, tail)` where `tail` is the rest of the array.
|
|
662
699
|
*
|
|
663
700
|
* **Example** (Head and tail destructuring)
|
|
664
701
|
*
|
|
@@ -689,10 +726,14 @@ export const matchLeft: {
|
|
|
689
726
|
* Pattern-matches on an array from the left, providing the first element and
|
|
690
727
|
* the remaining elements separately.
|
|
691
728
|
*
|
|
729
|
+
* **When to use**
|
|
730
|
+
*
|
|
731
|
+
* Use to pattern-match when you need the first element and remaining elements as
|
|
732
|
+
* separate values.
|
|
733
|
+
*
|
|
692
734
|
* **Details**
|
|
693
735
|
*
|
|
694
|
-
*
|
|
695
|
-
* - Use when you want to process the first element differently from the rest.
|
|
736
|
+
* `onNonEmpty` receives `(head, tail)` where `tail` is the rest of the array.
|
|
696
737
|
*
|
|
697
738
|
* **Example** (Head and tail destructuring)
|
|
698
739
|
*
|
|
@@ -732,10 +773,14 @@ export const matchLeft: {
|
|
|
732
773
|
* Pattern-matches on an array from the right, providing all elements except the
|
|
733
774
|
* last and the last element separately.
|
|
734
775
|
*
|
|
776
|
+
* **When to use**
|
|
777
|
+
*
|
|
778
|
+
* Use to pattern-match when you need all but the last element and the last element
|
|
779
|
+
* as separate values.
|
|
780
|
+
*
|
|
735
781
|
* **Details**
|
|
736
782
|
*
|
|
737
|
-
*
|
|
738
|
-
* - Use when you want to process the last element differently from the rest.
|
|
783
|
+
* `onNonEmpty` receives `(init, last)` where `init` is everything but the last element.
|
|
739
784
|
*
|
|
740
785
|
* **Example** (Init and last destructuring)
|
|
741
786
|
*
|
|
@@ -761,10 +806,14 @@ export const matchRight: {
|
|
|
761
806
|
* Pattern-matches on an array from the right, providing all elements except the
|
|
762
807
|
* last and the last element separately.
|
|
763
808
|
*
|
|
809
|
+
* **When to use**
|
|
810
|
+
*
|
|
811
|
+
* Use to pattern-match when you need all but the last element and the last element
|
|
812
|
+
* as separate values.
|
|
813
|
+
*
|
|
764
814
|
* **Details**
|
|
765
815
|
*
|
|
766
|
-
*
|
|
767
|
-
* - Use when you want to process the last element differently from the rest.
|
|
816
|
+
* `onNonEmpty` receives `(init, last)` where `init` is everything but the last element.
|
|
768
817
|
*
|
|
769
818
|
* **Example** (Init and last destructuring)
|
|
770
819
|
*
|
|
@@ -795,10 +844,14 @@ export const matchRight: {
|
|
|
795
844
|
* Pattern-matches on an array from the right, providing all elements except the
|
|
796
845
|
* last and the last element separately.
|
|
797
846
|
*
|
|
847
|
+
* **When to use**
|
|
848
|
+
*
|
|
849
|
+
* Use to pattern-match when you need all but the last element and the last element
|
|
850
|
+
* as separate values.
|
|
851
|
+
*
|
|
798
852
|
* **Details**
|
|
799
853
|
*
|
|
800
|
-
*
|
|
801
|
-
* - Use when you want to process the last element differently from the rest.
|
|
854
|
+
* `onNonEmpty` receives `(init, last)` where `init` is everything but the last element.
|
|
802
855
|
*
|
|
803
856
|
* **Example** (Init and last destructuring)
|
|
804
857
|
*
|
|
@@ -840,6 +893,10 @@ export const matchRight: {
|
|
|
840
893
|
/**
|
|
841
894
|
* Adds a single element to the front of an iterable, returning a `NonEmptyArray`.
|
|
842
895
|
*
|
|
896
|
+
* **When to use**
|
|
897
|
+
*
|
|
898
|
+
* Use to add a single element at the start of an iterable and get a `NonEmptyArray`.
|
|
899
|
+
*
|
|
843
900
|
* **Details**
|
|
844
901
|
*
|
|
845
902
|
* - Always returns a non-empty array.
|
|
@@ -864,6 +921,10 @@ export const prepend: {
|
|
|
864
921
|
/**
|
|
865
922
|
* Adds a single element to the front of an iterable, returning a `NonEmptyArray`.
|
|
866
923
|
*
|
|
924
|
+
* **When to use**
|
|
925
|
+
*
|
|
926
|
+
* Use to add a single element at the start of an iterable and get a `NonEmptyArray`.
|
|
927
|
+
*
|
|
867
928
|
* **Details**
|
|
868
929
|
*
|
|
869
930
|
* - Always returns a non-empty array.
|
|
@@ -888,6 +949,10 @@ export const prepend: {
|
|
|
888
949
|
/**
|
|
889
950
|
* Adds a single element to the front of an iterable, returning a `NonEmptyArray`.
|
|
890
951
|
*
|
|
952
|
+
* **When to use**
|
|
953
|
+
*
|
|
954
|
+
* Use to add a single element at the start of an iterable and get a `NonEmptyArray`.
|
|
955
|
+
*
|
|
891
956
|
* **Details**
|
|
892
957
|
*
|
|
893
958
|
* - Always returns a non-empty array.
|
|
@@ -914,6 +979,10 @@ export const prepend: {
|
|
|
914
979
|
/**
|
|
915
980
|
* Prepends all elements from a prefix iterable to the front of an array.
|
|
916
981
|
*
|
|
982
|
+
* **When to use**
|
|
983
|
+
*
|
|
984
|
+
* Use to prepend multiple elements from an iterable to the front of an array.
|
|
985
|
+
*
|
|
917
986
|
* **Details**
|
|
918
987
|
*
|
|
919
988
|
* - If either input is non-empty, the result is a `NonEmptyArray`.
|
|
@@ -938,6 +1007,10 @@ export const prependAll: {
|
|
|
938
1007
|
/**
|
|
939
1008
|
* Prepends all elements from a prefix iterable to the front of an array.
|
|
940
1009
|
*
|
|
1010
|
+
* **When to use**
|
|
1011
|
+
*
|
|
1012
|
+
* Use to prepend multiple elements from an iterable to the front of an array.
|
|
1013
|
+
*
|
|
941
1014
|
* **Details**
|
|
942
1015
|
*
|
|
943
1016
|
* - If either input is non-empty, the result is a `NonEmptyArray`.
|
|
@@ -962,6 +1035,10 @@ export const prependAll: {
|
|
|
962
1035
|
/**
|
|
963
1036
|
* Prepends all elements from a prefix iterable to the front of an array.
|
|
964
1037
|
*
|
|
1038
|
+
* **When to use**
|
|
1039
|
+
*
|
|
1040
|
+
* Use to prepend multiple elements from an iterable to the front of an array.
|
|
1041
|
+
*
|
|
965
1042
|
* **Details**
|
|
966
1043
|
*
|
|
967
1044
|
* - If either input is non-empty, the result is a `NonEmptyArray`.
|
|
@@ -986,6 +1063,10 @@ export const prependAll: {
|
|
|
986
1063
|
/**
|
|
987
1064
|
* Prepends all elements from a prefix iterable to the front of an array.
|
|
988
1065
|
*
|
|
1066
|
+
* **When to use**
|
|
1067
|
+
*
|
|
1068
|
+
* Use to prepend multiple elements from an iterable to the front of an array.
|
|
1069
|
+
*
|
|
989
1070
|
* **Details**
|
|
990
1071
|
*
|
|
991
1072
|
* - If either input is non-empty, the result is a `NonEmptyArray`.
|
|
@@ -1010,6 +1091,10 @@ export const prependAll: {
|
|
|
1010
1091
|
/**
|
|
1011
1092
|
* Prepends all elements from a prefix iterable to the front of an array.
|
|
1012
1093
|
*
|
|
1094
|
+
* **When to use**
|
|
1095
|
+
*
|
|
1096
|
+
* Use to prepend multiple elements from an iterable to the front of an array.
|
|
1097
|
+
*
|
|
1013
1098
|
* **Details**
|
|
1014
1099
|
*
|
|
1015
1100
|
* - If either input is non-empty, the result is a `NonEmptyArray`.
|
|
@@ -1039,6 +1124,11 @@ export const prependAll: {
|
|
|
1039
1124
|
/**
|
|
1040
1125
|
* Adds a single element to the end of an iterable, returning a `NonEmptyArray`.
|
|
1041
1126
|
*
|
|
1127
|
+
* **When to use**
|
|
1128
|
+
*
|
|
1129
|
+
* Use to add one element to the end of an iterable and get a new
|
|
1130
|
+
* `NonEmptyArray`.
|
|
1131
|
+
*
|
|
1042
1132
|
* **Details**
|
|
1043
1133
|
*
|
|
1044
1134
|
* - Always returns a non-empty array.
|
|
@@ -1063,6 +1153,11 @@ export const append: {
|
|
|
1063
1153
|
/**
|
|
1064
1154
|
* Adds a single element to the end of an iterable, returning a `NonEmptyArray`.
|
|
1065
1155
|
*
|
|
1156
|
+
* **When to use**
|
|
1157
|
+
*
|
|
1158
|
+
* Use to add one element to the end of an iterable and get a new
|
|
1159
|
+
* `NonEmptyArray`.
|
|
1160
|
+
*
|
|
1066
1161
|
* **Details**
|
|
1067
1162
|
*
|
|
1068
1163
|
* - Always returns a non-empty array.
|
|
@@ -1087,6 +1182,11 @@ export const append: {
|
|
|
1087
1182
|
/**
|
|
1088
1183
|
* Adds a single element to the end of an iterable, returning a `NonEmptyArray`.
|
|
1089
1184
|
*
|
|
1185
|
+
* **When to use**
|
|
1186
|
+
*
|
|
1187
|
+
* Use to add one element to the end of an iterable and get a new
|
|
1188
|
+
* `NonEmptyArray`.
|
|
1189
|
+
*
|
|
1090
1190
|
* **Details**
|
|
1091
1191
|
*
|
|
1092
1192
|
* - Always returns a non-empty array.
|
|
@@ -1113,6 +1213,11 @@ export const append: {
|
|
|
1113
1213
|
/**
|
|
1114
1214
|
* Concatenates two iterables into a single array.
|
|
1115
1215
|
*
|
|
1216
|
+
* **When to use**
|
|
1217
|
+
*
|
|
1218
|
+
* Use to combine two iterable inputs into a new array with the second input's
|
|
1219
|
+
* elements after the first.
|
|
1220
|
+
*
|
|
1116
1221
|
* **Details**
|
|
1117
1222
|
*
|
|
1118
1223
|
* - If either input is non-empty, the result is a `NonEmptyArray`.
|
|
@@ -1137,6 +1242,11 @@ export const appendAll: {
|
|
|
1137
1242
|
/**
|
|
1138
1243
|
* Concatenates two iterables into a single array.
|
|
1139
1244
|
*
|
|
1245
|
+
* **When to use**
|
|
1246
|
+
*
|
|
1247
|
+
* Use to combine two iterable inputs into a new array with the second input's
|
|
1248
|
+
* elements after the first.
|
|
1249
|
+
*
|
|
1140
1250
|
* **Details**
|
|
1141
1251
|
*
|
|
1142
1252
|
* - If either input is non-empty, the result is a `NonEmptyArray`.
|
|
@@ -1161,6 +1271,11 @@ export const appendAll: {
|
|
|
1161
1271
|
/**
|
|
1162
1272
|
* Concatenates two iterables into a single array.
|
|
1163
1273
|
*
|
|
1274
|
+
* **When to use**
|
|
1275
|
+
*
|
|
1276
|
+
* Use to combine two iterable inputs into a new array with the second input's
|
|
1277
|
+
* elements after the first.
|
|
1278
|
+
*
|
|
1164
1279
|
* **Details**
|
|
1165
1280
|
*
|
|
1166
1281
|
* - If either input is non-empty, the result is a `NonEmptyArray`.
|
|
@@ -1185,6 +1300,11 @@ export const appendAll: {
|
|
|
1185
1300
|
/**
|
|
1186
1301
|
* Concatenates two iterables into a single array.
|
|
1187
1302
|
*
|
|
1303
|
+
* **When to use**
|
|
1304
|
+
*
|
|
1305
|
+
* Use to combine two iterable inputs into a new array with the second input's
|
|
1306
|
+
* elements after the first.
|
|
1307
|
+
*
|
|
1188
1308
|
* **Details**
|
|
1189
1309
|
*
|
|
1190
1310
|
* - If either input is non-empty, the result is a `NonEmptyArray`.
|
|
@@ -1209,6 +1329,11 @@ export const appendAll: {
|
|
|
1209
1329
|
/**
|
|
1210
1330
|
* Concatenates two iterables into a single array.
|
|
1211
1331
|
*
|
|
1332
|
+
* **When to use**
|
|
1333
|
+
*
|
|
1334
|
+
* Use to combine two iterable inputs into a new array with the second input's
|
|
1335
|
+
* elements after the first.
|
|
1336
|
+
*
|
|
1212
1337
|
* **Details**
|
|
1213
1338
|
*
|
|
1214
1339
|
* - If either input is non-empty, the result is a `NonEmptyArray`.
|
|
@@ -1238,6 +1363,10 @@ export const appendAll: {
|
|
|
1238
1363
|
/**
|
|
1239
1364
|
* Left-to-right fold that keeps every intermediate accumulator value.
|
|
1240
1365
|
*
|
|
1366
|
+
* **When to use**
|
|
1367
|
+
*
|
|
1368
|
+
* Use to compute a running accumulator where each intermediate value is needed.
|
|
1369
|
+
*
|
|
1241
1370
|
* **Details**
|
|
1242
1371
|
*
|
|
1243
1372
|
* - The output length is `input.length + 1` (starts with the initial value).
|
|
@@ -1263,6 +1392,10 @@ export const scan: {
|
|
|
1263
1392
|
/**
|
|
1264
1393
|
* Left-to-right fold that keeps every intermediate accumulator value.
|
|
1265
1394
|
*
|
|
1395
|
+
* **When to use**
|
|
1396
|
+
*
|
|
1397
|
+
* Use to compute a running accumulator where each intermediate value is needed.
|
|
1398
|
+
*
|
|
1266
1399
|
* **Details**
|
|
1267
1400
|
*
|
|
1268
1401
|
* - The output length is `input.length + 1` (starts with the initial value).
|
|
@@ -1288,6 +1421,10 @@ export const scan: {
|
|
|
1288
1421
|
/**
|
|
1289
1422
|
* Left-to-right fold that keeps every intermediate accumulator value.
|
|
1290
1423
|
*
|
|
1424
|
+
* **When to use**
|
|
1425
|
+
*
|
|
1426
|
+
* Use to compute a running accumulator where each intermediate value is needed.
|
|
1427
|
+
*
|
|
1291
1428
|
* **Details**
|
|
1292
1429
|
*
|
|
1293
1430
|
* - The output length is `input.length + 1` (starts with the initial value).
|
|
@@ -1323,6 +1460,11 @@ export const scan: {
|
|
|
1323
1460
|
/**
|
|
1324
1461
|
* Right-to-left fold that keeps every intermediate accumulator value.
|
|
1325
1462
|
*
|
|
1463
|
+
* **When to use**
|
|
1464
|
+
*
|
|
1465
|
+
* Use to compute a running accumulator from right to left where each intermediate
|
|
1466
|
+
* value is needed.
|
|
1467
|
+
*
|
|
1326
1468
|
* **Details**
|
|
1327
1469
|
*
|
|
1328
1470
|
* - The output length is `input.length + 1` (ends with the initial value).
|
|
@@ -1347,6 +1489,11 @@ export const scanRight: {
|
|
|
1347
1489
|
/**
|
|
1348
1490
|
* Right-to-left fold that keeps every intermediate accumulator value.
|
|
1349
1491
|
*
|
|
1492
|
+
* **When to use**
|
|
1493
|
+
*
|
|
1494
|
+
* Use to compute a running accumulator from right to left where each intermediate
|
|
1495
|
+
* value is needed.
|
|
1496
|
+
*
|
|
1350
1497
|
* **Details**
|
|
1351
1498
|
*
|
|
1352
1499
|
* - The output length is `input.length + 1` (ends with the initial value).
|
|
@@ -1371,6 +1518,11 @@ export const scanRight: {
|
|
|
1371
1518
|
/**
|
|
1372
1519
|
* Right-to-left fold that keeps every intermediate accumulator value.
|
|
1373
1520
|
*
|
|
1521
|
+
* **When to use**
|
|
1522
|
+
*
|
|
1523
|
+
* Use to compute a running accumulator from right to left where each intermediate
|
|
1524
|
+
* value is needed.
|
|
1525
|
+
*
|
|
1374
1526
|
* **Details**
|
|
1375
1527
|
*
|
|
1376
1528
|
* - The output length is `input.length + 1` (ends with the initial value).
|
|
@@ -1405,6 +1557,10 @@ export const scanRight: {
|
|
|
1405
1557
|
/**
|
|
1406
1558
|
* Tests whether a value is an `Array`.
|
|
1407
1559
|
*
|
|
1560
|
+
* **When to use**
|
|
1561
|
+
*
|
|
1562
|
+
* Use to verify a value is a mutable array, narrowing its type to `Array<unknown>`.
|
|
1563
|
+
*
|
|
1408
1564
|
* **Details**
|
|
1409
1565
|
*
|
|
1410
1566
|
* - Acts as a type guard narrowing the input to `Array<unknown>`.
|
|
@@ -1429,6 +1585,10 @@ export const isArray: {
|
|
|
1429
1585
|
/**
|
|
1430
1586
|
* Tests whether a value is an `Array`.
|
|
1431
1587
|
*
|
|
1588
|
+
* **When to use**
|
|
1589
|
+
*
|
|
1590
|
+
* Use to verify a value is a mutable array, narrowing its type to `Array<unknown>`.
|
|
1591
|
+
*
|
|
1432
1592
|
* **Details**
|
|
1433
1593
|
*
|
|
1434
1594
|
* - Acts as a type guard narrowing the input to `Array<unknown>`.
|
|
@@ -1453,6 +1613,10 @@ export const isArray: {
|
|
|
1453
1613
|
/**
|
|
1454
1614
|
* Tests whether a value is an `Array`.
|
|
1455
1615
|
*
|
|
1616
|
+
* **When to use**
|
|
1617
|
+
*
|
|
1618
|
+
* Use to verify a value is a mutable array, narrowing its type to `Array<unknown>`.
|
|
1619
|
+
*
|
|
1456
1620
|
* **Details**
|
|
1457
1621
|
*
|
|
1458
1622
|
* - Acts as a type guard narrowing the input to `Array<unknown>`.
|
|
@@ -1562,6 +1726,10 @@ export const isReadonlyArrayNonEmpty: <A>(self: ReadonlyArray<A>) => self is Non
|
|
|
1562
1726
|
/**
|
|
1563
1727
|
* Returns the number of elements in a `ReadonlyArray`.
|
|
1564
1728
|
*
|
|
1729
|
+
* **When to use**
|
|
1730
|
+
*
|
|
1731
|
+
* Use when you need length as a composable function rather than a property access.
|
|
1732
|
+
*
|
|
1565
1733
|
* **Example** (Getting the length)
|
|
1566
1734
|
*
|
|
1567
1735
|
* ```ts
|
|
@@ -1586,6 +1754,11 @@ const clamp = <A>(i: number, as: ReadonlyArray<A>): number => Math.floor(Math.mi
|
|
|
1586
1754
|
* Safely reads an element at the given index, returning `Option.some` or
|
|
1587
1755
|
* `Option.none` if the index is out of bounds.
|
|
1588
1756
|
*
|
|
1757
|
+
* **When to use**
|
|
1758
|
+
*
|
|
1759
|
+
* Use when you need to read an array element by index and handle an
|
|
1760
|
+
* out-of-bounds index as `Option.none`.
|
|
1761
|
+
*
|
|
1589
1762
|
* **Details**
|
|
1590
1763
|
*
|
|
1591
1764
|
* - The index is floored to an integer.
|
|
@@ -1600,9 +1773,9 @@ const clamp = <A>(i: number, as: ReadonlyArray<A>): number => Math.floor(Math.mi
|
|
|
1600
1773
|
* console.log(Array.get([1, 2, 3], 10)) // None
|
|
1601
1774
|
* ```
|
|
1602
1775
|
*
|
|
1603
|
-
* @see {@link getUnsafe}
|
|
1604
|
-
* @see {@link head}
|
|
1605
|
-
* @see {@link last}
|
|
1776
|
+
* @see {@link getUnsafe} for indexed access that throws when the index is out of bounds
|
|
1777
|
+
* @see {@link head} for reading the first element as an `Option`
|
|
1778
|
+
* @see {@link last} for reading the last element as an `Option`
|
|
1606
1779
|
*
|
|
1607
1780
|
* @category getters
|
|
1608
1781
|
* @since 2.0.0
|
|
@@ -1612,6 +1785,11 @@ export const get: {
|
|
|
1612
1785
|
* Safely reads an element at the given index, returning `Option.some` or
|
|
1613
1786
|
* `Option.none` if the index is out of bounds.
|
|
1614
1787
|
*
|
|
1788
|
+
* **When to use**
|
|
1789
|
+
*
|
|
1790
|
+
* Use when you need to read an array element by index and handle an
|
|
1791
|
+
* out-of-bounds index as `Option.none`.
|
|
1792
|
+
*
|
|
1615
1793
|
* **Details**
|
|
1616
1794
|
*
|
|
1617
1795
|
* - The index is floored to an integer.
|
|
@@ -1626,9 +1804,9 @@ export const get: {
|
|
|
1626
1804
|
* console.log(Array.get([1, 2, 3], 10)) // None
|
|
1627
1805
|
* ```
|
|
1628
1806
|
*
|
|
1629
|
-
* @see {@link getUnsafe}
|
|
1630
|
-
* @see {@link head}
|
|
1631
|
-
* @see {@link last}
|
|
1807
|
+
* @see {@link getUnsafe} for indexed access that throws when the index is out of bounds
|
|
1808
|
+
* @see {@link head} for reading the first element as an `Option`
|
|
1809
|
+
* @see {@link last} for reading the last element as an `Option`
|
|
1632
1810
|
*
|
|
1633
1811
|
* @category getters
|
|
1634
1812
|
* @since 2.0.0
|
|
@@ -1638,6 +1816,11 @@ export const get: {
|
|
|
1638
1816
|
* Safely reads an element at the given index, returning `Option.some` or
|
|
1639
1817
|
* `Option.none` if the index is out of bounds.
|
|
1640
1818
|
*
|
|
1819
|
+
* **When to use**
|
|
1820
|
+
*
|
|
1821
|
+
* Use when you need to read an array element by index and handle an
|
|
1822
|
+
* out-of-bounds index as `Option.none`.
|
|
1823
|
+
*
|
|
1641
1824
|
* **Details**
|
|
1642
1825
|
*
|
|
1643
1826
|
* - The index is floored to an integer.
|
|
@@ -1652,9 +1835,9 @@ export const get: {
|
|
|
1652
1835
|
* console.log(Array.get([1, 2, 3], 10)) // None
|
|
1653
1836
|
* ```
|
|
1654
1837
|
*
|
|
1655
|
-
* @see {@link getUnsafe}
|
|
1656
|
-
* @see {@link head}
|
|
1657
|
-
* @see {@link last}
|
|
1838
|
+
* @see {@link getUnsafe} for indexed access that throws when the index is out of bounds
|
|
1839
|
+
* @see {@link head} for reading the first element as an `Option`
|
|
1840
|
+
* @see {@link last} for reading the last element as an `Option`
|
|
1658
1841
|
*
|
|
1659
1842
|
* @category getters
|
|
1660
1843
|
* @since 2.0.0
|
|
@@ -1668,6 +1851,11 @@ export const get: {
|
|
|
1668
1851
|
/**
|
|
1669
1852
|
* Reads an element at the given index, throwing if the index is out of bounds.
|
|
1670
1853
|
*
|
|
1854
|
+
* **When to use**
|
|
1855
|
+
*
|
|
1856
|
+
* Use to read an element at a known valid index when out-of-bounds would be a
|
|
1857
|
+
* programming error.
|
|
1858
|
+
*
|
|
1671
1859
|
* **Details**
|
|
1672
1860
|
*
|
|
1673
1861
|
* - Throws an `Error` with the message `"Index out of bounds: <i>"`.
|
|
@@ -1691,6 +1879,11 @@ export const getUnsafe: {
|
|
|
1691
1879
|
/**
|
|
1692
1880
|
* Reads an element at the given index, throwing if the index is out of bounds.
|
|
1693
1881
|
*
|
|
1882
|
+
* **When to use**
|
|
1883
|
+
*
|
|
1884
|
+
* Use to read an element at a known valid index when out-of-bounds would be a
|
|
1885
|
+
* programming error.
|
|
1886
|
+
*
|
|
1694
1887
|
* **Details**
|
|
1695
1888
|
*
|
|
1696
1889
|
* - Throws an `Error` with the message `"Index out of bounds: <i>"`.
|
|
@@ -1714,6 +1907,11 @@ export const getUnsafe: {
|
|
|
1714
1907
|
/**
|
|
1715
1908
|
* Reads an element at the given index, throwing if the index is out of bounds.
|
|
1716
1909
|
*
|
|
1910
|
+
* **When to use**
|
|
1911
|
+
*
|
|
1912
|
+
* Use to read an element at a known valid index when out-of-bounds would be a
|
|
1913
|
+
* programming error.
|
|
1914
|
+
*
|
|
1717
1915
|
* **Details**
|
|
1718
1916
|
*
|
|
1719
1917
|
* - Throws an `Error` with the message `"Index out of bounds: <i>"`.
|
|
@@ -1745,6 +1943,11 @@ export const getUnsafe: {
|
|
|
1745
1943
|
/**
|
|
1746
1944
|
* Splits a non-empty array into its first element and the remaining elements.
|
|
1747
1945
|
*
|
|
1946
|
+
* **When to use**
|
|
1947
|
+
*
|
|
1948
|
+
* Use when you have a `NonEmptyReadonlyArray` and need both its first element
|
|
1949
|
+
* and the remaining elements as separate values.
|
|
1950
|
+
*
|
|
1748
1951
|
* **Details**
|
|
1749
1952
|
*
|
|
1750
1953
|
* - Returns a tuple `[head, tail]`.
|
|
@@ -1759,9 +1962,9 @@ export const getUnsafe: {
|
|
|
1759
1962
|
* console.log(result) // [1, [2, 3, 4]]
|
|
1760
1963
|
* ```
|
|
1761
1964
|
*
|
|
1762
|
-
* @see {@link unappend}
|
|
1763
|
-
* @see {@link headNonEmpty}
|
|
1764
|
-
* @see {@link tailNonEmpty}
|
|
1965
|
+
* @see {@link unappend} for splitting a non-empty array into init and last
|
|
1966
|
+
* @see {@link headNonEmpty} for getting only the first element
|
|
1967
|
+
* @see {@link tailNonEmpty} for getting only the elements after the first
|
|
1765
1968
|
*
|
|
1766
1969
|
* @category splitting
|
|
1767
1970
|
* @since 2.0.0
|
|
@@ -1774,6 +1977,11 @@ export const unprepend = <A>(
|
|
|
1774
1977
|
* Splits a non-empty array into all elements except the last, and the last
|
|
1775
1978
|
* element.
|
|
1776
1979
|
*
|
|
1980
|
+
* **When to use**
|
|
1981
|
+
*
|
|
1982
|
+
* Use to split a non-empty array from the end when you need both the elements
|
|
1983
|
+
* before the last element and the last element.
|
|
1984
|
+
*
|
|
1777
1985
|
* **Details**
|
|
1778
1986
|
*
|
|
1779
1987
|
* - Returns a tuple `[init, last]`.
|
|
@@ -1788,9 +1996,9 @@ export const unprepend = <A>(
|
|
|
1788
1996
|
* console.log(result) // [[1, 2, 3], 4]
|
|
1789
1997
|
* ```
|
|
1790
1998
|
*
|
|
1791
|
-
* @see {@link unprepend}
|
|
1792
|
-
* @see {@link initNonEmpty}
|
|
1793
|
-
* @see {@link lastNonEmpty}
|
|
1999
|
+
* @see {@link unprepend} for splitting a non-empty array into head and tail
|
|
2000
|
+
* @see {@link initNonEmpty} for getting only the elements before the last
|
|
2001
|
+
* @see {@link lastNonEmpty} for getting only the last element
|
|
1794
2002
|
*
|
|
1795
2003
|
* @category splitting
|
|
1796
2004
|
* @since 2.0.0
|
|
@@ -1803,6 +2011,10 @@ export const unappend = <A>(
|
|
|
1803
2011
|
* Returns the first element of an array wrapped in `Option.some`, or
|
|
1804
2012
|
* `Option.none` if the array is empty.
|
|
1805
2013
|
*
|
|
2014
|
+
* **When to use**
|
|
2015
|
+
*
|
|
2016
|
+
* Use to safely get the first element of an array that may be empty.
|
|
2017
|
+
*
|
|
1806
2018
|
* **Example** (Getting the first element)
|
|
1807
2019
|
*
|
|
1808
2020
|
* ```ts
|
|
@@ -1824,6 +2036,11 @@ export const head: <A>(self: ReadonlyArray<A>) => Option.Option<A> = get(0)
|
|
|
1824
2036
|
* Returns the first element of a `NonEmptyReadonlyArray` directly (no `Option`
|
|
1825
2037
|
* wrapper).
|
|
1826
2038
|
*
|
|
2039
|
+
* **When to use**
|
|
2040
|
+
*
|
|
2041
|
+
* Use to get the first element without `Option` wrapping when the array is known
|
|
2042
|
+
* to be non-empty.
|
|
2043
|
+
*
|
|
1827
2044
|
* **Example** (Getting the head of a non-empty array)
|
|
1828
2045
|
*
|
|
1829
2046
|
* ```ts
|
|
@@ -1843,6 +2060,10 @@ export const headNonEmpty: <A>(self: NonEmptyReadonlyArray<A>) => A = getUnsafe(
|
|
|
1843
2060
|
* Returns the last element of an array wrapped in `Option.some`, or
|
|
1844
2061
|
* `Option.none` if the array is empty.
|
|
1845
2062
|
*
|
|
2063
|
+
* **When to use**
|
|
2064
|
+
*
|
|
2065
|
+
* Use to safely get the last element of an array that may be empty.
|
|
2066
|
+
*
|
|
1846
2067
|
* **Example** (Getting the last element)
|
|
1847
2068
|
*
|
|
1848
2069
|
* ```ts
|
|
@@ -1865,6 +2086,11 @@ export const last = <A>(self: ReadonlyArray<A>): Option.Option<A> =>
|
|
|
1865
2086
|
* Returns the last element of a `NonEmptyReadonlyArray` directly (no `Option`
|
|
1866
2087
|
* wrapper).
|
|
1867
2088
|
*
|
|
2089
|
+
* **When to use**
|
|
2090
|
+
*
|
|
2091
|
+
* Use to get the last element without `Option` wrapping when the array is known
|
|
2092
|
+
* to be non-empty.
|
|
2093
|
+
*
|
|
1868
2094
|
* **Example** (Getting the last of a non-empty array)
|
|
1869
2095
|
*
|
|
1870
2096
|
* ```ts
|
|
@@ -1883,6 +2109,10 @@ export const lastNonEmpty = <A>(self: NonEmptyReadonlyArray<A>): A => self[self.
|
|
|
1883
2109
|
/**
|
|
1884
2110
|
* Returns all elements except the first, wrapped in an `Option`.
|
|
1885
2111
|
*
|
|
2112
|
+
* **When to use**
|
|
2113
|
+
*
|
|
2114
|
+
* Use to safely get all elements after the first when the iterable may be empty.
|
|
2115
|
+
*
|
|
1886
2116
|
* **Details**
|
|
1887
2117
|
*
|
|
1888
2118
|
* - Allocates a new array via `slice(1)`.
|
|
@@ -1911,6 +2141,10 @@ export function tail<A>(self: Iterable<A>): Option.Option<Array<A>> {
|
|
|
1911
2141
|
/**
|
|
1912
2142
|
* Returns all elements except the first of a `NonEmptyReadonlyArray`.
|
|
1913
2143
|
*
|
|
2144
|
+
* **When to use**
|
|
2145
|
+
*
|
|
2146
|
+
* Use to get all elements after the first when the array is known to be non-empty.
|
|
2147
|
+
*
|
|
1914
2148
|
* **Example** (Getting the tail of a non-empty array)
|
|
1915
2149
|
*
|
|
1916
2150
|
* ```ts
|
|
@@ -1930,6 +2164,10 @@ export const tailNonEmpty = <A>(self: NonEmptyReadonlyArray<A>): Array<A> => sel
|
|
|
1930
2164
|
/**
|
|
1931
2165
|
* Returns all elements except the last, wrapped in an `Option`.
|
|
1932
2166
|
*
|
|
2167
|
+
* **When to use**
|
|
2168
|
+
*
|
|
2169
|
+
* Use to safely get all elements before the last when the iterable may be empty.
|
|
2170
|
+
*
|
|
1933
2171
|
* **Details**
|
|
1934
2172
|
*
|
|
1935
2173
|
* - Allocates a new array via `slice(0, -1)`.
|
|
@@ -1958,6 +2196,10 @@ export function init<A>(self: Iterable<A>): Option.Option<Array<A>> {
|
|
|
1958
2196
|
/**
|
|
1959
2197
|
* Returns all elements except the last of a `NonEmptyReadonlyArray`.
|
|
1960
2198
|
*
|
|
2199
|
+
* **When to use**
|
|
2200
|
+
*
|
|
2201
|
+
* Use to get all elements before the last when the array is known to be non-empty.
|
|
2202
|
+
*
|
|
1961
2203
|
* **Example** (Getting init of a non-empty array)
|
|
1962
2204
|
*
|
|
1963
2205
|
* ```ts
|
|
@@ -1977,6 +2219,10 @@ export const initNonEmpty = <A>(self: NonEmptyReadonlyArray<A>): Array<A> => sel
|
|
|
1977
2219
|
/**
|
|
1978
2220
|
* Keeps the first `n` elements, creating a new array.
|
|
1979
2221
|
*
|
|
2222
|
+
* **When to use**
|
|
2223
|
+
*
|
|
2224
|
+
* Use to keep up to the first `n` elements from an iterable as a new array.
|
|
2225
|
+
*
|
|
1980
2226
|
* **Details**
|
|
1981
2227
|
*
|
|
1982
2228
|
* - `n` is clamped to `[0, length]`.
|
|
@@ -1990,9 +2236,9 @@ export const initNonEmpty = <A>(self: NonEmptyReadonlyArray<A>): Array<A> => sel
|
|
|
1990
2236
|
* console.log(Array.take([1, 2, 3, 4, 5], 3)) // [1, 2, 3]
|
|
1991
2237
|
* ```
|
|
1992
2238
|
*
|
|
1993
|
-
* @see {@link takeRight}
|
|
1994
|
-
* @see {@link takeWhile}
|
|
1995
|
-
* @see {@link drop}
|
|
2239
|
+
* @see {@link takeRight} for keeping elements from the end
|
|
2240
|
+
* @see {@link takeWhile} for keeping an initial prefix while a predicate holds
|
|
2241
|
+
* @see {@link drop} for removing elements from the start
|
|
1996
2242
|
*
|
|
1997
2243
|
* @category getters
|
|
1998
2244
|
* @since 2.0.0
|
|
@@ -2001,6 +2247,10 @@ export const take: {
|
|
|
2001
2247
|
/**
|
|
2002
2248
|
* Keeps the first `n` elements, creating a new array.
|
|
2003
2249
|
*
|
|
2250
|
+
* **When to use**
|
|
2251
|
+
*
|
|
2252
|
+
* Use to keep up to the first `n` elements from an iterable as a new array.
|
|
2253
|
+
*
|
|
2004
2254
|
* **Details**
|
|
2005
2255
|
*
|
|
2006
2256
|
* - `n` is clamped to `[0, length]`.
|
|
@@ -2014,9 +2264,9 @@ export const take: {
|
|
|
2014
2264
|
* console.log(Array.take([1, 2, 3, 4, 5], 3)) // [1, 2, 3]
|
|
2015
2265
|
* ```
|
|
2016
2266
|
*
|
|
2017
|
-
* @see {@link takeRight}
|
|
2018
|
-
* @see {@link takeWhile}
|
|
2019
|
-
* @see {@link drop}
|
|
2267
|
+
* @see {@link takeRight} for keeping elements from the end
|
|
2268
|
+
* @see {@link takeWhile} for keeping an initial prefix while a predicate holds
|
|
2269
|
+
* @see {@link drop} for removing elements from the start
|
|
2020
2270
|
*
|
|
2021
2271
|
* @category getters
|
|
2022
2272
|
* @since 2.0.0
|
|
@@ -2025,6 +2275,10 @@ export const take: {
|
|
|
2025
2275
|
/**
|
|
2026
2276
|
* Keeps the first `n` elements, creating a new array.
|
|
2027
2277
|
*
|
|
2278
|
+
* **When to use**
|
|
2279
|
+
*
|
|
2280
|
+
* Use to keep up to the first `n` elements from an iterable as a new array.
|
|
2281
|
+
*
|
|
2028
2282
|
* **Details**
|
|
2029
2283
|
*
|
|
2030
2284
|
* - `n` is clamped to `[0, length]`.
|
|
@@ -2038,9 +2292,9 @@ export const take: {
|
|
|
2038
2292
|
* console.log(Array.take([1, 2, 3, 4, 5], 3)) // [1, 2, 3]
|
|
2039
2293
|
* ```
|
|
2040
2294
|
*
|
|
2041
|
-
* @see {@link takeRight}
|
|
2042
|
-
* @see {@link takeWhile}
|
|
2043
|
-
* @see {@link drop}
|
|
2295
|
+
* @see {@link takeRight} for keeping elements from the end
|
|
2296
|
+
* @see {@link takeWhile} for keeping an initial prefix while a predicate holds
|
|
2297
|
+
* @see {@link drop} for removing elements from the start
|
|
2044
2298
|
*
|
|
2045
2299
|
* @category getters
|
|
2046
2300
|
* @since 2.0.0
|
|
@@ -2054,6 +2308,10 @@ export const take: {
|
|
|
2054
2308
|
/**
|
|
2055
2309
|
* Keeps the last `n` elements, creating a new array.
|
|
2056
2310
|
*
|
|
2311
|
+
* **When to use**
|
|
2312
|
+
*
|
|
2313
|
+
* Use to keep the last `n` elements of an iterable.
|
|
2314
|
+
*
|
|
2057
2315
|
* **Details**
|
|
2058
2316
|
*
|
|
2059
2317
|
* - `n` is clamped to `[0, length]`.
|
|
@@ -2077,6 +2335,10 @@ export const takeRight: {
|
|
|
2077
2335
|
/**
|
|
2078
2336
|
* Keeps the last `n` elements, creating a new array.
|
|
2079
2337
|
*
|
|
2338
|
+
* **When to use**
|
|
2339
|
+
*
|
|
2340
|
+
* Use to keep the last `n` elements of an iterable.
|
|
2341
|
+
*
|
|
2080
2342
|
* **Details**
|
|
2081
2343
|
*
|
|
2082
2344
|
* - `n` is clamped to `[0, length]`.
|
|
@@ -2100,6 +2362,10 @@ export const takeRight: {
|
|
|
2100
2362
|
/**
|
|
2101
2363
|
* Keeps the last `n` elements, creating a new array.
|
|
2102
2364
|
*
|
|
2365
|
+
* **When to use**
|
|
2366
|
+
*
|
|
2367
|
+
* Use to keep the last `n` elements of an iterable.
|
|
2368
|
+
*
|
|
2103
2369
|
* **Details**
|
|
2104
2370
|
*
|
|
2105
2371
|
* - `n` is clamped to `[0, length]`.
|
|
@@ -2130,6 +2396,11 @@ export const takeRight: {
|
|
|
2130
2396
|
* Takes elements from the start while the predicate holds, stopping at the
|
|
2131
2397
|
* first element that fails.
|
|
2132
2398
|
*
|
|
2399
|
+
* **When to use**
|
|
2400
|
+
*
|
|
2401
|
+
* Use to keep the leading elements of an iterable while each element satisfies
|
|
2402
|
+
* a predicate, returning the retained prefix as an array.
|
|
2403
|
+
*
|
|
2133
2404
|
* **Details**
|
|
2134
2405
|
*
|
|
2135
2406
|
* - Supports refinements for type narrowing.
|
|
@@ -2143,9 +2414,9 @@ export const takeRight: {
|
|
|
2143
2414
|
* console.log(Array.takeWhile([1, 3, 2, 4, 1, 2], (x) => x < 4)) // [1, 3, 2]
|
|
2144
2415
|
* ```
|
|
2145
2416
|
*
|
|
2146
|
-
* @see {@link take}
|
|
2147
|
-
* @see {@link dropWhile}
|
|
2148
|
-
* @see {@link span}
|
|
2417
|
+
* @see {@link take} for keeping a fixed number of leading elements
|
|
2418
|
+
* @see {@link dropWhile} for removing the matching prefix and keeping the rest
|
|
2419
|
+
* @see {@link span} for splitting the matching prefix from the remaining elements
|
|
2149
2420
|
*
|
|
2150
2421
|
* @category getters
|
|
2151
2422
|
* @since 2.0.0
|
|
@@ -2155,6 +2426,11 @@ export const takeWhile: {
|
|
|
2155
2426
|
* Takes elements from the start while the predicate holds, stopping at the
|
|
2156
2427
|
* first element that fails.
|
|
2157
2428
|
*
|
|
2429
|
+
* **When to use**
|
|
2430
|
+
*
|
|
2431
|
+
* Use to keep the leading elements of an iterable while each element satisfies
|
|
2432
|
+
* a predicate, returning the retained prefix as an array.
|
|
2433
|
+
*
|
|
2158
2434
|
* **Details**
|
|
2159
2435
|
*
|
|
2160
2436
|
* - Supports refinements for type narrowing.
|
|
@@ -2168,9 +2444,9 @@ export const takeWhile: {
|
|
|
2168
2444
|
* console.log(Array.takeWhile([1, 3, 2, 4, 1, 2], (x) => x < 4)) // [1, 3, 2]
|
|
2169
2445
|
* ```
|
|
2170
2446
|
*
|
|
2171
|
-
* @see {@link take}
|
|
2172
|
-
* @see {@link dropWhile}
|
|
2173
|
-
* @see {@link span}
|
|
2447
|
+
* @see {@link take} for keeping a fixed number of leading elements
|
|
2448
|
+
* @see {@link dropWhile} for removing the matching prefix and keeping the rest
|
|
2449
|
+
* @see {@link span} for splitting the matching prefix from the remaining elements
|
|
2174
2450
|
*
|
|
2175
2451
|
* @category getters
|
|
2176
2452
|
* @since 2.0.0
|
|
@@ -2180,6 +2456,11 @@ export const takeWhile: {
|
|
|
2180
2456
|
* Takes elements from the start while the predicate holds, stopping at the
|
|
2181
2457
|
* first element that fails.
|
|
2182
2458
|
*
|
|
2459
|
+
* **When to use**
|
|
2460
|
+
*
|
|
2461
|
+
* Use to keep the leading elements of an iterable while each element satisfies
|
|
2462
|
+
* a predicate, returning the retained prefix as an array.
|
|
2463
|
+
*
|
|
2183
2464
|
* **Details**
|
|
2184
2465
|
*
|
|
2185
2466
|
* - Supports refinements for type narrowing.
|
|
@@ -2193,9 +2474,9 @@ export const takeWhile: {
|
|
|
2193
2474
|
* console.log(Array.takeWhile([1, 3, 2, 4, 1, 2], (x) => x < 4)) // [1, 3, 2]
|
|
2194
2475
|
* ```
|
|
2195
2476
|
*
|
|
2196
|
-
* @see {@link take}
|
|
2197
|
-
* @see {@link dropWhile}
|
|
2198
|
-
* @see {@link span}
|
|
2477
|
+
* @see {@link take} for keeping a fixed number of leading elements
|
|
2478
|
+
* @see {@link dropWhile} for removing the matching prefix and keeping the rest
|
|
2479
|
+
* @see {@link span} for splitting the matching prefix from the remaining elements
|
|
2199
2480
|
*
|
|
2200
2481
|
* @category getters
|
|
2201
2482
|
* @since 2.0.0
|
|
@@ -2205,6 +2486,11 @@ export const takeWhile: {
|
|
|
2205
2486
|
* Takes elements from the start while the predicate holds, stopping at the
|
|
2206
2487
|
* first element that fails.
|
|
2207
2488
|
*
|
|
2489
|
+
* **When to use**
|
|
2490
|
+
*
|
|
2491
|
+
* Use to keep the leading elements of an iterable while each element satisfies
|
|
2492
|
+
* a predicate, returning the retained prefix as an array.
|
|
2493
|
+
*
|
|
2208
2494
|
* **Details**
|
|
2209
2495
|
*
|
|
2210
2496
|
* - Supports refinements for type narrowing.
|
|
@@ -2218,9 +2504,9 @@ export const takeWhile: {
|
|
|
2218
2504
|
* console.log(Array.takeWhile([1, 3, 2, 4, 1, 2], (x) => x < 4)) // [1, 3, 2]
|
|
2219
2505
|
* ```
|
|
2220
2506
|
*
|
|
2221
|
-
* @see {@link take}
|
|
2222
|
-
* @see {@link dropWhile}
|
|
2223
|
-
* @see {@link span}
|
|
2507
|
+
* @see {@link take} for keeping a fixed number of leading elements
|
|
2508
|
+
* @see {@link dropWhile} for removing the matching prefix and keeping the rest
|
|
2509
|
+
* @see {@link span} for splitting the matching prefix from the remaining elements
|
|
2224
2510
|
*
|
|
2225
2511
|
* @category getters
|
|
2226
2512
|
* @since 2.0.0
|
|
@@ -2230,6 +2516,11 @@ export const takeWhile: {
|
|
|
2230
2516
|
* Takes elements from the start while the predicate holds, stopping at the
|
|
2231
2517
|
* first element that fails.
|
|
2232
2518
|
*
|
|
2519
|
+
* **When to use**
|
|
2520
|
+
*
|
|
2521
|
+
* Use to keep the leading elements of an iterable while each element satisfies
|
|
2522
|
+
* a predicate, returning the retained prefix as an array.
|
|
2523
|
+
*
|
|
2233
2524
|
* **Details**
|
|
2234
2525
|
*
|
|
2235
2526
|
* - Supports refinements for type narrowing.
|
|
@@ -2243,9 +2534,9 @@ export const takeWhile: {
|
|
|
2243
2534
|
* console.log(Array.takeWhile([1, 3, 2, 4, 1, 2], (x) => x < 4)) // [1, 3, 2]
|
|
2244
2535
|
* ```
|
|
2245
2536
|
*
|
|
2246
|
-
* @see {@link take}
|
|
2247
|
-
* @see {@link dropWhile}
|
|
2248
|
-
* @see {@link span}
|
|
2537
|
+
* @see {@link take} for keeping a fixed number of leading elements
|
|
2538
|
+
* @see {@link dropWhile} for removing the matching prefix and keeping the rest
|
|
2539
|
+
* @see {@link span} for splitting the matching prefix from the remaining elements
|
|
2249
2540
|
*
|
|
2250
2541
|
* @category getters
|
|
2251
2542
|
* @since 2.0.0
|
|
@@ -2267,11 +2558,19 @@ export const takeWhile: {
|
|
|
2267
2558
|
/**
|
|
2268
2559
|
* Takes elements from the start while a `Filter` succeeds, collecting transformed values.
|
|
2269
2560
|
*
|
|
2561
|
+
* **When to use**
|
|
2562
|
+
*
|
|
2563
|
+
* Use when you need to take a prefix of elements while a function can
|
|
2564
|
+
* successfully extract or transform them, stopping at the first element
|
|
2565
|
+
* that produces a failure result.
|
|
2566
|
+
*
|
|
2270
2567
|
* **Details**
|
|
2271
2568
|
*
|
|
2272
2569
|
* - The filter receives `(element, index)`.
|
|
2273
2570
|
* - Stops at the first filter failure.
|
|
2274
2571
|
*
|
|
2572
|
+
* @see {@link takeWhile} for taking a prefix based on a boolean predicate
|
|
2573
|
+
*
|
|
2275
2574
|
* @category getters
|
|
2276
2575
|
* @since 4.0.0
|
|
2277
2576
|
*/
|
|
@@ -2279,11 +2578,19 @@ export const takeWhileFilter: {
|
|
|
2279
2578
|
/**
|
|
2280
2579
|
* Takes elements from the start while a `Filter` succeeds, collecting transformed values.
|
|
2281
2580
|
*
|
|
2581
|
+
* **When to use**
|
|
2582
|
+
*
|
|
2583
|
+
* Use when you need to take a prefix of elements while a function can
|
|
2584
|
+
* successfully extract or transform them, stopping at the first element
|
|
2585
|
+
* that produces a failure result.
|
|
2586
|
+
*
|
|
2282
2587
|
* **Details**
|
|
2283
2588
|
*
|
|
2284
2589
|
* - The filter receives `(element, index)`.
|
|
2285
2590
|
* - Stops at the first filter failure.
|
|
2286
2591
|
*
|
|
2592
|
+
* @see {@link takeWhile} for taking a prefix based on a boolean predicate
|
|
2593
|
+
*
|
|
2287
2594
|
* @category getters
|
|
2288
2595
|
* @since 4.0.0
|
|
2289
2596
|
*/
|
|
@@ -2291,11 +2598,19 @@ export const takeWhileFilter: {
|
|
|
2291
2598
|
/**
|
|
2292
2599
|
* Takes elements from the start while a `Filter` succeeds, collecting transformed values.
|
|
2293
2600
|
*
|
|
2601
|
+
* **When to use**
|
|
2602
|
+
*
|
|
2603
|
+
* Use when you need to take a prefix of elements while a function can
|
|
2604
|
+
* successfully extract or transform them, stopping at the first element
|
|
2605
|
+
* that produces a failure result.
|
|
2606
|
+
*
|
|
2294
2607
|
* **Details**
|
|
2295
2608
|
*
|
|
2296
2609
|
* - The filter receives `(element, index)`.
|
|
2297
2610
|
* - Stops at the first filter failure.
|
|
2298
2611
|
*
|
|
2612
|
+
* @see {@link takeWhile} for taking a prefix based on a boolean predicate
|
|
2613
|
+
*
|
|
2299
2614
|
* @category getters
|
|
2300
2615
|
* @since 4.0.0
|
|
2301
2616
|
*/
|
|
@@ -2332,6 +2647,11 @@ const spanIndex = <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean
|
|
|
2332
2647
|
* Splits an iterable into two arrays: the longest prefix where the predicate
|
|
2333
2648
|
* holds, and the remaining elements.
|
|
2334
2649
|
*
|
|
2650
|
+
* **When to use**
|
|
2651
|
+
*
|
|
2652
|
+
* Use to split an iterable into the longest prefix that satisfies a predicate
|
|
2653
|
+
* and the elements after that prefix when you need both parts.
|
|
2654
|
+
*
|
|
2335
2655
|
* **Details**
|
|
2336
2656
|
*
|
|
2337
2657
|
* - Equivalent to `[takeWhile(pred), dropWhile(pred)]` but more efficient
|
|
@@ -2346,9 +2666,9 @@ const spanIndex = <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean
|
|
|
2346
2666
|
* console.log(Array.span([1, 3, 2, 4, 5], (x) => x % 2 === 1)) // [[1, 3], [2, 4, 5]]
|
|
2347
2667
|
* ```
|
|
2348
2668
|
*
|
|
2349
|
-
* @see {@link takeWhile}
|
|
2350
|
-
* @see {@link dropWhile}
|
|
2351
|
-
* @see {@link splitWhere}
|
|
2669
|
+
* @see {@link takeWhile} for keeping only the matching prefix
|
|
2670
|
+
* @see {@link dropWhile} for keeping only the elements after the matching prefix
|
|
2671
|
+
* @see {@link splitWhere} for splitting at the first element that satisfies a predicate
|
|
2352
2672
|
*
|
|
2353
2673
|
* @category splitting
|
|
2354
2674
|
* @since 2.0.0
|
|
@@ -2358,6 +2678,11 @@ export const span: {
|
|
|
2358
2678
|
* Splits an iterable into two arrays: the longest prefix where the predicate
|
|
2359
2679
|
* holds, and the remaining elements.
|
|
2360
2680
|
*
|
|
2681
|
+
* **When to use**
|
|
2682
|
+
*
|
|
2683
|
+
* Use to split an iterable into the longest prefix that satisfies a predicate
|
|
2684
|
+
* and the elements after that prefix when you need both parts.
|
|
2685
|
+
*
|
|
2361
2686
|
* **Details**
|
|
2362
2687
|
*
|
|
2363
2688
|
* - Equivalent to `[takeWhile(pred), dropWhile(pred)]` but more efficient
|
|
@@ -2372,9 +2697,9 @@ export const span: {
|
|
|
2372
2697
|
* console.log(Array.span([1, 3, 2, 4, 5], (x) => x % 2 === 1)) // [[1, 3], [2, 4, 5]]
|
|
2373
2698
|
* ```
|
|
2374
2699
|
*
|
|
2375
|
-
* @see {@link takeWhile}
|
|
2376
|
-
* @see {@link dropWhile}
|
|
2377
|
-
* @see {@link splitWhere}
|
|
2700
|
+
* @see {@link takeWhile} for keeping only the matching prefix
|
|
2701
|
+
* @see {@link dropWhile} for keeping only the elements after the matching prefix
|
|
2702
|
+
* @see {@link splitWhere} for splitting at the first element that satisfies a predicate
|
|
2378
2703
|
*
|
|
2379
2704
|
* @category splitting
|
|
2380
2705
|
* @since 2.0.0
|
|
@@ -2384,6 +2709,11 @@ export const span: {
|
|
|
2384
2709
|
* Splits an iterable into two arrays: the longest prefix where the predicate
|
|
2385
2710
|
* holds, and the remaining elements.
|
|
2386
2711
|
*
|
|
2712
|
+
* **When to use**
|
|
2713
|
+
*
|
|
2714
|
+
* Use to split an iterable into the longest prefix that satisfies a predicate
|
|
2715
|
+
* and the elements after that prefix when you need both parts.
|
|
2716
|
+
*
|
|
2387
2717
|
* **Details**
|
|
2388
2718
|
*
|
|
2389
2719
|
* - Equivalent to `[takeWhile(pred), dropWhile(pred)]` but more efficient
|
|
@@ -2398,9 +2728,9 @@ export const span: {
|
|
|
2398
2728
|
* console.log(Array.span([1, 3, 2, 4, 5], (x) => x % 2 === 1)) // [[1, 3], [2, 4, 5]]
|
|
2399
2729
|
* ```
|
|
2400
2730
|
*
|
|
2401
|
-
* @see {@link takeWhile}
|
|
2402
|
-
* @see {@link dropWhile}
|
|
2403
|
-
* @see {@link splitWhere}
|
|
2731
|
+
* @see {@link takeWhile} for keeping only the matching prefix
|
|
2732
|
+
* @see {@link dropWhile} for keeping only the elements after the matching prefix
|
|
2733
|
+
* @see {@link splitWhere} for splitting at the first element that satisfies a predicate
|
|
2404
2734
|
*
|
|
2405
2735
|
* @category splitting
|
|
2406
2736
|
* @since 2.0.0
|
|
@@ -2410,6 +2740,11 @@ export const span: {
|
|
|
2410
2740
|
* Splits an iterable into two arrays: the longest prefix where the predicate
|
|
2411
2741
|
* holds, and the remaining elements.
|
|
2412
2742
|
*
|
|
2743
|
+
* **When to use**
|
|
2744
|
+
*
|
|
2745
|
+
* Use to split an iterable into the longest prefix that satisfies a predicate
|
|
2746
|
+
* and the elements after that prefix when you need both parts.
|
|
2747
|
+
*
|
|
2413
2748
|
* **Details**
|
|
2414
2749
|
*
|
|
2415
2750
|
* - Equivalent to `[takeWhile(pred), dropWhile(pred)]` but more efficient
|
|
@@ -2424,9 +2759,9 @@ export const span: {
|
|
|
2424
2759
|
* console.log(Array.span([1, 3, 2, 4, 5], (x) => x % 2 === 1)) // [[1, 3], [2, 4, 5]]
|
|
2425
2760
|
* ```
|
|
2426
2761
|
*
|
|
2427
|
-
* @see {@link takeWhile}
|
|
2428
|
-
* @see {@link dropWhile}
|
|
2429
|
-
* @see {@link splitWhere}
|
|
2762
|
+
* @see {@link takeWhile} for keeping only the matching prefix
|
|
2763
|
+
* @see {@link dropWhile} for keeping only the elements after the matching prefix
|
|
2764
|
+
* @see {@link splitWhere} for splitting at the first element that satisfies a predicate
|
|
2430
2765
|
*
|
|
2431
2766
|
* @category splitting
|
|
2432
2767
|
* @since 2.0.0
|
|
@@ -2436,6 +2771,11 @@ export const span: {
|
|
|
2436
2771
|
* Splits an iterable into two arrays: the longest prefix where the predicate
|
|
2437
2772
|
* holds, and the remaining elements.
|
|
2438
2773
|
*
|
|
2774
|
+
* **When to use**
|
|
2775
|
+
*
|
|
2776
|
+
* Use to split an iterable into the longest prefix that satisfies a predicate
|
|
2777
|
+
* and the elements after that prefix when you need both parts.
|
|
2778
|
+
*
|
|
2439
2779
|
* **Details**
|
|
2440
2780
|
*
|
|
2441
2781
|
* - Equivalent to `[takeWhile(pred), dropWhile(pred)]` but more efficient
|
|
@@ -2450,9 +2790,9 @@ export const span: {
|
|
|
2450
2790
|
* console.log(Array.span([1, 3, 2, 4, 5], (x) => x % 2 === 1)) // [[1, 3], [2, 4, 5]]
|
|
2451
2791
|
* ```
|
|
2452
2792
|
*
|
|
2453
|
-
* @see {@link takeWhile}
|
|
2454
|
-
* @see {@link dropWhile}
|
|
2455
|
-
* @see {@link splitWhere}
|
|
2793
|
+
* @see {@link takeWhile} for keeping only the matching prefix
|
|
2794
|
+
* @see {@link dropWhile} for keeping only the elements after the matching prefix
|
|
2795
|
+
* @see {@link splitWhere} for splitting at the first element that satisfies a predicate
|
|
2456
2796
|
*
|
|
2457
2797
|
* @category splitting
|
|
2458
2798
|
* @since 2.0.0
|
|
@@ -2469,6 +2809,11 @@ export const span: {
|
|
|
2469
2809
|
/**
|
|
2470
2810
|
* Removes the first `n` elements, creating a new array.
|
|
2471
2811
|
*
|
|
2812
|
+
* **When to use**
|
|
2813
|
+
*
|
|
2814
|
+
* Use to keep the suffix of an iterable after skipping a fixed number of
|
|
2815
|
+
* leading elements.
|
|
2816
|
+
*
|
|
2472
2817
|
* **Details**
|
|
2473
2818
|
*
|
|
2474
2819
|
* - `n` is clamped to `[0, length]`.
|
|
@@ -2482,9 +2827,9 @@ export const span: {
|
|
|
2482
2827
|
* console.log(Array.drop([1, 2, 3, 4, 5], 2)) // [3, 4, 5]
|
|
2483
2828
|
* ```
|
|
2484
2829
|
*
|
|
2485
|
-
* @see {@link dropRight}
|
|
2486
|
-
* @see {@link dropWhile}
|
|
2487
|
-
* @see {@link take}
|
|
2830
|
+
* @see {@link dropRight} for removing a fixed number of elements from the end
|
|
2831
|
+
* @see {@link dropWhile} for removing a prefix based on a predicate instead of a fixed count
|
|
2832
|
+
* @see {@link take} for keeping a fixed number of elements from the start
|
|
2488
2833
|
*
|
|
2489
2834
|
* @category getters
|
|
2490
2835
|
* @since 2.0.0
|
|
@@ -2493,6 +2838,11 @@ export const drop: {
|
|
|
2493
2838
|
/**
|
|
2494
2839
|
* Removes the first `n` elements, creating a new array.
|
|
2495
2840
|
*
|
|
2841
|
+
* **When to use**
|
|
2842
|
+
*
|
|
2843
|
+
* Use to keep the suffix of an iterable after skipping a fixed number of
|
|
2844
|
+
* leading elements.
|
|
2845
|
+
*
|
|
2496
2846
|
* **Details**
|
|
2497
2847
|
*
|
|
2498
2848
|
* - `n` is clamped to `[0, length]`.
|
|
@@ -2506,9 +2856,9 @@ export const drop: {
|
|
|
2506
2856
|
* console.log(Array.drop([1, 2, 3, 4, 5], 2)) // [3, 4, 5]
|
|
2507
2857
|
* ```
|
|
2508
2858
|
*
|
|
2509
|
-
* @see {@link dropRight}
|
|
2510
|
-
* @see {@link dropWhile}
|
|
2511
|
-
* @see {@link take}
|
|
2859
|
+
* @see {@link dropRight} for removing a fixed number of elements from the end
|
|
2860
|
+
* @see {@link dropWhile} for removing a prefix based on a predicate instead of a fixed count
|
|
2861
|
+
* @see {@link take} for keeping a fixed number of elements from the start
|
|
2512
2862
|
*
|
|
2513
2863
|
* @category getters
|
|
2514
2864
|
* @since 2.0.0
|
|
@@ -2517,6 +2867,11 @@ export const drop: {
|
|
|
2517
2867
|
/**
|
|
2518
2868
|
* Removes the first `n` elements, creating a new array.
|
|
2519
2869
|
*
|
|
2870
|
+
* **When to use**
|
|
2871
|
+
*
|
|
2872
|
+
* Use to keep the suffix of an iterable after skipping a fixed number of
|
|
2873
|
+
* leading elements.
|
|
2874
|
+
*
|
|
2520
2875
|
* **Details**
|
|
2521
2876
|
*
|
|
2522
2877
|
* - `n` is clamped to `[0, length]`.
|
|
@@ -2530,9 +2885,9 @@ export const drop: {
|
|
|
2530
2885
|
* console.log(Array.drop([1, 2, 3, 4, 5], 2)) // [3, 4, 5]
|
|
2531
2886
|
* ```
|
|
2532
2887
|
*
|
|
2533
|
-
* @see {@link dropRight}
|
|
2534
|
-
* @see {@link dropWhile}
|
|
2535
|
-
* @see {@link take}
|
|
2888
|
+
* @see {@link dropRight} for removing a fixed number of elements from the end
|
|
2889
|
+
* @see {@link dropWhile} for removing a prefix based on a predicate instead of a fixed count
|
|
2890
|
+
* @see {@link take} for keeping a fixed number of elements from the start
|
|
2536
2891
|
*
|
|
2537
2892
|
* @category getters
|
|
2538
2893
|
* @since 2.0.0
|
|
@@ -2546,9 +2901,13 @@ export const drop: {
|
|
|
2546
2901
|
/**
|
|
2547
2902
|
* Removes the last `n` elements, creating a new array.
|
|
2548
2903
|
*
|
|
2904
|
+
* **When to use**
|
|
2905
|
+
*
|
|
2906
|
+
* Use to remove the last `n` elements from an iterable.
|
|
2907
|
+
*
|
|
2549
2908
|
* **Details**
|
|
2550
2909
|
*
|
|
2551
|
-
*
|
|
2910
|
+
* `n` is clamped to `[0, length]`.
|
|
2552
2911
|
*
|
|
2553
2912
|
* **Example** (Dropping from the end)
|
|
2554
2913
|
*
|
|
@@ -2568,9 +2927,13 @@ export const dropRight: {
|
|
|
2568
2927
|
/**
|
|
2569
2928
|
* Removes the last `n` elements, creating a new array.
|
|
2570
2929
|
*
|
|
2930
|
+
* **When to use**
|
|
2931
|
+
*
|
|
2932
|
+
* Use to remove the last `n` elements from an iterable.
|
|
2933
|
+
*
|
|
2571
2934
|
* **Details**
|
|
2572
2935
|
*
|
|
2573
|
-
*
|
|
2936
|
+
* `n` is clamped to `[0, length]`.
|
|
2574
2937
|
*
|
|
2575
2938
|
* **Example** (Dropping from the end)
|
|
2576
2939
|
*
|
|
@@ -2590,9 +2953,13 @@ export const dropRight: {
|
|
|
2590
2953
|
/**
|
|
2591
2954
|
* Removes the last `n` elements, creating a new array.
|
|
2592
2955
|
*
|
|
2956
|
+
* **When to use**
|
|
2957
|
+
*
|
|
2958
|
+
* Use to remove the last `n` elements from an iterable.
|
|
2959
|
+
*
|
|
2593
2960
|
* **Details**
|
|
2594
2961
|
*
|
|
2595
|
-
*
|
|
2962
|
+
* `n` is clamped to `[0, length]`.
|
|
2596
2963
|
*
|
|
2597
2964
|
* **Example** (Dropping from the end)
|
|
2598
2965
|
*
|
|
@@ -2617,9 +2984,13 @@ export const dropRight: {
|
|
|
2617
2984
|
/**
|
|
2618
2985
|
* Drops elements from the start while the predicate holds, returning the rest.
|
|
2619
2986
|
*
|
|
2987
|
+
* **When to use**
|
|
2988
|
+
*
|
|
2989
|
+
* Use to remove a leading prefix of elements that satisfy a predicate.
|
|
2990
|
+
*
|
|
2620
2991
|
* **Details**
|
|
2621
2992
|
*
|
|
2622
|
-
*
|
|
2993
|
+
* The predicate receives `(element, index)`.
|
|
2623
2994
|
*
|
|
2624
2995
|
* **Example** (Dropping while condition holds)
|
|
2625
2996
|
*
|
|
@@ -2639,9 +3010,13 @@ export const dropWhile: {
|
|
|
2639
3010
|
/**
|
|
2640
3011
|
* Drops elements from the start while the predicate holds, returning the rest.
|
|
2641
3012
|
*
|
|
3013
|
+
* **When to use**
|
|
3014
|
+
*
|
|
3015
|
+
* Use to remove a leading prefix of elements that satisfy a predicate.
|
|
3016
|
+
*
|
|
2642
3017
|
* **Details**
|
|
2643
3018
|
*
|
|
2644
|
-
*
|
|
3019
|
+
* The predicate receives `(element, index)`.
|
|
2645
3020
|
*
|
|
2646
3021
|
* **Example** (Dropping while condition holds)
|
|
2647
3022
|
*
|
|
@@ -2661,9 +3036,13 @@ export const dropWhile: {
|
|
|
2661
3036
|
/**
|
|
2662
3037
|
* Drops elements from the start while the predicate holds, returning the rest.
|
|
2663
3038
|
*
|
|
3039
|
+
* **When to use**
|
|
3040
|
+
*
|
|
3041
|
+
* Use to remove a leading prefix of elements that satisfy a predicate.
|
|
3042
|
+
*
|
|
2664
3043
|
* **Details**
|
|
2665
3044
|
*
|
|
2666
|
-
*
|
|
3045
|
+
* The predicate receives `(element, index)`.
|
|
2667
3046
|
*
|
|
2668
3047
|
* **Example** (Dropping while condition holds)
|
|
2669
3048
|
*
|
|
@@ -2695,11 +3074,19 @@ export const dropWhile: {
|
|
|
2695
3074
|
/**
|
|
2696
3075
|
* Drops elements from the start while a `Filter` succeeds.
|
|
2697
3076
|
*
|
|
3077
|
+
* **When to use**
|
|
3078
|
+
*
|
|
3079
|
+
* Use when dropping a prefix requires computing a `Result` per element instead
|
|
3080
|
+
* of a simple boolean predicate.
|
|
3081
|
+
*
|
|
2698
3082
|
* **Details**
|
|
2699
3083
|
*
|
|
2700
3084
|
* - The filter receives `(element, index)`.
|
|
2701
3085
|
* - Returns the remaining original elements after the first filter failure.
|
|
2702
3086
|
*
|
|
3087
|
+
* @see {@link dropWhile} for dropping a prefix with a simple boolean predicate
|
|
3088
|
+
* @see {@link takeWhileFilter} for keeping only the matching prefix
|
|
3089
|
+
*
|
|
2703
3090
|
* @category getters
|
|
2704
3091
|
* @since 4.0.0
|
|
2705
3092
|
*/
|
|
@@ -2707,11 +3094,19 @@ export const dropWhileFilter: {
|
|
|
2707
3094
|
/**
|
|
2708
3095
|
* Drops elements from the start while a `Filter` succeeds.
|
|
2709
3096
|
*
|
|
3097
|
+
* **When to use**
|
|
3098
|
+
*
|
|
3099
|
+
* Use when dropping a prefix requires computing a `Result` per element instead
|
|
3100
|
+
* of a simple boolean predicate.
|
|
3101
|
+
*
|
|
2710
3102
|
* **Details**
|
|
2711
3103
|
*
|
|
2712
3104
|
* - The filter receives `(element, index)`.
|
|
2713
3105
|
* - Returns the remaining original elements after the first filter failure.
|
|
2714
3106
|
*
|
|
3107
|
+
* @see {@link dropWhile} for dropping a prefix with a simple boolean predicate
|
|
3108
|
+
* @see {@link takeWhileFilter} for keeping only the matching prefix
|
|
3109
|
+
*
|
|
2715
3110
|
* @category getters
|
|
2716
3111
|
* @since 4.0.0
|
|
2717
3112
|
*/
|
|
@@ -2719,11 +3114,19 @@ export const dropWhileFilter: {
|
|
|
2719
3114
|
/**
|
|
2720
3115
|
* Drops elements from the start while a `Filter` succeeds.
|
|
2721
3116
|
*
|
|
3117
|
+
* **When to use**
|
|
3118
|
+
*
|
|
3119
|
+
* Use when dropping a prefix requires computing a `Result` per element instead
|
|
3120
|
+
* of a simple boolean predicate.
|
|
3121
|
+
*
|
|
2722
3122
|
* **Details**
|
|
2723
3123
|
*
|
|
2724
3124
|
* - The filter receives `(element, index)`.
|
|
2725
3125
|
* - Returns the remaining original elements after the first filter failure.
|
|
2726
3126
|
*
|
|
3127
|
+
* @see {@link dropWhile} for dropping a prefix with a simple boolean predicate
|
|
3128
|
+
* @see {@link takeWhileFilter} for keeping only the matching prefix
|
|
3129
|
+
*
|
|
2727
3130
|
* @category getters
|
|
2728
3131
|
* @since 4.0.0
|
|
2729
3132
|
*/
|
|
@@ -2747,6 +3150,11 @@ export const dropWhileFilter: {
|
|
|
2747
3150
|
* Returns the index of the first element matching the predicate, wrapped in an
|
|
2748
3151
|
* `Option`.
|
|
2749
3152
|
*
|
|
3153
|
+
* **When to use**
|
|
3154
|
+
*
|
|
3155
|
+
* Use to find the index of the first matching element from the start of an
|
|
3156
|
+
* iterable.
|
|
3157
|
+
*
|
|
2750
3158
|
* **Example** (Finding an index)
|
|
2751
3159
|
*
|
|
2752
3160
|
* ```ts
|
|
@@ -2766,6 +3174,11 @@ export const findFirstIndex: {
|
|
|
2766
3174
|
* Returns the index of the first element matching the predicate, wrapped in an
|
|
2767
3175
|
* `Option`.
|
|
2768
3176
|
*
|
|
3177
|
+
* **When to use**
|
|
3178
|
+
*
|
|
3179
|
+
* Use to find the index of the first matching element from the start of an
|
|
3180
|
+
* iterable.
|
|
3181
|
+
*
|
|
2769
3182
|
* **Example** (Finding an index)
|
|
2770
3183
|
*
|
|
2771
3184
|
* ```ts
|
|
@@ -2785,6 +3198,11 @@ export const findFirstIndex: {
|
|
|
2785
3198
|
* Returns the index of the first element matching the predicate, wrapped in an
|
|
2786
3199
|
* `Option`.
|
|
2787
3200
|
*
|
|
3201
|
+
* **When to use**
|
|
3202
|
+
*
|
|
3203
|
+
* Use to find the index of the first matching element from the start of an
|
|
3204
|
+
* iterable.
|
|
3205
|
+
*
|
|
2788
3206
|
* **Example** (Finding an index)
|
|
2789
3207
|
*
|
|
2790
3208
|
* ```ts
|
|
@@ -2815,6 +3233,10 @@ export const findFirstIndex: {
|
|
|
2815
3233
|
* Returns the index of the last element matching the predicate, wrapped in an
|
|
2816
3234
|
* `Option`.
|
|
2817
3235
|
*
|
|
3236
|
+
* **When to use**
|
|
3237
|
+
*
|
|
3238
|
+
* Use to find the index of the last matching element from the end of an array.
|
|
3239
|
+
*
|
|
2818
3240
|
* **Example** (Finding the last matching index)
|
|
2819
3241
|
*
|
|
2820
3242
|
* ```ts
|
|
@@ -2834,6 +3256,10 @@ export const findLastIndex: {
|
|
|
2834
3256
|
* Returns the index of the last element matching the predicate, wrapped in an
|
|
2835
3257
|
* `Option`.
|
|
2836
3258
|
*
|
|
3259
|
+
* **When to use**
|
|
3260
|
+
*
|
|
3261
|
+
* Use to find the index of the last matching element from the end of an array.
|
|
3262
|
+
*
|
|
2837
3263
|
* **Example** (Finding the last matching index)
|
|
2838
3264
|
*
|
|
2839
3265
|
* ```ts
|
|
@@ -2853,6 +3279,10 @@ export const findLastIndex: {
|
|
|
2853
3279
|
* Returns the index of the last element matching the predicate, wrapped in an
|
|
2854
3280
|
* `Option`.
|
|
2855
3281
|
*
|
|
3282
|
+
* **When to use**
|
|
3283
|
+
*
|
|
3284
|
+
* Use to find the index of the last matching element from the end of an array.
|
|
3285
|
+
*
|
|
2856
3286
|
* **Example** (Finding the last matching index)
|
|
2857
3287
|
*
|
|
2858
3288
|
* ```ts
|
|
@@ -2882,6 +3312,11 @@ export const findLastIndex: {
|
|
|
2882
3312
|
* Returns the first element matching a predicate, refinement, or mapping
|
|
2883
3313
|
* function, wrapped in `Option`.
|
|
2884
3314
|
*
|
|
3315
|
+
* **When to use**
|
|
3316
|
+
*
|
|
3317
|
+
* Use to scan an iterable in iteration order and return the first selected
|
|
3318
|
+
* element or mapped value as an `Option`.
|
|
3319
|
+
*
|
|
2885
3320
|
* **Details**
|
|
2886
3321
|
*
|
|
2887
3322
|
* - Accepts a predicate `(a, i) => boolean`, a refinement, or a function
|
|
@@ -2908,6 +3343,11 @@ export const findFirst: {
|
|
|
2908
3343
|
* Returns the first element matching a predicate, refinement, or mapping
|
|
2909
3344
|
* function, wrapped in `Option`.
|
|
2910
3345
|
*
|
|
3346
|
+
* **When to use**
|
|
3347
|
+
*
|
|
3348
|
+
* Use to scan an iterable in iteration order and return the first selected
|
|
3349
|
+
* element or mapped value as an `Option`.
|
|
3350
|
+
*
|
|
2911
3351
|
* **Details**
|
|
2912
3352
|
*
|
|
2913
3353
|
* - Accepts a predicate `(a, i) => boolean`, a refinement, or a function
|
|
@@ -2934,6 +3374,11 @@ export const findFirst: {
|
|
|
2934
3374
|
* Returns the first element matching a predicate, refinement, or mapping
|
|
2935
3375
|
* function, wrapped in `Option`.
|
|
2936
3376
|
*
|
|
3377
|
+
* **When to use**
|
|
3378
|
+
*
|
|
3379
|
+
* Use to scan an iterable in iteration order and return the first selected
|
|
3380
|
+
* element or mapped value as an `Option`.
|
|
3381
|
+
*
|
|
2937
3382
|
* **Details**
|
|
2938
3383
|
*
|
|
2939
3384
|
* - Accepts a predicate `(a, i) => boolean`, a refinement, or a function
|
|
@@ -2960,6 +3405,11 @@ export const findFirst: {
|
|
|
2960
3405
|
* Returns the first element matching a predicate, refinement, or mapping
|
|
2961
3406
|
* function, wrapped in `Option`.
|
|
2962
3407
|
*
|
|
3408
|
+
* **When to use**
|
|
3409
|
+
*
|
|
3410
|
+
* Use to scan an iterable in iteration order and return the first selected
|
|
3411
|
+
* element or mapped value as an `Option`.
|
|
3412
|
+
*
|
|
2963
3413
|
* **Details**
|
|
2964
3414
|
*
|
|
2965
3415
|
* - Accepts a predicate `(a, i) => boolean`, a refinement, or a function
|
|
@@ -2986,6 +3436,11 @@ export const findFirst: {
|
|
|
2986
3436
|
* Returns the first element matching a predicate, refinement, or mapping
|
|
2987
3437
|
* function, wrapped in `Option`.
|
|
2988
3438
|
*
|
|
3439
|
+
* **When to use**
|
|
3440
|
+
*
|
|
3441
|
+
* Use to scan an iterable in iteration order and return the first selected
|
|
3442
|
+
* element or mapped value as an `Option`.
|
|
3443
|
+
*
|
|
2989
3444
|
* **Details**
|
|
2990
3445
|
*
|
|
2991
3446
|
* - Accepts a predicate `(a, i) => boolean`, a refinement, or a function
|
|
@@ -3012,6 +3467,11 @@ export const findFirst: {
|
|
|
3012
3467
|
* Returns the first element matching a predicate, refinement, or mapping
|
|
3013
3468
|
* function, wrapped in `Option`.
|
|
3014
3469
|
*
|
|
3470
|
+
* **When to use**
|
|
3471
|
+
*
|
|
3472
|
+
* Use to scan an iterable in iteration order and return the first selected
|
|
3473
|
+
* element or mapped value as an `Option`.
|
|
3474
|
+
*
|
|
3015
3475
|
* **Details**
|
|
3016
3476
|
*
|
|
3017
3477
|
* - Accepts a predicate `(a, i) => boolean`, a refinement, or a function
|
|
@@ -3038,6 +3498,11 @@ export const findFirst: {
|
|
|
3038
3498
|
* Returns the first element matching a predicate, refinement, or mapping
|
|
3039
3499
|
* function, wrapped in `Option`.
|
|
3040
3500
|
*
|
|
3501
|
+
* **When to use**
|
|
3502
|
+
*
|
|
3503
|
+
* Use to scan an iterable in iteration order and return the first selected
|
|
3504
|
+
* element or mapped value as an `Option`.
|
|
3505
|
+
*
|
|
3041
3506
|
* **Details**
|
|
3042
3507
|
*
|
|
3043
3508
|
* - Accepts a predicate `(a, i) => boolean`, a refinement, or a function
|
|
@@ -3066,6 +3531,10 @@ export const findFirst: {
|
|
|
3066
3531
|
* Returns the first selected value together with its index, wrapped in an
|
|
3067
3532
|
* `Option`.
|
|
3068
3533
|
*
|
|
3534
|
+
* **When to use**
|
|
3535
|
+
*
|
|
3536
|
+
* Use to find both the first matching element and its index in one pass.
|
|
3537
|
+
*
|
|
3069
3538
|
* **Details**
|
|
3070
3539
|
*
|
|
3071
3540
|
* Accepts a predicate, a refinement, or a function returning `Option`. For an
|
|
@@ -3091,6 +3560,10 @@ export const findFirstWithIndex: {
|
|
|
3091
3560
|
* Returns the first selected value together with its index, wrapped in an
|
|
3092
3561
|
* `Option`.
|
|
3093
3562
|
*
|
|
3563
|
+
* **When to use**
|
|
3564
|
+
*
|
|
3565
|
+
* Use to find both the first matching element and its index in one pass.
|
|
3566
|
+
*
|
|
3094
3567
|
* **Details**
|
|
3095
3568
|
*
|
|
3096
3569
|
* Accepts a predicate, a refinement, or a function returning `Option`. For an
|
|
@@ -3116,6 +3589,10 @@ export const findFirstWithIndex: {
|
|
|
3116
3589
|
* Returns the first selected value together with its index, wrapped in an
|
|
3117
3590
|
* `Option`.
|
|
3118
3591
|
*
|
|
3592
|
+
* **When to use**
|
|
3593
|
+
*
|
|
3594
|
+
* Use to find both the first matching element and its index in one pass.
|
|
3595
|
+
*
|
|
3119
3596
|
* **Details**
|
|
3120
3597
|
*
|
|
3121
3598
|
* Accepts a predicate, a refinement, or a function returning `Option`. For an
|
|
@@ -3141,6 +3618,10 @@ export const findFirstWithIndex: {
|
|
|
3141
3618
|
* Returns the first selected value together with its index, wrapped in an
|
|
3142
3619
|
* `Option`.
|
|
3143
3620
|
*
|
|
3621
|
+
* **When to use**
|
|
3622
|
+
*
|
|
3623
|
+
* Use to find both the first matching element and its index in one pass.
|
|
3624
|
+
*
|
|
3144
3625
|
* **Details**
|
|
3145
3626
|
*
|
|
3146
3627
|
* Accepts a predicate, a refinement, or a function returning `Option`. For an
|
|
@@ -3166,6 +3647,10 @@ export const findFirstWithIndex: {
|
|
|
3166
3647
|
* Returns the first selected value together with its index, wrapped in an
|
|
3167
3648
|
* `Option`.
|
|
3168
3649
|
*
|
|
3650
|
+
* **When to use**
|
|
3651
|
+
*
|
|
3652
|
+
* Use to find both the first matching element and its index in one pass.
|
|
3653
|
+
*
|
|
3169
3654
|
* **Details**
|
|
3170
3655
|
*
|
|
3171
3656
|
* Accepts a predicate, a refinement, or a function returning `Option`. For an
|
|
@@ -3191,6 +3676,10 @@ export const findFirstWithIndex: {
|
|
|
3191
3676
|
* Returns the first selected value together with its index, wrapped in an
|
|
3192
3677
|
* `Option`.
|
|
3193
3678
|
*
|
|
3679
|
+
* **When to use**
|
|
3680
|
+
*
|
|
3681
|
+
* Use to find both the first matching element and its index in one pass.
|
|
3682
|
+
*
|
|
3194
3683
|
* **Details**
|
|
3195
3684
|
*
|
|
3196
3685
|
* Accepts a predicate, a refinement, or a function returning `Option`. For an
|
|
@@ -3216,6 +3705,10 @@ export const findFirstWithIndex: {
|
|
|
3216
3705
|
* Returns the first selected value together with its index, wrapped in an
|
|
3217
3706
|
* `Option`.
|
|
3218
3707
|
*
|
|
3708
|
+
* **When to use**
|
|
3709
|
+
*
|
|
3710
|
+
* Use to find both the first matching element and its index in one pass.
|
|
3711
|
+
*
|
|
3219
3712
|
* **Details**
|
|
3220
3713
|
*
|
|
3221
3714
|
* Accepts a predicate, a refinement, or a function returning `Option`. For an
|
|
@@ -3265,6 +3758,10 @@ export const findFirstWithIndex: {
|
|
|
3265
3758
|
* Returns the last element matching a predicate, refinement, or mapping
|
|
3266
3759
|
* function, wrapped in `Option`.
|
|
3267
3760
|
*
|
|
3761
|
+
* **When to use**
|
|
3762
|
+
*
|
|
3763
|
+
* Use to find the last matching element from the end of an array.
|
|
3764
|
+
*
|
|
3268
3765
|
* **Details**
|
|
3269
3766
|
*
|
|
3270
3767
|
* - Searches from the end of the array.
|
|
@@ -3289,6 +3786,10 @@ export const findLast: {
|
|
|
3289
3786
|
* Returns the last element matching a predicate, refinement, or mapping
|
|
3290
3787
|
* function, wrapped in `Option`.
|
|
3291
3788
|
*
|
|
3789
|
+
* **When to use**
|
|
3790
|
+
*
|
|
3791
|
+
* Use to find the last matching element from the end of an array.
|
|
3792
|
+
*
|
|
3292
3793
|
* **Details**
|
|
3293
3794
|
*
|
|
3294
3795
|
* - Searches from the end of the array.
|
|
@@ -3313,6 +3814,10 @@ export const findLast: {
|
|
|
3313
3814
|
* Returns the last element matching a predicate, refinement, or mapping
|
|
3314
3815
|
* function, wrapped in `Option`.
|
|
3315
3816
|
*
|
|
3817
|
+
* **When to use**
|
|
3818
|
+
*
|
|
3819
|
+
* Use to find the last matching element from the end of an array.
|
|
3820
|
+
*
|
|
3316
3821
|
* **Details**
|
|
3317
3822
|
*
|
|
3318
3823
|
* - Searches from the end of the array.
|
|
@@ -3337,6 +3842,10 @@ export const findLast: {
|
|
|
3337
3842
|
* Returns the last element matching a predicate, refinement, or mapping
|
|
3338
3843
|
* function, wrapped in `Option`.
|
|
3339
3844
|
*
|
|
3845
|
+
* **When to use**
|
|
3846
|
+
*
|
|
3847
|
+
* Use to find the last matching element from the end of an array.
|
|
3848
|
+
*
|
|
3340
3849
|
* **Details**
|
|
3341
3850
|
*
|
|
3342
3851
|
* - Searches from the end of the array.
|
|
@@ -3361,6 +3870,10 @@ export const findLast: {
|
|
|
3361
3870
|
* Returns the last element matching a predicate, refinement, or mapping
|
|
3362
3871
|
* function, wrapped in `Option`.
|
|
3363
3872
|
*
|
|
3873
|
+
* **When to use**
|
|
3874
|
+
*
|
|
3875
|
+
* Use to find the last matching element from the end of an array.
|
|
3876
|
+
*
|
|
3364
3877
|
* **Details**
|
|
3365
3878
|
*
|
|
3366
3879
|
* - Searches from the end of the array.
|
|
@@ -3385,6 +3898,10 @@ export const findLast: {
|
|
|
3385
3898
|
* Returns the last element matching a predicate, refinement, or mapping
|
|
3386
3899
|
* function, wrapped in `Option`.
|
|
3387
3900
|
*
|
|
3901
|
+
* **When to use**
|
|
3902
|
+
*
|
|
3903
|
+
* Use to find the last matching element from the end of an array.
|
|
3904
|
+
*
|
|
3388
3905
|
* **Details**
|
|
3389
3906
|
*
|
|
3390
3907
|
* - Searches from the end of the array.
|
|
@@ -3409,6 +3926,10 @@ export const findLast: {
|
|
|
3409
3926
|
* Returns the last element matching a predicate, refinement, or mapping
|
|
3410
3927
|
* function, wrapped in `Option`.
|
|
3411
3928
|
*
|
|
3929
|
+
* **When to use**
|
|
3930
|
+
*
|
|
3931
|
+
* Use to find the last matching element from the end of an array.
|
|
3932
|
+
*
|
|
3412
3933
|
* **Details**
|
|
3413
3934
|
*
|
|
3414
3935
|
* - Searches from the end of the array.
|
|
@@ -3457,6 +3978,10 @@ export const findLast: {
|
|
|
3457
3978
|
* Inserts an element at the specified index, returning a new `NonEmptyArray`
|
|
3458
3979
|
* wrapped in an `Option`.
|
|
3459
3980
|
*
|
|
3981
|
+
* **When to use**
|
|
3982
|
+
*
|
|
3983
|
+
* Use to insert a single element at a specific position in an array.
|
|
3984
|
+
*
|
|
3460
3985
|
* **Details**
|
|
3461
3986
|
*
|
|
3462
3987
|
* - Valid indices: `0` to `length` (inclusive — inserting at `length` appends).
|
|
@@ -3481,6 +4006,10 @@ export const insertAt: {
|
|
|
3481
4006
|
* Inserts an element at the specified index, returning a new `NonEmptyArray`
|
|
3482
4007
|
* wrapped in an `Option`.
|
|
3483
4008
|
*
|
|
4009
|
+
* **When to use**
|
|
4010
|
+
*
|
|
4011
|
+
* Use to insert a single element at a specific position in an array.
|
|
4012
|
+
*
|
|
3484
4013
|
* **Details**
|
|
3485
4014
|
*
|
|
3486
4015
|
* - Valid indices: `0` to `length` (inclusive — inserting at `length` appends).
|
|
@@ -3505,6 +4034,10 @@ export const insertAt: {
|
|
|
3505
4034
|
* Inserts an element at the specified index, returning a new `NonEmptyArray`
|
|
3506
4035
|
* wrapped in an `Option`.
|
|
3507
4036
|
*
|
|
4037
|
+
* **When to use**
|
|
4038
|
+
*
|
|
4039
|
+
* Use to insert a single element at a specific position in an array.
|
|
4040
|
+
*
|
|
3508
4041
|
* **Details**
|
|
3509
4042
|
*
|
|
3510
4043
|
* - Valid indices: `0` to `length` (inclusive — inserting at `length` appends).
|
|
@@ -3538,6 +4071,10 @@ export const insertAt: {
|
|
|
3538
4071
|
* Replaces the element at the specified index with a new value, returning the
|
|
3539
4072
|
* updated array in `Option.some`.
|
|
3540
4073
|
*
|
|
4074
|
+
* **When to use**
|
|
4075
|
+
*
|
|
4076
|
+
* Use to set a fixed replacement value at a specific index.
|
|
4077
|
+
*
|
|
3541
4078
|
* **Details**
|
|
3542
4079
|
*
|
|
3543
4080
|
* - Returns `Option.none()` when the index is out of bounds.
|
|
@@ -3562,6 +4099,10 @@ export const replace: {
|
|
|
3562
4099
|
* Replaces the element at the specified index with a new value, returning the
|
|
3563
4100
|
* updated array in `Option.some`.
|
|
3564
4101
|
*
|
|
4102
|
+
* **When to use**
|
|
4103
|
+
*
|
|
4104
|
+
* Use to set a fixed replacement value at a specific index.
|
|
4105
|
+
*
|
|
3565
4106
|
* **Details**
|
|
3566
4107
|
*
|
|
3567
4108
|
* - Returns `Option.none()` when the index is out of bounds.
|
|
@@ -3588,6 +4129,10 @@ export const replace: {
|
|
|
3588
4129
|
* Replaces the element at the specified index with a new value, returning the
|
|
3589
4130
|
* updated array in `Option.some`.
|
|
3590
4131
|
*
|
|
4132
|
+
* **When to use**
|
|
4133
|
+
*
|
|
4134
|
+
* Use to set a fixed replacement value at a specific index.
|
|
4135
|
+
*
|
|
3591
4136
|
* **Details**
|
|
3592
4137
|
*
|
|
3593
4138
|
* - Returns `Option.none()` when the index is out of bounds.
|
|
@@ -3617,6 +4162,11 @@ export const replace: {
|
|
|
3617
4162
|
* Applies a function to the element at the specified index, returning the
|
|
3618
4163
|
* updated array in `Option.some`.
|
|
3619
4164
|
*
|
|
4165
|
+
* **When to use**
|
|
4166
|
+
*
|
|
4167
|
+
* Use to derive a replacement value from the current element at a specific
|
|
4168
|
+
* index while leaving the other elements unchanged.
|
|
4169
|
+
*
|
|
3620
4170
|
* **Details**
|
|
3621
4171
|
*
|
|
3622
4172
|
* - Returns `Option.none()` when the index is out of bounds.
|
|
@@ -3643,6 +4193,11 @@ export const modify: {
|
|
|
3643
4193
|
* Applies a function to the element at the specified index, returning the
|
|
3644
4194
|
* updated array in `Option.some`.
|
|
3645
4195
|
*
|
|
4196
|
+
* **When to use**
|
|
4197
|
+
*
|
|
4198
|
+
* Use to derive a replacement value from the current element at a specific
|
|
4199
|
+
* index while leaving the other elements unchanged.
|
|
4200
|
+
*
|
|
3646
4201
|
* **Details**
|
|
3647
4202
|
*
|
|
3648
4203
|
* - Returns `Option.none()` when the index is out of bounds.
|
|
@@ -3669,6 +4224,11 @@ export const modify: {
|
|
|
3669
4224
|
* Applies a function to the element at the specified index, returning the
|
|
3670
4225
|
* updated array in `Option.some`.
|
|
3671
4226
|
*
|
|
4227
|
+
* **When to use**
|
|
4228
|
+
*
|
|
4229
|
+
* Use to derive a replacement value from the current element at a specific
|
|
4230
|
+
* index while leaving the other elements unchanged.
|
|
4231
|
+
*
|
|
3672
4232
|
* **Details**
|
|
3673
4233
|
*
|
|
3674
4234
|
* - Returns `Option.none()` when the index is out of bounds.
|
|
@@ -3706,9 +4266,13 @@ export const modify: {
|
|
|
3706
4266
|
* Removes the element at the specified index, returning a new array. If the
|
|
3707
4267
|
* index is out of bounds, returns a copy of the original.
|
|
3708
4268
|
*
|
|
4269
|
+
* **When to use**
|
|
4270
|
+
*
|
|
4271
|
+
* Use to remove a single element at a known index.
|
|
4272
|
+
*
|
|
3709
4273
|
* **Details**
|
|
3710
4274
|
*
|
|
3711
|
-
*
|
|
4275
|
+
* Does not mutate the input.
|
|
3712
4276
|
*
|
|
3713
4277
|
* **Example** (Removing an element)
|
|
3714
4278
|
*
|
|
@@ -3730,9 +4294,13 @@ export const remove: {
|
|
|
3730
4294
|
* Removes the element at the specified index, returning a new array. If the
|
|
3731
4295
|
* index is out of bounds, returns a copy of the original.
|
|
3732
4296
|
*
|
|
4297
|
+
* **When to use**
|
|
4298
|
+
*
|
|
4299
|
+
* Use to remove a single element at a known index.
|
|
4300
|
+
*
|
|
3733
4301
|
* **Details**
|
|
3734
4302
|
*
|
|
3735
|
-
*
|
|
4303
|
+
* Does not mutate the input.
|
|
3736
4304
|
*
|
|
3737
4305
|
* **Example** (Removing an element)
|
|
3738
4306
|
*
|
|
@@ -3754,9 +4322,13 @@ export const remove: {
|
|
|
3754
4322
|
* Removes the element at the specified index, returning a new array. If the
|
|
3755
4323
|
* index is out of bounds, returns a copy of the original.
|
|
3756
4324
|
*
|
|
4325
|
+
* **When to use**
|
|
4326
|
+
*
|
|
4327
|
+
* Use to remove a single element at a known index.
|
|
4328
|
+
*
|
|
3757
4329
|
* **Details**
|
|
3758
4330
|
*
|
|
3759
|
-
*
|
|
4331
|
+
* Does not mutate the input.
|
|
3760
4332
|
*
|
|
3761
4333
|
* **Example** (Removing an element)
|
|
3762
4334
|
*
|
|
@@ -3786,6 +4358,10 @@ export const remove: {
|
|
|
3786
4358
|
/**
|
|
3787
4359
|
* Reverses an iterable into a new array.
|
|
3788
4360
|
*
|
|
4361
|
+
* **When to use**
|
|
4362
|
+
*
|
|
4363
|
+
* Use to reverse the order of elements without mutating the original input.
|
|
4364
|
+
*
|
|
3789
4365
|
* **Details**
|
|
3790
4366
|
*
|
|
3791
4367
|
* - Does not mutate the input.
|
|
@@ -3810,6 +4386,10 @@ export const reverse = <S extends Iterable<any>>(
|
|
|
3810
4386
|
/**
|
|
3811
4387
|
* Sorts an array by the given `Order`, returning a new array.
|
|
3812
4388
|
*
|
|
4389
|
+
* **When to use**
|
|
4390
|
+
*
|
|
4391
|
+
* Use to sort an array using a single `Order` comparator.
|
|
4392
|
+
*
|
|
3813
4393
|
* **Details**
|
|
3814
4394
|
*
|
|
3815
4395
|
* - Does not mutate the input.
|
|
@@ -3835,6 +4415,10 @@ export const sort: {
|
|
|
3835
4415
|
/**
|
|
3836
4416
|
* Sorts an array by the given `Order`, returning a new array.
|
|
3837
4417
|
*
|
|
4418
|
+
* **When to use**
|
|
4419
|
+
*
|
|
4420
|
+
* Use to sort an array using a single `Order` comparator.
|
|
4421
|
+
*
|
|
3838
4422
|
* **Details**
|
|
3839
4423
|
*
|
|
3840
4424
|
* - Does not mutate the input.
|
|
@@ -3860,6 +4444,10 @@ export const sort: {
|
|
|
3860
4444
|
/**
|
|
3861
4445
|
* Sorts an array by the given `Order`, returning a new array.
|
|
3862
4446
|
*
|
|
4447
|
+
* **When to use**
|
|
4448
|
+
*
|
|
4449
|
+
* Use to sort an array using a single `Order` comparator.
|
|
4450
|
+
*
|
|
3863
4451
|
* **Details**
|
|
3864
4452
|
*
|
|
3865
4453
|
* - Does not mutate the input.
|
|
@@ -3885,6 +4473,10 @@ export const sort: {
|
|
|
3885
4473
|
/**
|
|
3886
4474
|
* Sorts an array by the given `Order`, returning a new array.
|
|
3887
4475
|
*
|
|
4476
|
+
* **When to use**
|
|
4477
|
+
*
|
|
4478
|
+
* Use to sort an array using a single `Order` comparator.
|
|
4479
|
+
*
|
|
3888
4480
|
* **Details**
|
|
3889
4481
|
*
|
|
3890
4482
|
* - Does not mutate the input.
|
|
@@ -3917,6 +4509,11 @@ export const sort: {
|
|
|
3917
4509
|
* Sorts an array by a derived key using a mapping function and an `Order` for
|
|
3918
4510
|
* that key.
|
|
3919
4511
|
*
|
|
4512
|
+
* **When to use**
|
|
4513
|
+
*
|
|
4514
|
+
* Use when values need to be sorted by a derived key, such as a string length
|
|
4515
|
+
* or object field, while the output should keep the original values.
|
|
4516
|
+
*
|
|
3920
4517
|
* **Details**
|
|
3921
4518
|
*
|
|
3922
4519
|
* - Equivalent to `sort(Order.mapInput(order, f))` but more convenient.
|
|
@@ -3931,8 +4528,8 @@ export const sort: {
|
|
|
3931
4528
|
* // ["b", "cc", "aaa"]
|
|
3932
4529
|
* ```
|
|
3933
4530
|
*
|
|
3934
|
-
* @see {@link sort}
|
|
3935
|
-
* @see {@link sortBy}
|
|
4531
|
+
* @see {@link sort} for sorting with an `Order` that compares the elements directly
|
|
4532
|
+
* @see {@link sortBy} for sorting with multiple `Order`s applied in sequence
|
|
3936
4533
|
*
|
|
3937
4534
|
* @category elements
|
|
3938
4535
|
* @since 2.0.0
|
|
@@ -3942,6 +4539,11 @@ export const sortWith: {
|
|
|
3942
4539
|
* Sorts an array by a derived key using a mapping function and an `Order` for
|
|
3943
4540
|
* that key.
|
|
3944
4541
|
*
|
|
4542
|
+
* **When to use**
|
|
4543
|
+
*
|
|
4544
|
+
* Use when values need to be sorted by a derived key, such as a string length
|
|
4545
|
+
* or object field, while the output should keep the original values.
|
|
4546
|
+
*
|
|
3945
4547
|
* **Details**
|
|
3946
4548
|
*
|
|
3947
4549
|
* - Equivalent to `sort(Order.mapInput(order, f))` but more convenient.
|
|
@@ -3956,8 +4558,8 @@ export const sortWith: {
|
|
|
3956
4558
|
* // ["b", "cc", "aaa"]
|
|
3957
4559
|
* ```
|
|
3958
4560
|
*
|
|
3959
|
-
* @see {@link sort}
|
|
3960
|
-
* @see {@link sortBy}
|
|
4561
|
+
* @see {@link sort} for sorting with an `Order` that compares the elements directly
|
|
4562
|
+
* @see {@link sortBy} for sorting with multiple `Order`s applied in sequence
|
|
3961
4563
|
*
|
|
3962
4564
|
* @category elements
|
|
3963
4565
|
* @since 2.0.0
|
|
@@ -3967,6 +4569,11 @@ export const sortWith: {
|
|
|
3967
4569
|
* Sorts an array by a derived key using a mapping function and an `Order` for
|
|
3968
4570
|
* that key.
|
|
3969
4571
|
*
|
|
4572
|
+
* **When to use**
|
|
4573
|
+
*
|
|
4574
|
+
* Use when values need to be sorted by a derived key, such as a string length
|
|
4575
|
+
* or object field, while the output should keep the original values.
|
|
4576
|
+
*
|
|
3970
4577
|
* **Details**
|
|
3971
4578
|
*
|
|
3972
4579
|
* - Equivalent to `sort(Order.mapInput(order, f))` but more convenient.
|
|
@@ -3981,8 +4588,8 @@ export const sortWith: {
|
|
|
3981
4588
|
* // ["b", "cc", "aaa"]
|
|
3982
4589
|
* ```
|
|
3983
4590
|
*
|
|
3984
|
-
* @see {@link sort}
|
|
3985
|
-
* @see {@link sortBy}
|
|
4591
|
+
* @see {@link sort} for sorting with an `Order` that compares the elements directly
|
|
4592
|
+
* @see {@link sortBy} for sorting with multiple `Order`s applied in sequence
|
|
3986
4593
|
*
|
|
3987
4594
|
* @category elements
|
|
3988
4595
|
* @since 2.0.0
|
|
@@ -3992,6 +4599,11 @@ export const sortWith: {
|
|
|
3992
4599
|
* Sorts an array by a derived key using a mapping function and an `Order` for
|
|
3993
4600
|
* that key.
|
|
3994
4601
|
*
|
|
4602
|
+
* **When to use**
|
|
4603
|
+
*
|
|
4604
|
+
* Use when values need to be sorted by a derived key, such as a string length
|
|
4605
|
+
* or object field, while the output should keep the original values.
|
|
4606
|
+
*
|
|
3995
4607
|
* **Details**
|
|
3996
4608
|
*
|
|
3997
4609
|
* - Equivalent to `sort(Order.mapInput(order, f))` but more convenient.
|
|
@@ -4006,8 +4618,8 @@ export const sortWith: {
|
|
|
4006
4618
|
* // ["b", "cc", "aaa"]
|
|
4007
4619
|
* ```
|
|
4008
4620
|
*
|
|
4009
|
-
* @see {@link sort}
|
|
4010
|
-
* @see {@link sortBy}
|
|
4621
|
+
* @see {@link sort} for sorting with an `Order` that compares the elements directly
|
|
4622
|
+
* @see {@link sortBy} for sorting with multiple `Order`s applied in sequence
|
|
4011
4623
|
*
|
|
4012
4624
|
* @category elements
|
|
4013
4625
|
* @since 2.0.0
|
|
@@ -4023,6 +4635,11 @@ export const sortWith: {
|
|
|
4023
4635
|
* Sorts an array by multiple `Order`s applied in sequence: the first order is
|
|
4024
4636
|
* used first; ties are broken by the second order, and so on.
|
|
4025
4637
|
*
|
|
4638
|
+
* **When to use**
|
|
4639
|
+
*
|
|
4640
|
+
* Use to sort by multiple criteria where later orders break ties from earlier
|
|
4641
|
+
* ones.
|
|
4642
|
+
*
|
|
4026
4643
|
* **Details**
|
|
4027
4644
|
*
|
|
4028
4645
|
* - Data-last only (returns a function).
|
|
@@ -4075,6 +4692,10 @@ export const sortBy = <S extends Iterable<any>>(
|
|
|
4075
4692
|
* Pairs elements from two iterables by position. If the iterables differ in
|
|
4076
4693
|
* length, the extra elements from the longer one are discarded.
|
|
4077
4694
|
*
|
|
4695
|
+
* **When to use**
|
|
4696
|
+
*
|
|
4697
|
+
* Use to pair corresponding elements from two iterables when you need simple pairs without a custom combiner.
|
|
4698
|
+
*
|
|
4078
4699
|
* **Details**
|
|
4079
4700
|
*
|
|
4080
4701
|
* - Returns `NonEmptyArray` when both inputs are non-empty.
|
|
@@ -4098,6 +4719,10 @@ export const zip: {
|
|
|
4098
4719
|
* Pairs elements from two iterables by position. If the iterables differ in
|
|
4099
4720
|
* length, the extra elements from the longer one are discarded.
|
|
4100
4721
|
*
|
|
4722
|
+
* **When to use**
|
|
4723
|
+
*
|
|
4724
|
+
* Use to pair corresponding elements from two iterables when you need simple pairs without a custom combiner.
|
|
4725
|
+
*
|
|
4101
4726
|
* **Details**
|
|
4102
4727
|
*
|
|
4103
4728
|
* - Returns `NonEmptyArray` when both inputs are non-empty.
|
|
@@ -4121,6 +4746,10 @@ export const zip: {
|
|
|
4121
4746
|
* Pairs elements from two iterables by position. If the iterables differ in
|
|
4122
4747
|
* length, the extra elements from the longer one are discarded.
|
|
4123
4748
|
*
|
|
4749
|
+
* **When to use**
|
|
4750
|
+
*
|
|
4751
|
+
* Use to pair corresponding elements from two iterables when you need simple pairs without a custom combiner.
|
|
4752
|
+
*
|
|
4124
4753
|
* **Details**
|
|
4125
4754
|
*
|
|
4126
4755
|
* - Returns `NonEmptyArray` when both inputs are non-empty.
|
|
@@ -4144,6 +4773,10 @@ export const zip: {
|
|
|
4144
4773
|
* Pairs elements from two iterables by position. If the iterables differ in
|
|
4145
4774
|
* length, the extra elements from the longer one are discarded.
|
|
4146
4775
|
*
|
|
4776
|
+
* **When to use**
|
|
4777
|
+
*
|
|
4778
|
+
* Use to pair corresponding elements from two iterables when you need simple pairs without a custom combiner.
|
|
4779
|
+
*
|
|
4147
4780
|
* **Details**
|
|
4148
4781
|
*
|
|
4149
4782
|
* - Returns `NonEmptyArray` when both inputs are non-empty.
|
|
@@ -4167,6 +4800,10 @@ export const zip: {
|
|
|
4167
4800
|
* Pairs elements from two iterables by position. If the iterables differ in
|
|
4168
4801
|
* length, the extra elements from the longer one are discarded.
|
|
4169
4802
|
*
|
|
4803
|
+
* **When to use**
|
|
4804
|
+
*
|
|
4805
|
+
* Use to pair corresponding elements from two iterables when you need simple pairs without a custom combiner.
|
|
4806
|
+
*
|
|
4170
4807
|
* **Details**
|
|
4171
4808
|
*
|
|
4172
4809
|
* - Returns `NonEmptyArray` when both inputs are non-empty.
|
|
@@ -4336,6 +4973,10 @@ export const unzip: <S extends Iterable<readonly [any, any]>>(
|
|
|
4336
4973
|
/**
|
|
4337
4974
|
* Places a separator element between every pair of elements.
|
|
4338
4975
|
*
|
|
4976
|
+
* **When to use**
|
|
4977
|
+
*
|
|
4978
|
+
* Use to insert a separator between elements, for example when preparing data for display or concatenation.
|
|
4979
|
+
*
|
|
4339
4980
|
* **Details**
|
|
4340
4981
|
*
|
|
4341
4982
|
* - Preserves `NonEmptyArray` in the return type.
|
|
@@ -4358,6 +4999,10 @@ export const intersperse: {
|
|
|
4358
4999
|
/**
|
|
4359
5000
|
* Places a separator element between every pair of elements.
|
|
4360
5001
|
*
|
|
5002
|
+
* **When to use**
|
|
5003
|
+
*
|
|
5004
|
+
* Use to insert a separator between elements, for example when preparing data for display or concatenation.
|
|
5005
|
+
*
|
|
4361
5006
|
* **Details**
|
|
4362
5007
|
*
|
|
4363
5008
|
* - Preserves `NonEmptyArray` in the return type.
|
|
@@ -4380,6 +5025,10 @@ export const intersperse: {
|
|
|
4380
5025
|
/**
|
|
4381
5026
|
* Places a separator element between every pair of elements.
|
|
4382
5027
|
*
|
|
5028
|
+
* **When to use**
|
|
5029
|
+
*
|
|
5030
|
+
* Use to insert a separator between elements, for example when preparing data for display or concatenation.
|
|
5031
|
+
*
|
|
4383
5032
|
* **Details**
|
|
4384
5033
|
*
|
|
4385
5034
|
* - Preserves `NonEmptyArray` in the return type.
|
|
@@ -4402,6 +5051,10 @@ export const intersperse: {
|
|
|
4402
5051
|
/**
|
|
4403
5052
|
* Places a separator element between every pair of elements.
|
|
4404
5053
|
*
|
|
5054
|
+
* **When to use**
|
|
5055
|
+
*
|
|
5056
|
+
* Use to insert a separator between elements, for example when preparing data for display or concatenation.
|
|
5057
|
+
*
|
|
4405
5058
|
* **Details**
|
|
4406
5059
|
*
|
|
4407
5060
|
* - Preserves `NonEmptyArray` in the return type.
|
|
@@ -4441,6 +5094,10 @@ export const intersperse: {
|
|
|
4441
5094
|
* Applies a function to the first element of a non-empty array, returning a
|
|
4442
5095
|
* new array.
|
|
4443
5096
|
*
|
|
5097
|
+
* **When to use**
|
|
5098
|
+
*
|
|
5099
|
+
* Use to transform the first element of a non-empty array while preserving the rest.
|
|
5100
|
+
*
|
|
4444
5101
|
* **Example** (Modifying the head)
|
|
4445
5102
|
*
|
|
4446
5103
|
* ```ts
|
|
@@ -4460,6 +5117,10 @@ export const modifyHeadNonEmpty: {
|
|
|
4460
5117
|
* Applies a function to the first element of a non-empty array, returning a
|
|
4461
5118
|
* new array.
|
|
4462
5119
|
*
|
|
5120
|
+
* **When to use**
|
|
5121
|
+
*
|
|
5122
|
+
* Use to transform the first element of a non-empty array while preserving the rest.
|
|
5123
|
+
*
|
|
4463
5124
|
* **Example** (Modifying the head)
|
|
4464
5125
|
*
|
|
4465
5126
|
* ```ts
|
|
@@ -4479,6 +5140,10 @@ export const modifyHeadNonEmpty: {
|
|
|
4479
5140
|
* Applies a function to the first element of a non-empty array, returning a
|
|
4480
5141
|
* new array.
|
|
4481
5142
|
*
|
|
5143
|
+
* **When to use**
|
|
5144
|
+
*
|
|
5145
|
+
* Use to transform the first element of a non-empty array while preserving the rest.
|
|
5146
|
+
*
|
|
4482
5147
|
* **Example** (Modifying the head)
|
|
4483
5148
|
*
|
|
4484
5149
|
* ```ts
|
|
@@ -4687,6 +5352,11 @@ export const setLastNonEmpty: {
|
|
|
4687
5352
|
* Rotates an array by `n` steps. Positive `n` rotates right; negative `n`
|
|
4688
5353
|
* rotates left.
|
|
4689
5354
|
*
|
|
5355
|
+
* **When to use**
|
|
5356
|
+
*
|
|
5357
|
+
* Use when elements should wrap around the end of the array rather than being
|
|
5358
|
+
* dropped.
|
|
5359
|
+
*
|
|
4690
5360
|
* **Details**
|
|
4691
5361
|
*
|
|
4692
5362
|
* - `n` is rounded to the nearest integer before rotating.
|
|
@@ -4701,6 +5371,9 @@ export const setLastNonEmpty: {
|
|
|
4701
5371
|
* console.log(Array.rotate(["a", "b", "c", "d"], 2)) // ["c", "d", "a", "b"]
|
|
4702
5372
|
* ```
|
|
4703
5373
|
*
|
|
5374
|
+
* @see {@link take} for taking a fixed number of elements from the start
|
|
5375
|
+
* @see {@link drop} for dropping a fixed number of elements from the start
|
|
5376
|
+
*
|
|
4704
5377
|
* @category elements
|
|
4705
5378
|
* @since 2.0.0
|
|
4706
5379
|
*/
|
|
@@ -4709,6 +5382,11 @@ export const rotate: {
|
|
|
4709
5382
|
* Rotates an array by `n` steps. Positive `n` rotates right; negative `n`
|
|
4710
5383
|
* rotates left.
|
|
4711
5384
|
*
|
|
5385
|
+
* **When to use**
|
|
5386
|
+
*
|
|
5387
|
+
* Use when elements should wrap around the end of the array rather than being
|
|
5388
|
+
* dropped.
|
|
5389
|
+
*
|
|
4712
5390
|
* **Details**
|
|
4713
5391
|
*
|
|
4714
5392
|
* - `n` is rounded to the nearest integer before rotating.
|
|
@@ -4723,6 +5401,9 @@ export const rotate: {
|
|
|
4723
5401
|
* console.log(Array.rotate(["a", "b", "c", "d"], 2)) // ["c", "d", "a", "b"]
|
|
4724
5402
|
* ```
|
|
4725
5403
|
*
|
|
5404
|
+
* @see {@link take} for taking a fixed number of elements from the start
|
|
5405
|
+
* @see {@link drop} for dropping a fixed number of elements from the start
|
|
5406
|
+
*
|
|
4726
5407
|
* @category elements
|
|
4727
5408
|
* @since 2.0.0
|
|
4728
5409
|
*/
|
|
@@ -4731,6 +5412,11 @@ export const rotate: {
|
|
|
4731
5412
|
* Rotates an array by `n` steps. Positive `n` rotates right; negative `n`
|
|
4732
5413
|
* rotates left.
|
|
4733
5414
|
*
|
|
5415
|
+
* **When to use**
|
|
5416
|
+
*
|
|
5417
|
+
* Use when elements should wrap around the end of the array rather than being
|
|
5418
|
+
* dropped.
|
|
5419
|
+
*
|
|
4734
5420
|
* **Details**
|
|
4735
5421
|
*
|
|
4736
5422
|
* - `n` is rounded to the nearest integer before rotating.
|
|
@@ -4745,6 +5431,9 @@ export const rotate: {
|
|
|
4745
5431
|
* console.log(Array.rotate(["a", "b", "c", "d"], 2)) // ["c", "d", "a", "b"]
|
|
4746
5432
|
* ```
|
|
4747
5433
|
*
|
|
5434
|
+
* @see {@link take} for taking a fixed number of elements from the start
|
|
5435
|
+
* @see {@link drop} for dropping a fixed number of elements from the start
|
|
5436
|
+
*
|
|
4748
5437
|
* @category elements
|
|
4749
5438
|
* @since 2.0.0
|
|
4750
5439
|
*/
|
|
@@ -4753,6 +5442,11 @@ export const rotate: {
|
|
|
4753
5442
|
* Rotates an array by `n` steps. Positive `n` rotates right; negative `n`
|
|
4754
5443
|
* rotates left.
|
|
4755
5444
|
*
|
|
5445
|
+
* **When to use**
|
|
5446
|
+
*
|
|
5447
|
+
* Use when elements should wrap around the end of the array rather than being
|
|
5448
|
+
* dropped.
|
|
5449
|
+
*
|
|
4756
5450
|
* **Details**
|
|
4757
5451
|
*
|
|
4758
5452
|
* - `n` is rounded to the nearest integer before rotating.
|
|
@@ -4767,6 +5461,9 @@ export const rotate: {
|
|
|
4767
5461
|
* console.log(Array.rotate(["a", "b", "c", "d"], 2)) // ["c", "d", "a", "b"]
|
|
4768
5462
|
* ```
|
|
4769
5463
|
*
|
|
5464
|
+
* @see {@link take} for taking a fixed number of elements from the start
|
|
5465
|
+
* @see {@link drop} for dropping a fixed number of elements from the start
|
|
5466
|
+
*
|
|
4770
5467
|
* @category elements
|
|
4771
5468
|
* @since 2.0.0
|
|
4772
5469
|
*/
|
|
@@ -4792,6 +5489,11 @@ export const rotate: {
|
|
|
4792
5489
|
/**
|
|
4793
5490
|
* Returns a membership-test function using a custom equivalence.
|
|
4794
5491
|
*
|
|
5492
|
+
* **When to use**
|
|
5493
|
+
*
|
|
5494
|
+
* Use when checking membership with caller-provided equality instead of
|
|
5495
|
+
* `Equal.equivalence()`.
|
|
5496
|
+
*
|
|
4795
5497
|
* **Example** (Custom equality check)
|
|
4796
5498
|
*
|
|
4797
5499
|
* ```ts
|
|
@@ -4801,7 +5503,7 @@ export const rotate: {
|
|
|
4801
5503
|
* console.log(pipe([1, 2, 3, 4], containsNumber(3))) // true
|
|
4802
5504
|
* ```
|
|
4803
5505
|
*
|
|
4804
|
-
* @see {@link contains}
|
|
5506
|
+
* @see {@link contains} for the `Equal.equivalence()` variant
|
|
4805
5507
|
*
|
|
4806
5508
|
* @category elements
|
|
4807
5509
|
* @since 2.0.0
|
|
@@ -4823,6 +5525,11 @@ export const containsWith = <A>(isEquivalent: (self: A, that: A) => boolean): {
|
|
|
4823
5525
|
* Tests whether an array contains a value, using `Equal.equivalence()` for
|
|
4824
5526
|
* comparison.
|
|
4825
5527
|
*
|
|
5528
|
+
* **When to use**
|
|
5529
|
+
*
|
|
5530
|
+
* Use to check membership with Effect's default equality instead of providing a
|
|
5531
|
+
* comparison function.
|
|
5532
|
+
*
|
|
4826
5533
|
* **Example** (Checking membership)
|
|
4827
5534
|
*
|
|
4828
5535
|
* ```ts
|
|
@@ -4841,6 +5548,11 @@ export const contains: {
|
|
|
4841
5548
|
* Tests whether an array contains a value, using `Equal.equivalence()` for
|
|
4842
5549
|
* comparison.
|
|
4843
5550
|
*
|
|
5551
|
+
* **When to use**
|
|
5552
|
+
*
|
|
5553
|
+
* Use to check membership with Effect's default equality instead of providing a
|
|
5554
|
+
* comparison function.
|
|
5555
|
+
*
|
|
4844
5556
|
* **Example** (Checking membership)
|
|
4845
5557
|
*
|
|
4846
5558
|
* ```ts
|
|
@@ -4859,6 +5571,11 @@ export const contains: {
|
|
|
4859
5571
|
* Tests whether an array contains a value, using `Equal.equivalence()` for
|
|
4860
5572
|
* comparison.
|
|
4861
5573
|
*
|
|
5574
|
+
* **When to use**
|
|
5575
|
+
*
|
|
5576
|
+
* Use to check membership with Effect's default equality instead of providing a
|
|
5577
|
+
* comparison function.
|
|
5578
|
+
*
|
|
4862
5579
|
* **Example** (Checking membership)
|
|
4863
5580
|
*
|
|
4864
5581
|
* ```ts
|
|
@@ -4879,6 +5596,11 @@ export const contains: {
|
|
|
4879
5596
|
* Repeatedly applies a function that consumes a prefix of the array and
|
|
4880
5597
|
* produces a value plus the remaining elements, collecting the values.
|
|
4881
5598
|
*
|
|
5599
|
+
* **When to use**
|
|
5600
|
+
*
|
|
5601
|
+
* Use when the grouping logic is custom and each step needs to return both a
|
|
5602
|
+
* value and the remaining input.
|
|
5603
|
+
*
|
|
4882
5604
|
* **Details**
|
|
4883
5605
|
*
|
|
4884
5606
|
* - The function receives a `NonEmptyReadonlyArray` and returns
|
|
@@ -4909,6 +5631,11 @@ export const chop: {
|
|
|
4909
5631
|
* Repeatedly applies a function that consumes a prefix of the array and
|
|
4910
5632
|
* produces a value plus the remaining elements, collecting the values.
|
|
4911
5633
|
*
|
|
5634
|
+
* **When to use**
|
|
5635
|
+
*
|
|
5636
|
+
* Use when the grouping logic is custom and each step needs to return both a
|
|
5637
|
+
* value and the remaining input.
|
|
5638
|
+
*
|
|
4912
5639
|
* **Details**
|
|
4913
5640
|
*
|
|
4914
5641
|
* - The function receives a `NonEmptyReadonlyArray` and returns
|
|
@@ -4941,6 +5668,11 @@ export const chop: {
|
|
|
4941
5668
|
* Repeatedly applies a function that consumes a prefix of the array and
|
|
4942
5669
|
* produces a value plus the remaining elements, collecting the values.
|
|
4943
5670
|
*
|
|
5671
|
+
* **When to use**
|
|
5672
|
+
*
|
|
5673
|
+
* Use when the grouping logic is custom and each step needs to return both a
|
|
5674
|
+
* value and the remaining input.
|
|
5675
|
+
*
|
|
4944
5676
|
* **Details**
|
|
4945
5677
|
*
|
|
4946
5678
|
* - The function receives a `NonEmptyReadonlyArray` and returns
|
|
@@ -4974,6 +5706,11 @@ export const chop: {
|
|
|
4974
5706
|
* Repeatedly applies a function that consumes a prefix of the array and
|
|
4975
5707
|
* produces a value plus the remaining elements, collecting the values.
|
|
4976
5708
|
*
|
|
5709
|
+
* **When to use**
|
|
5710
|
+
*
|
|
5711
|
+
* Use when the grouping logic is custom and each step needs to return both a
|
|
5712
|
+
* value and the remaining input.
|
|
5713
|
+
*
|
|
4977
5714
|
* **Details**
|
|
4978
5715
|
*
|
|
4979
5716
|
* - The function receives a `NonEmptyReadonlyArray` and returns
|
|
@@ -5025,6 +5762,10 @@ export const chop: {
|
|
|
5025
5762
|
/**
|
|
5026
5763
|
* Splits an iterable into two arrays at the given index.
|
|
5027
5764
|
*
|
|
5765
|
+
* **When to use**
|
|
5766
|
+
*
|
|
5767
|
+
* Use to divide an array into a prefix and suffix at a specific position.
|
|
5768
|
+
*
|
|
5028
5769
|
* **Details**
|
|
5029
5770
|
*
|
|
5030
5771
|
* - `n` can be `0` (all elements in the second array).
|
|
@@ -5048,6 +5789,10 @@ export const splitAt: {
|
|
|
5048
5789
|
/**
|
|
5049
5790
|
* Splits an iterable into two arrays at the given index.
|
|
5050
5791
|
*
|
|
5792
|
+
* **When to use**
|
|
5793
|
+
*
|
|
5794
|
+
* Use to divide an array into a prefix and suffix at a specific position.
|
|
5795
|
+
*
|
|
5051
5796
|
* **Details**
|
|
5052
5797
|
*
|
|
5053
5798
|
* - `n` can be `0` (all elements in the second array).
|
|
@@ -5071,6 +5816,10 @@ export const splitAt: {
|
|
|
5071
5816
|
/**
|
|
5072
5817
|
* Splits an iterable into two arrays at the given index.
|
|
5073
5818
|
*
|
|
5819
|
+
* **When to use**
|
|
5820
|
+
*
|
|
5821
|
+
* Use to divide an array into a prefix and suffix at a specific position.
|
|
5822
|
+
*
|
|
5074
5823
|
* **Details**
|
|
5075
5824
|
*
|
|
5076
5825
|
* - `n` can be `0` (all elements in the second array).
|
|
@@ -5170,6 +5919,10 @@ export const splitAtNonEmpty: {
|
|
|
5170
5919
|
/**
|
|
5171
5920
|
* Splits an iterable into `n` roughly equal-sized chunks.
|
|
5172
5921
|
*
|
|
5922
|
+
* **When to use**
|
|
5923
|
+
*
|
|
5924
|
+
* Use to distribute elements across a fixed number of groups, such as when splitting work across threads.
|
|
5925
|
+
*
|
|
5173
5926
|
* **Details**
|
|
5174
5927
|
*
|
|
5175
5928
|
* - Uses `chunksOf(ceil(length / n))` internally.
|
|
@@ -5192,6 +5945,10 @@ export const split: {
|
|
|
5192
5945
|
/**
|
|
5193
5946
|
* Splits an iterable into `n` roughly equal-sized chunks.
|
|
5194
5947
|
*
|
|
5948
|
+
* **When to use**
|
|
5949
|
+
*
|
|
5950
|
+
* Use to distribute elements across a fixed number of groups, such as when splitting work across threads.
|
|
5951
|
+
*
|
|
5195
5952
|
* **Details**
|
|
5196
5953
|
*
|
|
5197
5954
|
* - Uses `chunksOf(ceil(length / n))` internally.
|
|
@@ -5214,6 +5971,10 @@ export const split: {
|
|
|
5214
5971
|
/**
|
|
5215
5972
|
* Splits an iterable into `n` roughly equal-sized chunks.
|
|
5216
5973
|
*
|
|
5974
|
+
* **When to use**
|
|
5975
|
+
*
|
|
5976
|
+
* Use to distribute elements across a fixed number of groups, such as when splitting work across threads.
|
|
5977
|
+
*
|
|
5217
5978
|
* **Details**
|
|
5218
5979
|
*
|
|
5219
5980
|
* - Uses `chunksOf(ceil(length / n))` internally.
|
|
@@ -5242,6 +6003,10 @@ export const split: {
|
|
|
5242
6003
|
* Splits an iterable at the first element matching the predicate. The matching
|
|
5243
6004
|
* element is included in the second array.
|
|
5244
6005
|
*
|
|
6006
|
+
* **When to use**
|
|
6007
|
+
*
|
|
6008
|
+
* Use to split an array at a condition boundary when you know which element marks the transition point.
|
|
6009
|
+
*
|
|
5245
6010
|
* **Example** (Splitting at a condition)
|
|
5246
6011
|
*
|
|
5247
6012
|
* ```ts
|
|
@@ -5261,6 +6026,10 @@ export const splitWhere: {
|
|
|
5261
6026
|
* Splits an iterable at the first element matching the predicate. The matching
|
|
5262
6027
|
* element is included in the second array.
|
|
5263
6028
|
*
|
|
6029
|
+
* **When to use**
|
|
6030
|
+
*
|
|
6031
|
+
* Use to split an array at a condition boundary when you know which element marks the transition point.
|
|
6032
|
+
*
|
|
5264
6033
|
* **Example** (Splitting at a condition)
|
|
5265
6034
|
*
|
|
5266
6035
|
* ```ts
|
|
@@ -5280,6 +6049,10 @@ export const splitWhere: {
|
|
|
5280
6049
|
* Splits an iterable at the first element matching the predicate. The matching
|
|
5281
6050
|
* element is included in the second array.
|
|
5282
6051
|
*
|
|
6052
|
+
* **When to use**
|
|
6053
|
+
*
|
|
6054
|
+
* Use to split an array at a condition boundary when you know which element marks the transition point.
|
|
6055
|
+
*
|
|
5283
6056
|
* **Example** (Splitting at a condition)
|
|
5284
6057
|
*
|
|
5285
6058
|
* ```ts
|
|
@@ -5304,6 +6077,11 @@ export const splitWhere: {
|
|
|
5304
6077
|
/**
|
|
5305
6078
|
* Creates a shallow copy of an array.
|
|
5306
6079
|
*
|
|
6080
|
+
* **When to use**
|
|
6081
|
+
*
|
|
6082
|
+
* Use to create a distinct array reference for an existing array, for example
|
|
6083
|
+
* before mutating the returned array.
|
|
6084
|
+
*
|
|
5307
6085
|
* **Details**
|
|
5308
6086
|
*
|
|
5309
6087
|
* - Preserves `NonEmptyArray` in the return type.
|
|
@@ -5329,6 +6107,11 @@ export const copy: {
|
|
|
5329
6107
|
/**
|
|
5330
6108
|
* Creates a shallow copy of an array.
|
|
5331
6109
|
*
|
|
6110
|
+
* **When to use**
|
|
6111
|
+
*
|
|
6112
|
+
* Use to create a distinct array reference for an existing array, for example
|
|
6113
|
+
* before mutating the returned array.
|
|
6114
|
+
*
|
|
5332
6115
|
* **Details**
|
|
5333
6116
|
*
|
|
5334
6117
|
* - Preserves `NonEmptyArray` in the return type.
|
|
@@ -5354,6 +6137,11 @@ export const copy: {
|
|
|
5354
6137
|
/**
|
|
5355
6138
|
* Creates a shallow copy of an array.
|
|
5356
6139
|
*
|
|
6140
|
+
* **When to use**
|
|
6141
|
+
*
|
|
6142
|
+
* Use to create a distinct array reference for an existing array, for example
|
|
6143
|
+
* before mutating the returned array.
|
|
6144
|
+
*
|
|
5357
6145
|
* **Details**
|
|
5358
6146
|
*
|
|
5359
6147
|
* - Preserves `NonEmptyArray` in the return type.
|
|
@@ -5382,6 +6170,10 @@ export const copy: {
|
|
|
5382
6170
|
* Pads or truncates an array to exactly `n` elements, filling with `fill`
|
|
5383
6171
|
* if the array is shorter, or slicing if longer.
|
|
5384
6172
|
*
|
|
6173
|
+
* **When to use**
|
|
6174
|
+
*
|
|
6175
|
+
* Use to ensure an array has a specific length, padding with a fill value or truncating as needed.
|
|
6176
|
+
*
|
|
5385
6177
|
* **Details**
|
|
5386
6178
|
*
|
|
5387
6179
|
* - Returns an empty array when `n <= 0`.
|
|
@@ -5405,6 +6197,10 @@ export const pad: {
|
|
|
5405
6197
|
* Pads or truncates an array to exactly `n` elements, filling with `fill`
|
|
5406
6198
|
* if the array is shorter, or slicing if longer.
|
|
5407
6199
|
*
|
|
6200
|
+
* **When to use**
|
|
6201
|
+
*
|
|
6202
|
+
* Use to ensure an array has a specific length, padding with a fill value or truncating as needed.
|
|
6203
|
+
*
|
|
5408
6204
|
* **Details**
|
|
5409
6205
|
*
|
|
5410
6206
|
* - Returns an empty array when `n <= 0`.
|
|
@@ -5430,6 +6226,10 @@ export const pad: {
|
|
|
5430
6226
|
* Pads or truncates an array to exactly `n` elements, filling with `fill`
|
|
5431
6227
|
* if the array is shorter, or slicing if longer.
|
|
5432
6228
|
*
|
|
6229
|
+
* **When to use**
|
|
6230
|
+
*
|
|
6231
|
+
* Use to ensure an array has a specific length, padding with a fill value or truncating as needed.
|
|
6232
|
+
*
|
|
5433
6233
|
* **Details**
|
|
5434
6234
|
*
|
|
5435
6235
|
* - Returns an empty array when `n <= 0`.
|
|
@@ -5463,6 +6263,11 @@ export const pad: {
|
|
|
5463
6263
|
* Splits an iterable into chunks of length `n`. The last chunk may be shorter
|
|
5464
6264
|
* if `n` does not evenly divide the length.
|
|
5465
6265
|
*
|
|
6266
|
+
* **When to use**
|
|
6267
|
+
*
|
|
6268
|
+
* Use to divide an iterable into non-overlapping chunks with a maximum chunk
|
|
6269
|
+
* size.
|
|
6270
|
+
*
|
|
5466
6271
|
* **Details**
|
|
5467
6272
|
*
|
|
5468
6273
|
* - `chunksOf(n)([])` is `[]`, not `[[]]`.
|
|
@@ -5488,6 +6293,11 @@ export const chunksOf: {
|
|
|
5488
6293
|
* Splits an iterable into chunks of length `n`. The last chunk may be shorter
|
|
5489
6294
|
* if `n` does not evenly divide the length.
|
|
5490
6295
|
*
|
|
6296
|
+
* **When to use**
|
|
6297
|
+
*
|
|
6298
|
+
* Use to divide an iterable into non-overlapping chunks with a maximum chunk
|
|
6299
|
+
* size.
|
|
6300
|
+
*
|
|
5491
6301
|
* **Details**
|
|
5492
6302
|
*
|
|
5493
6303
|
* - `chunksOf(n)([])` is `[]`, not `[[]]`.
|
|
@@ -5515,6 +6325,11 @@ export const chunksOf: {
|
|
|
5515
6325
|
* Splits an iterable into chunks of length `n`. The last chunk may be shorter
|
|
5516
6326
|
* if `n` does not evenly divide the length.
|
|
5517
6327
|
*
|
|
6328
|
+
* **When to use**
|
|
6329
|
+
*
|
|
6330
|
+
* Use to divide an iterable into non-overlapping chunks with a maximum chunk
|
|
6331
|
+
* size.
|
|
6332
|
+
*
|
|
5518
6333
|
* **Details**
|
|
5519
6334
|
*
|
|
5520
6335
|
* - `chunksOf(n)([])` is `[]`, not `[[]]`.
|
|
@@ -5540,6 +6355,11 @@ export const chunksOf: {
|
|
|
5540
6355
|
* Splits an iterable into chunks of length `n`. The last chunk may be shorter
|
|
5541
6356
|
* if `n` does not evenly divide the length.
|
|
5542
6357
|
*
|
|
6358
|
+
* **When to use**
|
|
6359
|
+
*
|
|
6360
|
+
* Use to divide an iterable into non-overlapping chunks with a maximum chunk
|
|
6361
|
+
* size.
|
|
6362
|
+
*
|
|
5543
6363
|
* **Details**
|
|
5544
6364
|
*
|
|
5545
6365
|
* - `chunksOf(n)([])` is `[]`, not `[[]]`.
|
|
@@ -5572,6 +6392,10 @@ export const chunksOf: {
|
|
|
5572
6392
|
/**
|
|
5573
6393
|
* Creates overlapping sliding windows of size `n`.
|
|
5574
6394
|
*
|
|
6395
|
+
* **When to use**
|
|
6396
|
+
*
|
|
6397
|
+
* Use to process sequences with a moving window, such as for computing running averages or detecting patterns.
|
|
6398
|
+
*
|
|
5575
6399
|
* **Details**
|
|
5576
6400
|
*
|
|
5577
6401
|
* - Returns an empty array if `n <= 0` or the array has fewer than `n` elements.
|
|
@@ -5595,6 +6419,10 @@ export const window: {
|
|
|
5595
6419
|
/**
|
|
5596
6420
|
* Creates overlapping sliding windows of size `n`.
|
|
5597
6421
|
*
|
|
6422
|
+
* **When to use**
|
|
6423
|
+
*
|
|
6424
|
+
* Use to process sequences with a moving window, such as for computing running averages or detecting patterns.
|
|
6425
|
+
*
|
|
5598
6426
|
* **Details**
|
|
5599
6427
|
*
|
|
5600
6428
|
* - Returns an empty array if `n <= 0` or the array has fewer than `n` elements.
|
|
@@ -5618,6 +6446,10 @@ export const window: {
|
|
|
5618
6446
|
/**
|
|
5619
6447
|
* Creates overlapping sliding windows of size `n`.
|
|
5620
6448
|
*
|
|
6449
|
+
* **When to use**
|
|
6450
|
+
*
|
|
6451
|
+
* Use to process sequences with a moving window, such as for computing running averages or detecting patterns.
|
|
6452
|
+
*
|
|
5621
6453
|
* **Details**
|
|
5622
6454
|
*
|
|
5623
6455
|
* - Returns an empty array if `n <= 0` or the array has fewer than `n` elements.
|
|
@@ -5652,6 +6484,11 @@ export const window: {
|
|
|
5652
6484
|
/**
|
|
5653
6485
|
* Groups consecutive equal elements using a custom equivalence function.
|
|
5654
6486
|
*
|
|
6487
|
+
* **When to use**
|
|
6488
|
+
*
|
|
6489
|
+
* Use when a non-empty array is already arranged so matching elements are
|
|
6490
|
+
* adjacent and you need a custom equivalence function.
|
|
6491
|
+
*
|
|
5655
6492
|
* **Details**
|
|
5656
6493
|
*
|
|
5657
6494
|
* - Only groups **adjacent** elements — non-adjacent duplicates stay separate.
|
|
@@ -5666,8 +6503,8 @@ export const window: {
|
|
|
5666
6503
|
* // [["a", "a"], ["b", "b", "b"], ["c"], ["a"]]
|
|
5667
6504
|
* ```
|
|
5668
6505
|
*
|
|
5669
|
-
* @see {@link group}
|
|
5670
|
-
* @see {@link groupBy}
|
|
6506
|
+
* @see {@link group} for grouping adjacent elements with `Equal.equivalence()`
|
|
6507
|
+
* @see {@link groupBy} for grouping all elements into a record by key, regardless of adjacency
|
|
5671
6508
|
*
|
|
5672
6509
|
* @category grouping
|
|
5673
6510
|
* @since 2.0.0
|
|
@@ -5676,6 +6513,11 @@ export const groupWith: {
|
|
|
5676
6513
|
/**
|
|
5677
6514
|
* Groups consecutive equal elements using a custom equivalence function.
|
|
5678
6515
|
*
|
|
6516
|
+
* **When to use**
|
|
6517
|
+
*
|
|
6518
|
+
* Use when a non-empty array is already arranged so matching elements are
|
|
6519
|
+
* adjacent and you need a custom equivalence function.
|
|
6520
|
+
*
|
|
5679
6521
|
* **Details**
|
|
5680
6522
|
*
|
|
5681
6523
|
* - Only groups **adjacent** elements — non-adjacent duplicates stay separate.
|
|
@@ -5690,8 +6532,8 @@ export const groupWith: {
|
|
|
5690
6532
|
* // [["a", "a"], ["b", "b", "b"], ["c"], ["a"]]
|
|
5691
6533
|
* ```
|
|
5692
6534
|
*
|
|
5693
|
-
* @see {@link group}
|
|
5694
|
-
* @see {@link groupBy}
|
|
6535
|
+
* @see {@link group} for grouping adjacent elements with `Equal.equivalence()`
|
|
6536
|
+
* @see {@link groupBy} for grouping all elements into a record by key, regardless of adjacency
|
|
5695
6537
|
*
|
|
5696
6538
|
* @category grouping
|
|
5697
6539
|
* @since 2.0.0
|
|
@@ -5700,6 +6542,11 @@ export const groupWith: {
|
|
|
5700
6542
|
/**
|
|
5701
6543
|
* Groups consecutive equal elements using a custom equivalence function.
|
|
5702
6544
|
*
|
|
6545
|
+
* **When to use**
|
|
6546
|
+
*
|
|
6547
|
+
* Use when a non-empty array is already arranged so matching elements are
|
|
6548
|
+
* adjacent and you need a custom equivalence function.
|
|
6549
|
+
*
|
|
5703
6550
|
* **Details**
|
|
5704
6551
|
*
|
|
5705
6552
|
* - Only groups **adjacent** elements — non-adjacent duplicates stay separate.
|
|
@@ -5714,8 +6561,8 @@ export const groupWith: {
|
|
|
5714
6561
|
* // [["a", "a"], ["b", "b", "b"], ["c"], ["a"]]
|
|
5715
6562
|
* ```
|
|
5716
6563
|
*
|
|
5717
|
-
* @see {@link group}
|
|
5718
|
-
* @see {@link groupBy}
|
|
6564
|
+
* @see {@link group} for grouping adjacent elements with `Equal.equivalence()`
|
|
6565
|
+
* @see {@link groupBy} for grouping all elements into a record by key, regardless of adjacency
|
|
5719
6566
|
*
|
|
5720
6567
|
* @category grouping
|
|
5721
6568
|
* @since 2.0.0
|
|
@@ -5746,6 +6593,11 @@ export const groupWith: {
|
|
|
5746
6593
|
/**
|
|
5747
6594
|
* Groups consecutive equal elements using `Equal.equivalence()`.
|
|
5748
6595
|
*
|
|
6596
|
+
* **When to use**
|
|
6597
|
+
*
|
|
6598
|
+
* Use when equal values are already adjacent and Effect's default equality is
|
|
6599
|
+
* the right comparison.
|
|
6600
|
+
*
|
|
5749
6601
|
* **Details**
|
|
5750
6602
|
*
|
|
5751
6603
|
* - Only groups **adjacent** elements.
|
|
@@ -5772,6 +6624,10 @@ export const group: <A>(self: NonEmptyReadonlyArray<A>) => NonEmptyArray<NonEmpt
|
|
|
5772
6624
|
* Groups elements into a record by a key-returning function. Each key maps
|
|
5773
6625
|
* to a `NonEmptyArray` of elements that produced that key.
|
|
5774
6626
|
*
|
|
6627
|
+
* **When to use**
|
|
6628
|
+
*
|
|
6629
|
+
* Use to build buckets of elements indexed by a computed string or symbol key.
|
|
6630
|
+
*
|
|
5775
6631
|
* **Details**
|
|
5776
6632
|
*
|
|
5777
6633
|
* - Unlike {@link group}/{@link groupWith}, elements do not need to be
|
|
@@ -5805,6 +6661,10 @@ export const groupBy: {
|
|
|
5805
6661
|
* Groups elements into a record by a key-returning function. Each key maps
|
|
5806
6662
|
* to a `NonEmptyArray` of elements that produced that key.
|
|
5807
6663
|
*
|
|
6664
|
+
* **When to use**
|
|
6665
|
+
*
|
|
6666
|
+
* Use to build buckets of elements indexed by a computed string or symbol key.
|
|
6667
|
+
*
|
|
5808
6668
|
* **Details**
|
|
5809
6669
|
*
|
|
5810
6670
|
* - Unlike {@link group}/{@link groupWith}, elements do not need to be
|
|
@@ -5838,6 +6698,10 @@ export const groupBy: {
|
|
|
5838
6698
|
* Groups elements into a record by a key-returning function. Each key maps
|
|
5839
6699
|
* to a `NonEmptyArray` of elements that produced that key.
|
|
5840
6700
|
*
|
|
6701
|
+
* **When to use**
|
|
6702
|
+
*
|
|
6703
|
+
* Use to build buckets of elements indexed by a computed string or symbol key.
|
|
6704
|
+
*
|
|
5841
6705
|
* **Details**
|
|
5842
6706
|
*
|
|
5843
6707
|
* - Unlike {@link group}/{@link groupWith}, elements do not need to be
|
|
@@ -5887,6 +6751,11 @@ export const groupBy: {
|
|
|
5887
6751
|
* Computes the union of two arrays using a custom equivalence, removing
|
|
5888
6752
|
* duplicates.
|
|
5889
6753
|
*
|
|
6754
|
+
* **When to use**
|
|
6755
|
+
*
|
|
6756
|
+
* Use when you need the union of two arrays but duplicate detection must use a
|
|
6757
|
+
* custom equivalence instead of the default `Equal.equivalence()`.
|
|
6758
|
+
*
|
|
5890
6759
|
* **Example** (Union with custom equality)
|
|
5891
6760
|
*
|
|
5892
6761
|
* ```ts
|
|
@@ -5895,9 +6764,9 @@ export const groupBy: {
|
|
|
5895
6764
|
* console.log(Array.unionWith([1, 2], [2, 3], (a, b) => a === b)) // [1, 2, 3]
|
|
5896
6765
|
* ```
|
|
5897
6766
|
*
|
|
5898
|
-
* @see {@link union}
|
|
5899
|
-
* @see {@link
|
|
5900
|
-
* @see {@link
|
|
6767
|
+
* @see {@link union} for the `Equal.equivalence()` variant
|
|
6768
|
+
* @see {@link intersectionWith} for keeping elements present in both arrays
|
|
6769
|
+
* @see {@link differenceWith} for keeping elements present only in the first array
|
|
5901
6770
|
*
|
|
5902
6771
|
* @category elements
|
|
5903
6772
|
* @since 2.0.0
|
|
@@ -5907,6 +6776,11 @@ export const unionWith: {
|
|
|
5907
6776
|
* Computes the union of two arrays using a custom equivalence, removing
|
|
5908
6777
|
* duplicates.
|
|
5909
6778
|
*
|
|
6779
|
+
* **When to use**
|
|
6780
|
+
*
|
|
6781
|
+
* Use when you need the union of two arrays but duplicate detection must use a
|
|
6782
|
+
* custom equivalence instead of the default `Equal.equivalence()`.
|
|
6783
|
+
*
|
|
5910
6784
|
* **Example** (Union with custom equality)
|
|
5911
6785
|
*
|
|
5912
6786
|
* ```ts
|
|
@@ -5915,9 +6789,9 @@ export const unionWith: {
|
|
|
5915
6789
|
* console.log(Array.unionWith([1, 2], [2, 3], (a, b) => a === b)) // [1, 2, 3]
|
|
5916
6790
|
* ```
|
|
5917
6791
|
*
|
|
5918
|
-
* @see {@link union}
|
|
5919
|
-
* @see {@link
|
|
5920
|
-
* @see {@link
|
|
6792
|
+
* @see {@link union} for the `Equal.equivalence()` variant
|
|
6793
|
+
* @see {@link intersectionWith} for keeping elements present in both arrays
|
|
6794
|
+
* @see {@link differenceWith} for keeping elements present only in the first array
|
|
5921
6795
|
*
|
|
5922
6796
|
* @category elements
|
|
5923
6797
|
* @since 2.0.0
|
|
@@ -5930,6 +6804,11 @@ export const unionWith: {
|
|
|
5930
6804
|
* Computes the union of two arrays using a custom equivalence, removing
|
|
5931
6805
|
* duplicates.
|
|
5932
6806
|
*
|
|
6807
|
+
* **When to use**
|
|
6808
|
+
*
|
|
6809
|
+
* Use when you need the union of two arrays but duplicate detection must use a
|
|
6810
|
+
* custom equivalence instead of the default `Equal.equivalence()`.
|
|
6811
|
+
*
|
|
5933
6812
|
* **Example** (Union with custom equality)
|
|
5934
6813
|
*
|
|
5935
6814
|
* ```ts
|
|
@@ -5938,9 +6817,9 @@ export const unionWith: {
|
|
|
5938
6817
|
* console.log(Array.unionWith([1, 2], [2, 3], (a, b) => a === b)) // [1, 2, 3]
|
|
5939
6818
|
* ```
|
|
5940
6819
|
*
|
|
5941
|
-
* @see {@link union}
|
|
5942
|
-
* @see {@link
|
|
5943
|
-
* @see {@link
|
|
6820
|
+
* @see {@link union} for the `Equal.equivalence()` variant
|
|
6821
|
+
* @see {@link intersectionWith} for keeping elements present in both arrays
|
|
6822
|
+
* @see {@link differenceWith} for keeping elements present only in the first array
|
|
5944
6823
|
*
|
|
5945
6824
|
* @category elements
|
|
5946
6825
|
* @since 2.0.0
|
|
@@ -5954,6 +6833,11 @@ export const unionWith: {
|
|
|
5954
6833
|
* Computes the union of two arrays using a custom equivalence, removing
|
|
5955
6834
|
* duplicates.
|
|
5956
6835
|
*
|
|
6836
|
+
* **When to use**
|
|
6837
|
+
*
|
|
6838
|
+
* Use when you need the union of two arrays but duplicate detection must use a
|
|
6839
|
+
* custom equivalence instead of the default `Equal.equivalence()`.
|
|
6840
|
+
*
|
|
5957
6841
|
* **Example** (Union with custom equality)
|
|
5958
6842
|
*
|
|
5959
6843
|
* ```ts
|
|
@@ -5962,9 +6846,9 @@ export const unionWith: {
|
|
|
5962
6846
|
* console.log(Array.unionWith([1, 2], [2, 3], (a, b) => a === b)) // [1, 2, 3]
|
|
5963
6847
|
* ```
|
|
5964
6848
|
*
|
|
5965
|
-
* @see {@link union}
|
|
5966
|
-
* @see {@link
|
|
5967
|
-
* @see {@link
|
|
6849
|
+
* @see {@link union} for the `Equal.equivalence()` variant
|
|
6850
|
+
* @see {@link intersectionWith} for keeping elements present in both arrays
|
|
6851
|
+
* @see {@link differenceWith} for keeping elements present only in the first array
|
|
5968
6852
|
*
|
|
5969
6853
|
* @category elements
|
|
5970
6854
|
* @since 2.0.0
|
|
@@ -5978,6 +6862,11 @@ export const unionWith: {
|
|
|
5978
6862
|
* Computes the union of two arrays using a custom equivalence, removing
|
|
5979
6863
|
* duplicates.
|
|
5980
6864
|
*
|
|
6865
|
+
* **When to use**
|
|
6866
|
+
*
|
|
6867
|
+
* Use when you need the union of two arrays but duplicate detection must use a
|
|
6868
|
+
* custom equivalence instead of the default `Equal.equivalence()`.
|
|
6869
|
+
*
|
|
5981
6870
|
* **Example** (Union with custom equality)
|
|
5982
6871
|
*
|
|
5983
6872
|
* ```ts
|
|
@@ -5986,9 +6875,9 @@ export const unionWith: {
|
|
|
5986
6875
|
* console.log(Array.unionWith([1, 2], [2, 3], (a, b) => a === b)) // [1, 2, 3]
|
|
5987
6876
|
* ```
|
|
5988
6877
|
*
|
|
5989
|
-
* @see {@link union}
|
|
5990
|
-
* @see {@link
|
|
5991
|
-
* @see {@link
|
|
6878
|
+
* @see {@link union} for the `Equal.equivalence()` variant
|
|
6879
|
+
* @see {@link intersectionWith} for keeping elements present in both arrays
|
|
6880
|
+
* @see {@link differenceWith} for keeping elements present only in the first array
|
|
5992
6881
|
*
|
|
5993
6882
|
* @category elements
|
|
5994
6883
|
* @since 2.0.0
|
|
@@ -6141,6 +7030,11 @@ export const union: {
|
|
|
6141
7030
|
* Computes the intersection of two arrays using a custom equivalence. Order is
|
|
6142
7031
|
* determined by the first array.
|
|
6143
7032
|
*
|
|
7033
|
+
* **When to use**
|
|
7034
|
+
*
|
|
7035
|
+
* Use when keeping only values present in both arrays and equality must be
|
|
7036
|
+
* defined by a custom comparator, such as matching objects by id.
|
|
7037
|
+
*
|
|
6144
7038
|
* **Example** (Intersection with custom equality)
|
|
6145
7039
|
*
|
|
6146
7040
|
* ```ts
|
|
@@ -6152,9 +7046,9 @@ export const union: {
|
|
|
6152
7046
|
* console.log(Array.intersectionWith(isEquivalent)(array2)(array1)) // [{ id: 1 }, { id: 3 }]
|
|
6153
7047
|
* ```
|
|
6154
7048
|
*
|
|
6155
|
-
* @see {@link intersection}
|
|
6156
|
-
* @see {@link
|
|
6157
|
-
* @see {@link
|
|
7049
|
+
* @see {@link intersection} for the `Equal.equivalence()` variant
|
|
7050
|
+
* @see {@link unionWith} for keeping values from either array with custom equality
|
|
7051
|
+
* @see {@link differenceWith} for keeping values only from the first array with custom equality
|
|
6158
7052
|
*
|
|
6159
7053
|
* @category elements
|
|
6160
7054
|
* @since 2.0.0
|
|
@@ -6239,6 +7133,11 @@ export const intersection: {
|
|
|
6239
7133
|
* Computes elements in the first array that are not in the second, using a
|
|
6240
7134
|
* custom equivalence.
|
|
6241
7135
|
*
|
|
7136
|
+
* **When to use**
|
|
7137
|
+
*
|
|
7138
|
+
* Use when keeping only values from the first array and equality must be
|
|
7139
|
+
* defined by a custom comparator, such as matching objects by id.
|
|
7140
|
+
*
|
|
6242
7141
|
* **Example** (Difference with custom equality)
|
|
6243
7142
|
*
|
|
6244
7143
|
* ```ts
|
|
@@ -6248,9 +7147,9 @@ export const intersection: {
|
|
|
6248
7147
|
* console.log(diff) // [1]
|
|
6249
7148
|
* ```
|
|
6250
7149
|
*
|
|
6251
|
-
* @see {@link difference}
|
|
6252
|
-
* @see {@link
|
|
6253
|
-
* @see {@link
|
|
7150
|
+
* @see {@link difference} for the `Equal.equivalence()` variant
|
|
7151
|
+
* @see {@link unionWith} for keeping values from either array with custom equality
|
|
7152
|
+
* @see {@link intersectionWith} for keeping values present in both arrays with custom equality
|
|
6254
7153
|
*
|
|
6255
7154
|
* @category elements
|
|
6256
7155
|
* @since 2.0.0
|
|
@@ -6273,6 +7172,11 @@ export const differenceWith = <A>(isEquivalent: (self: A, that: A) => boolean):
|
|
|
6273
7172
|
* Computes elements in the first array that are not in the second, using
|
|
6274
7173
|
* `Equal.equivalence()`.
|
|
6275
7174
|
*
|
|
7175
|
+
* **When to use**
|
|
7176
|
+
*
|
|
7177
|
+
* Use when you need to keep values from the first array that are absent from
|
|
7178
|
+
* the second and the default `Equal.equivalence()` comparison is appropriate.
|
|
7179
|
+
*
|
|
6276
7180
|
* **Example** (Array difference)
|
|
6277
7181
|
*
|
|
6278
7182
|
* ```ts
|
|
@@ -6293,6 +7197,11 @@ export const difference: {
|
|
|
6293
7197
|
* Computes elements in the first array that are not in the second, using
|
|
6294
7198
|
* `Equal.equivalence()`.
|
|
6295
7199
|
*
|
|
7200
|
+
* **When to use**
|
|
7201
|
+
*
|
|
7202
|
+
* Use when you need to keep values from the first array that are absent from
|
|
7203
|
+
* the second and the default `Equal.equivalence()` comparison is appropriate.
|
|
7204
|
+
*
|
|
6296
7205
|
* **Example** (Array difference)
|
|
6297
7206
|
*
|
|
6298
7207
|
* ```ts
|
|
@@ -6313,6 +7222,11 @@ export const difference: {
|
|
|
6313
7222
|
* Computes elements in the first array that are not in the second, using
|
|
6314
7223
|
* `Equal.equivalence()`.
|
|
6315
7224
|
*
|
|
7225
|
+
* **When to use**
|
|
7226
|
+
*
|
|
7227
|
+
* Use when you need to keep values from the first array that are absent from
|
|
7228
|
+
* the second and the default `Equal.equivalence()` comparison is appropriate.
|
|
7229
|
+
*
|
|
6316
7230
|
* **Example** (Array difference)
|
|
6317
7231
|
*
|
|
6318
7232
|
* ```ts
|
|
@@ -6334,6 +7248,10 @@ export const difference: {
|
|
|
6334
7248
|
/**
|
|
6335
7249
|
* Creates an empty array.
|
|
6336
7250
|
*
|
|
7251
|
+
* **When to use**
|
|
7252
|
+
*
|
|
7253
|
+
* Use to create a typed empty array without allocating placeholder elements.
|
|
7254
|
+
*
|
|
6337
7255
|
* **Example** (Creating an empty array)
|
|
6338
7256
|
*
|
|
6339
7257
|
* ```ts
|
|
@@ -6492,6 +7410,10 @@ export declare namespace ReadonlyArray {
|
|
|
6492
7410
|
/**
|
|
6493
7411
|
* Transforms each element using a function, returning a new array.
|
|
6494
7412
|
*
|
|
7413
|
+
* **When to use**
|
|
7414
|
+
*
|
|
7415
|
+
* Use to transform each element independently while preserving the array shape.
|
|
7416
|
+
*
|
|
6495
7417
|
* **Details**
|
|
6496
7418
|
*
|
|
6497
7419
|
* - The function receives `(element, index)`.
|
|
@@ -6514,6 +7436,10 @@ export const map: {
|
|
|
6514
7436
|
/**
|
|
6515
7437
|
* Transforms each element using a function, returning a new array.
|
|
6516
7438
|
*
|
|
7439
|
+
* **When to use**
|
|
7440
|
+
*
|
|
7441
|
+
* Use to transform each element independently while preserving the array shape.
|
|
7442
|
+
*
|
|
6517
7443
|
* **Details**
|
|
6518
7444
|
*
|
|
6519
7445
|
* - The function receives `(element, index)`.
|
|
@@ -6536,6 +7462,10 @@ export const map: {
|
|
|
6536
7462
|
/**
|
|
6537
7463
|
* Transforms each element using a function, returning a new array.
|
|
6538
7464
|
*
|
|
7465
|
+
* **When to use**
|
|
7466
|
+
*
|
|
7467
|
+
* Use to transform each element independently while preserving the array shape.
|
|
7468
|
+
*
|
|
6539
7469
|
* **Details**
|
|
6540
7470
|
*
|
|
6541
7471
|
* - The function receives `(element, index)`.
|
|
@@ -6560,6 +7490,11 @@ export const map: {
|
|
|
6560
7490
|
/**
|
|
6561
7491
|
* Maps each element to an array and flattens the results into a single array.
|
|
6562
7492
|
*
|
|
7493
|
+
* **When to use**
|
|
7494
|
+
*
|
|
7495
|
+
* Use to map each element to zero or more values and concatenate the results in
|
|
7496
|
+
* one pass.
|
|
7497
|
+
*
|
|
6563
7498
|
* **Details**
|
|
6564
7499
|
*
|
|
6565
7500
|
* - The function receives `(element, index)`.
|
|
@@ -6583,6 +7518,11 @@ export const flatMap: {
|
|
|
6583
7518
|
/**
|
|
6584
7519
|
* Maps each element to an array and flattens the results into a single array.
|
|
6585
7520
|
*
|
|
7521
|
+
* **When to use**
|
|
7522
|
+
*
|
|
7523
|
+
* Use to map each element to zero or more values and concatenate the results in
|
|
7524
|
+
* one pass.
|
|
7525
|
+
*
|
|
6586
7526
|
* **Details**
|
|
6587
7527
|
*
|
|
6588
7528
|
* - The function receives `(element, index)`.
|
|
@@ -6606,6 +7546,11 @@ export const flatMap: {
|
|
|
6606
7546
|
/**
|
|
6607
7547
|
* Maps each element to an array and flattens the results into a single array.
|
|
6608
7548
|
*
|
|
7549
|
+
* **When to use**
|
|
7550
|
+
*
|
|
7551
|
+
* Use to map each element to zero or more values and concatenate the results in
|
|
7552
|
+
* one pass.
|
|
7553
|
+
*
|
|
6609
7554
|
* **Details**
|
|
6610
7555
|
*
|
|
6611
7556
|
* - The function receives `(element, index)`.
|
|
@@ -6632,6 +7577,11 @@ export const flatMap: {
|
|
|
6632
7577
|
/**
|
|
6633
7578
|
* Maps each element to an array and flattens the results into a single array.
|
|
6634
7579
|
*
|
|
7580
|
+
* **When to use**
|
|
7581
|
+
*
|
|
7582
|
+
* Use to map each element to zero or more values and concatenate the results in
|
|
7583
|
+
* one pass.
|
|
7584
|
+
*
|
|
6635
7585
|
* **Details**
|
|
6636
7586
|
*
|
|
6637
7587
|
* - The function receives `(element, index)`.
|
|
@@ -6672,6 +7622,11 @@ export const flatMap: {
|
|
|
6672
7622
|
/**
|
|
6673
7623
|
* Flattens a nested array of arrays into a single array.
|
|
6674
7624
|
*
|
|
7625
|
+
* **When to use**
|
|
7626
|
+
*
|
|
7627
|
+
* Use to collapse one level of nested arrays when no per-element mapping is
|
|
7628
|
+
* needed.
|
|
7629
|
+
*
|
|
6675
7630
|
* **Example** (Flattening nested arrays)
|
|
6676
7631
|
*
|
|
6677
7632
|
* ```ts
|
|
@@ -6691,6 +7646,11 @@ export const flatten: <const S extends ReadonlyArray<ReadonlyArray<any>>>(self:
|
|
|
6691
7646
|
/**
|
|
6692
7647
|
* Extracts all `Some` values from an iterable of `Option`s, discarding `None`s.
|
|
6693
7648
|
*
|
|
7649
|
+
* **When to use**
|
|
7650
|
+
*
|
|
7651
|
+
* Use to collect only present values from `Option` values while discarding
|
|
7652
|
+
* `None` values.
|
|
7653
|
+
*
|
|
6694
7654
|
* **Example** (Extracting Some values)
|
|
6695
7655
|
*
|
|
6696
7656
|
* ```ts
|
|
@@ -6722,6 +7682,11 @@ export const getSomes: <T extends Iterable<Option.Option<X>>, X = any>(
|
|
|
6722
7682
|
* Extracts all failure values from an iterable of `Result`s, discarding
|
|
6723
7683
|
* successes.
|
|
6724
7684
|
*
|
|
7685
|
+
* **When to use**
|
|
7686
|
+
*
|
|
7687
|
+
* Use to collect only failure values from `Result` values while discarding
|
|
7688
|
+
* successes.
|
|
7689
|
+
*
|
|
6725
7690
|
* **Example** (Extracting failures)
|
|
6726
7691
|
*
|
|
6727
7692
|
* ```ts
|
|
@@ -6754,6 +7719,11 @@ export const getFailures = <T extends Iterable<Result.Result<any, any>>>(
|
|
|
6754
7719
|
* Extracts all success values from an iterable of `Result`s, discarding
|
|
6755
7720
|
* failures.
|
|
6756
7721
|
*
|
|
7722
|
+
* **When to use**
|
|
7723
|
+
*
|
|
7724
|
+
* Use to collect only success values from `Result` values while discarding
|
|
7725
|
+
* failures.
|
|
7726
|
+
*
|
|
6757
7727
|
* **Example** (Extracting successes)
|
|
6758
7728
|
*
|
|
6759
7729
|
* ```ts
|
|
@@ -6785,6 +7755,11 @@ export const getSuccesses = <T extends Iterable<Result.Result<any, any>>>(
|
|
|
6785
7755
|
/**
|
|
6786
7756
|
* Keeps transformed values for elements where a `Filter` succeeds.
|
|
6787
7757
|
*
|
|
7758
|
+
* **When to use**
|
|
7759
|
+
*
|
|
7760
|
+
* Use to transform elements with a `Result`-returning filter while discarding
|
|
7761
|
+
* failures.
|
|
7762
|
+
*
|
|
6788
7763
|
* **Details**
|
|
6789
7764
|
*
|
|
6790
7765
|
* - The filter receives `(element, index)`.
|
|
@@ -6800,6 +7775,7 @@ export const getSuccesses = <T extends Iterable<Result.Result<any, any>>>(
|
|
|
6800
7775
|
* ```
|
|
6801
7776
|
*
|
|
6802
7777
|
* @see {@link filter} — keep original elements matching a predicate
|
|
7778
|
+
* @see {@link partition} for keeping both failures and successes
|
|
6803
7779
|
*
|
|
6804
7780
|
* @category filtering
|
|
6805
7781
|
* @since 2.0.0
|
|
@@ -6808,6 +7784,11 @@ export const filterMap: {
|
|
|
6808
7784
|
/**
|
|
6809
7785
|
* Keeps transformed values for elements where a `Filter` succeeds.
|
|
6810
7786
|
*
|
|
7787
|
+
* **When to use**
|
|
7788
|
+
*
|
|
7789
|
+
* Use to transform elements with a `Result`-returning filter while discarding
|
|
7790
|
+
* failures.
|
|
7791
|
+
*
|
|
6811
7792
|
* **Details**
|
|
6812
7793
|
*
|
|
6813
7794
|
* - The filter receives `(element, index)`.
|
|
@@ -6823,6 +7804,7 @@ export const filterMap: {
|
|
|
6823
7804
|
* ```
|
|
6824
7805
|
*
|
|
6825
7806
|
* @see {@link filter} — keep original elements matching a predicate
|
|
7807
|
+
* @see {@link partition} for keeping both failures and successes
|
|
6826
7808
|
*
|
|
6827
7809
|
* @category filtering
|
|
6828
7810
|
* @since 2.0.0
|
|
@@ -6831,6 +7813,11 @@ export const filterMap: {
|
|
|
6831
7813
|
/**
|
|
6832
7814
|
* Keeps transformed values for elements where a `Filter` succeeds.
|
|
6833
7815
|
*
|
|
7816
|
+
* **When to use**
|
|
7817
|
+
*
|
|
7818
|
+
* Use to transform elements with a `Result`-returning filter while discarding
|
|
7819
|
+
* failures.
|
|
7820
|
+
*
|
|
6834
7821
|
* **Details**
|
|
6835
7822
|
*
|
|
6836
7823
|
* - The filter receives `(element, index)`.
|
|
@@ -6846,6 +7833,7 @@ export const filterMap: {
|
|
|
6846
7833
|
* ```
|
|
6847
7834
|
*
|
|
6848
7835
|
* @see {@link filter} — keep original elements matching a predicate
|
|
7836
|
+
* @see {@link partition} for keeping both failures and successes
|
|
6849
7837
|
*
|
|
6850
7838
|
* @category filtering
|
|
6851
7839
|
* @since 2.0.0
|
|
@@ -6866,6 +7854,10 @@ export const filterMap: {
|
|
|
6866
7854
|
/**
|
|
6867
7855
|
* Keeps only elements satisfying a predicate (or refinement).
|
|
6868
7856
|
*
|
|
7857
|
+
* **When to use**
|
|
7858
|
+
*
|
|
7859
|
+
* Use to keep original elements that satisfy a boolean predicate or refinement.
|
|
7860
|
+
*
|
|
6869
7861
|
* **Details**
|
|
6870
7862
|
*
|
|
6871
7863
|
* - The predicate receives `(element, index)`.
|
|
@@ -6880,6 +7872,7 @@ export const filterMap: {
|
|
|
6880
7872
|
* ```
|
|
6881
7873
|
*
|
|
6882
7874
|
* @see {@link partition} — split into matching and non-matching
|
|
7875
|
+
* @see {@link filterMap} for transforming while filtering
|
|
6883
7876
|
*
|
|
6884
7877
|
* @category filtering
|
|
6885
7878
|
* @since 2.0.0
|
|
@@ -6888,6 +7881,10 @@ export const filter: {
|
|
|
6888
7881
|
/**
|
|
6889
7882
|
* Keeps only elements satisfying a predicate (or refinement).
|
|
6890
7883
|
*
|
|
7884
|
+
* **When to use**
|
|
7885
|
+
*
|
|
7886
|
+
* Use to keep original elements that satisfy a boolean predicate or refinement.
|
|
7887
|
+
*
|
|
6891
7888
|
* **Details**
|
|
6892
7889
|
*
|
|
6893
7890
|
* - The predicate receives `(element, index)`.
|
|
@@ -6902,6 +7899,7 @@ export const filter: {
|
|
|
6902
7899
|
* ```
|
|
6903
7900
|
*
|
|
6904
7901
|
* @see {@link partition} — split into matching and non-matching
|
|
7902
|
+
* @see {@link filterMap} for transforming while filtering
|
|
6905
7903
|
*
|
|
6906
7904
|
* @category filtering
|
|
6907
7905
|
* @since 2.0.0
|
|
@@ -6910,6 +7908,10 @@ export const filter: {
|
|
|
6910
7908
|
/**
|
|
6911
7909
|
* Keeps only elements satisfying a predicate (or refinement).
|
|
6912
7910
|
*
|
|
7911
|
+
* **When to use**
|
|
7912
|
+
*
|
|
7913
|
+
* Use to keep original elements that satisfy a boolean predicate or refinement.
|
|
7914
|
+
*
|
|
6913
7915
|
* **Details**
|
|
6914
7916
|
*
|
|
6915
7917
|
* - The predicate receives `(element, index)`.
|
|
@@ -6924,6 +7926,7 @@ export const filter: {
|
|
|
6924
7926
|
* ```
|
|
6925
7927
|
*
|
|
6926
7928
|
* @see {@link partition} — split into matching and non-matching
|
|
7929
|
+
* @see {@link filterMap} for transforming while filtering
|
|
6927
7930
|
*
|
|
6928
7931
|
* @category filtering
|
|
6929
7932
|
* @since 2.0.0
|
|
@@ -6932,6 +7935,10 @@ export const filter: {
|
|
|
6932
7935
|
/**
|
|
6933
7936
|
* Keeps only elements satisfying a predicate (or refinement).
|
|
6934
7937
|
*
|
|
7938
|
+
* **When to use**
|
|
7939
|
+
*
|
|
7940
|
+
* Use to keep original elements that satisfy a boolean predicate or refinement.
|
|
7941
|
+
*
|
|
6935
7942
|
* **Details**
|
|
6936
7943
|
*
|
|
6937
7944
|
* - The predicate receives `(element, index)`.
|
|
@@ -6946,6 +7953,7 @@ export const filter: {
|
|
|
6946
7953
|
* ```
|
|
6947
7954
|
*
|
|
6948
7955
|
* @see {@link partition} — split into matching and non-matching
|
|
7956
|
+
* @see {@link filterMap} for transforming while filtering
|
|
6949
7957
|
*
|
|
6950
7958
|
* @category filtering
|
|
6951
7959
|
* @since 2.0.0
|
|
@@ -6954,6 +7962,10 @@ export const filter: {
|
|
|
6954
7962
|
/**
|
|
6955
7963
|
* Keeps only elements satisfying a predicate (or refinement).
|
|
6956
7964
|
*
|
|
7965
|
+
* **When to use**
|
|
7966
|
+
*
|
|
7967
|
+
* Use to keep original elements that satisfy a boolean predicate or refinement.
|
|
7968
|
+
*
|
|
6957
7969
|
* **Details**
|
|
6958
7970
|
*
|
|
6959
7971
|
* - The predicate receives `(element, index)`.
|
|
@@ -6968,6 +7980,7 @@ export const filter: {
|
|
|
6968
7980
|
* ```
|
|
6969
7981
|
*
|
|
6970
7982
|
* @see {@link partition} — split into matching and non-matching
|
|
7983
|
+
* @see {@link filterMap} for transforming while filtering
|
|
6971
7984
|
*
|
|
6972
7985
|
* @category filtering
|
|
6973
7986
|
* @since 2.0.0
|
|
@@ -6990,6 +8003,11 @@ export const filter: {
|
|
|
6990
8003
|
/**
|
|
6991
8004
|
* Splits an iterable using a `Filter` into failures and successes.
|
|
6992
8005
|
*
|
|
8006
|
+
* **When to use**
|
|
8007
|
+
*
|
|
8008
|
+
* Use to evaluate each element with a `Result`-returning filter and keep both
|
|
8009
|
+
* failure and success values.
|
|
8010
|
+
*
|
|
6993
8011
|
* **Details**
|
|
6994
8012
|
*
|
|
6995
8013
|
* - Returns `[excluded, satisfying]`.
|
|
@@ -7007,6 +8025,7 @@ export const filter: {
|
|
|
7007
8025
|
* ```
|
|
7008
8026
|
*
|
|
7009
8027
|
* @see {@link filter} — keep only matching elements
|
|
8028
|
+
* @see {@link filterMap} for discarding failures
|
|
7010
8029
|
* @see {@link separate} — split an iterable of `Result` values
|
|
7011
8030
|
*
|
|
7012
8031
|
* @category filtering
|
|
@@ -7016,6 +8035,11 @@ export const partition: {
|
|
|
7016
8035
|
/**
|
|
7017
8036
|
* Splits an iterable using a `Filter` into failures and successes.
|
|
7018
8037
|
*
|
|
8038
|
+
* **When to use**
|
|
8039
|
+
*
|
|
8040
|
+
* Use to evaluate each element with a `Result`-returning filter and keep both
|
|
8041
|
+
* failure and success values.
|
|
8042
|
+
*
|
|
7019
8043
|
* **Details**
|
|
7020
8044
|
*
|
|
7021
8045
|
* - Returns `[excluded, satisfying]`.
|
|
@@ -7033,6 +8057,7 @@ export const partition: {
|
|
|
7033
8057
|
* ```
|
|
7034
8058
|
*
|
|
7035
8059
|
* @see {@link filter} — keep only matching elements
|
|
8060
|
+
* @see {@link filterMap} for discarding failures
|
|
7036
8061
|
* @see {@link separate} — split an iterable of `Result` values
|
|
7037
8062
|
*
|
|
7038
8063
|
* @category filtering
|
|
@@ -7042,6 +8067,11 @@ export const partition: {
|
|
|
7042
8067
|
/**
|
|
7043
8068
|
* Splits an iterable using a `Filter` into failures and successes.
|
|
7044
8069
|
*
|
|
8070
|
+
* **When to use**
|
|
8071
|
+
*
|
|
8072
|
+
* Use to evaluate each element with a `Result`-returning filter and keep both
|
|
8073
|
+
* failure and success values.
|
|
8074
|
+
*
|
|
7045
8075
|
* **Details**
|
|
7046
8076
|
*
|
|
7047
8077
|
* - Returns `[excluded, satisfying]`.
|
|
@@ -7059,6 +8089,7 @@ export const partition: {
|
|
|
7059
8089
|
* ```
|
|
7060
8090
|
*
|
|
7061
8091
|
* @see {@link filter} — keep only matching elements
|
|
8092
|
+
* @see {@link filterMap} for discarding failures
|
|
7062
8093
|
* @see {@link separate} — split an iterable of `Result` values
|
|
7063
8094
|
*
|
|
7064
8095
|
* @category filtering
|
|
@@ -7089,6 +8120,10 @@ export const partition: {
|
|
|
7089
8120
|
/**
|
|
7090
8121
|
* Separates an iterable of `Result`s into failure values and success values.
|
|
7091
8122
|
*
|
|
8123
|
+
* **When to use**
|
|
8124
|
+
*
|
|
8125
|
+
* Use to split existing `Result` values into failure and success arrays.
|
|
8126
|
+
*
|
|
7092
8127
|
* **Details**
|
|
7093
8128
|
*
|
|
7094
8129
|
* - Returns `[failures, successes]`.
|
|
@@ -7108,6 +8143,7 @@ export const partition: {
|
|
|
7108
8143
|
*
|
|
7109
8144
|
* @see {@link getFailures} — extract only failures
|
|
7110
8145
|
* @see {@link getSuccesses} — extract only successes
|
|
8146
|
+
* @see {@link partition} for computing `Result` values while splitting
|
|
7111
8147
|
*
|
|
7112
8148
|
* @category filtering
|
|
7113
8149
|
* @since 2.0.0
|
|
@@ -7122,6 +8158,10 @@ export const separate: <T extends Iterable<Result.Result<any, any>>>(
|
|
|
7122
8158
|
/**
|
|
7123
8159
|
* Folds an iterable from left to right into a single value.
|
|
7124
8160
|
*
|
|
8161
|
+
* **When to use**
|
|
8162
|
+
*
|
|
8163
|
+
* Use to combine all elements into one accumulated value from left to right.
|
|
8164
|
+
*
|
|
7125
8165
|
* **Details**
|
|
7126
8166
|
*
|
|
7127
8167
|
* - The function receives `(accumulator, element, index)`.
|
|
@@ -7144,6 +8184,10 @@ export const reduce: {
|
|
|
7144
8184
|
/**
|
|
7145
8185
|
* Folds an iterable from left to right into a single value.
|
|
7146
8186
|
*
|
|
8187
|
+
* **When to use**
|
|
8188
|
+
*
|
|
8189
|
+
* Use to combine all elements into one accumulated value from left to right.
|
|
8190
|
+
*
|
|
7147
8191
|
* **Details**
|
|
7148
8192
|
*
|
|
7149
8193
|
* - The function receives `(accumulator, element, index)`.
|
|
@@ -7166,6 +8210,10 @@ export const reduce: {
|
|
|
7166
8210
|
/**
|
|
7167
8211
|
* Folds an iterable from left to right into a single value.
|
|
7168
8212
|
*
|
|
8213
|
+
* **When to use**
|
|
8214
|
+
*
|
|
8215
|
+
* Use to combine all elements into one accumulated value from left to right.
|
|
8216
|
+
*
|
|
7169
8217
|
* **Details**
|
|
7170
8218
|
*
|
|
7171
8219
|
* - The function receives `(accumulator, element, index)`.
|
|
@@ -7194,6 +8242,11 @@ export const reduce: {
|
|
|
7194
8242
|
/**
|
|
7195
8243
|
* Folds an iterable from right to left into a single value.
|
|
7196
8244
|
*
|
|
8245
|
+
* **When to use**
|
|
8246
|
+
*
|
|
8247
|
+
* Use when folding order matters and values must be combined from right to
|
|
8248
|
+
* left.
|
|
8249
|
+
*
|
|
7197
8250
|
* **Details**
|
|
7198
8251
|
*
|
|
7199
8252
|
* - The function receives `(accumulator, element, index)`.
|
|
@@ -7216,6 +8269,11 @@ export const reduceRight: {
|
|
|
7216
8269
|
/**
|
|
7217
8270
|
* Folds an iterable from right to left into a single value.
|
|
7218
8271
|
*
|
|
8272
|
+
* **When to use**
|
|
8273
|
+
*
|
|
8274
|
+
* Use when folding order matters and values must be combined from right to
|
|
8275
|
+
* left.
|
|
8276
|
+
*
|
|
7219
8277
|
* **Details**
|
|
7220
8278
|
*
|
|
7221
8279
|
* - The function receives `(accumulator, element, index)`.
|
|
@@ -7238,6 +8296,11 @@ export const reduceRight: {
|
|
|
7238
8296
|
/**
|
|
7239
8297
|
* Folds an iterable from right to left into a single value.
|
|
7240
8298
|
*
|
|
8299
|
+
* **When to use**
|
|
8300
|
+
*
|
|
8301
|
+
* Use when folding order matters and values must be combined from right to
|
|
8302
|
+
* left.
|
|
8303
|
+
*
|
|
7241
8304
|
* **Details**
|
|
7242
8305
|
*
|
|
7243
8306
|
* - The function receives `(accumulator, element, index)`.
|
|
@@ -7340,6 +8403,10 @@ export const liftOption = <A extends Array<unknown>, B>(
|
|
|
7340
8403
|
* Converts a nullable value to an array: `null`/`undefined` becomes `[]`,
|
|
7341
8404
|
* anything else becomes `[value]`.
|
|
7342
8405
|
*
|
|
8406
|
+
* **When to use**
|
|
8407
|
+
*
|
|
8408
|
+
* Use to treat a nullable single value as zero or one array element.
|
|
8409
|
+
*
|
|
7343
8410
|
* **Example** (Nullable to array)
|
|
7344
8411
|
*
|
|
7345
8412
|
* ```ts
|
|
@@ -7390,6 +8457,11 @@ export const liftNullishOr = <A extends Array<unknown>, B>(
|
|
|
7390
8457
|
* Maps each element with a nullable-returning function, keeping only non-null /
|
|
7391
8458
|
* non-undefined results.
|
|
7392
8459
|
*
|
|
8460
|
+
* **When to use**
|
|
8461
|
+
*
|
|
8462
|
+
* Use when mapping and filtering in one step, where the mapper can return
|
|
8463
|
+
* `null` or `undefined` to skip elements.
|
|
8464
|
+
*
|
|
7393
8465
|
* **Example** (FlatMapping with nullable)
|
|
7394
8466
|
*
|
|
7395
8467
|
* ```ts
|
|
@@ -7399,6 +8471,9 @@ export const liftNullishOr = <A extends Array<unknown>, B>(
|
|
|
7399
8471
|
* // [1, 3]
|
|
7400
8472
|
* ```
|
|
7401
8473
|
*
|
|
8474
|
+
* @see {@link flatMap} for mapping each element to an array and flattening
|
|
8475
|
+
* @see {@link fromNullishOr} for converting a single nullable value to an array
|
|
8476
|
+
*
|
|
7402
8477
|
* @category sequencing
|
|
7403
8478
|
* @since 4.0.0
|
|
7404
8479
|
*/
|
|
@@ -7407,6 +8482,11 @@ export const flatMapNullishOr: {
|
|
|
7407
8482
|
* Maps each element with a nullable-returning function, keeping only non-null /
|
|
7408
8483
|
* non-undefined results.
|
|
7409
8484
|
*
|
|
8485
|
+
* **When to use**
|
|
8486
|
+
*
|
|
8487
|
+
* Use when mapping and filtering in one step, where the mapper can return
|
|
8488
|
+
* `null` or `undefined` to skip elements.
|
|
8489
|
+
*
|
|
7410
8490
|
* **Example** (FlatMapping with nullable)
|
|
7411
8491
|
*
|
|
7412
8492
|
* ```ts
|
|
@@ -7416,6 +8496,9 @@ export const flatMapNullishOr: {
|
|
|
7416
8496
|
* // [1, 3]
|
|
7417
8497
|
* ```
|
|
7418
8498
|
*
|
|
8499
|
+
* @see {@link flatMap} for mapping each element to an array and flattening
|
|
8500
|
+
* @see {@link fromNullishOr} for converting a single nullable value to an array
|
|
8501
|
+
*
|
|
7419
8502
|
* @category sequencing
|
|
7420
8503
|
* @since 4.0.0
|
|
7421
8504
|
*/
|
|
@@ -7424,6 +8507,11 @@ export const flatMapNullishOr: {
|
|
|
7424
8507
|
* Maps each element with a nullable-returning function, keeping only non-null /
|
|
7425
8508
|
* non-undefined results.
|
|
7426
8509
|
*
|
|
8510
|
+
* **When to use**
|
|
8511
|
+
*
|
|
8512
|
+
* Use when mapping and filtering in one step, where the mapper can return
|
|
8513
|
+
* `null` or `undefined` to skip elements.
|
|
8514
|
+
*
|
|
7427
8515
|
* **Example** (FlatMapping with nullable)
|
|
7428
8516
|
*
|
|
7429
8517
|
* ```ts
|
|
@@ -7433,6 +8521,9 @@ export const flatMapNullishOr: {
|
|
|
7433
8521
|
* // [1, 3]
|
|
7434
8522
|
* ```
|
|
7435
8523
|
*
|
|
8524
|
+
* @see {@link flatMap} for mapping each element to an array and flattening
|
|
8525
|
+
* @see {@link fromNullishOr} for converting a single nullable value to an array
|
|
8526
|
+
*
|
|
7436
8527
|
* @category sequencing
|
|
7437
8528
|
* @since 4.0.0
|
|
7438
8529
|
*/
|
|
@@ -7479,6 +8570,11 @@ export const liftResult = <A extends Array<unknown>, E, B>(
|
|
|
7479
8570
|
* Tests whether all elements satisfy the predicate. Supports refinements for
|
|
7480
8571
|
* type narrowing.
|
|
7481
8572
|
*
|
|
8573
|
+
* **When to use**
|
|
8574
|
+
*
|
|
8575
|
+
* Use to check that all elements satisfy a predicate, including
|
|
8576
|
+
* refinement-based type narrowing.
|
|
8577
|
+
*
|
|
7482
8578
|
* **Example** (Testing all elements)
|
|
7483
8579
|
*
|
|
7484
8580
|
* ```ts
|
|
@@ -7498,6 +8594,11 @@ export const every: {
|
|
|
7498
8594
|
* Tests whether all elements satisfy the predicate. Supports refinements for
|
|
7499
8595
|
* type narrowing.
|
|
7500
8596
|
*
|
|
8597
|
+
* **When to use**
|
|
8598
|
+
*
|
|
8599
|
+
* Use to check that all elements satisfy a predicate, including
|
|
8600
|
+
* refinement-based type narrowing.
|
|
8601
|
+
*
|
|
7501
8602
|
* **Example** (Testing all elements)
|
|
7502
8603
|
*
|
|
7503
8604
|
* ```ts
|
|
@@ -7517,6 +8618,11 @@ export const every: {
|
|
|
7517
8618
|
* Tests whether all elements satisfy the predicate. Supports refinements for
|
|
7518
8619
|
* type narrowing.
|
|
7519
8620
|
*
|
|
8621
|
+
* **When to use**
|
|
8622
|
+
*
|
|
8623
|
+
* Use to check that all elements satisfy a predicate, including
|
|
8624
|
+
* refinement-based type narrowing.
|
|
8625
|
+
*
|
|
7520
8626
|
* **Example** (Testing all elements)
|
|
7521
8627
|
*
|
|
7522
8628
|
* ```ts
|
|
@@ -7536,6 +8642,11 @@ export const every: {
|
|
|
7536
8642
|
* Tests whether all elements satisfy the predicate. Supports refinements for
|
|
7537
8643
|
* type narrowing.
|
|
7538
8644
|
*
|
|
8645
|
+
* **When to use**
|
|
8646
|
+
*
|
|
8647
|
+
* Use to check that all elements satisfy a predicate, including
|
|
8648
|
+
* refinement-based type narrowing.
|
|
8649
|
+
*
|
|
7539
8650
|
* **Example** (Testing all elements)
|
|
7540
8651
|
*
|
|
7541
8652
|
* ```ts
|
|
@@ -7555,6 +8666,11 @@ export const every: {
|
|
|
7555
8666
|
* Tests whether all elements satisfy the predicate. Supports refinements for
|
|
7556
8667
|
* type narrowing.
|
|
7557
8668
|
*
|
|
8669
|
+
* **When to use**
|
|
8670
|
+
*
|
|
8671
|
+
* Use to check that all elements satisfy a predicate, including
|
|
8672
|
+
* refinement-based type narrowing.
|
|
8673
|
+
*
|
|
7558
8674
|
* **Example** (Testing all elements)
|
|
7559
8675
|
*
|
|
7560
8676
|
* ```ts
|
|
@@ -7646,6 +8762,11 @@ export const some: {
|
|
|
7646
8762
|
* Applies a function to each suffix of the array (starting from each index),
|
|
7647
8763
|
* collecting the results.
|
|
7648
8764
|
*
|
|
8765
|
+
* **When to use**
|
|
8766
|
+
*
|
|
8767
|
+
* Use when a computation depends on every suffix of an array, such as
|
|
8768
|
+
* cumulative aggregations from each position.
|
|
8769
|
+
*
|
|
7649
8770
|
* **Details**
|
|
7650
8771
|
*
|
|
7651
8772
|
* - For index `i`, the function receives `self.slice(i)`.
|
|
@@ -7658,6 +8779,8 @@ export const some: {
|
|
|
7658
8779
|
* console.log(Array.extend([1, 2, 3], (as) => as.length)) // [3, 2, 1]
|
|
7659
8780
|
* ```
|
|
7660
8781
|
*
|
|
8782
|
+
* @see {@link scan} for keeping intermediate accumulator values during a fold
|
|
8783
|
+
*
|
|
7661
8784
|
* @category mapping
|
|
7662
8785
|
* @since 2.0.0
|
|
7663
8786
|
*/
|
|
@@ -7666,6 +8789,11 @@ export const extend: {
|
|
|
7666
8789
|
* Applies a function to each suffix of the array (starting from each index),
|
|
7667
8790
|
* collecting the results.
|
|
7668
8791
|
*
|
|
8792
|
+
* **When to use**
|
|
8793
|
+
*
|
|
8794
|
+
* Use when a computation depends on every suffix of an array, such as
|
|
8795
|
+
* cumulative aggregations from each position.
|
|
8796
|
+
*
|
|
7669
8797
|
* **Details**
|
|
7670
8798
|
*
|
|
7671
8799
|
* - For index `i`, the function receives `self.slice(i)`.
|
|
@@ -7678,6 +8806,8 @@ export const extend: {
|
|
|
7678
8806
|
* console.log(Array.extend([1, 2, 3], (as) => as.length)) // [3, 2, 1]
|
|
7679
8807
|
* ```
|
|
7680
8808
|
*
|
|
8809
|
+
* @see {@link scan} for keeping intermediate accumulator values during a fold
|
|
8810
|
+
*
|
|
7681
8811
|
* @category mapping
|
|
7682
8812
|
* @since 2.0.0
|
|
7683
8813
|
*/
|
|
@@ -7686,6 +8816,11 @@ export const extend: {
|
|
|
7686
8816
|
* Applies a function to each suffix of the array (starting from each index),
|
|
7687
8817
|
* collecting the results.
|
|
7688
8818
|
*
|
|
8819
|
+
* **When to use**
|
|
8820
|
+
*
|
|
8821
|
+
* Use when a computation depends on every suffix of an array, such as
|
|
8822
|
+
* cumulative aggregations from each position.
|
|
8823
|
+
*
|
|
7689
8824
|
* **Details**
|
|
7690
8825
|
*
|
|
7691
8826
|
* - For index `i`, the function receives `self.slice(i)`.
|
|
@@ -7698,6 +8833,8 @@ export const extend: {
|
|
|
7698
8833
|
* console.log(Array.extend([1, 2, 3], (as) => as.length)) // [3, 2, 1]
|
|
7699
8834
|
* ```
|
|
7700
8835
|
*
|
|
8836
|
+
* @see {@link scan} for keeping intermediate accumulator values during a fold
|
|
8837
|
+
*
|
|
7701
8838
|
* @category mapping
|
|
7702
8839
|
* @since 2.0.0
|
|
7703
8840
|
*/
|
|
@@ -7907,6 +9044,11 @@ export const makeEquivalence: <A>(
|
|
|
7907
9044
|
/**
|
|
7908
9045
|
* Runs a side-effect for each element. The callback receives `(element, index)`.
|
|
7909
9046
|
*
|
|
9047
|
+
* **When to use**
|
|
9048
|
+
*
|
|
9049
|
+
* Use to iterate over an array for side-effects only, when no transformed
|
|
9050
|
+
* result is needed.
|
|
9051
|
+
*
|
|
7910
9052
|
* **Example** (Iterating with side-effects)
|
|
7911
9053
|
*
|
|
7912
9054
|
* ```ts
|
|
@@ -7915,6 +9057,8 @@ export const makeEquivalence: <A>(
|
|
|
7915
9057
|
* Array.forEach([1, 2, 3], (n) => console.log(n)) // 1, 2, 3
|
|
7916
9058
|
* ```
|
|
7917
9059
|
*
|
|
9060
|
+
* @see {@link map} for transforming each element into a new array
|
|
9061
|
+
*
|
|
7918
9062
|
* @category elements
|
|
7919
9063
|
* @since 2.0.0
|
|
7920
9064
|
*/
|
|
@@ -7922,6 +9066,11 @@ export const forEach: {
|
|
|
7922
9066
|
/**
|
|
7923
9067
|
* Runs a side-effect for each element. The callback receives `(element, index)`.
|
|
7924
9068
|
*
|
|
9069
|
+
* **When to use**
|
|
9070
|
+
*
|
|
9071
|
+
* Use to iterate over an array for side-effects only, when no transformed
|
|
9072
|
+
* result is needed.
|
|
9073
|
+
*
|
|
7925
9074
|
* **Example** (Iterating with side-effects)
|
|
7926
9075
|
*
|
|
7927
9076
|
* ```ts
|
|
@@ -7930,6 +9079,8 @@ export const forEach: {
|
|
|
7930
9079
|
* Array.forEach([1, 2, 3], (n) => console.log(n)) // 1, 2, 3
|
|
7931
9080
|
* ```
|
|
7932
9081
|
*
|
|
9082
|
+
* @see {@link map} for transforming each element into a new array
|
|
9083
|
+
*
|
|
7933
9084
|
* @category elements
|
|
7934
9085
|
* @since 2.0.0
|
|
7935
9086
|
*/
|
|
@@ -7937,6 +9088,11 @@ export const forEach: {
|
|
|
7937
9088
|
/**
|
|
7938
9089
|
* Runs a side-effect for each element. The callback receives `(element, index)`.
|
|
7939
9090
|
*
|
|
9091
|
+
* **When to use**
|
|
9092
|
+
*
|
|
9093
|
+
* Use to iterate over an array for side-effects only, when no transformed
|
|
9094
|
+
* result is needed.
|
|
9095
|
+
*
|
|
7940
9096
|
* **Example** (Iterating with side-effects)
|
|
7941
9097
|
*
|
|
7942
9098
|
* ```ts
|
|
@@ -7945,6 +9101,8 @@ export const forEach: {
|
|
|
7945
9101
|
* Array.forEach([1, 2, 3], (n) => console.log(n)) // 1, 2, 3
|
|
7946
9102
|
* ```
|
|
7947
9103
|
*
|
|
9104
|
+
* @see {@link map} for transforming each element into a new array
|
|
9105
|
+
*
|
|
7948
9106
|
* @category elements
|
|
7949
9107
|
* @since 2.0.0
|
|
7950
9108
|
*/
|
|
@@ -7955,6 +9113,11 @@ export const forEach: {
|
|
|
7955
9113
|
* Removes duplicates using a custom equivalence, preserving the order of the
|
|
7956
9114
|
* first occurrence.
|
|
7957
9115
|
*
|
|
9116
|
+
* **When to use**
|
|
9117
|
+
*
|
|
9118
|
+
* Use to remove all duplicate elements with a custom equivalence when default
|
|
9119
|
+
* equality is not appropriate.
|
|
9120
|
+
*
|
|
7958
9121
|
* **Example** (Deduplicating with custom equality)
|
|
7959
9122
|
*
|
|
7960
9123
|
* ```ts
|
|
@@ -7974,6 +9137,11 @@ export const dedupeWith: {
|
|
|
7974
9137
|
* Removes duplicates using a custom equivalence, preserving the order of the
|
|
7975
9138
|
* first occurrence.
|
|
7976
9139
|
*
|
|
9140
|
+
* **When to use**
|
|
9141
|
+
*
|
|
9142
|
+
* Use to remove all duplicate elements with a custom equivalence when default
|
|
9143
|
+
* equality is not appropriate.
|
|
9144
|
+
*
|
|
7977
9145
|
* **Example** (Deduplicating with custom equality)
|
|
7978
9146
|
*
|
|
7979
9147
|
* ```ts
|
|
@@ -7995,6 +9163,11 @@ export const dedupeWith: {
|
|
|
7995
9163
|
* Removes duplicates using a custom equivalence, preserving the order of the
|
|
7996
9164
|
* first occurrence.
|
|
7997
9165
|
*
|
|
9166
|
+
* **When to use**
|
|
9167
|
+
*
|
|
9168
|
+
* Use to remove all duplicate elements with a custom equivalence when default
|
|
9169
|
+
* equality is not appropriate.
|
|
9170
|
+
*
|
|
7998
9171
|
* **Example** (Deduplicating with custom equality)
|
|
7999
9172
|
*
|
|
8000
9173
|
* ```ts
|
|
@@ -8017,6 +9190,11 @@ export const dedupeWith: {
|
|
|
8017
9190
|
* Removes duplicates using a custom equivalence, preserving the order of the
|
|
8018
9191
|
* first occurrence.
|
|
8019
9192
|
*
|
|
9193
|
+
* **When to use**
|
|
9194
|
+
*
|
|
9195
|
+
* Use to remove all duplicate elements with a custom equivalence when default
|
|
9196
|
+
* equality is not appropriate.
|
|
9197
|
+
*
|
|
8020
9198
|
* **Example** (Deduplicating with custom equality)
|
|
8021
9199
|
*
|
|
8022
9200
|
* ```ts
|
|
@@ -8054,6 +9232,11 @@ export const dedupeWith: {
|
|
|
8054
9232
|
* Removes duplicates using `Equal.equivalence()`, preserving the order of the
|
|
8055
9233
|
* first occurrence.
|
|
8056
9234
|
*
|
|
9235
|
+
* **When to use**
|
|
9236
|
+
*
|
|
9237
|
+
* Use to remove repeated values from an iterable when Effect's default equality
|
|
9238
|
+
* is the right comparison, preserving the first occurrence.
|
|
9239
|
+
*
|
|
8057
9240
|
* **Example** (Removing duplicates)
|
|
8058
9241
|
*
|
|
8059
9242
|
* ```ts
|
|
@@ -8076,6 +9259,12 @@ export const dedupe = <S extends Iterable<any>>(
|
|
|
8076
9259
|
/**
|
|
8077
9260
|
* Removes consecutive duplicate elements using a custom equivalence.
|
|
8078
9261
|
*
|
|
9262
|
+
* **When to use**
|
|
9263
|
+
*
|
|
9264
|
+
* Use when consecutive duplicates should be collapsed using a custom
|
|
9265
|
+
* equivalence, while equivalent values that appear later should remain in the
|
|
9266
|
+
* result.
|
|
9267
|
+
*
|
|
8079
9268
|
* **Details**
|
|
8080
9269
|
*
|
|
8081
9270
|
* - Non-adjacent duplicates are preserved.
|
|
@@ -8099,6 +9288,12 @@ export const dedupeAdjacentWith: {
|
|
|
8099
9288
|
/**
|
|
8100
9289
|
* Removes consecutive duplicate elements using a custom equivalence.
|
|
8101
9290
|
*
|
|
9291
|
+
* **When to use**
|
|
9292
|
+
*
|
|
9293
|
+
* Use when consecutive duplicates should be collapsed using a custom
|
|
9294
|
+
* equivalence, while equivalent values that appear later should remain in the
|
|
9295
|
+
* result.
|
|
9296
|
+
*
|
|
8102
9297
|
* **Details**
|
|
8103
9298
|
*
|
|
8104
9299
|
* - Non-adjacent duplicates are preserved.
|
|
@@ -8122,6 +9317,12 @@ export const dedupeAdjacentWith: {
|
|
|
8122
9317
|
/**
|
|
8123
9318
|
* Removes consecutive duplicate elements using a custom equivalence.
|
|
8124
9319
|
*
|
|
9320
|
+
* **When to use**
|
|
9321
|
+
*
|
|
9322
|
+
* Use when consecutive duplicates should be collapsed using a custom
|
|
9323
|
+
* equivalence, while equivalent values that appear later should remain in the
|
|
9324
|
+
* result.
|
|
9325
|
+
*
|
|
8125
9326
|
* **Details**
|
|
8126
9327
|
*
|
|
8127
9328
|
* - Non-adjacent duplicates are preserved.
|
|
@@ -8157,6 +9358,11 @@ export const dedupeAdjacentWith: {
|
|
|
8157
9358
|
/**
|
|
8158
9359
|
* Removes consecutive duplicate elements using `Equal.equivalence()`.
|
|
8159
9360
|
*
|
|
9361
|
+
* **When to use**
|
|
9362
|
+
*
|
|
9363
|
+
* Use when you need to collapse consecutive duplicates while preserving later
|
|
9364
|
+
* non-consecutive repeats, and the default equality is sufficient.
|
|
9365
|
+
*
|
|
8160
9366
|
* **Example** (Removing adjacent duplicates)
|
|
8161
9367
|
*
|
|
8162
9368
|
* ```ts
|
|
@@ -8229,6 +9435,11 @@ export const join: {
|
|
|
8229
9435
|
/**
|
|
8230
9436
|
* Maps over an array while threading an accumulator through each step, returning both the final state and the mapped array.
|
|
8231
9437
|
*
|
|
9438
|
+
* **When to use**
|
|
9439
|
+
*
|
|
9440
|
+
* Use when mapping needs state threaded through each element and the final state
|
|
9441
|
+
* is also needed.
|
|
9442
|
+
*
|
|
8232
9443
|
* **Details**
|
|
8233
9444
|
*
|
|
8234
9445
|
* - Combines `map` and `reduce` in a single pass.
|
|
@@ -8255,6 +9466,11 @@ export const mapAccum: {
|
|
|
8255
9466
|
/**
|
|
8256
9467
|
* Maps over an array while threading an accumulator through each step, returning both the final state and the mapped array.
|
|
8257
9468
|
*
|
|
9469
|
+
* **When to use**
|
|
9470
|
+
*
|
|
9471
|
+
* Use when mapping needs state threaded through each element and the final state
|
|
9472
|
+
* is also needed.
|
|
9473
|
+
*
|
|
8258
9474
|
* **Details**
|
|
8259
9475
|
*
|
|
8260
9476
|
* - Combines `map` and `reduce` in a single pass.
|
|
@@ -8281,6 +9497,11 @@ export const mapAccum: {
|
|
|
8281
9497
|
/**
|
|
8282
9498
|
* Maps over an array while threading an accumulator through each step, returning both the final state and the mapped array.
|
|
8283
9499
|
*
|
|
9500
|
+
* **When to use**
|
|
9501
|
+
*
|
|
9502
|
+
* Use when mapping needs state threaded through each element and the final state
|
|
9503
|
+
* is also needed.
|
|
9504
|
+
*
|
|
8284
9505
|
* **Details**
|
|
8285
9506
|
*
|
|
8286
9507
|
* - Combines `map` and `reduce` in a single pass.
|
|
@@ -8327,6 +9548,11 @@ export const mapAccum: {
|
|
|
8327
9548
|
/**
|
|
8328
9549
|
* Computes the cartesian product of two arrays, applying a combiner to each pair.
|
|
8329
9550
|
*
|
|
9551
|
+
* **When to use**
|
|
9552
|
+
*
|
|
9553
|
+
* Use to compute every combination from two arrays and immediately transform
|
|
9554
|
+
* each pair into a custom result.
|
|
9555
|
+
*
|
|
8330
9556
|
* **Details**
|
|
8331
9557
|
*
|
|
8332
9558
|
* - Produces every combination of an element from `self` with an element from `that`.
|
|
@@ -8342,7 +9568,7 @@ export const mapAccum: {
|
|
|
8342
9568
|
* console.log(result) // ["1-a", "1-b", "2-a", "2-b"]
|
|
8343
9569
|
* ```
|
|
8344
9570
|
*
|
|
8345
|
-
* @see {@link cartesian}
|
|
9571
|
+
* @see {@link cartesian} for returning tuples instead of applying a combiner
|
|
8346
9572
|
*
|
|
8347
9573
|
* @category elements
|
|
8348
9574
|
* @since 2.0.0
|
|
@@ -8351,6 +9577,11 @@ export const cartesianWith: {
|
|
|
8351
9577
|
/**
|
|
8352
9578
|
* Computes the cartesian product of two arrays, applying a combiner to each pair.
|
|
8353
9579
|
*
|
|
9580
|
+
* **When to use**
|
|
9581
|
+
*
|
|
9582
|
+
* Use to compute every combination from two arrays and immediately transform
|
|
9583
|
+
* each pair into a custom result.
|
|
9584
|
+
*
|
|
8354
9585
|
* **Details**
|
|
8355
9586
|
*
|
|
8356
9587
|
* - Produces every combination of an element from `self` with an element from `that`.
|
|
@@ -8366,7 +9597,7 @@ export const cartesianWith: {
|
|
|
8366
9597
|
* console.log(result) // ["1-a", "1-b", "2-a", "2-b"]
|
|
8367
9598
|
* ```
|
|
8368
9599
|
*
|
|
8369
|
-
* @see {@link cartesian}
|
|
9600
|
+
* @see {@link cartesian} for returning tuples instead of applying a combiner
|
|
8370
9601
|
*
|
|
8371
9602
|
* @category elements
|
|
8372
9603
|
* @since 2.0.0
|
|
@@ -8375,6 +9606,11 @@ export const cartesianWith: {
|
|
|
8375
9606
|
/**
|
|
8376
9607
|
* Computes the cartesian product of two arrays, applying a combiner to each pair.
|
|
8377
9608
|
*
|
|
9609
|
+
* **When to use**
|
|
9610
|
+
*
|
|
9611
|
+
* Use to compute every combination from two arrays and immediately transform
|
|
9612
|
+
* each pair into a custom result.
|
|
9613
|
+
*
|
|
8378
9614
|
* **Details**
|
|
8379
9615
|
*
|
|
8380
9616
|
* - Produces every combination of an element from `self` with an element from `that`.
|
|
@@ -8390,7 +9626,7 @@ export const cartesianWith: {
|
|
|
8390
9626
|
* console.log(result) // ["1-a", "1-b", "2-a", "2-b"]
|
|
8391
9627
|
* ```
|
|
8392
9628
|
*
|
|
8393
|
-
* @see {@link cartesian}
|
|
9629
|
+
* @see {@link cartesian} for returning tuples instead of applying a combiner
|
|
8394
9630
|
*
|
|
8395
9631
|
* @category elements
|
|
8396
9632
|
* @since 2.0.0
|
|
@@ -8405,6 +9641,10 @@ export const cartesianWith: {
|
|
|
8405
9641
|
/**
|
|
8406
9642
|
* Computes the cartesian product of two arrays, returning all pairs as tuples.
|
|
8407
9643
|
*
|
|
9644
|
+
* **When to use**
|
|
9645
|
+
*
|
|
9646
|
+
* Use when you need every `[a, b]` pair from two arrays as tuples.
|
|
9647
|
+
*
|
|
8408
9648
|
* **Details**
|
|
8409
9649
|
*
|
|
8410
9650
|
* - Produces every `[a, b]` combination of an element from `self` with an element from `that`.
|
|
@@ -8428,6 +9668,10 @@ export const cartesian: {
|
|
|
8428
9668
|
/**
|
|
8429
9669
|
* Computes the cartesian product of two arrays, returning all pairs as tuples.
|
|
8430
9670
|
*
|
|
9671
|
+
* **When to use**
|
|
9672
|
+
*
|
|
9673
|
+
* Use when you need every `[a, b]` pair from two arrays as tuples.
|
|
9674
|
+
*
|
|
8431
9675
|
* **Details**
|
|
8432
9676
|
*
|
|
8433
9677
|
* - Produces every `[a, b]` combination of an element from `self` with an element from `that`.
|
|
@@ -8451,6 +9695,10 @@ export const cartesian: {
|
|
|
8451
9695
|
/**
|
|
8452
9696
|
* Computes the cartesian product of two arrays, returning all pairs as tuples.
|
|
8453
9697
|
*
|
|
9698
|
+
* **When to use**
|
|
9699
|
+
*
|
|
9700
|
+
* Use when you need every `[a, b]` pair from two arrays as tuples.
|
|
9701
|
+
*
|
|
8454
9702
|
* **Details**
|
|
8455
9703
|
*
|
|
8456
9704
|
* - Produces every `[a, b]` combination of an element from `self` with an element from `that`.
|
|
@@ -8485,7 +9733,7 @@ export const cartesian: {
|
|
|
8485
9733
|
*
|
|
8486
9734
|
* **When to use**
|
|
8487
9735
|
*
|
|
8488
|
-
*
|
|
9736
|
+
* Use when begin a pipeline with `Do`, then use {@link bind} to introduce array variables and {@link let_ let} for plain values.
|
|
8489
9737
|
* - Each `bind` produces the cartesian product of all bound variables (like nested loops).
|
|
8490
9738
|
* - Use `filter` and `map` in the pipeline to add conditions and transformations.
|
|
8491
9739
|
*
|
|
@@ -8516,6 +9764,11 @@ export const Do: ReadonlyArray<{}> = of({})
|
|
|
8516
9764
|
/**
|
|
8517
9765
|
* Introduces a new array variable into a do-notation scope, producing the cartesian product with all previous bindings.
|
|
8518
9766
|
*
|
|
9767
|
+
* **When to use**
|
|
9768
|
+
*
|
|
9769
|
+
* Use to add another array-producing binding to an `Array.Do` pipeline, pairing
|
|
9770
|
+
* each existing scope with every value returned by the callback.
|
|
9771
|
+
*
|
|
8519
9772
|
* **Details**
|
|
8520
9773
|
*
|
|
8521
9774
|
* - Each `bind` call adds a named property to the accumulated object.
|
|
@@ -8547,6 +9800,11 @@ export const bind: {
|
|
|
8547
9800
|
/**
|
|
8548
9801
|
* Introduces a new array variable into a do-notation scope, producing the cartesian product with all previous bindings.
|
|
8549
9802
|
*
|
|
9803
|
+
* **When to use**
|
|
9804
|
+
*
|
|
9805
|
+
* Use to add another array-producing binding to an `Array.Do` pipeline, pairing
|
|
9806
|
+
* each existing scope with every value returned by the callback.
|
|
9807
|
+
*
|
|
8550
9808
|
* **Details**
|
|
8551
9809
|
*
|
|
8552
9810
|
* - Each `bind` call adds a named property to the accumulated object.
|
|
@@ -8580,6 +9838,11 @@ export const bind: {
|
|
|
8580
9838
|
/**
|
|
8581
9839
|
* Introduces a new array variable into a do-notation scope, producing the cartesian product with all previous bindings.
|
|
8582
9840
|
*
|
|
9841
|
+
* **When to use**
|
|
9842
|
+
*
|
|
9843
|
+
* Use to add another array-producing binding to an `Array.Do` pipeline, pairing
|
|
9844
|
+
* each existing scope with every value returned by the callback.
|
|
9845
|
+
*
|
|
8583
9846
|
* **Details**
|
|
8584
9847
|
*
|
|
8585
9848
|
* - Each `bind` call adds a named property to the accumulated object.
|
|
@@ -8617,6 +9880,11 @@ export const bind: {
|
|
|
8617
9880
|
/**
|
|
8618
9881
|
* Names the elements of an array by wrapping each in an object with the given key, starting a do-notation scope.
|
|
8619
9882
|
*
|
|
9883
|
+
* **When to use**
|
|
9884
|
+
*
|
|
9885
|
+
* Use when you already have an array and want to start a do-notation pipeline
|
|
9886
|
+
* by naming each element.
|
|
9887
|
+
*
|
|
8620
9888
|
* **Details**
|
|
8621
9889
|
*
|
|
8622
9890
|
* - Equivalent to `Array.map(self, (a) => ({ [tag]: a }))`.
|
|
@@ -8644,6 +9912,11 @@ export const bindTo: {
|
|
|
8644
9912
|
/**
|
|
8645
9913
|
* Names the elements of an array by wrapping each in an object with the given key, starting a do-notation scope.
|
|
8646
9914
|
*
|
|
9915
|
+
* **When to use**
|
|
9916
|
+
*
|
|
9917
|
+
* Use when you already have an array and want to start a do-notation pipeline
|
|
9918
|
+
* by naming each element.
|
|
9919
|
+
*
|
|
8647
9920
|
* **Details**
|
|
8648
9921
|
*
|
|
8649
9922
|
* - Equivalent to `Array.map(self, (a) => ({ [tag]: a }))`.
|
|
@@ -8671,6 +9944,11 @@ export const bindTo: {
|
|
|
8671
9944
|
/**
|
|
8672
9945
|
* Names the elements of an array by wrapping each in an object with the given key, starting a do-notation scope.
|
|
8673
9946
|
*
|
|
9947
|
+
* **When to use**
|
|
9948
|
+
*
|
|
9949
|
+
* Use when you already have an array and want to start a do-notation pipeline
|
|
9950
|
+
* by naming each element.
|
|
9951
|
+
*
|
|
8674
9952
|
* **Details**
|
|
8675
9953
|
*
|
|
8676
9954
|
* - Equivalent to `Array.map(self, (a) => ({ [tag]: a }))`.
|
|
@@ -8770,6 +10048,11 @@ export function makeReducerConcat<A>(): Reducer.Reducer<Array<A>> {
|
|
|
8770
10048
|
/**
|
|
8771
10049
|
* Counts the elements in an iterable that satisfy a predicate.
|
|
8772
10050
|
*
|
|
10051
|
+
* **When to use**
|
|
10052
|
+
*
|
|
10053
|
+
* Use to count how many elements satisfy a predicate when you only need the
|
|
10054
|
+
* number of matches instead of the matching elements.
|
|
10055
|
+
*
|
|
8773
10056
|
* **Details**
|
|
8774
10057
|
*
|
|
8775
10058
|
* - The predicate receives both the element and its index.
|
|
@@ -8793,6 +10076,11 @@ export const countBy: {
|
|
|
8793
10076
|
/**
|
|
8794
10077
|
* Counts the elements in an iterable that satisfy a predicate.
|
|
8795
10078
|
*
|
|
10079
|
+
* **When to use**
|
|
10080
|
+
*
|
|
10081
|
+
* Use to count how many elements satisfy a predicate when you only need the
|
|
10082
|
+
* number of matches instead of the matching elements.
|
|
10083
|
+
*
|
|
8796
10084
|
* **Details**
|
|
8797
10085
|
*
|
|
8798
10086
|
* - The predicate receives both the element and its index.
|
|
@@ -8816,6 +10104,11 @@ export const countBy: {
|
|
|
8816
10104
|
/**
|
|
8817
10105
|
* Counts the elements in an iterable that satisfy a predicate.
|
|
8818
10106
|
*
|
|
10107
|
+
* **When to use**
|
|
10108
|
+
*
|
|
10109
|
+
* Use to count how many elements satisfy a predicate when you only need the
|
|
10110
|
+
* number of matches instead of the matching elements.
|
|
10111
|
+
*
|
|
8819
10112
|
* **Details**
|
|
8820
10113
|
*
|
|
8821
10114
|
* - The predicate receives both the element and its index.
|