effect 4.0.0-beta.74 → 4.0.0-beta.75
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 +729 -611
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +273 -213
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +37 -30
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +19 -16
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +34 -40
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +16 -16
- package/dist/BigInt.js.map +1 -1
- package/dist/Boolean.d.ts +8 -8
- package/dist/Boolean.js +4 -4
- package/dist/Brand.d.ts +13 -11
- package/dist/Brand.d.ts.map +1 -1
- package/dist/Brand.js +10 -8
- package/dist/Brand.js.map +1 -1
- package/dist/Cause.d.ts +21 -23
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +21 -23
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +219 -9
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +83 -3
- package/dist/Channel.js.map +1 -1
- package/dist/ChannelSchema.d.ts +11 -11
- package/dist/ChannelSchema.js +5 -5
- package/dist/Chunk.d.ts +69 -16
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +43 -8
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +3 -3
- package/dist/Clock.js +3 -3
- package/dist/Combiner.d.ts +9 -13
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +9 -13
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +49 -56
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +40 -43
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +34 -44
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +24 -32
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +2 -2
- package/dist/Console.js +2 -2
- package/dist/Context.d.ts +60 -72
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +28 -32
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +2 -2
- package/dist/Cron.js +2 -2
- package/dist/Crypto.d.ts +4 -4
- package/dist/Crypto.js +4 -4
- package/dist/Data.d.ts +21 -15
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +7 -7
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +35 -16
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +35 -8
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +24 -15
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +8 -5
- package/dist/Deferred.js.map +1 -1
- package/dist/Duration.d.ts +44 -31
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +22 -11
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +516 -416
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +234 -174
- package/dist/Effect.js.map +1 -1
- package/dist/Encoding.d.ts +5 -0
- package/dist/Encoding.d.ts.map +1 -1
- package/dist/Encoding.js +5 -0
- package/dist/Encoding.js.map +1 -1
- package/dist/Equal.d.ts +26 -39
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +10 -17
- package/dist/Equal.js.map +1 -1
- package/dist/Equivalence.d.ts +71 -99
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +53 -73
- package/dist/Equivalence.js.map +1 -1
- package/dist/ErrorReporter.d.ts +1 -1
- package/dist/ErrorReporter.js +1 -1
- package/dist/Exit.d.ts +79 -96
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js +57 -64
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +8 -6
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js +8 -6
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +25 -0
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +15 -0
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +35 -0
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +15 -0
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +20 -0
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +10 -0
- package/dist/FiberSet.js.map +1 -1
- package/dist/Filter.d.ts +4 -4
- package/dist/Filter.js +4 -4
- package/dist/Formatter.d.ts +14 -19
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +14 -19
- package/dist/Formatter.js.map +1 -1
- package/dist/Function.d.ts +15 -16
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +9 -10
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +2 -2
- package/dist/Graph.js +2 -2
- package/dist/HKT.d.ts +2 -2
- package/dist/Hash.d.ts +2 -1
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +2 -1
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +15 -0
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +5 -0
- package/dist/HashMap.js.map +1 -1
- package/dist/HashRing.d.ts +9 -9
- package/dist/HashRing.js +3 -3
- package/dist/Iterable.d.ts +24 -12
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +16 -6
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonPatch.d.ts +2 -3
- package/dist/JsonPatch.d.ts.map +1 -1
- package/dist/JsonPatch.js +2 -3
- package/dist/JsonPatch.js.map +1 -1
- package/dist/JsonPointer.d.ts +2 -6
- package/dist/JsonPointer.d.ts.map +1 -1
- package/dist/JsonPointer.js +2 -6
- package/dist/JsonPointer.js.map +1 -1
- package/dist/JsonSchema.d.ts +17 -13
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +17 -13
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Latch.d.ts +4 -3
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +4 -3
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +92 -114
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +38 -46
- package/dist/Layer.js.map +1 -1
- package/dist/Logger.d.ts +11 -14
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +11 -14
- package/dist/Logger.js.map +1 -1
- package/dist/Match.d.ts +2 -2
- package/dist/Match.js +2 -2
- package/dist/Metric.d.ts +89 -109
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +51 -61
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +21 -12
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +7 -4
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableList.d.ts +15 -0
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +15 -0
- package/dist/MutableList.js.map +1 -1
- package/dist/MutableRef.d.ts +56 -42
- package/dist/MutableRef.d.ts.map +1 -1
- package/dist/MutableRef.js +28 -22
- package/dist/MutableRef.js.map +1 -1
- package/dist/Newtype.d.ts +10 -7
- package/dist/Newtype.d.ts.map +1 -1
- package/dist/Newtype.js +10 -7
- package/dist/Newtype.js.map +1 -1
- package/dist/Number.d.ts +23 -11
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +9 -5
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts +16 -16
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +10 -9
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +196 -168
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +96 -79
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +118 -179
- package/dist/Order.d.ts.map +1 -1
- package/dist/Order.js +92 -144
- package/dist/Order.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts +14 -14
- package/dist/PartitionedSemaphore.js +6 -6
- package/dist/Path.d.ts +2 -2
- package/dist/Path.js +2 -2
- package/dist/Pipeable.d.ts +2 -2
- package/dist/Pipeable.js +2 -2
- package/dist/PlatformError.d.ts +4 -4
- package/dist/PlatformError.js +4 -4
- package/dist/Pool.d.ts +7 -11
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +3 -5
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts +274 -263
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/Predicate.js +128 -123
- package/dist/Predicate.js.map +1 -1
- package/dist/PubSub.d.ts +24 -14
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +16 -6
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts +4 -4
- package/dist/Pull.js +4 -4
- package/dist/Queue.d.ts +46 -7
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +46 -7
- package/dist/Queue.js.map +1 -1
- package/dist/RcRef.d.ts +0 -4
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/RcRef.js.map +1 -1
- package/dist/Redactable.d.ts +2 -2
- package/dist/Redactable.js +2 -2
- package/dist/Redacted.d.ts +3 -3
- package/dist/Redacted.js +3 -3
- package/dist/Reducer.d.ts +2 -3
- package/dist/Reducer.d.ts.map +1 -1
- package/dist/Reducer.js +2 -3
- package/dist/Reducer.js.map +1 -1
- package/dist/Ref.d.ts +17 -16
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +15 -14
- package/dist/Ref.js.map +1 -1
- package/dist/References.d.ts +4 -4
- package/dist/References.js +4 -4
- package/dist/Request.d.ts +18 -18
- package/dist/Request.js +6 -6
- package/dist/Resource.d.ts +2 -2
- package/dist/Resource.js +2 -2
- package/dist/Result.d.ts +77 -33
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +42 -19
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +11 -8
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +11 -8
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +107 -45
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +41 -29
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +6 -4
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +6 -4
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +443 -371
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +518 -427
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +42 -21
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +80 -59
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +126 -106
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +121 -101
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts +37 -39
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +16 -17
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +72 -153
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +72 -145
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +30 -21
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +26 -22
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +169 -145
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +183 -159
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/SchemaUtils.js +2 -2
- package/dist/SchemaUtils.js.map +1 -1
- package/dist/Scope.d.ts +15 -0
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +15 -0
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.d.ts +1 -1
- package/dist/ScopedCache.js +1 -1
- package/dist/ScopedRef.d.ts +14 -18
- package/dist/ScopedRef.d.ts.map +1 -1
- package/dist/ScopedRef.js +6 -8
- package/dist/ScopedRef.js.map +1 -1
- package/dist/Semaphore.d.ts +9 -9
- package/dist/Semaphore.js +3 -3
- package/dist/Sink.d.ts +13 -13
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +9 -9
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +4 -5
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stdio.js +4 -5
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +321 -44
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +137 -22
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +6 -9
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +2 -3
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +15 -13
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +11 -9
- package/dist/Struct.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +24 -19
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +12 -7
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/SynchronizedRef.d.ts +88 -63
- package/dist/SynchronizedRef.d.ts.map +1 -1
- package/dist/SynchronizedRef.js +32 -23
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Tracer.d.ts +4 -4
- package/dist/Tracer.js +4 -4
- package/dist/Trie.d.ts +15 -0
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +5 -0
- package/dist/Trie.js.map +1 -1
- package/dist/Tuple.d.ts +25 -19
- package/dist/Tuple.d.ts.map +1 -1
- package/dist/Tuple.js +17 -13
- package/dist/Tuple.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +6 -3
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +2 -1
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/TxRef.d.ts +16 -16
- package/dist/TxRef.js +8 -8
- package/dist/TxSubscriptionRef.d.ts +43 -27
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.js +19 -13
- package/dist/TxSubscriptionRef.js.map +1 -1
- package/dist/Types.d.ts +12 -38
- package/dist/Types.d.ts.map +1 -1
- package/dist/Types.js +0 -2
- package/dist/UndefinedOr.d.ts +15 -14
- package/dist/UndefinedOr.d.ts.map +1 -1
- package/dist/UndefinedOr.js +11 -10
- package/dist/UndefinedOr.js.map +1 -1
- package/dist/Unify.d.ts +2 -2
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/arbitrary.js +9 -9
- package/dist/internal/schema/arbitrary.js.map +1 -1
- package/dist/internal/schema/equivalence.js +9 -9
- package/dist/internal/schema/equivalence.js.map +1 -1
- package/dist/internal/schema/representation.js +14 -14
- package/dist/internal/schema/representation.js.map +1 -1
- package/dist/internal/schema/schema.js +11 -11
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +10 -10
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +9 -9
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +4 -2
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +4 -2
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +17 -20
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +36 -39
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +4 -5
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +4 -5
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.d.ts +4 -4
- package/dist/unstable/ai/EmbeddingModel.js +4 -4
- package/dist/unstable/ai/IdGenerator.d.ts +2 -3
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.js +2 -3
- package/dist/unstable/ai/IdGenerator.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +3 -2
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +5 -4
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +14 -12
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +19 -17
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +11 -4
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +8 -5
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +20 -18
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +45 -43
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +2 -2
- package/dist/unstable/ai/Prompt.js +3 -3
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.d.ts +3 -2
- package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.js +3 -2
- package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
- package/dist/unstable/ai/Telemetry.d.ts +21 -6
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +7 -2
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +7 -6
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +8 -7
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +2 -2
- package/dist/unstable/ai/Toolkit.js +2 -2
- package/dist/unstable/cli/Command.d.ts +37 -16
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +15 -8
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.d.ts +1 -1
- package/dist/unstable/cli/Completions.js +1 -1
- package/dist/unstable/cli/Flag.d.ts +7 -6
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +7 -6
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +6 -1
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
- package/dist/unstable/cli/GlobalFlag.js +7 -2
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/Param.d.ts +3 -3
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +13 -10
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +3 -2
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +3 -2
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.d.ts +1 -2
- package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.d.ts +5 -0
- package/dist/unstable/cluster/ClusterMetrics.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.js +5 -0
- package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts +3 -3
- package/dist/unstable/cluster/ClusterSchema.js +3 -3
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +15 -15
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +10 -0
- package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityResource.js +10 -0
- package/dist/unstable/cluster/EntityResource.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +2 -2
- package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
- package/dist/unstable/cluster/Envelope.js +2 -2
- package/dist/unstable/cluster/Envelope.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +2 -2
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +12 -12
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts +2 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.js +2 -1
- package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts +2 -2
- package/dist/unstable/cluster/RunnerServer.js +2 -2
- package/dist/unstable/cluster/Runners.d.ts +3 -3
- package/dist/unstable/cluster/Runners.js +3 -3
- package/dist/unstable/cluster/ShardId.js +3 -3
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts +3 -3
- package/dist/unstable/cluster/Sharding.js +3 -3
- package/dist/unstable/cluster/ShardingConfig.d.ts +4 -4
- package/dist/unstable/cluster/ShardingConfig.js +4 -4
- package/dist/unstable/cluster/Snowflake.d.ts +1 -1
- package/dist/unstable/cluster/Snowflake.js +3 -3
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +2 -2
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/encoding/Msgpack.d.ts +2 -2
- package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.js +5 -5
- package/dist/unstable/encoding/Msgpack.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +5 -0
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Ndjson.js +5 -0
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +2 -2
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +2 -2
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts +2 -1
- package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventGroup.js +2 -1
- package/dist/unstable/eventlog/EventGroup.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +10 -0
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js +10 -0
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +3 -3
- package/dist/unstable/eventlog/EventLog.js +3 -3
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +2 -3
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.js +2 -3
- package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +5 -7
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +5 -7
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +4 -4
- package/dist/unstable/eventlog/EventLogSessionAuth.js +4 -4
- package/dist/unstable/http/Cookies.js +4 -4
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts +2 -3
- package/dist/unstable/http/Etag.d.ts.map +1 -1
- package/dist/unstable/http/Etag.js +2 -3
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/Headers.js +2 -2
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.js +2 -2
- package/dist/unstable/http/HttpBody.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +2 -2
- package/dist/unstable/http/HttpClient.js +2 -2
- package/dist/unstable/http/HttpClientRequest.d.ts +30 -3
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +10 -1
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +1 -1
- package/dist/unstable/http/HttpRouter.js +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +25 -20
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +13 -8
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/Multipart.js +3 -3
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +30 -0
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +16 -6
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.d.ts +3 -2
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +3 -2
- 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 +10 -8
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +15 -15
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +3 -3
- package/dist/unstable/httpapi/HttpApiMiddleware.js +3 -3
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +2 -2
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +9 -9
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +11 -11
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/observability/OtlpResource.d.ts +5 -0
- package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpResource.js +5 -0
- package/dist/unstable/observability/OtlpResource.js.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts +4 -2
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +4 -2
- package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +3 -3
- package/dist/unstable/reactivity/Atom.js +3 -3
- package/dist/unstable/rpc/RpcSchema.d.ts +2 -2
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +2 -2
- package/dist/unstable/rpc/RpcSerialization.js +2 -2
- package/dist/unstable/schema/Model.js +5 -5
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +2 -2
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/sql/SqlSchema.d.ts +4 -4
- package/dist/unstable/sql/SqlSchema.js +4 -4
- package/dist/unstable/workers/Transferable.d.ts +2 -2
- package/dist/unstable/workers/Transferable.d.ts.map +1 -1
- package/dist/unstable/workers/Transferable.js +5 -5
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +7 -7
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/DurableQueue.d.ts +1 -2
- package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableQueue.js +1 -2
- package/dist/unstable/workflow/DurableQueue.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +35 -15
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +94 -72
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +10 -2
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +16 -8
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.d.ts +2 -4
- package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.js +9 -11
- package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.js +7 -7
- package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
- package/package.json +1 -1
- package/src/Array.ts +729 -611
- package/src/BigDecimal.ts +37 -30
- package/src/BigInt.ts +34 -40
- package/src/Boolean.ts +8 -8
- package/src/Brand.ts +16 -14
- package/src/Cause.ts +21 -23
- package/src/Channel.ts +249 -9
- package/src/ChannelSchema.ts +11 -11
- package/src/Chunk.ts +69 -16
- package/src/Clock.ts +3 -3
- package/src/Combiner.ts +9 -13
- package/src/Config.ts +60 -67
- package/src/ConfigProvider.ts +34 -44
- package/src/Console.ts +2 -2
- package/src/Context.ts +60 -72
- package/src/Cron.ts +2 -2
- package/src/Crypto.ts +4 -4
- package/src/Data.ts +21 -15
- package/src/DateTime.ts +35 -16
- package/src/Deferred.ts +24 -15
- package/src/Duration.ts +44 -31
- package/src/Effect.ts +516 -416
- package/src/Encoding.ts +5 -0
- package/src/Equal.ts +26 -39
- package/src/Equivalence.ts +71 -99
- package/src/ErrorReporter.ts +1 -1
- package/src/Exit.ts +79 -96
- package/src/Fiber.ts +8 -6
- package/src/FiberHandle.ts +25 -0
- package/src/FiberMap.ts +35 -0
- package/src/FiberSet.ts +20 -0
- package/src/Filter.ts +4 -4
- package/src/Formatter.ts +14 -19
- package/src/Function.ts +15 -16
- package/src/Graph.ts +2 -2
- package/src/HKT.ts +2 -2
- package/src/Hash.ts +2 -1
- package/src/HashMap.ts +15 -0
- package/src/HashRing.ts +9 -9
- package/src/Iterable.ts +24 -12
- package/src/JsonPatch.ts +2 -3
- package/src/JsonPointer.ts +2 -6
- package/src/JsonSchema.ts +17 -13
- package/src/Latch.ts +4 -3
- package/src/Layer.ts +92 -114
- package/src/Logger.ts +15 -18
- package/src/Match.ts +2 -2
- package/src/Metric.ts +109 -137
- package/src/MutableHashMap.ts +35 -20
- package/src/MutableList.ts +15 -0
- package/src/MutableRef.ts +56 -42
- package/src/Newtype.ts +10 -7
- package/src/Number.ts +23 -11
- package/src/Optic.ts +25 -22
- package/src/Option.ts +196 -168
- package/src/Order.ts +118 -179
- package/src/PartitionedSemaphore.ts +14 -14
- package/src/Path.ts +2 -2
- package/src/Pipeable.ts +2 -2
- package/src/PlatformError.ts +4 -4
- package/src/Pool.ts +7 -11
- package/src/Predicate.ts +274 -263
- package/src/PubSub.ts +24 -14
- package/src/Pull.ts +4 -4
- package/src/Queue.ts +46 -7
- package/src/RcRef.ts +0 -4
- package/src/Redactable.ts +2 -2
- package/src/Redacted.ts +3 -3
- package/src/Reducer.ts +2 -3
- package/src/Ref.ts +43 -40
- package/src/References.ts +4 -4
- package/src/Request.ts +18 -18
- package/src/Resource.ts +2 -2
- package/src/Result.ts +87 -33
- package/src/Runtime.ts +11 -8
- package/src/Schedule.ts +112 -45
- package/src/Scheduler.ts +6 -4
- package/src/Schema.ts +843 -649
- package/src/SchemaAST.ts +148 -117
- package/src/SchemaGetter.ts +142 -121
- package/src/SchemaIssue.ts +39 -41
- package/src/SchemaParser.ts +173 -229
- package/src/SchemaRepresentation.ts +38 -28
- package/src/SchemaTransformation.ts +233 -207
- package/src/SchemaUtils.ts +2 -2
- package/src/Scope.ts +15 -0
- package/src/ScopedCache.ts +1 -1
- package/src/ScopedRef.ts +14 -18
- package/src/Semaphore.ts +9 -9
- package/src/Sink.ts +13 -13
- package/src/Stdio.ts +4 -5
- package/src/Stream.ts +354 -57
- package/src/String.ts +6 -9
- package/src/Struct.ts +15 -13
- package/src/SubscriptionRef.ts +24 -19
- package/src/SynchronizedRef.ts +88 -63
- package/src/Tracer.ts +4 -4
- package/src/Trie.ts +15 -0
- package/src/Tuple.ts +25 -19
- package/src/TxReentrantLock.ts +6 -3
- package/src/TxRef.ts +16 -16
- package/src/TxSubscriptionRef.ts +43 -27
- package/src/Types.ts +12 -39
- package/src/UndefinedOr.ts +15 -14
- package/src/Unify.ts +2 -2
- package/src/internal/schema/annotations.ts +4 -4
- package/src/internal/schema/arbitrary.ts +16 -16
- package/src/internal/schema/equivalence.ts +11 -11
- package/src/internal/schema/representation.ts +23 -23
- package/src/internal/schema/schema.ts +17 -17
- package/src/testing/TestSchema.ts +20 -20
- package/src/unstable/ai/AiError.ts +4 -2
- package/src/unstable/ai/AnthropicStructuredOutput.ts +59 -56
- package/src/unstable/ai/Chat.ts +4 -5
- package/src/unstable/ai/EmbeddingModel.ts +4 -4
- package/src/unstable/ai/IdGenerator.ts +2 -3
- package/src/unstable/ai/LanguageModel.ts +5 -4
- package/src/unstable/ai/McpSchema.ts +19 -17
- package/src/unstable/ai/McpServer.ts +14 -7
- package/src/unstable/ai/OpenAiStructuredOutput.ts +72 -61
- package/src/unstable/ai/Prompt.ts +5 -5
- package/src/unstable/ai/ResponseIdTracker.ts +3 -2
- package/src/unstable/ai/Telemetry.ts +21 -6
- package/src/unstable/ai/Tool.ts +11 -10
- package/src/unstable/ai/Toolkit.ts +2 -2
- package/src/unstable/cli/Command.ts +37 -16
- package/src/unstable/cli/Completions.ts +1 -1
- package/src/unstable/cli/Flag.ts +7 -6
- package/src/unstable/cli/GlobalFlag.ts +7 -1
- package/src/unstable/cli/Param.ts +23 -18
- package/src/unstable/cli/Primitive.ts +3 -2
- package/src/unstable/cluster/ClusterCron.ts +1 -2
- package/src/unstable/cluster/ClusterMetrics.ts +5 -0
- package/src/unstable/cluster/ClusterSchema.ts +3 -3
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +15 -15
- package/src/unstable/cluster/EntityResource.ts +10 -0
- package/src/unstable/cluster/Envelope.ts +3 -3
- package/src/unstable/cluster/Reply.ts +14 -12
- package/src/unstable/cluster/RunnerHealth.ts +2 -1
- package/src/unstable/cluster/RunnerServer.ts +2 -2
- package/src/unstable/cluster/Runners.ts +3 -3
- package/src/unstable/cluster/ShardId.ts +3 -3
- package/src/unstable/cluster/Sharding.ts +3 -3
- package/src/unstable/cluster/ShardingConfig.ts +4 -4
- package/src/unstable/cluster/Snowflake.ts +3 -3
- package/src/unstable/cluster/internal/entityManager.ts +2 -2
- package/src/unstable/encoding/Msgpack.ts +6 -6
- package/src/unstable/encoding/Ndjson.ts +5 -0
- package/src/unstable/encoding/Sse.ts +2 -2
- package/src/unstable/eventlog/EventGroup.ts +2 -1
- package/src/unstable/eventlog/EventJournal.ts +10 -0
- package/src/unstable/eventlog/EventLog.ts +3 -3
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +2 -3
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +5 -7
- package/src/unstable/eventlog/EventLogSessionAuth.ts +4 -4
- package/src/unstable/http/Cookies.ts +4 -4
- package/src/unstable/http/Etag.ts +2 -3
- package/src/unstable/http/Headers.ts +2 -2
- package/src/unstable/http/HttpBody.ts +2 -2
- package/src/unstable/http/HttpClient.ts +2 -2
- package/src/unstable/http/HttpClientRequest.ts +30 -3
- package/src/unstable/http/HttpRouter.ts +1 -1
- package/src/unstable/http/HttpServerResponse.ts +25 -20
- package/src/unstable/http/Multipart.ts +3 -3
- package/src/unstable/http/UrlParams.ts +36 -6
- package/src/unstable/httpapi/HttpApi.ts +5 -4
- package/src/unstable/httpapi/HttpApiBuilder.ts +14 -13
- package/src/unstable/httpapi/HttpApiClient.ts +16 -16
- package/src/unstable/httpapi/HttpApiMiddleware.ts +3 -3
- package/src/unstable/httpapi/HttpApiSchema.ts +15 -15
- package/src/unstable/httpapi/OpenApi.ts +18 -18
- package/src/unstable/observability/OtlpResource.ts +5 -0
- package/src/unstable/observability/PrometheusMetrics.ts +4 -2
- package/src/unstable/reactivity/Atom.ts +3 -3
- package/src/unstable/rpc/RpcSchema.ts +2 -2
- package/src/unstable/rpc/RpcSerialization.ts +2 -2
- package/src/unstable/schema/Model.ts +5 -5
- package/src/unstable/schema/VariantSchema.ts +2 -2
- package/src/unstable/sql/SqlSchema.ts +4 -4
- package/src/unstable/workers/Transferable.ts +6 -6
- package/src/unstable/workflow/DurableDeferred.ts +7 -7
- package/src/unstable/workflow/DurableQueue.ts +1 -2
- package/src/unstable/workflow/Workflow.ts +159 -114
- package/src/unstable/workflow/WorkflowEngine.ts +16 -8
- package/src/unstable/workflow/WorkflowProxy.ts +9 -11
- package/src/unstable/workflow/WorkflowProxyServer.ts +7 -7
package/dist/Array.js
CHANGED
|
@@ -122,9 +122,12 @@ export const Array = globalThis.Array;
|
|
|
122
122
|
*
|
|
123
123
|
* **When to use**
|
|
124
124
|
*
|
|
125
|
-
* Use when you
|
|
126
|
-
*
|
|
127
|
-
*
|
|
125
|
+
* Use when you need to create a typed non-empty array from literal values.
|
|
126
|
+
*
|
|
127
|
+
* **Details**
|
|
128
|
+
*
|
|
129
|
+
* The element type is inferred as the union of all arguments. Because at least
|
|
130
|
+
* one argument is required, this always returns a `NonEmptyArray`.
|
|
128
131
|
*
|
|
129
132
|
* **Example** (Creating an array from values)
|
|
130
133
|
*
|
|
@@ -147,9 +150,11 @@ export const make = (...elements) => elements;
|
|
|
147
150
|
*
|
|
148
151
|
* **When to use**
|
|
149
152
|
*
|
|
150
|
-
* Use when you need a pre-sized array
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
+
* Use when you need a pre-sized array that will be filled imperatively.
|
|
154
|
+
*
|
|
155
|
+
* **Details**
|
|
156
|
+
*
|
|
157
|
+
* Elements are typed as `A | undefined` because the slots are empty.
|
|
153
158
|
*
|
|
154
159
|
* **Example** (Allocating a fixed-size array)
|
|
155
160
|
*
|
|
@@ -171,9 +176,13 @@ export const allocate = n => new Array(n);
|
|
|
171
176
|
*
|
|
172
177
|
* **When to use**
|
|
173
178
|
*
|
|
174
|
-
* Use when you need
|
|
175
|
-
*
|
|
176
|
-
*
|
|
179
|
+
* Use when you need to compute each array element from its index.
|
|
180
|
+
*
|
|
181
|
+
* **Details**
|
|
182
|
+
*
|
|
183
|
+
* `n` is normalized to an integer greater than or equal to 1, so this function
|
|
184
|
+
* always returns at least one element. Supports both data-first and data-last
|
|
185
|
+
* usage.
|
|
177
186
|
*
|
|
178
187
|
* **Example** (Generating values from indices)
|
|
179
188
|
*
|
|
@@ -204,9 +213,11 @@ export const makeBy = /*#__PURE__*/dual(2, (n, f) => {
|
|
|
204
213
|
*
|
|
205
214
|
* **When to use**
|
|
206
215
|
*
|
|
207
|
-
* Use when you need a sequence of consecutive integers.
|
|
208
|
-
*
|
|
209
|
-
*
|
|
216
|
+
* Use when you need a non-empty sequence of consecutive integers.
|
|
217
|
+
*
|
|
218
|
+
* **Details**
|
|
219
|
+
*
|
|
220
|
+
* If `start > end`, returns `[start]`.
|
|
210
221
|
*
|
|
211
222
|
* **Example** (Creating a range)
|
|
212
223
|
*
|
|
@@ -228,9 +239,13 @@ export const range = (start, end) => start <= end ? makeBy(end - start + 1, i =>
|
|
|
228
239
|
*
|
|
229
240
|
* **When to use**
|
|
230
241
|
*
|
|
231
|
-
* Use when you need
|
|
232
|
-
*
|
|
233
|
-
*
|
|
242
|
+
* Use when you need a non-empty array containing repeated copies of one value.
|
|
243
|
+
*
|
|
244
|
+
* **Details**
|
|
245
|
+
*
|
|
246
|
+
* `n` is normalized to an integer greater than or equal to 1, so this function
|
|
247
|
+
* always returns at least one element. Supports both data-first and data-last
|
|
248
|
+
* usage.
|
|
234
249
|
*
|
|
235
250
|
* **Example** (Repeating a value)
|
|
236
251
|
*
|
|
@@ -256,10 +271,9 @@ export const replicate = /*#__PURE__*/dual(2, (a, n) => makeBy(n, () => a));
|
|
|
256
271
|
*
|
|
257
272
|
* **Details**
|
|
258
273
|
*
|
|
259
|
-
*
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
* an array.
|
|
274
|
+
* If the input is already an array, this returns it by reference without
|
|
275
|
+
* copying. Otherwise, it creates a new array from the iterable. Use `copy` if
|
|
276
|
+
* you need a fresh array even when the input is already an array.
|
|
263
277
|
*
|
|
264
278
|
* **Example** (Converting a Set to an array)
|
|
265
279
|
*
|
|
@@ -287,9 +301,9 @@ export const fromIterable = collection => Array.isArray(collection) ? collection
|
|
|
287
301
|
*
|
|
288
302
|
* **Details**
|
|
289
303
|
*
|
|
290
|
-
*
|
|
291
|
-
*
|
|
292
|
-
*
|
|
304
|
+
* If the input is already an array, this returns it by reference. If the input
|
|
305
|
+
* is a single value, this wraps it in a one-element array. This is useful for
|
|
306
|
+
* APIs that accept `A | Array<A>`.
|
|
293
307
|
*
|
|
294
308
|
* **Example** (Normalizing input)
|
|
295
309
|
*
|
|
@@ -317,8 +331,8 @@ export const ensure = self => Array.isArray(self) ? self : [self];
|
|
|
317
331
|
*
|
|
318
332
|
* **Details**
|
|
319
333
|
*
|
|
320
|
-
*
|
|
321
|
-
*
|
|
334
|
+
* Key order follows `Object.entries` semantics. Empty records produce an empty
|
|
335
|
+
* array.
|
|
322
336
|
*
|
|
323
337
|
* **Example** (Record to entries)
|
|
324
338
|
*
|
|
@@ -363,9 +377,12 @@ export const fromOption = Option.toArray;
|
|
|
363
377
|
*
|
|
364
378
|
* **When to use**
|
|
365
379
|
*
|
|
366
|
-
* Use when you need to branch on whether an array
|
|
367
|
-
*
|
|
368
|
-
*
|
|
380
|
+
* Use when you need to branch on whether an array is empty.
|
|
381
|
+
*
|
|
382
|
+
* **Details**
|
|
383
|
+
*
|
|
384
|
+
* `onNonEmpty` receives a `NonEmptyReadonlyArray`. Supports both data-first and
|
|
385
|
+
* data-last usage.
|
|
369
386
|
*
|
|
370
387
|
* **Example** (Branching on emptiness)
|
|
371
388
|
*
|
|
@@ -396,8 +413,8 @@ export const match = /*#__PURE__*/dual(2, (self, {
|
|
|
396
413
|
*
|
|
397
414
|
* **When to use**
|
|
398
415
|
*
|
|
399
|
-
* Use
|
|
400
|
-
*
|
|
416
|
+
* Use when you need to branch on an array and handle the non-empty case as the
|
|
417
|
+
* first element plus the remaining elements.
|
|
401
418
|
*
|
|
402
419
|
* **Details**
|
|
403
420
|
*
|
|
@@ -432,8 +449,8 @@ export const matchLeft = /*#__PURE__*/dual(2, (self, {
|
|
|
432
449
|
*
|
|
433
450
|
* **When to use**
|
|
434
451
|
*
|
|
435
|
-
* Use
|
|
436
|
-
*
|
|
452
|
+
* Use when you need to branch on an array and handle the non-empty case as the
|
|
453
|
+
* elements before the last plus the last element.
|
|
437
454
|
*
|
|
438
455
|
* **Details**
|
|
439
456
|
*
|
|
@@ -467,11 +484,8 @@ export const matchRight = /*#__PURE__*/dual(2, (self, {
|
|
|
467
484
|
*
|
|
468
485
|
* **When to use**
|
|
469
486
|
*
|
|
470
|
-
* Use
|
|
471
|
-
*
|
|
472
|
-
* **Details**
|
|
473
|
-
*
|
|
474
|
-
* - Always returns a non-empty array.
|
|
487
|
+
* Use when you need to guarantee a non-empty result after adding a required
|
|
488
|
+
* leading value.
|
|
475
489
|
*
|
|
476
490
|
* **Example** (Prepending an element)
|
|
477
491
|
*
|
|
@@ -498,7 +512,7 @@ export const prepend = /*#__PURE__*/dual(2, (self, head) => [head, ...self]);
|
|
|
498
512
|
*
|
|
499
513
|
* **Details**
|
|
500
514
|
*
|
|
501
|
-
*
|
|
515
|
+
* If either input is non-empty, the result is a `NonEmptyArray`.
|
|
502
516
|
*
|
|
503
517
|
* **Example** (Prepending multiple elements)
|
|
504
518
|
*
|
|
@@ -521,12 +535,8 @@ export const prependAll = /*#__PURE__*/dual(2, (self, that) => fromIterable(that
|
|
|
521
535
|
*
|
|
522
536
|
* **When to use**
|
|
523
537
|
*
|
|
524
|
-
* Use
|
|
525
|
-
*
|
|
526
|
-
*
|
|
527
|
-
* **Details**
|
|
528
|
-
*
|
|
529
|
-
* - Always returns a non-empty array.
|
|
538
|
+
* Use when you need to guarantee a non-empty result after adding a required
|
|
539
|
+
* trailing value.
|
|
530
540
|
*
|
|
531
541
|
* **Example** (Appending an element)
|
|
532
542
|
*
|
|
@@ -554,7 +564,7 @@ export const append = /*#__PURE__*/dual(2, (self, last) => [...self, last]);
|
|
|
554
564
|
*
|
|
555
565
|
* **Details**
|
|
556
566
|
*
|
|
557
|
-
*
|
|
567
|
+
* If either input is non-empty, the result is a `NonEmptyArray`.
|
|
558
568
|
*
|
|
559
569
|
* **Example** (Concatenating arrays)
|
|
560
570
|
*
|
|
@@ -581,9 +591,9 @@ export const appendAll = /*#__PURE__*/dual(2, (self, that) => fromIterable(self)
|
|
|
581
591
|
*
|
|
582
592
|
* **Details**
|
|
583
593
|
*
|
|
584
|
-
*
|
|
585
|
-
*
|
|
586
|
-
*
|
|
594
|
+
* The output length is `input.length + 1` because it starts with the initial
|
|
595
|
+
* value. The result is always a `NonEmptyArray`. Use `reduce` if you only need
|
|
596
|
+
* the final accumulated value.
|
|
587
597
|
*
|
|
588
598
|
* **Example** (Running totals)
|
|
589
599
|
*
|
|
@@ -619,8 +629,8 @@ export const scan = /*#__PURE__*/dual(3, (self, b, f) => {
|
|
|
619
629
|
*
|
|
620
630
|
* **Details**
|
|
621
631
|
*
|
|
622
|
-
*
|
|
623
|
-
*
|
|
632
|
+
* The output length is `input.length + 1` because it ends with the initial
|
|
633
|
+
* value. The result is always a `NonEmptyArray`.
|
|
624
634
|
*
|
|
625
635
|
* **Example** (Reverse running totals)
|
|
626
636
|
*
|
|
@@ -655,8 +665,8 @@ export const scanRight = /*#__PURE__*/dual(3, (self, b, f) => {
|
|
|
655
665
|
*
|
|
656
666
|
* **Details**
|
|
657
667
|
*
|
|
658
|
-
*
|
|
659
|
-
*
|
|
668
|
+
* Acts as a type guard narrowing the input to `Array<unknown>` and delegates to
|
|
669
|
+
* `globalThis.Array.isArray`.
|
|
660
670
|
*
|
|
661
671
|
* **Example** (Type-guarding an unknown value)
|
|
662
672
|
*
|
|
@@ -716,6 +726,11 @@ export const isReadonlyArrayEmpty = isArrayEmpty;
|
|
|
716
726
|
* Checks whether a mutable `Array` is non-empty, narrowing the type to
|
|
717
727
|
* `NonEmptyArray`.
|
|
718
728
|
*
|
|
729
|
+
* **When to use**
|
|
730
|
+
*
|
|
731
|
+
* Use when you need the narrowed value to remain a mutable `Array` after proving
|
|
732
|
+
* it has at least one element.
|
|
733
|
+
*
|
|
719
734
|
* **Example** (Checking for a non-empty array)
|
|
720
735
|
*
|
|
721
736
|
* ```ts
|
|
@@ -736,6 +751,11 @@ export const isArrayNonEmpty = internalArray.isArrayNonEmpty;
|
|
|
736
751
|
* Checks whether a `ReadonlyArray` is non-empty, narrowing the type to
|
|
737
752
|
* `NonEmptyReadonlyArray`.
|
|
738
753
|
*
|
|
754
|
+
* **When to use**
|
|
755
|
+
*
|
|
756
|
+
* Use when you need to prove a readonly array has at least one element without
|
|
757
|
+
* requiring mutable array methods afterward.
|
|
758
|
+
*
|
|
739
759
|
* **Example** (Checking for a non-empty readonly array)
|
|
740
760
|
*
|
|
741
761
|
* ```ts
|
|
@@ -787,8 +807,7 @@ const clamp = (i, as) => Math.floor(Math.min(Math.max(0, i), as.length));
|
|
|
787
807
|
*
|
|
788
808
|
* **Details**
|
|
789
809
|
*
|
|
790
|
-
*
|
|
791
|
-
* - Never throws.
|
|
810
|
+
* The index is floored to an integer. This never throws.
|
|
792
811
|
*
|
|
793
812
|
* **Example** (Safe index access)
|
|
794
813
|
*
|
|
@@ -815,13 +834,13 @@ export const get = /*#__PURE__*/dual(2, (self, index) => {
|
|
|
815
834
|
*
|
|
816
835
|
* **When to use**
|
|
817
836
|
*
|
|
818
|
-
* Use to read an element at a known valid index when out-of-bounds would
|
|
819
|
-
* programming error.
|
|
837
|
+
* Use to read an array element at a known valid index when out-of-bounds would
|
|
838
|
+
* be a programming error.
|
|
820
839
|
*
|
|
821
840
|
* **Details**
|
|
822
841
|
*
|
|
823
|
-
*
|
|
824
|
-
*
|
|
842
|
+
* Throws an `Error` with the message `"Index out of bounds: <i>"`. Prefer
|
|
843
|
+
* `get` for safe access.
|
|
825
844
|
*
|
|
826
845
|
* **Example** (Unsafe index access)
|
|
827
846
|
*
|
|
@@ -854,8 +873,7 @@ export const getUnsafe = /*#__PURE__*/dual(2, (self, index) => {
|
|
|
854
873
|
*
|
|
855
874
|
* **Details**
|
|
856
875
|
*
|
|
857
|
-
*
|
|
858
|
-
* - Requires a `NonEmptyReadonlyArray`.
|
|
876
|
+
* Returns a tuple `[head, tail]` and requires a `NonEmptyReadonlyArray`.
|
|
859
877
|
*
|
|
860
878
|
* **Example** (Destructuring head and tail)
|
|
861
879
|
*
|
|
@@ -880,13 +898,12 @@ export const unprepend = self => [headNonEmpty(self), tailNonEmpty(self)];
|
|
|
880
898
|
*
|
|
881
899
|
* **When to use**
|
|
882
900
|
*
|
|
883
|
-
* Use to split a non-empty array
|
|
884
|
-
*
|
|
901
|
+
* Use when you need to split a non-empty array into the elements before the
|
|
902
|
+
* last element and the last element.
|
|
885
903
|
*
|
|
886
904
|
* **Details**
|
|
887
905
|
*
|
|
888
|
-
*
|
|
889
|
-
* - Requires a `NonEmptyReadonlyArray`.
|
|
906
|
+
* Returns a tuple `[init, last]` and requires a `NonEmptyReadonlyArray`.
|
|
890
907
|
*
|
|
891
908
|
* **Example** (Destructuring init and last)
|
|
892
909
|
*
|
|
@@ -1008,8 +1025,7 @@ export const lastNonEmpty = self => self[self.length - 1];
|
|
|
1008
1025
|
*
|
|
1009
1026
|
* **Details**
|
|
1010
1027
|
*
|
|
1011
|
-
*
|
|
1012
|
-
* - Returns `Option.none()` for empty inputs.
|
|
1028
|
+
* Allocates a new array via `slice(1)`. Empty inputs return `Option.none()`.
|
|
1013
1029
|
*
|
|
1014
1030
|
* **Example** (Getting the tail)
|
|
1015
1031
|
*
|
|
@@ -1061,8 +1077,8 @@ export const tailNonEmpty = self => self.slice(1);
|
|
|
1061
1077
|
*
|
|
1062
1078
|
* **Details**
|
|
1063
1079
|
*
|
|
1064
|
-
*
|
|
1065
|
-
*
|
|
1080
|
+
* Allocates a new array via `slice(0, -1)`. Empty inputs return
|
|
1081
|
+
* `Option.none()`.
|
|
1066
1082
|
*
|
|
1067
1083
|
* **Example** (Getting init)
|
|
1068
1084
|
*
|
|
@@ -1114,8 +1130,7 @@ export const initNonEmpty = self => self.slice(0, -1);
|
|
|
1114
1130
|
*
|
|
1115
1131
|
* **Details**
|
|
1116
1132
|
*
|
|
1117
|
-
*
|
|
1118
|
-
* - Returns an empty array when `n <= 0`.
|
|
1133
|
+
* `n` is clamped to `[0, length]`. Returns an empty array when `n <= 0`.
|
|
1119
1134
|
*
|
|
1120
1135
|
* **Example** (Taking from the start)
|
|
1121
1136
|
*
|
|
@@ -1145,8 +1160,7 @@ export const take = /*#__PURE__*/dual(2, (self, n) => {
|
|
|
1145
1160
|
*
|
|
1146
1161
|
* **Details**
|
|
1147
1162
|
*
|
|
1148
|
-
*
|
|
1149
|
-
* - Returns an empty array when `n <= 0`.
|
|
1163
|
+
* `n` is clamped to `[0, length]`. Returns an empty array when `n <= 0`.
|
|
1150
1164
|
*
|
|
1151
1165
|
* **Example** (Taking from the end)
|
|
1152
1166
|
*
|
|
@@ -1178,8 +1192,8 @@ export const takeRight = /*#__PURE__*/dual(2, (self, n) => {
|
|
|
1178
1192
|
*
|
|
1179
1193
|
* **Details**
|
|
1180
1194
|
*
|
|
1181
|
-
*
|
|
1182
|
-
*
|
|
1195
|
+
* Supports refinements for type narrowing. The predicate receives
|
|
1196
|
+
* `(element, index)`.
|
|
1183
1197
|
*
|
|
1184
1198
|
* **Example** (Taking while condition holds)
|
|
1185
1199
|
*
|
|
@@ -1213,14 +1227,14 @@ export const takeWhile = /*#__PURE__*/dual(2, (self, predicate) => {
|
|
|
1213
1227
|
*
|
|
1214
1228
|
* **When to use**
|
|
1215
1229
|
*
|
|
1216
|
-
* Use when you need to take a prefix
|
|
1217
|
-
* successfully extract or transform
|
|
1230
|
+
* Use when you need to take a prefix from an iterable while a function can
|
|
1231
|
+
* successfully extract or transform elements, stopping at the first element
|
|
1218
1232
|
* that produces a failure result.
|
|
1219
1233
|
*
|
|
1220
1234
|
* **Details**
|
|
1221
1235
|
*
|
|
1222
|
-
*
|
|
1223
|
-
*
|
|
1236
|
+
* The filter receives `(element, index)` and processing stops at the first
|
|
1237
|
+
* filter failure.
|
|
1224
1238
|
*
|
|
1225
1239
|
* @see {@link takeWhile} for taking a prefix based on a boolean predicate
|
|
1226
1240
|
*
|
|
@@ -1256,14 +1270,14 @@ const spanIndex = (self, predicate) => {
|
|
|
1256
1270
|
*
|
|
1257
1271
|
* **When to use**
|
|
1258
1272
|
*
|
|
1259
|
-
* Use
|
|
1260
|
-
*
|
|
1273
|
+
* Use when you need both the longest predicate-matching prefix and the
|
|
1274
|
+
* remaining elements.
|
|
1261
1275
|
*
|
|
1262
1276
|
* **Details**
|
|
1263
1277
|
*
|
|
1264
|
-
*
|
|
1265
|
-
*
|
|
1266
|
-
*
|
|
1278
|
+
* Equivalent to `[takeWhile(pred), dropWhile(pred)]`, but more efficient
|
|
1279
|
+
* because it runs in a single pass. Supports refinements for type narrowing of
|
|
1280
|
+
* the prefix.
|
|
1267
1281
|
*
|
|
1268
1282
|
* **Example** (Splitting at predicate boundary)
|
|
1269
1283
|
*
|
|
@@ -1294,8 +1308,8 @@ export const span = /*#__PURE__*/dual(2, (self, predicate) => {
|
|
|
1294
1308
|
*
|
|
1295
1309
|
* **Details**
|
|
1296
1310
|
*
|
|
1297
|
-
*
|
|
1298
|
-
*
|
|
1311
|
+
* `n` is clamped to `[0, length]`. When `n <= 0`, this returns a copy of the
|
|
1312
|
+
* full array.
|
|
1299
1313
|
*
|
|
1300
1314
|
* **Example** (Dropping from the start)
|
|
1301
1315
|
*
|
|
@@ -1386,13 +1400,13 @@ export const dropWhile = /*#__PURE__*/dual(2, (self, predicate) => {
|
|
|
1386
1400
|
*
|
|
1387
1401
|
* **When to use**
|
|
1388
1402
|
*
|
|
1389
|
-
* Use when
|
|
1390
|
-
* of a simple boolean predicate.
|
|
1403
|
+
* Use when you need to drop a prefix from an iterable by computing a `Result`
|
|
1404
|
+
* per element instead of using a simple boolean predicate.
|
|
1391
1405
|
*
|
|
1392
1406
|
* **Details**
|
|
1393
1407
|
*
|
|
1394
|
-
*
|
|
1395
|
-
*
|
|
1408
|
+
* The filter receives `(element, index)`. The result contains the remaining
|
|
1409
|
+
* original elements after the first filter failure.
|
|
1396
1410
|
*
|
|
1397
1411
|
* @see {@link dropWhile} for dropping a prefix with a simple boolean predicate
|
|
1398
1412
|
* @see {@link takeWhileFilter} for keeping only the matching prefix
|
|
@@ -1486,9 +1500,9 @@ export const findLastIndex = /*#__PURE__*/dual(2, (self, predicate) => {
|
|
|
1486
1500
|
*
|
|
1487
1501
|
* **Details**
|
|
1488
1502
|
*
|
|
1489
|
-
*
|
|
1490
|
-
*
|
|
1491
|
-
*
|
|
1503
|
+
* Accepts a predicate `(a, i) => boolean`, a refinement, or a function
|
|
1504
|
+
* `(a, i) => Option<B>` for simultaneous find-and-transform. If no element
|
|
1505
|
+
* matches, this returns `Option.none()`.
|
|
1492
1506
|
*
|
|
1493
1507
|
* **Example** (Finding the first match)
|
|
1494
1508
|
*
|
|
@@ -1561,8 +1575,8 @@ export const findFirstWithIndex = /*#__PURE__*/dual(2, (self, f) => {
|
|
|
1561
1575
|
*
|
|
1562
1576
|
* **Details**
|
|
1563
1577
|
*
|
|
1564
|
-
*
|
|
1565
|
-
*
|
|
1578
|
+
* Searches from the end of the array. If no element matches, this returns
|
|
1579
|
+
* `Option.none()`.
|
|
1566
1580
|
*
|
|
1567
1581
|
* **Example** (Finding the last match)
|
|
1568
1582
|
*
|
|
@@ -1605,7 +1619,7 @@ export const findLast = /*#__PURE__*/dual(2, (self, f) => {
|
|
|
1605
1619
|
*
|
|
1606
1620
|
* **Details**
|
|
1607
1621
|
*
|
|
1608
|
-
*
|
|
1622
|
+
* Valid indices are `0` to `length`, inclusive. Inserting at `length` appends.
|
|
1609
1623
|
*
|
|
1610
1624
|
* **Example** (Inserting at an index)
|
|
1611
1625
|
*
|
|
@@ -1639,7 +1653,7 @@ export const insertAt = /*#__PURE__*/dual(3, (self, i, b) => {
|
|
|
1639
1653
|
*
|
|
1640
1654
|
* **Details**
|
|
1641
1655
|
*
|
|
1642
|
-
*
|
|
1656
|
+
* Returns `Option.none()` when the index is out of bounds.
|
|
1643
1657
|
*
|
|
1644
1658
|
* **Example** (Replacing an element)
|
|
1645
1659
|
*
|
|
@@ -1662,12 +1676,12 @@ export const replace = /*#__PURE__*/dual(3, (self, i, b) => modify(self, i, () =
|
|
|
1662
1676
|
*
|
|
1663
1677
|
* **When to use**
|
|
1664
1678
|
*
|
|
1665
|
-
* Use to derive a replacement value from
|
|
1666
|
-
*
|
|
1679
|
+
* Use to derive a replacement value from an array element at a specific index
|
|
1680
|
+
* while leaving the other elements unchanged.
|
|
1667
1681
|
*
|
|
1668
1682
|
* **Details**
|
|
1669
1683
|
*
|
|
1670
|
-
*
|
|
1684
|
+
* Returns `Option.none()` when the index is out of bounds.
|
|
1671
1685
|
*
|
|
1672
1686
|
* **Example** (Modifying an element)
|
|
1673
1687
|
*
|
|
@@ -1701,7 +1715,8 @@ export const modify = /*#__PURE__*/dual(3, (self, i, f) => {
|
|
|
1701
1715
|
*
|
|
1702
1716
|
* **When to use**
|
|
1703
1717
|
*
|
|
1704
|
-
* Use to
|
|
1718
|
+
* Use when you want a missing index to be a no-op and need a fresh array result
|
|
1719
|
+
* instead of an optional failure.
|
|
1705
1720
|
*
|
|
1706
1721
|
* **Example** (Removing an element)
|
|
1707
1722
|
*
|
|
@@ -1731,11 +1746,12 @@ export const remove = /*#__PURE__*/dual(2, (self, i) => {
|
|
|
1731
1746
|
*
|
|
1732
1747
|
* **When to use**
|
|
1733
1748
|
*
|
|
1734
|
-
* Use to reverse
|
|
1749
|
+
* Use to reverse an iterable into a new array without mutating the original
|
|
1750
|
+
* input.
|
|
1735
1751
|
*
|
|
1736
1752
|
* **Details**
|
|
1737
1753
|
*
|
|
1738
|
-
*
|
|
1754
|
+
* Preserves `NonEmptyArray` in the return type.
|
|
1739
1755
|
*
|
|
1740
1756
|
* **Example** (Reversing an array)
|
|
1741
1757
|
*
|
|
@@ -1758,9 +1774,8 @@ export const reverse = self => Array.from(self).reverse();
|
|
|
1758
1774
|
*
|
|
1759
1775
|
* **Details**
|
|
1760
1776
|
*
|
|
1761
|
-
*
|
|
1762
|
-
*
|
|
1763
|
-
* multi-key sorting.
|
|
1777
|
+
* Preserves `NonEmptyArray` in the return type. Use `sortWith` to sort by a
|
|
1778
|
+
* derived key, or `sortBy` for multi-key sorting.
|
|
1764
1779
|
*
|
|
1765
1780
|
* **Example** (Sorting numbers)
|
|
1766
1781
|
*
|
|
@@ -1787,12 +1802,12 @@ export const sort = /*#__PURE__*/dual(2, (self, O) => {
|
|
|
1787
1802
|
*
|
|
1788
1803
|
* **When to use**
|
|
1789
1804
|
*
|
|
1790
|
-
* Use when
|
|
1791
|
-
*
|
|
1805
|
+
* Use when you need to sort values by a derived key, such as a string length or
|
|
1806
|
+
* object field, while keeping the original values.
|
|
1792
1807
|
*
|
|
1793
1808
|
* **Details**
|
|
1794
1809
|
*
|
|
1795
|
-
*
|
|
1810
|
+
* Equivalent to `sort(Order.mapInput(order, f))`, but more convenient.
|
|
1796
1811
|
*
|
|
1797
1812
|
* **Example** (Sorting strings by length)
|
|
1798
1813
|
*
|
|
@@ -1821,8 +1836,8 @@ export const sortWith = /*#__PURE__*/dual(3, (self, f, order) => Array.from(self
|
|
|
1821
1836
|
*
|
|
1822
1837
|
* **Details**
|
|
1823
1838
|
*
|
|
1824
|
-
*
|
|
1825
|
-
*
|
|
1839
|
+
* This is data-last only and returns a function. The return type preserves
|
|
1840
|
+
* `NonEmptyArray`.
|
|
1826
1841
|
*
|
|
1827
1842
|
* **Example** (Multi-key sorting)
|
|
1828
1843
|
*
|
|
@@ -1868,11 +1883,11 @@ export const sortBy = (...orders) => {
|
|
|
1868
1883
|
*
|
|
1869
1884
|
* **When to use**
|
|
1870
1885
|
*
|
|
1871
|
-
* Use
|
|
1886
|
+
* Use when you need simple pairs of corresponding elements from two iterables.
|
|
1872
1887
|
*
|
|
1873
1888
|
* **Details**
|
|
1874
1889
|
*
|
|
1875
|
-
*
|
|
1890
|
+
* Returns `NonEmptyArray` when both inputs are non-empty.
|
|
1876
1891
|
*
|
|
1877
1892
|
* **Example** (Zipping two arrays)
|
|
1878
1893
|
*
|
|
@@ -1893,6 +1908,11 @@ export const zip = /*#__PURE__*/dual(2, (self, that) => zipWith(self, that, Tupl
|
|
|
1893
1908
|
* Combines elements from two iterables pairwise using a function. If the
|
|
1894
1909
|
* iterables differ in length, extra elements are discarded.
|
|
1895
1910
|
*
|
|
1911
|
+
* **When to use**
|
|
1912
|
+
*
|
|
1913
|
+
* Use when zipping two iterables in an array pipeline and each pair should
|
|
1914
|
+
* become a computed array element instead of a tuple.
|
|
1915
|
+
*
|
|
1896
1916
|
* **Example** (Zipping with addition)
|
|
1897
1917
|
*
|
|
1898
1918
|
* ```ts
|
|
@@ -1957,8 +1977,8 @@ export const unzip = self => {
|
|
|
1957
1977
|
*
|
|
1958
1978
|
* **Details**
|
|
1959
1979
|
*
|
|
1960
|
-
*
|
|
1961
|
-
*
|
|
1980
|
+
* The return type preserves `NonEmptyArray`. Empty inputs produce an empty
|
|
1981
|
+
* result.
|
|
1962
1982
|
*
|
|
1963
1983
|
* **Example** (Interspersing a separator)
|
|
1964
1984
|
*
|
|
@@ -2014,6 +2034,11 @@ export const modifyHeadNonEmpty = /*#__PURE__*/dual(2, (self, f) => [f(headNonEm
|
|
|
2014
2034
|
/**
|
|
2015
2035
|
* Replaces the first element of a non-empty array with a new value.
|
|
2016
2036
|
*
|
|
2037
|
+
* **When to use**
|
|
2038
|
+
*
|
|
2039
|
+
* Use when you already know the array is non-empty and the replacement value
|
|
2040
|
+
* does not depend on the current first element.
|
|
2041
|
+
*
|
|
2017
2042
|
* **Example** (Setting the head)
|
|
2018
2043
|
*
|
|
2019
2044
|
* ```ts
|
|
@@ -2033,6 +2058,11 @@ export const setHeadNonEmpty = /*#__PURE__*/dual(2, (self, b) => modifyHeadNonEm
|
|
|
2033
2058
|
* Applies a function to the last element of a non-empty array, returning a
|
|
2034
2059
|
* new array.
|
|
2035
2060
|
*
|
|
2061
|
+
* **When to use**
|
|
2062
|
+
*
|
|
2063
|
+
* Use when you already know the array is non-empty and the new last element
|
|
2064
|
+
* depends on the current last element.
|
|
2065
|
+
*
|
|
2036
2066
|
* **Example** (Modifying the last element)
|
|
2037
2067
|
*
|
|
2038
2068
|
* ```ts
|
|
@@ -2051,6 +2081,11 @@ export const modifyLastNonEmpty = /*#__PURE__*/dual(2, (self, f) => append(initN
|
|
|
2051
2081
|
/**
|
|
2052
2082
|
* Replaces the last element of a non-empty array with a new value.
|
|
2053
2083
|
*
|
|
2084
|
+
* **When to use**
|
|
2085
|
+
*
|
|
2086
|
+
* Use when you already know the array is non-empty and the replacement value
|
|
2087
|
+
* does not depend on the current last element.
|
|
2088
|
+
*
|
|
2054
2089
|
* **Example** (Setting the last element)
|
|
2055
2090
|
*
|
|
2056
2091
|
* ```ts
|
|
@@ -2077,9 +2112,9 @@ export const setLastNonEmpty = /*#__PURE__*/dual(2, (self, b) => modifyLastNonEm
|
|
|
2077
2112
|
*
|
|
2078
2113
|
* **Details**
|
|
2079
2114
|
*
|
|
2080
|
-
*
|
|
2081
|
-
*
|
|
2082
|
-
*
|
|
2115
|
+
* `n` is rounded to the nearest integer before rotating. The return type
|
|
2116
|
+
* preserves `NonEmptyArray`. Empty arrays, or rotations normalized to `0`,
|
|
2117
|
+
* return a copy.
|
|
2083
2118
|
*
|
|
2084
2119
|
* **Example** (Rotating elements)
|
|
2085
2120
|
*
|
|
@@ -2148,8 +2183,8 @@ export const containsWith = isEquivalent => dual(2, (self, a) => {
|
|
|
2148
2183
|
*
|
|
2149
2184
|
* **When to use**
|
|
2150
2185
|
*
|
|
2151
|
-
* Use to check
|
|
2152
|
-
* comparison function.
|
|
2186
|
+
* Use to check whether an iterable contains a value using Effect's default
|
|
2187
|
+
* equality instead of providing a comparison function.
|
|
2153
2188
|
*
|
|
2154
2189
|
* **Example** (Checking membership)
|
|
2155
2190
|
*
|
|
@@ -2171,15 +2206,13 @@ export const contains = /*#__PURE__*/containsWith(/*#__PURE__*/Equal.asEquivalen
|
|
|
2171
2206
|
*
|
|
2172
2207
|
* **When to use**
|
|
2173
2208
|
*
|
|
2174
|
-
* Use when
|
|
2175
|
-
*
|
|
2209
|
+
* Use when you need custom grouping logic where each step returns both a value
|
|
2210
|
+
* and the remaining input.
|
|
2176
2211
|
*
|
|
2177
2212
|
* **Details**
|
|
2178
2213
|
*
|
|
2179
|
-
*
|
|
2180
|
-
*
|
|
2181
|
-
* - Continues until the remaining array is empty.
|
|
2182
|
-
* - Useful for custom splitting/grouping logic.
|
|
2214
|
+
* The function receives a `NonEmptyReadonlyArray` and returns `[value, rest]`.
|
|
2215
|
+
* Processing continues until the remaining array is empty.
|
|
2183
2216
|
*
|
|
2184
2217
|
* **Example** (Chopping an array)
|
|
2185
2218
|
*
|
|
@@ -2223,8 +2256,8 @@ export const chop = /*#__PURE__*/dual(2, (self, f) => {
|
|
|
2223
2256
|
*
|
|
2224
2257
|
* **Details**
|
|
2225
2258
|
*
|
|
2226
|
-
*
|
|
2227
|
-
*
|
|
2259
|
+
* `n` can be `0`, in which case all elements are placed in the second array.
|
|
2260
|
+
* The index is floored to an integer.
|
|
2228
2261
|
*
|
|
2229
2262
|
* **Example** (Splitting at an index)
|
|
2230
2263
|
*
|
|
@@ -2255,6 +2288,11 @@ export const splitAt = /*#__PURE__*/dual(2, (self, n) => {
|
|
|
2255
2288
|
* Splits a non-empty array into two parts at the given index. The first part
|
|
2256
2289
|
* is guaranteed to be non-empty (`n` is clamped to >= 1).
|
|
2257
2290
|
*
|
|
2291
|
+
* **When to use**
|
|
2292
|
+
*
|
|
2293
|
+
* Use when downstream code requires the left side of the split to contain at
|
|
2294
|
+
* least one element.
|
|
2295
|
+
*
|
|
2258
2296
|
* **Example** (Splitting a non-empty array)
|
|
2259
2297
|
*
|
|
2260
2298
|
* ```ts
|
|
@@ -2282,8 +2320,7 @@ export const splitAtNonEmpty = /*#__PURE__*/dual(2, (self, n) => {
|
|
|
2282
2320
|
*
|
|
2283
2321
|
* **Details**
|
|
2284
2322
|
*
|
|
2285
|
-
*
|
|
2286
|
-
* - The last chunk may be shorter.
|
|
2323
|
+
* Uses `chunksOf(ceil(length / n))` internally. The last chunk may be shorter.
|
|
2287
2324
|
*
|
|
2288
2325
|
* **Example** (Splitting into groups)
|
|
2289
2326
|
*
|
|
@@ -2308,7 +2345,8 @@ export const split = /*#__PURE__*/dual(2, (self, n) => {
|
|
|
2308
2345
|
*
|
|
2309
2346
|
* **When to use**
|
|
2310
2347
|
*
|
|
2311
|
-
* Use to split an array at
|
|
2348
|
+
* Use when you need to split an array at the first element that marks a
|
|
2349
|
+
* condition boundary.
|
|
2312
2350
|
*
|
|
2313
2351
|
* **Example** (Splitting at a condition)
|
|
2314
2352
|
*
|
|
@@ -2335,8 +2373,8 @@ export const splitWhere = /*#__PURE__*/dual(2, (self, predicate) => span(self, (
|
|
|
2335
2373
|
*
|
|
2336
2374
|
* **Details**
|
|
2337
2375
|
*
|
|
2338
|
-
*
|
|
2339
|
-
*
|
|
2376
|
+
* The return type preserves `NonEmptyArray`. Use this when you need a distinct
|
|
2377
|
+
* reference, for example before mutating the returned array.
|
|
2340
2378
|
*
|
|
2341
2379
|
* **Example** (Copying an array)
|
|
2342
2380
|
*
|
|
@@ -2365,7 +2403,7 @@ export const copy = self => self.slice();
|
|
|
2365
2403
|
*
|
|
2366
2404
|
* **Details**
|
|
2367
2405
|
*
|
|
2368
|
-
*
|
|
2406
|
+
* Returns an empty array when `n <= 0`.
|
|
2369
2407
|
*
|
|
2370
2408
|
* **Example** (Padding an array)
|
|
2371
2409
|
*
|
|
@@ -2393,14 +2431,13 @@ export const pad = /*#__PURE__*/dual(3, (self, n, fill) => {
|
|
|
2393
2431
|
*
|
|
2394
2432
|
* **When to use**
|
|
2395
2433
|
*
|
|
2396
|
-
* Use to divide an iterable into non-overlapping chunks with a
|
|
2397
|
-
* size.
|
|
2434
|
+
* Use to divide an iterable into a new array of non-overlapping chunks with a
|
|
2435
|
+
* maximum chunk size.
|
|
2398
2436
|
*
|
|
2399
2437
|
* **Details**
|
|
2400
2438
|
*
|
|
2401
|
-
*
|
|
2402
|
-
*
|
|
2403
|
-
* - Preserves `NonEmptyArray` in the outer return type.
|
|
2439
|
+
* `chunksOf(n)([])` is `[]`, not `[[]]`. Each chunk is a `NonEmptyArray`, and
|
|
2440
|
+
* the outer return type preserves `NonEmptyArray`.
|
|
2404
2441
|
*
|
|
2405
2442
|
* **Example** (Chunking an array)
|
|
2406
2443
|
*
|
|
@@ -2432,8 +2469,8 @@ export const chunksOf = /*#__PURE__*/dual(2, (self, n) => {
|
|
|
2432
2469
|
*
|
|
2433
2470
|
* **Details**
|
|
2434
2471
|
*
|
|
2435
|
-
*
|
|
2436
|
-
*
|
|
2472
|
+
* Returns an empty array if `n <= 0` or the array has fewer than `n` elements.
|
|
2473
|
+
* Each window is a tuple of exactly `n` elements.
|
|
2437
2474
|
*
|
|
2438
2475
|
* **Example** (Sliding windows)
|
|
2439
2476
|
*
|
|
@@ -2463,13 +2500,13 @@ export const window = /*#__PURE__*/dual(2, (self, n) => {
|
|
|
2463
2500
|
*
|
|
2464
2501
|
* **When to use**
|
|
2465
2502
|
*
|
|
2466
|
-
* Use when a non-empty array
|
|
2467
|
-
* adjacent and
|
|
2503
|
+
* Use when you already have a non-empty array arranged so matching elements are
|
|
2504
|
+
* adjacent and need a custom equivalence function.
|
|
2468
2505
|
*
|
|
2469
2506
|
* **Details**
|
|
2470
2507
|
*
|
|
2471
|
-
*
|
|
2472
|
-
*
|
|
2508
|
+
* Only adjacent elements are grouped. Non-adjacent duplicates stay separate.
|
|
2509
|
+
* Requires a `NonEmptyReadonlyArray`.
|
|
2473
2510
|
*
|
|
2474
2511
|
* **Example** (Grouping consecutive equal elements)
|
|
2475
2512
|
*
|
|
@@ -2505,12 +2542,12 @@ export const groupWith = /*#__PURE__*/dual(2, (self, isEquivalent) => chop(self,
|
|
|
2505
2542
|
*
|
|
2506
2543
|
* **When to use**
|
|
2507
2544
|
*
|
|
2508
|
-
* Use when
|
|
2509
|
-
* the right comparison.
|
|
2545
|
+
* Use when you already have adjacent equal values and Effect's default equality
|
|
2546
|
+
* is the right comparison.
|
|
2510
2547
|
*
|
|
2511
2548
|
* **Details**
|
|
2512
2549
|
*
|
|
2513
|
-
*
|
|
2550
|
+
* Only adjacent elements are grouped.
|
|
2514
2551
|
*
|
|
2515
2552
|
* **Example** (Grouping adjacent equal elements)
|
|
2516
2553
|
*
|
|
@@ -2537,9 +2574,8 @@ export const group = /*#__PURE__*/groupWith(/*#__PURE__*/Equal.asEquivalence());
|
|
|
2537
2574
|
*
|
|
2538
2575
|
* **Details**
|
|
2539
2576
|
*
|
|
2540
|
-
*
|
|
2541
|
-
*
|
|
2542
|
-
* - Key function must return a `string` or `symbol`.
|
|
2577
|
+
* Unlike `group` and `groupWith`, elements do not need to be adjacent to be
|
|
2578
|
+
* grouped together. The key function must return a `string` or `symbol`.
|
|
2543
2579
|
*
|
|
2544
2580
|
* **Example** (Grouping by a property)
|
|
2545
2581
|
*
|
|
@@ -2637,8 +2673,8 @@ export const union = /*#__PURE__*/dual(2, (self, that) => unionWith(self, that,
|
|
|
2637
2673
|
*
|
|
2638
2674
|
* **When to use**
|
|
2639
2675
|
*
|
|
2640
|
-
* Use when
|
|
2641
|
-
* defined by a custom comparator, such as matching objects by id.
|
|
2676
|
+
* Use when you need to keep only values present in both arrays and equality
|
|
2677
|
+
* must be defined by a custom comparator, such as matching objects by id.
|
|
2642
2678
|
*
|
|
2643
2679
|
* **Example** (Intersection with custom equality)
|
|
2644
2680
|
*
|
|
@@ -2669,6 +2705,11 @@ export const intersectionWith = isEquivalent => {
|
|
|
2669
2705
|
* Computes the intersection of two arrays using `Equal.equivalence()`. Order is
|
|
2670
2706
|
* determined by the first array.
|
|
2671
2707
|
*
|
|
2708
|
+
* **When to use**
|
|
2709
|
+
*
|
|
2710
|
+
* Use when Effect equality is the right membership test and you want to keep
|
|
2711
|
+
* values present in both inputs while preserving the first input's order.
|
|
2712
|
+
*
|
|
2672
2713
|
* **Example** (Array intersection)
|
|
2673
2714
|
*
|
|
2674
2715
|
* ```ts
|
|
@@ -2691,8 +2732,8 @@ export const intersection = /*#__PURE__*/intersectionWith(/*#__PURE__*/Equal.asE
|
|
|
2691
2732
|
*
|
|
2692
2733
|
* **When to use**
|
|
2693
2734
|
*
|
|
2694
|
-
* Use when
|
|
2695
|
-
* defined by a custom comparator, such as matching objects by id.
|
|
2735
|
+
* Use when you need to keep only values from the first array and equality must
|
|
2736
|
+
* be defined by a custom comparator, such as matching objects by id.
|
|
2696
2737
|
*
|
|
2697
2738
|
* **Example** (Difference with custom equality)
|
|
2698
2739
|
*
|
|
@@ -2792,8 +2833,8 @@ export const of = a => [a];
|
|
|
2792
2833
|
*
|
|
2793
2834
|
* **Details**
|
|
2794
2835
|
*
|
|
2795
|
-
*
|
|
2796
|
-
*
|
|
2836
|
+
* The function receives `(element, index)`. The return type preserves
|
|
2837
|
+
* `NonEmptyArray`.
|
|
2797
2838
|
*
|
|
2798
2839
|
* **Example** (Doubling values)
|
|
2799
2840
|
*
|
|
@@ -2814,13 +2855,13 @@ export const map = /*#__PURE__*/dual(2, (self, f) => self.map(f));
|
|
|
2814
2855
|
*
|
|
2815
2856
|
* **When to use**
|
|
2816
2857
|
*
|
|
2817
|
-
* Use to map each element to zero or more values and concatenate the
|
|
2818
|
-
* one pass.
|
|
2858
|
+
* Use to map each array element to zero or more values and concatenate the
|
|
2859
|
+
* results in one pass.
|
|
2819
2860
|
*
|
|
2820
2861
|
* **Details**
|
|
2821
2862
|
*
|
|
2822
|
-
*
|
|
2823
|
-
*
|
|
2863
|
+
* The function receives `(element, index)`. This returns `NonEmptyArray` when
|
|
2864
|
+
* both the input and mapped arrays are non-empty.
|
|
2824
2865
|
*
|
|
2825
2866
|
* **Example** (FlatMapping an array)
|
|
2826
2867
|
*
|
|
@@ -2876,8 +2917,8 @@ export const flatten = /*#__PURE__*/flatMap(identity);
|
|
|
2876
2917
|
*
|
|
2877
2918
|
* **When to use**
|
|
2878
2919
|
*
|
|
2879
|
-
* Use to collect only present values from `Option` values while
|
|
2880
|
-
* `None` values.
|
|
2920
|
+
* Use to collect only present values from an iterable of `Option` values while
|
|
2921
|
+
* discarding `None` values.
|
|
2881
2922
|
*
|
|
2882
2923
|
* **Example** (Extracting Some values)
|
|
2883
2924
|
*
|
|
@@ -2908,8 +2949,8 @@ export const getSomes = self => {
|
|
|
2908
2949
|
*
|
|
2909
2950
|
* **When to use**
|
|
2910
2951
|
*
|
|
2911
|
-
* Use
|
|
2912
|
-
*
|
|
2952
|
+
* Use when you can drop the success channel and only need the failure
|
|
2953
|
+
* payloads, not the original result wrappers.
|
|
2913
2954
|
*
|
|
2914
2955
|
* **Example** (Extracting failures)
|
|
2915
2956
|
*
|
|
@@ -2941,8 +2982,8 @@ export const getFailures = self => {
|
|
|
2941
2982
|
*
|
|
2942
2983
|
* **When to use**
|
|
2943
2984
|
*
|
|
2944
|
-
* Use
|
|
2945
|
-
*
|
|
2985
|
+
* Use when you can drop the failure channel and only need the success
|
|
2986
|
+
* payloads, not the original result wrappers.
|
|
2946
2987
|
*
|
|
2947
2988
|
* **Example** (Extracting successes)
|
|
2948
2989
|
*
|
|
@@ -2973,13 +3014,12 @@ export const getSuccesses = self => {
|
|
|
2973
3014
|
*
|
|
2974
3015
|
* **When to use**
|
|
2975
3016
|
*
|
|
2976
|
-
* Use to
|
|
2977
|
-
* failures.
|
|
3017
|
+
* Use to filter an iterable with a `Result`-returning transformation while
|
|
3018
|
+
* discarding failures.
|
|
2978
3019
|
*
|
|
2979
3020
|
* **Details**
|
|
2980
3021
|
*
|
|
2981
|
-
*
|
|
2982
|
-
* - Failures are discarded.
|
|
3022
|
+
* The filter receives `(element, index)`. Failures are discarded.
|
|
2983
3023
|
*
|
|
2984
3024
|
* **Example** (Filter and transform)
|
|
2985
3025
|
*
|
|
@@ -3012,12 +3052,13 @@ export const filterMap = /*#__PURE__*/dual(2, (self, f) => {
|
|
|
3012
3052
|
*
|
|
3013
3053
|
* **When to use**
|
|
3014
3054
|
*
|
|
3015
|
-
* Use to
|
|
3055
|
+
* Use to filter an iterable into a new array of original elements that satisfy
|
|
3056
|
+
* a boolean predicate or refinement.
|
|
3016
3057
|
*
|
|
3017
3058
|
* **Details**
|
|
3018
3059
|
*
|
|
3019
|
-
*
|
|
3020
|
-
*
|
|
3060
|
+
* The predicate receives `(element, index)`. Refinements are supported for type
|
|
3061
|
+
* narrowing.
|
|
3021
3062
|
*
|
|
3022
3063
|
* **Example** (Filtering even numbers)
|
|
3023
3064
|
*
|
|
@@ -3048,13 +3089,12 @@ export const filter = /*#__PURE__*/dual(2, (self, predicate) => {
|
|
|
3048
3089
|
*
|
|
3049
3090
|
* **When to use**
|
|
3050
3091
|
*
|
|
3051
|
-
* Use to
|
|
3052
|
-
* failure and success values.
|
|
3092
|
+
* Use to partition an iterable by evaluating each element with a
|
|
3093
|
+
* `Result`-returning filter and keeping both failure and success values.
|
|
3053
3094
|
*
|
|
3054
3095
|
* **Details**
|
|
3055
3096
|
*
|
|
3056
|
-
*
|
|
3057
|
-
* - The filter receives `(element, index)`.
|
|
3097
|
+
* Returns `[excluded, satisfying]`. The filter receives `(element, index)`.
|
|
3058
3098
|
*
|
|
3059
3099
|
* **Example** (Partitioning with a filter)
|
|
3060
3100
|
*
|
|
@@ -3093,12 +3133,12 @@ export const partition = /*#__PURE__*/dual(2, (self, f) => {
|
|
|
3093
3133
|
*
|
|
3094
3134
|
* **When to use**
|
|
3095
3135
|
*
|
|
3096
|
-
* Use to split
|
|
3136
|
+
* Use to split an iterable of `Result` values into failure and success arrays.
|
|
3097
3137
|
*
|
|
3098
3138
|
* **Details**
|
|
3099
3139
|
*
|
|
3100
|
-
*
|
|
3101
|
-
*
|
|
3140
|
+
* Returns `[failures, successes]`. This is equivalent to
|
|
3141
|
+
* `partition(identity)`.
|
|
3102
3142
|
*
|
|
3103
3143
|
* **Example** (Separating Results)
|
|
3104
3144
|
*
|
|
@@ -3129,7 +3169,7 @@ export const separate = /*#__PURE__*/partition(identity);
|
|
|
3129
3169
|
*
|
|
3130
3170
|
* **Details**
|
|
3131
3171
|
*
|
|
3132
|
-
*
|
|
3172
|
+
* The function receives `(accumulator, element, index)`.
|
|
3133
3173
|
*
|
|
3134
3174
|
* **Example** (Summing an array)
|
|
3135
3175
|
*
|
|
@@ -3151,12 +3191,11 @@ export const reduce = /*#__PURE__*/dual(3, (self, b, f) => fromIterable(self).re
|
|
|
3151
3191
|
*
|
|
3152
3192
|
* **When to use**
|
|
3153
3193
|
*
|
|
3154
|
-
* Use when
|
|
3155
|
-
* left.
|
|
3194
|
+
* Use when you need to fold values from right to left.
|
|
3156
3195
|
*
|
|
3157
3196
|
* **Details**
|
|
3158
3197
|
*
|
|
3159
|
-
*
|
|
3198
|
+
* The function receives `(accumulator, element, index)`.
|
|
3160
3199
|
*
|
|
3161
3200
|
* **Example** (Right-to-left fold)
|
|
3162
3201
|
*
|
|
@@ -3198,6 +3237,11 @@ export const liftPredicate = predicate => b => predicate(b) ? [b] : [];
|
|
|
3198
3237
|
* Lifts an `Option`-returning function into one that returns an array:
|
|
3199
3238
|
* `Some(a)` becomes `[a]`, `None` becomes `[]`.
|
|
3200
3239
|
*
|
|
3240
|
+
* **When to use**
|
|
3241
|
+
*
|
|
3242
|
+
* Use when an optional parser or lookup should participate in array pipelines
|
|
3243
|
+
* as zero-or-one results.
|
|
3244
|
+
*
|
|
3201
3245
|
* **Example** (Lifting an Option function)
|
|
3202
3246
|
*
|
|
3203
3247
|
* ```ts
|
|
@@ -3273,7 +3317,7 @@ export const liftNullishOr = f => (...a) => fromNullishOr(f(...a));
|
|
|
3273
3317
|
*
|
|
3274
3318
|
* **When to use**
|
|
3275
3319
|
*
|
|
3276
|
-
* Use when
|
|
3320
|
+
* Use when you need to map and filter in one step, where the mapper can return
|
|
3277
3321
|
* `null` or `undefined` to skip elements.
|
|
3278
3322
|
*
|
|
3279
3323
|
* **Example** (FlatMapping with nullable)
|
|
@@ -3296,6 +3340,11 @@ export const flatMapNullishOr = /*#__PURE__*/dual(2, (self, f) => flatMap(self,
|
|
|
3296
3340
|
* Lifts a `Result`-returning function into one that returns an array: failures
|
|
3297
3341
|
* produce `[]`, successes produce `[value]`.
|
|
3298
3342
|
*
|
|
3343
|
+
* **When to use**
|
|
3344
|
+
*
|
|
3345
|
+
* Use when a fallible parser or lookup should participate in array pipelines as
|
|
3346
|
+
* zero-or-one results and the failure value should be discarded.
|
|
3347
|
+
*
|
|
3299
3348
|
* **Example** (Lifting a Result function)
|
|
3300
3349
|
*
|
|
3301
3350
|
* ```ts
|
|
@@ -3327,7 +3376,7 @@ export const liftResult = f => (...a) => {
|
|
|
3327
3376
|
*
|
|
3328
3377
|
* **When to use**
|
|
3329
3378
|
*
|
|
3330
|
-
* Use to check
|
|
3379
|
+
* Use to check whether every array element satisfies a predicate, including
|
|
3331
3380
|
* refinement-based type narrowing.
|
|
3332
3381
|
*
|
|
3333
3382
|
* **Example** (Testing all elements)
|
|
@@ -3371,12 +3420,12 @@ export const some = /*#__PURE__*/dual(2, (self, predicate) => self.some(predicat
|
|
|
3371
3420
|
*
|
|
3372
3421
|
* **When to use**
|
|
3373
3422
|
*
|
|
3374
|
-
* Use when a
|
|
3423
|
+
* Use when you need to compute a result from every suffix of an array, such as
|
|
3375
3424
|
* cumulative aggregations from each position.
|
|
3376
3425
|
*
|
|
3377
3426
|
* **Details**
|
|
3378
3427
|
*
|
|
3379
|
-
*
|
|
3428
|
+
* For index `i`, the function receives `self.slice(i)`.
|
|
3380
3429
|
*
|
|
3381
3430
|
* **Example** (Suffix lengths)
|
|
3382
3431
|
*
|
|
@@ -3598,7 +3647,7 @@ export const dedupe = self => dedupeWith(self, Equal.asEquivalence());
|
|
|
3598
3647
|
*
|
|
3599
3648
|
* **Details**
|
|
3600
3649
|
*
|
|
3601
|
-
*
|
|
3650
|
+
* Non-adjacent duplicates are preserved.
|
|
3602
3651
|
*
|
|
3603
3652
|
* **Example** (Deduplicating adjacent elements)
|
|
3604
3653
|
*
|
|
@@ -3671,15 +3720,15 @@ export const join = /*#__PURE__*/dual(2, (self, sep) => fromIterable(self).join(
|
|
|
3671
3720
|
*
|
|
3672
3721
|
* **When to use**
|
|
3673
3722
|
*
|
|
3674
|
-
* Use when
|
|
3675
|
-
*
|
|
3723
|
+
* Use when you need to map while threading state through each element and keep
|
|
3724
|
+
* the final state.
|
|
3676
3725
|
*
|
|
3677
3726
|
* **Details**
|
|
3678
3727
|
*
|
|
3679
|
-
*
|
|
3680
|
-
*
|
|
3681
|
-
*
|
|
3682
|
-
*
|
|
3728
|
+
* Combines `map` and `reduce` in a single pass. The callback receives the
|
|
3729
|
+
* current state, element, and index, and returns `[nextState, mappedValue]`.
|
|
3730
|
+
* The result is `[finalState, mappedArray]`. This can be used in both
|
|
3731
|
+
* data-first and data-last style.
|
|
3683
3732
|
*
|
|
3684
3733
|
* **Example** (Running sum alongside mapped values)
|
|
3685
3734
|
*
|
|
@@ -3718,9 +3767,9 @@ export const mapAccum = /*#__PURE__*/dual(3, (self, s, f) => {
|
|
|
3718
3767
|
*
|
|
3719
3768
|
* **Details**
|
|
3720
3769
|
*
|
|
3721
|
-
*
|
|
3722
|
-
*
|
|
3723
|
-
*
|
|
3770
|
+
* Produces every combination of an element from `self` with an element from
|
|
3771
|
+
* `that`, so the result length is `self.length * that.length`. Iteration visits
|
|
3772
|
+
* every element of `that` for each element of `self`.
|
|
3724
3773
|
*
|
|
3725
3774
|
* **Example** (Combining numbers and letters)
|
|
3726
3775
|
*
|
|
@@ -3746,8 +3795,8 @@ export const cartesianWith = /*#__PURE__*/dual(3, (self, that, f) => flatMap(sel
|
|
|
3746
3795
|
*
|
|
3747
3796
|
* **Details**
|
|
3748
3797
|
*
|
|
3749
|
-
*
|
|
3750
|
-
*
|
|
3798
|
+
* Produces every `[a, b]` combination of an element from `self` with an element
|
|
3799
|
+
* from `that`, so the result length is `self.length * that.length`.
|
|
3751
3800
|
*
|
|
3752
3801
|
* **Example** (All pairs of two arrays)
|
|
3753
3802
|
*
|
|
@@ -3772,9 +3821,14 @@ export const cartesian = /*#__PURE__*/dual(2, (self, that) => cartesianWith(self
|
|
|
3772
3821
|
*
|
|
3773
3822
|
* **When to use**
|
|
3774
3823
|
*
|
|
3775
|
-
* Use when
|
|
3776
|
-
*
|
|
3777
|
-
*
|
|
3824
|
+
* Use when you want array-comprehension style code with do notation.
|
|
3825
|
+
*
|
|
3826
|
+
* **Details**
|
|
3827
|
+
*
|
|
3828
|
+
* Use {@link bind} to introduce array variables and {@link let_ let} for plain
|
|
3829
|
+
* values. Each `bind` produces the cartesian product of all bound variables,
|
|
3830
|
+
* like nested loops. Use `filter` and `map` in the pipeline to add conditions
|
|
3831
|
+
* and transformations.
|
|
3778
3832
|
*
|
|
3779
3833
|
* **Example** (Array comprehension with do notation)
|
|
3780
3834
|
*
|
|
@@ -3809,9 +3863,9 @@ export const Do = /*#__PURE__*/of({});
|
|
|
3809
3863
|
*
|
|
3810
3864
|
* **Details**
|
|
3811
3865
|
*
|
|
3812
|
-
*
|
|
3813
|
-
*
|
|
3814
|
-
*
|
|
3866
|
+
* Each `bind` call adds a named property to the accumulated object. The
|
|
3867
|
+
* callback receives the current scope and must return an array. This is
|
|
3868
|
+
* equivalent to `flatMap` plus merging the new value into the scope object.
|
|
3815
3869
|
*
|
|
3816
3870
|
* **Example** (Binding two arrays)
|
|
3817
3871
|
*
|
|
@@ -3845,8 +3899,8 @@ export const bind = /*#__PURE__*/internalDoNotation.bind(map, flatMap);
|
|
|
3845
3899
|
*
|
|
3846
3900
|
* **Details**
|
|
3847
3901
|
*
|
|
3848
|
-
*
|
|
3849
|
-
*
|
|
3902
|
+
* Equivalent to `Array.map(self, (a) => ({ [tag]: a }))`. This is an
|
|
3903
|
+
* alternative to starting with `Do` plus `bind` when you already have an array.
|
|
3850
3904
|
*
|
|
3851
3905
|
* **Example** (Naming an existing array)
|
|
3852
3906
|
*
|
|
@@ -3872,10 +3926,16 @@ export {
|
|
|
3872
3926
|
/**
|
|
3873
3927
|
* Adds a computed plain value to the do-notation scope without introducing a new array dimension.
|
|
3874
3928
|
*
|
|
3929
|
+
* **When to use**
|
|
3930
|
+
*
|
|
3931
|
+
* Use when each do-notation branch needs a derived field from the current
|
|
3932
|
+
* bindings without multiplying the number of branches.
|
|
3933
|
+
*
|
|
3875
3934
|
* **Details**
|
|
3876
3935
|
*
|
|
3877
|
-
*
|
|
3878
|
-
*
|
|
3936
|
+
* Unlike `bind`, the callback returns a single value instead of an array, so
|
|
3937
|
+
* no cartesian product occurs. Use this for derived or intermediate values
|
|
3938
|
+
* that depend on previously bound variables.
|
|
3879
3939
|
*
|
|
3880
3940
|
* **Example** (Adding a computed value)
|
|
3881
3941
|
*
|
|
@@ -3926,13 +3986,13 @@ export function makeReducerConcat() {
|
|
|
3926
3986
|
*
|
|
3927
3987
|
* **When to use**
|
|
3928
3988
|
*
|
|
3929
|
-
* Use to count how many elements
|
|
3930
|
-
*
|
|
3989
|
+
* Use when you need to count how many elements of an iterable satisfy a
|
|
3990
|
+
* predicate.
|
|
3931
3991
|
*
|
|
3932
3992
|
* **Details**
|
|
3933
3993
|
*
|
|
3934
|
-
*
|
|
3935
|
-
*
|
|
3994
|
+
* The predicate receives both the element and its index. Empty iterables return
|
|
3995
|
+
* `0`.
|
|
3936
3996
|
*
|
|
3937
3997
|
* **Example** (Counting even numbers)
|
|
3938
3998
|
*
|