effect 3.8.3 → 3.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Array.js.map +1 -1
- package/dist/cjs/BigDecimal.js +2 -3
- package/dist/cjs/BigDecimal.js.map +1 -1
- package/dist/cjs/BigInt.js.map +1 -1
- package/dist/cjs/Boolean.js.map +1 -1
- package/dist/cjs/Cause.js.map +1 -1
- package/dist/cjs/Channel.js.map +1 -1
- package/dist/cjs/ChildExecutorDecision.js.map +1 -1
- package/dist/cjs/Chunk.js.map +1 -1
- package/dist/cjs/Config.js.map +1 -1
- package/dist/cjs/ConfigError.js.map +1 -1
- package/dist/cjs/ConfigProvider.js.map +1 -1
- package/dist/cjs/ConfigProviderPathPatch.js.map +1 -1
- package/dist/cjs/Console.js.map +1 -1
- package/dist/cjs/Context.js.map +1 -1
- package/dist/cjs/Cron.js.map +1 -1
- package/dist/cjs/Data.js.map +1 -1
- package/dist/cjs/DateTime.js.map +1 -1
- package/dist/cjs/Deferred.js.map +1 -1
- package/dist/cjs/Differ.js.map +1 -1
- package/dist/cjs/Duration.js.map +1 -1
- package/dist/cjs/Effect.js.map +1 -1
- package/dist/cjs/Either.js.map +1 -1
- package/dist/cjs/Equivalence.js.map +1 -1
- package/dist/cjs/ExecutionStrategy.js.map +1 -1
- package/dist/cjs/Exit.js.map +1 -1
- package/dist/cjs/Fiber.js.map +1 -1
- package/dist/cjs/FiberHandle.js.map +1 -1
- package/dist/cjs/FiberId.js.map +1 -1
- package/dist/cjs/FiberMap.js.map +1 -1
- package/dist/cjs/FiberRef.js.map +1 -1
- package/dist/cjs/FiberRefs.js.map +1 -1
- package/dist/cjs/FiberRefsPatch.js.map +1 -1
- package/dist/cjs/FiberSet.js.map +1 -1
- package/dist/cjs/Function.js.map +1 -1
- package/dist/cjs/GroupBy.js.map +1 -1
- package/dist/cjs/Hash.js.map +1 -1
- package/dist/cjs/HashMap.js.map +1 -1
- package/dist/cjs/HashSet.js.map +1 -1
- package/dist/cjs/Iterable.js.map +1 -1
- package/dist/cjs/KeyedPool.js.map +1 -1
- package/dist/cjs/Layer.js.map +1 -1
- package/dist/cjs/List.js.map +1 -1
- package/dist/cjs/LogLevel.js.map +1 -1
- package/dist/cjs/Logger.js.map +1 -1
- package/dist/cjs/Mailbox.js.map +1 -1
- package/dist/cjs/MergeDecision.js.map +1 -1
- package/dist/cjs/MergeState.js.map +1 -1
- package/dist/cjs/MergeStrategy.js.map +1 -1
- package/dist/cjs/Metric.js.map +1 -1
- package/dist/cjs/MetricHook.js.map +1 -1
- package/dist/cjs/MetricKey.js.map +1 -1
- package/dist/cjs/MetricPolling.js.map +1 -1
- package/dist/cjs/MetricState.js.map +1 -1
- package/dist/cjs/Micro.js +54 -23
- package/dist/cjs/Micro.js.map +1 -1
- package/dist/cjs/MutableHashMap.js.map +1 -1
- package/dist/cjs/MutableHashSet.js.map +1 -1
- package/dist/cjs/MutableList.js.map +1 -1
- package/dist/cjs/MutableQueue.js.map +1 -1
- package/dist/cjs/MutableRef.js.map +1 -1
- package/dist/cjs/Number.js.map +1 -1
- package/dist/cjs/Option.js.map +1 -1
- package/dist/cjs/Order.js.map +1 -1
- package/dist/cjs/Ordering.js.map +1 -1
- package/dist/cjs/Pipeable.js.map +1 -1
- package/dist/cjs/Pool.js.map +1 -1
- package/dist/cjs/Predicate.js.map +1 -1
- package/dist/cjs/PubSub.js.map +1 -1
- package/dist/cjs/Queue.js.map +1 -1
- package/dist/cjs/RcMap.js.map +1 -1
- package/dist/cjs/Readable.js.map +1 -1
- package/dist/cjs/Record.js.map +1 -1
- package/dist/cjs/RedBlackTree.js.map +1 -1
- package/dist/cjs/Ref.js.map +1 -1
- package/dist/cjs/Request.js.map +1 -1
- package/dist/cjs/RequestResolver.js.map +1 -1
- package/dist/cjs/Runtime.js.map +1 -1
- package/dist/cjs/RuntimeFlags.js.map +1 -1
- package/dist/cjs/RuntimeFlagsPatch.js.map +1 -1
- package/dist/cjs/STM.js.map +1 -1
- package/dist/cjs/Schedule.js.map +1 -1
- package/dist/cjs/ScheduleInterval.js.map +1 -1
- package/dist/cjs/ScheduleIntervals.js.map +1 -1
- package/dist/cjs/Scheduler.js.map +1 -1
- package/dist/cjs/Scope.js +25 -15
- package/dist/cjs/Scope.js.map +1 -1
- package/dist/cjs/ScopedRef.js.map +1 -1
- package/dist/cjs/Sink.js.map +1 -1
- package/dist/cjs/SortedMap.js.map +1 -1
- package/dist/cjs/SortedSet.js.map +1 -1
- package/dist/cjs/Stream.js +17 -3
- package/dist/cjs/Stream.js.map +1 -1
- package/dist/cjs/StreamHaltStrategy.js.map +1 -1
- package/dist/cjs/String.js.map +1 -1
- package/dist/cjs/Struct.js.map +1 -1
- package/dist/cjs/Subscribable.js.map +1 -1
- package/dist/cjs/SubscriptionRef.js.map +1 -1
- package/dist/cjs/SynchronizedRef.js.map +1 -1
- package/dist/cjs/TArray.js.map +1 -1
- package/dist/cjs/TDeferred.js.map +1 -1
- package/dist/cjs/TMap.js.map +1 -1
- package/dist/cjs/TPriorityQueue.js.map +1 -1
- package/dist/cjs/TPubSub.js.map +1 -1
- package/dist/cjs/TQueue.js.map +1 -1
- package/dist/cjs/TReentrantLock.js.map +1 -1
- package/dist/cjs/TRef.js.map +1 -1
- package/dist/cjs/TSemaphore.js.map +1 -1
- package/dist/cjs/TSet.js.map +1 -1
- package/dist/cjs/Take.js.map +1 -1
- package/dist/cjs/TestAnnotationMap.js.map +1 -1
- package/dist/cjs/TestClock.js.map +1 -1
- package/dist/cjs/TestServices.js.map +1 -1
- package/dist/cjs/Trie.js.map +1 -1
- package/dist/cjs/Tuple.js.map +1 -1
- package/dist/cjs/Unify.js.map +1 -1
- package/dist/cjs/UpstreamPullRequest.js.map +1 -1
- package/dist/cjs/UpstreamPullStrategy.js.map +1 -1
- package/dist/cjs/Utils.js +1 -14
- package/dist/cjs/Utils.js.map +1 -1
- package/dist/cjs/internal/core.js +4 -3
- package/dist/cjs/internal/core.js.map +1 -1
- package/dist/cjs/internal/runtime.js +1 -1
- package/dist/cjs/internal/runtime.js.map +1 -1
- package/dist/cjs/internal/stream.js +12 -3
- package/dist/cjs/internal/stream.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/dts/Array.d.ts +2684 -0
- package/dist/dts/Array.d.ts.map +1 -1
- package/dist/dts/BigDecimal.d.ts +558 -1
- package/dist/dts/BigDecimal.d.ts.map +1 -1
- package/dist/dts/BigInt.d.ts +490 -0
- package/dist/dts/BigInt.d.ts.map +1 -1
- package/dist/dts/Boolean.d.ts +228 -0
- package/dist/dts/Boolean.d.ts.map +1 -1
- package/dist/dts/Cause.d.ts +172 -0
- package/dist/dts/Cause.d.ts.map +1 -1
- package/dist/dts/Channel.d.ts +750 -0
- package/dist/dts/Channel.d.ts.map +1 -1
- package/dist/dts/ChildExecutorDecision.d.ts +12 -0
- package/dist/dts/ChildExecutorDecision.d.ts.map +1 -1
- package/dist/dts/Chunk.d.ts +791 -0
- package/dist/dts/Chunk.d.ts.map +1 -1
- package/dist/dts/Config.d.ts +174 -0
- package/dist/dts/Config.d.ts.map +1 -1
- package/dist/dts/ConfigError.d.ts +16 -0
- package/dist/dts/ConfigError.d.ts.map +1 -1
- package/dist/dts/ConfigProvider.d.ts +84 -0
- package/dist/dts/ConfigProvider.d.ts.map +1 -1
- package/dist/dts/ConfigProviderPathPatch.d.ts +32 -0
- package/dist/dts/ConfigProviderPathPatch.d.ts.map +1 -1
- package/dist/dts/Console.d.ts +24 -0
- package/dist/dts/Console.d.ts.map +1 -1
- package/dist/dts/Context.d.ts +232 -0
- package/dist/dts/Context.d.ts.map +1 -1
- package/dist/dts/Cron.d.ts +12 -0
- package/dist/dts/Cron.d.ts.map +1 -1
- package/dist/dts/Data.d.ts +165 -0
- package/dist/dts/Data.d.ts.map +1 -1
- package/dist/dts/DateTime.d.ts +878 -0
- package/dist/dts/DateTime.d.ts.map +1 -1
- package/dist/dts/Deferred.d.ts +170 -0
- package/dist/dts/Deferred.d.ts.map +1 -1
- package/dist/dts/Differ.d.ts +78 -0
- package/dist/dts/Differ.d.ts.map +1 -1
- package/dist/dts/Duration.d.ts +130 -0
- package/dist/dts/Duration.d.ts.map +1 -1
- package/dist/dts/Effect.d.ts +4117 -3
- package/dist/dts/Effect.d.ts.map +1 -1
- package/dist/dts/Either.d.ts +620 -0
- package/dist/dts/Either.d.ts.map +1 -1
- package/dist/dts/Equivalence.d.ts +24 -0
- package/dist/dts/Equivalence.d.ts.map +1 -1
- package/dist/dts/ExecutionStrategy.d.ts +14 -0
- package/dist/dts/ExecutionStrategy.d.ts.map +1 -1
- package/dist/dts/Exit.d.ts +252 -0
- package/dist/dts/Exit.d.ts.map +1 -1
- package/dist/dts/Fiber.d.ts +182 -0
- package/dist/dts/Fiber.d.ts.map +1 -1
- package/dist/dts/FiberHandle.d.ts +42 -0
- package/dist/dts/FiberHandle.d.ts.map +1 -1
- package/dist/dts/FiberId.d.ts +24 -0
- package/dist/dts/FiberId.d.ts.map +1 -1
- package/dist/dts/FiberMap.d.ts +102 -0
- package/dist/dts/FiberMap.d.ts.map +1 -1
- package/dist/dts/FiberRef.d.ts +80 -0
- package/dist/dts/FiberRef.d.ts.map +1 -1
- package/dist/dts/FiberRefs.d.ts +84 -0
- package/dist/dts/FiberRefs.d.ts.map +1 -1
- package/dist/dts/FiberRefsPatch.d.ts +30 -0
- package/dist/dts/FiberRefsPatch.d.ts.map +1 -1
- package/dist/dts/FiberSet.d.ts +38 -0
- package/dist/dts/FiberSet.d.ts.map +1 -1
- package/dist/dts/Function.d.ts +144 -28
- package/dist/dts/Function.d.ts.map +1 -1
- package/dist/dts/GroupBy.d.ts +38 -0
- package/dist/dts/GroupBy.d.ts.map +1 -1
- package/dist/dts/Hash.d.ts +8 -0
- package/dist/dts/Hash.d.ts.map +1 -1
- package/dist/dts/HashMap.d.ts +300 -0
- package/dist/dts/HashMap.d.ts.map +1 -1
- package/dist/dts/HashSet.d.ts +284 -0
- package/dist/dts/HashSet.d.ts.map +1 -1
- package/dist/dts/Iterable.d.ts +454 -0
- package/dist/dts/Iterable.d.ts.map +1 -1
- package/dist/dts/KeyedPool.d.ts +34 -0
- package/dist/dts/KeyedPool.d.ts.map +1 -1
- package/dist/dts/Layer.d.ts +414 -0
- package/dist/dts/Layer.d.ts.map +1 -1
- package/dist/dts/List.d.ts +430 -0
- package/dist/dts/List.d.ts.map +1 -1
- package/dist/dts/LogLevel.d.ts +46 -0
- package/dist/dts/LogLevel.d.ts.map +1 -1
- package/dist/dts/Logger.d.ts +194 -0
- package/dist/dts/Logger.d.ts.map +1 -1
- package/dist/dts/Mailbox.d.ts +16 -0
- package/dist/dts/Mailbox.d.ts.map +1 -1
- package/dist/dts/MergeDecision.d.ts +8 -0
- package/dist/dts/MergeDecision.d.ts.map +1 -1
- package/dist/dts/MergeState.d.ts +8 -0
- package/dist/dts/MergeState.d.ts.map +1 -1
- package/dist/dts/MergeStrategy.d.ts +12 -0
- package/dist/dts/MergeStrategy.d.ts.map +1 -1
- package/dist/dts/Metric.d.ts +410 -0
- package/dist/dts/Metric.d.ts.map +1 -1
- package/dist/dts/MetricHook.d.ts +24 -0
- package/dist/dts/MetricHook.d.ts.map +1 -1
- package/dist/dts/MetricKey.d.ts +48 -0
- package/dist/dts/MetricKey.d.ts.map +1 -1
- package/dist/dts/MetricPolling.d.ts +40 -0
- package/dist/dts/MetricPolling.d.ts.map +1 -1
- package/dist/dts/MetricState.d.ts +16 -0
- package/dist/dts/MetricState.d.ts.map +1 -1
- package/dist/dts/Micro.d.ts +1203 -25
- package/dist/dts/Micro.d.ts.map +1 -1
- package/dist/dts/MutableHashMap.d.ts +50 -0
- package/dist/dts/MutableHashMap.d.ts.map +1 -1
- package/dist/dts/MutableHashSet.d.ts +24 -0
- package/dist/dts/MutableHashSet.d.ts.map +1 -1
- package/dist/dts/MutableList.d.ts +36 -0
- package/dist/dts/MutableList.d.ts.map +1 -1
- package/dist/dts/MutableQueue.d.ts +62 -0
- package/dist/dts/MutableQueue.d.ts.map +1 -1
- package/dist/dts/MutableRef.d.ts +56 -0
- package/dist/dts/MutableRef.d.ts.map +1 -1
- package/dist/dts/Number.d.ts +474 -0
- package/dist/dts/Number.d.ts.map +1 -1
- package/dist/dts/Option.d.ts +1019 -0
- package/dist/dts/Option.d.ts.map +1 -1
- package/dist/dts/Order.d.ts +24 -0
- package/dist/dts/Order.d.ts.map +1 -1
- package/dist/dts/Ordering.d.ts +66 -0
- package/dist/dts/Ordering.d.ts.map +1 -1
- package/dist/dts/Pipeable.d.ts +21 -21
- package/dist/dts/Pipeable.d.ts.map +1 -1
- package/dist/dts/Pool.d.ts +16 -0
- package/dist/dts/Pool.d.ts.map +1 -1
- package/dist/dts/Predicate.d.ts +498 -0
- package/dist/dts/Predicate.d.ts.map +1 -1
- package/dist/dts/PubSub.d.ts +28 -0
- package/dist/dts/PubSub.d.ts.map +1 -1
- package/dist/dts/Queue.d.ts +104 -0
- package/dist/dts/Queue.d.ts.map +1 -1
- package/dist/dts/RcMap.d.ts +70 -0
- package/dist/dts/RcMap.d.ts.map +1 -1
- package/dist/dts/Readable.d.ts +16 -0
- package/dist/dts/Readable.d.ts.map +1 -1
- package/dist/dts/Record.d.ts +800 -0
- package/dist/dts/Record.d.ts.map +1 -1
- package/dist/dts/RedBlackTree.d.ts +300 -0
- package/dist/dts/RedBlackTree.d.ts.map +1 -1
- package/dist/dts/Ref.d.ts +88 -0
- package/dist/dts/Ref.d.ts.map +1 -1
- package/dist/dts/Request.d.ts +76 -0
- package/dist/dts/Request.d.ts.map +1 -1
- package/dist/dts/RequestResolver.d.ts +144 -0
- package/dist/dts/RequestResolver.d.ts.map +1 -1
- package/dist/dts/Runtime.d.ts +126 -0
- package/dist/dts/Runtime.d.ts.map +1 -1
- package/dist/dts/RuntimeFlags.d.ts +100 -0
- package/dist/dts/RuntimeFlags.d.ts.map +1 -1
- package/dist/dts/RuntimeFlagsPatch.d.ts +112 -0
- package/dist/dts/RuntimeFlagsPatch.d.ts.map +1 -1
- package/dist/dts/STM.d.ts +1090 -0
- package/dist/dts/STM.d.ts.map +1 -1
- package/dist/dts/Schedule.d.ts +704 -0
- package/dist/dts/Schedule.d.ts.map +1 -1
- package/dist/dts/ScheduleInterval.d.ts +68 -0
- package/dist/dts/ScheduleInterval.d.ts.map +1 -1
- package/dist/dts/ScheduleIntervals.d.ts +50 -0
- package/dist/dts/ScheduleIntervals.d.ts.map +1 -1
- package/dist/dts/Scope.d.ts +76 -15
- package/dist/dts/Scope.d.ts.map +1 -1
- package/dist/dts/ScopedRef.d.ts +22 -0
- package/dist/dts/ScopedRef.d.ts.map +1 -1
- package/dist/dts/Sink.d.ts +464 -0
- package/dist/dts/Sink.d.ts.map +1 -1
- package/dist/dts/SortedMap.d.ts +76 -0
- package/dist/dts/SortedMap.d.ts.map +1 -1
- package/dist/dts/SortedSet.d.ts +142 -0
- package/dist/dts/SortedSet.d.ts.map +1 -1
- package/dist/dts/Stream.d.ts +4998 -1
- package/dist/dts/Stream.d.ts.map +1 -1
- package/dist/dts/StreamHaltStrategy.d.ts +12 -0
- package/dist/dts/StreamHaltStrategy.d.ts.map +1 -1
- package/dist/dts/String.d.ts +200 -0
- package/dist/dts/String.d.ts.map +1 -1
- package/dist/dts/Struct.d.ts +84 -0
- package/dist/dts/Struct.d.ts.map +1 -1
- package/dist/dts/Subscribable.d.ts +16 -0
- package/dist/dts/Subscribable.d.ts.map +1 -1
- package/dist/dts/SubscriptionRef.d.ts +152 -0
- package/dist/dts/SubscriptionRef.d.ts.map +1 -1
- package/dist/dts/SynchronizedRef.d.ts +152 -0
- package/dist/dts/SynchronizedRef.d.ts.map +1 -1
- package/dist/dts/TArray.d.ts +426 -0
- package/dist/dts/TArray.d.ts.map +1 -1
- package/dist/dts/TDeferred.d.ts +24 -0
- package/dist/dts/TDeferred.d.ts.map +1 -1
- package/dist/dts/TMap.d.ts +366 -0
- package/dist/dts/TMap.d.ts.map +1 -1
- package/dist/dts/TPriorityQueue.d.ts +60 -0
- package/dist/dts/TPriorityQueue.d.ts.map +1 -1
- package/dist/dts/TPubSub.d.ts +28 -0
- package/dist/dts/TPubSub.d.ts.map +1 -1
- package/dist/dts/TQueue.d.ts +108 -0
- package/dist/dts/TQueue.d.ts.map +1 -1
- package/dist/dts/TReentrantLock.d.ts +36 -0
- package/dist/dts/TReentrantLock.d.ts.map +1 -1
- package/dist/dts/TRef.d.ts +88 -0
- package/dist/dts/TRef.d.ts.map +1 -1
- package/dist/dts/TSemaphore.d.ts +40 -0
- package/dist/dts/TSemaphore.d.ts.map +1 -1
- package/dist/dts/TSet.d.ts +254 -0
- package/dist/dts/TSet.d.ts.map +1 -1
- package/dist/dts/Take.d.ts +56 -0
- package/dist/dts/Take.d.ts.map +1 -1
- package/dist/dts/TestAnnotationMap.d.ts.map +1 -1
- package/dist/dts/TestClock.d.ts.map +1 -1
- package/dist/dts/TestServices.d.ts.map +1 -1
- package/dist/dts/Trie.d.ts +906 -0
- package/dist/dts/Trie.d.ts.map +1 -1
- package/dist/dts/Tuple.d.ts +144 -0
- package/dist/dts/Tuple.d.ts.map +1 -1
- package/dist/dts/Unify.d.ts +18 -0
- package/dist/dts/Unify.d.ts.map +1 -1
- package/dist/dts/UpstreamPullRequest.d.ts +12 -0
- package/dist/dts/UpstreamPullRequest.d.ts.map +1 -1
- package/dist/dts/UpstreamPullStrategy.d.ts +12 -0
- package/dist/dts/UpstreamPullStrategy.d.ts.map +1 -1
- package/dist/dts/Utils.d.ts.map +1 -1
- package/dist/dts/internal/stream.d.ts.map +1 -1
- package/dist/esm/Array.js.map +1 -1
- package/dist/esm/BigDecimal.js +2 -2
- package/dist/esm/BigDecimal.js.map +1 -1
- package/dist/esm/BigInt.js.map +1 -1
- package/dist/esm/Boolean.js.map +1 -1
- package/dist/esm/Cause.js.map +1 -1
- package/dist/esm/Channel.js.map +1 -1
- package/dist/esm/ChildExecutorDecision.js.map +1 -1
- package/dist/esm/Chunk.js.map +1 -1
- package/dist/esm/Config.js.map +1 -1
- package/dist/esm/ConfigError.js.map +1 -1
- package/dist/esm/ConfigProvider.js.map +1 -1
- package/dist/esm/ConfigProviderPathPatch.js.map +1 -1
- package/dist/esm/Console.js.map +1 -1
- package/dist/esm/Context.js.map +1 -1
- package/dist/esm/Cron.js.map +1 -1
- package/dist/esm/Data.js.map +1 -1
- package/dist/esm/DateTime.js.map +1 -1
- package/dist/esm/Deferred.js.map +1 -1
- package/dist/esm/Differ.js.map +1 -1
- package/dist/esm/Duration.js.map +1 -1
- package/dist/esm/Effect.js.map +1 -1
- package/dist/esm/Either.js.map +1 -1
- package/dist/esm/Equivalence.js.map +1 -1
- package/dist/esm/ExecutionStrategy.js.map +1 -1
- package/dist/esm/Exit.js.map +1 -1
- package/dist/esm/Fiber.js.map +1 -1
- package/dist/esm/FiberHandle.js.map +1 -1
- package/dist/esm/FiberId.js.map +1 -1
- package/dist/esm/FiberMap.js.map +1 -1
- package/dist/esm/FiberRef.js.map +1 -1
- package/dist/esm/FiberRefs.js.map +1 -1
- package/dist/esm/FiberRefsPatch.js.map +1 -1
- package/dist/esm/FiberSet.js.map +1 -1
- package/dist/esm/Function.js.map +1 -1
- package/dist/esm/GroupBy.js.map +1 -1
- package/dist/esm/Hash.js.map +1 -1
- package/dist/esm/HashMap.js.map +1 -1
- package/dist/esm/HashSet.js.map +1 -1
- package/dist/esm/Iterable.js.map +1 -1
- package/dist/esm/KeyedPool.js.map +1 -1
- package/dist/esm/Layer.js.map +1 -1
- package/dist/esm/List.js.map +1 -1
- package/dist/esm/LogLevel.js.map +1 -1
- package/dist/esm/Logger.js.map +1 -1
- package/dist/esm/Mailbox.js.map +1 -1
- package/dist/esm/MergeDecision.js.map +1 -1
- package/dist/esm/MergeState.js.map +1 -1
- package/dist/esm/MergeStrategy.js.map +1 -1
- package/dist/esm/Metric.js.map +1 -1
- package/dist/esm/MetricHook.js.map +1 -1
- package/dist/esm/MetricKey.js.map +1 -1
- package/dist/esm/MetricPolling.js.map +1 -1
- package/dist/esm/MetricState.js.map +1 -1
- package/dist/esm/Micro.js +50 -20
- package/dist/esm/Micro.js.map +1 -1
- package/dist/esm/MutableHashMap.js.map +1 -1
- package/dist/esm/MutableHashSet.js.map +1 -1
- package/dist/esm/MutableList.js.map +1 -1
- package/dist/esm/MutableQueue.js.map +1 -1
- package/dist/esm/MutableRef.js.map +1 -1
- package/dist/esm/Number.js.map +1 -1
- package/dist/esm/Option.js.map +1 -1
- package/dist/esm/Order.js.map +1 -1
- package/dist/esm/Ordering.js.map +1 -1
- package/dist/esm/Pipeable.js.map +1 -1
- package/dist/esm/Pool.js.map +1 -1
- package/dist/esm/Predicate.js.map +1 -1
- package/dist/esm/PubSub.js.map +1 -1
- package/dist/esm/Queue.js.map +1 -1
- package/dist/esm/RcMap.js.map +1 -1
- package/dist/esm/Readable.js.map +1 -1
- package/dist/esm/Record.js.map +1 -1
- package/dist/esm/RedBlackTree.js.map +1 -1
- package/dist/esm/Ref.js.map +1 -1
- package/dist/esm/Request.js.map +1 -1
- package/dist/esm/RequestResolver.js.map +1 -1
- package/dist/esm/Runtime.js.map +1 -1
- package/dist/esm/RuntimeFlags.js.map +1 -1
- package/dist/esm/RuntimeFlagsPatch.js.map +1 -1
- package/dist/esm/STM.js.map +1 -1
- package/dist/esm/Schedule.js.map +1 -1
- package/dist/esm/ScheduleInterval.js.map +1 -1
- package/dist/esm/ScheduleIntervals.js.map +1 -1
- package/dist/esm/Scheduler.js.map +1 -1
- package/dist/esm/Scope.js +25 -15
- package/dist/esm/Scope.js.map +1 -1
- package/dist/esm/ScopedRef.js.map +1 -1
- package/dist/esm/Sink.js.map +1 -1
- package/dist/esm/SortedMap.js.map +1 -1
- package/dist/esm/SortedSet.js.map +1 -1
- package/dist/esm/Stream.js +14 -0
- package/dist/esm/Stream.js.map +1 -1
- package/dist/esm/StreamHaltStrategy.js.map +1 -1
- package/dist/esm/String.js.map +1 -1
- package/dist/esm/Struct.js.map +1 -1
- package/dist/esm/Subscribable.js.map +1 -1
- package/dist/esm/SubscriptionRef.js.map +1 -1
- package/dist/esm/SynchronizedRef.js.map +1 -1
- package/dist/esm/TArray.js.map +1 -1
- package/dist/esm/TDeferred.js.map +1 -1
- package/dist/esm/TMap.js.map +1 -1
- package/dist/esm/TPriorityQueue.js.map +1 -1
- package/dist/esm/TPubSub.js.map +1 -1
- package/dist/esm/TQueue.js.map +1 -1
- package/dist/esm/TReentrantLock.js.map +1 -1
- package/dist/esm/TRef.js.map +1 -1
- package/dist/esm/TSemaphore.js.map +1 -1
- package/dist/esm/TSet.js.map +1 -1
- package/dist/esm/Take.js.map +1 -1
- package/dist/esm/TestAnnotationMap.js.map +1 -1
- package/dist/esm/TestClock.js.map +1 -1
- package/dist/esm/TestServices.js.map +1 -1
- package/dist/esm/Trie.js.map +1 -1
- package/dist/esm/Tuple.js.map +1 -1
- package/dist/esm/Unify.js.map +1 -1
- package/dist/esm/UpstreamPullRequest.js.map +1 -1
- package/dist/esm/UpstreamPullStrategy.js.map +1 -1
- package/dist/esm/Utils.js +1 -14
- package/dist/esm/Utils.js.map +1 -1
- package/dist/esm/internal/core.js +1 -1
- package/dist/esm/internal/core.js.map +1 -1
- package/dist/esm/internal/runtime.js +1 -1
- package/dist/esm/internal/runtime.js.map +1 -1
- package/dist/esm/internal/stream.js +9 -0
- package/dist/esm/internal/stream.js.map +1 -1
- package/dist/esm/internal/version.js +1 -1
- package/package.json +1 -1
- package/src/Array.ts +2723 -36
- package/src/BigDecimal.ts +585 -18
- package/src/BigInt.ts +516 -16
- package/src/Boolean.ts +241 -8
- package/src/Cause.ts +177 -1
- package/src/Channel.ts +766 -49
- package/src/ChildExecutorDecision.ts +12 -0
- package/src/Chunk.ts +818 -4
- package/src/Config.ts +187 -8
- package/src/ConfigError.ts +16 -0
- package/src/ConfigProvider.ts +89 -1
- package/src/ConfigProviderPathPatch.ts +32 -0
- package/src/Console.ts +37 -8
- package/src/Context.ts +232 -0
- package/src/Cron.ts +12 -0
- package/src/Data.ts +165 -0
- package/src/DateTime.ts +1006 -50
- package/src/Deferred.ts +170 -0
- package/src/Differ.ts +89 -27
- package/src/Duration.ts +156 -16
- package/src/Effect.ts +4297 -123
- package/src/Either.ts +650 -34
- package/src/Equivalence.ts +24 -0
- package/src/ExecutionStrategy.ts +29 -10
- package/src/Exit.ts +252 -0
- package/src/Fiber.ts +182 -0
- package/src/FiberHandle.ts +42 -0
- package/src/FiberId.ts +24 -0
- package/src/FiberMap.ts +144 -21
- package/src/FiberRef.ts +80 -0
- package/src/FiberRefs.ts +84 -0
- package/src/FiberRefsPatch.ts +35 -1
- package/src/FiberSet.ts +38 -0
- package/src/Function.ts +416 -31
- package/src/GroupBy.ts +38 -0
- package/src/Hash.ts +8 -0
- package/src/HashMap.ts +300 -0
- package/src/HashSet.ts +284 -0
- package/src/Iterable.ts +456 -6
- package/src/KeyedPool.ts +34 -0
- package/src/Layer.ts +426 -30
- package/src/List.ts +476 -3
- package/src/LogLevel.ts +46 -0
- package/src/Logger.ts +195 -4
- package/src/Mailbox.ts +16 -0
- package/src/MergeDecision.ts +8 -0
- package/src/MergeState.ts +8 -0
- package/src/MergeStrategy.ts +25 -8
- package/src/Metric.ts +426 -15
- package/src/MetricHook.ts +24 -0
- package/src/MetricKey.ts +62 -8
- package/src/MetricPolling.ts +42 -6
- package/src/MetricState.ts +16 -0
- package/src/Micro.ts +1350 -102
- package/src/MutableHashMap.ts +105 -1
- package/src/MutableHashSet.ts +24 -0
- package/src/MutableList.ts +36 -0
- package/src/MutableQueue.ts +62 -0
- package/src/MutableRef.ts +56 -0
- package/src/Number.ts +500 -16
- package/src/Option.ts +1042 -16
- package/src/Order.ts +24 -0
- package/src/Ordering.ts +66 -0
- package/src/Pipeable.ts +224 -21
- package/src/Pool.ts +16 -0
- package/src/Predicate.ts +498 -0
- package/src/PubSub.ts +28 -0
- package/src/Queue.ts +104 -0
- package/src/RcMap.ts +70 -0
- package/src/Readable.ts +18 -7
- package/src/Record.ts +814 -40
- package/src/RedBlackTree.ts +305 -1
- package/src/Ref.ts +88 -0
- package/src/Request.ts +76 -0
- package/src/RequestResolver.ts +145 -4
- package/src/Runtime.ts +134 -2
- package/src/RuntimeFlags.ts +100 -0
- package/src/RuntimeFlagsPatch.ts +112 -0
- package/src/STM.ts +1107 -11
- package/src/Schedule.ts +704 -0
- package/src/ScheduleInterval.ts +68 -0
- package/src/ScheduleIntervals.ts +50 -0
- package/src/Scheduler.ts +2 -0
- package/src/Scope.ts +83 -15
- package/src/ScopedRef.ts +22 -0
- package/src/Sink.ts +464 -0
- package/src/SortedMap.ts +76 -0
- package/src/SortedSet.ts +143 -3
- package/src/Stream.ts +5041 -54
- package/src/StreamHaltStrategy.ts +29 -12
- package/src/String.ts +200 -0
- package/src/Struct.ts +86 -7
- package/src/Subscribable.ts +16 -0
- package/src/SubscriptionRef.ts +159 -11
- package/src/SynchronizedRef.ts +169 -8
- package/src/TArray.ts +431 -1
- package/src/TDeferred.ts +24 -0
- package/src/TMap.ts +381 -12
- package/src/TPriorityQueue.ts +60 -0
- package/src/TPubSub.ts +28 -0
- package/src/TQueue.ts +108 -0
- package/src/TReentrantLock.ts +36 -0
- package/src/TRef.ts +88 -0
- package/src/TSemaphore.ts +40 -0
- package/src/TSet.ts +280 -12
- package/src/Take.ts +56 -0
- package/src/TestAnnotationMap.ts +45 -1
- package/src/TestClock.ts +6 -0
- package/src/TestServices.ts +66 -0
- package/src/Trie.ts +906 -0
- package/src/Tuple.ts +157 -8
- package/src/Unify.ts +19 -3
- package/src/UpstreamPullRequest.ts +12 -0
- package/src/UpstreamPullStrategy.ts +12 -0
- package/src/Utils.ts +1 -15
- package/src/internal/core.ts +1 -1
- package/src/internal/runtime.ts +1 -1
- package/src/internal/stream.ts +27 -0
- package/src/internal/version.ts +1 -1
package/src/Record.ts
CHANGED
|
@@ -119,9 +119,49 @@ export const isEmptyReadonlyRecord: <K extends string, A>(
|
|
|
119
119
|
* @since 2.0.0
|
|
120
120
|
*/
|
|
121
121
|
export const fromIterableWith: {
|
|
122
|
+
/**
|
|
123
|
+
* Takes an iterable and a projection function and returns a record.
|
|
124
|
+
* The projection function maps each value of the iterable to a tuple of a key and a value, which is then added to the resulting record.
|
|
125
|
+
*
|
|
126
|
+
* @param self - An iterable of values to be mapped to a record.
|
|
127
|
+
* @param f - A projection function that maps values of the iterable to a tuple of a key and a value.
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* import { fromIterableWith } from "effect/Record"
|
|
131
|
+
*
|
|
132
|
+
* const input = [1, 2, 3, 4]
|
|
133
|
+
*
|
|
134
|
+
* assert.deepStrictEqual(
|
|
135
|
+
* fromIterableWith(input, a => [String(a), a * 2]),
|
|
136
|
+
* { '1': 2, '2': 4, '3': 6, '4': 8 }
|
|
137
|
+
* )
|
|
138
|
+
*
|
|
139
|
+
* @category constructors
|
|
140
|
+
* @since 2.0.0
|
|
141
|
+
*/
|
|
122
142
|
<A, K extends string | symbol, B>(
|
|
123
143
|
f: (a: A) => readonly [K, B]
|
|
124
144
|
): (self: Iterable<A>) => Record<ReadonlyRecord.NonLiteralKey<K>, B>
|
|
145
|
+
/**
|
|
146
|
+
* Takes an iterable and a projection function and returns a record.
|
|
147
|
+
* The projection function maps each value of the iterable to a tuple of a key and a value, which is then added to the resulting record.
|
|
148
|
+
*
|
|
149
|
+
* @param self - An iterable of values to be mapped to a record.
|
|
150
|
+
* @param f - A projection function that maps values of the iterable to a tuple of a key and a value.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* import { fromIterableWith } from "effect/Record"
|
|
154
|
+
*
|
|
155
|
+
* const input = [1, 2, 3, 4]
|
|
156
|
+
*
|
|
157
|
+
* assert.deepStrictEqual(
|
|
158
|
+
* fromIterableWith(input, a => [String(a), a * 2]),
|
|
159
|
+
* { '1': 2, '2': 4, '3': 6, '4': 8 }
|
|
160
|
+
* )
|
|
161
|
+
*
|
|
162
|
+
* @category constructors
|
|
163
|
+
* @since 2.0.0
|
|
164
|
+
*/
|
|
125
165
|
<A, K extends string | symbol, B>(
|
|
126
166
|
self: Iterable<A>,
|
|
127
167
|
f: (a: A) => readonly [K, B]
|
|
@@ -209,7 +249,37 @@ export const fromEntries: <Entry extends readonly [string | symbol, any]>(
|
|
|
209
249
|
* @since 2.0.0
|
|
210
250
|
*/
|
|
211
251
|
export const collect: {
|
|
252
|
+
/**
|
|
253
|
+
* Transforms the values of a record into an `Array` with a custom mapping function.
|
|
254
|
+
*
|
|
255
|
+
* @param self - The record to transform.
|
|
256
|
+
* @param f - The custom mapping function to apply to each key/value of the record.
|
|
257
|
+
*
|
|
258
|
+
* @example
|
|
259
|
+
* import { collect } from "effect/Record"
|
|
260
|
+
*
|
|
261
|
+
* const x = { a: 1, b: 2, c: 3 }
|
|
262
|
+
* assert.deepStrictEqual(collect(x, (key, n) => [key, n]), [["a", 1], ["b", 2], ["c", 3]])
|
|
263
|
+
*
|
|
264
|
+
* @category conversions
|
|
265
|
+
* @since 2.0.0
|
|
266
|
+
*/
|
|
212
267
|
<K extends string, A, B>(f: (key: K, a: A) => B): (self: ReadonlyRecord<K, A>) => Array<B>
|
|
268
|
+
/**
|
|
269
|
+
* Transforms the values of a record into an `Array` with a custom mapping function.
|
|
270
|
+
*
|
|
271
|
+
* @param self - The record to transform.
|
|
272
|
+
* @param f - The custom mapping function to apply to each key/value of the record.
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
* import { collect } from "effect/Record"
|
|
276
|
+
*
|
|
277
|
+
* const x = { a: 1, b: 2, c: 3 }
|
|
278
|
+
* assert.deepStrictEqual(collect(x, (key, n) => [key, n]), [["a", 1], ["b", 2], ["c", 3]])
|
|
279
|
+
*
|
|
280
|
+
* @category conversions
|
|
281
|
+
* @since 2.0.0
|
|
282
|
+
*/
|
|
213
283
|
<K extends string, A, B>(self: ReadonlyRecord<K, A>, f: (key: K, a: A) => B): Array<B>
|
|
214
284
|
} = dual(
|
|
215
285
|
2,
|
|
@@ -270,13 +340,36 @@ export const size = <K extends string, A>(self: ReadonlyRecord<K, A>): number =>
|
|
|
270
340
|
* @since 2.0.0
|
|
271
341
|
*/
|
|
272
342
|
export const has: {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
343
|
+
/**
|
|
344
|
+
* Check if a given `key` exists in a record.
|
|
345
|
+
*
|
|
346
|
+
* @param self - the record to look in.
|
|
347
|
+
* @param key - the key to look for in the record.
|
|
348
|
+
*
|
|
349
|
+
* @example
|
|
350
|
+
* import { empty, has } from "effect/Record"
|
|
351
|
+
*
|
|
352
|
+
* assert.deepStrictEqual(has({ a: 1, b: 2 }, "a"), true);
|
|
353
|
+
* assert.deepStrictEqual(has(empty<string>(), "c"), false);
|
|
354
|
+
*
|
|
355
|
+
* @since 2.0.0
|
|
356
|
+
*/
|
|
357
|
+
<K extends string | symbol>(key: NoInfer<K>): <A>(self: ReadonlyRecord<K, A>) => boolean
|
|
358
|
+
/**
|
|
359
|
+
* Check if a given `key` exists in a record.
|
|
360
|
+
*
|
|
361
|
+
* @param self - the record to look in.
|
|
362
|
+
* @param key - the key to look for in the record.
|
|
363
|
+
*
|
|
364
|
+
* @example
|
|
365
|
+
* import { empty, has } from "effect/Record"
|
|
366
|
+
*
|
|
367
|
+
* assert.deepStrictEqual(has({ a: 1, b: 2 }, "a"), true);
|
|
368
|
+
* assert.deepStrictEqual(has(empty<string>(), "c"), false);
|
|
369
|
+
*
|
|
370
|
+
* @since 2.0.0
|
|
371
|
+
*/
|
|
372
|
+
<K extends string | symbol, A>(self: ReadonlyRecord<K, A>, key: NoInfer<K>): boolean
|
|
280
373
|
} = dual(
|
|
281
374
|
2,
|
|
282
375
|
<K extends string | symbol, A>(
|
|
@@ -302,7 +395,39 @@ export const has: {
|
|
|
302
395
|
* @since 2.0.0
|
|
303
396
|
*/
|
|
304
397
|
export const get: {
|
|
398
|
+
/**
|
|
399
|
+
* Retrieve a value at a particular key from a record, returning it wrapped in an `Option`.
|
|
400
|
+
*
|
|
401
|
+
* @param self - The record to retrieve value from.
|
|
402
|
+
* @param key - Key to retrieve from record.
|
|
403
|
+
*
|
|
404
|
+
* @example
|
|
405
|
+
* import { Record as R, Option } from "effect"
|
|
406
|
+
*
|
|
407
|
+
* const person: Record<string, unknown> = { name: "John Doe", age: 35 }
|
|
408
|
+
*
|
|
409
|
+
* assert.deepStrictEqual(R.get(person, "name"), Option.some("John Doe"))
|
|
410
|
+
* assert.deepStrictEqual(R.get(person, "email"), Option.none())
|
|
411
|
+
*
|
|
412
|
+
* @since 2.0.0
|
|
413
|
+
*/
|
|
305
414
|
<K extends string | symbol>(key: NoInfer<K>): <A>(self: ReadonlyRecord<K, A>) => Option.Option<A>
|
|
415
|
+
/**
|
|
416
|
+
* Retrieve a value at a particular key from a record, returning it wrapped in an `Option`.
|
|
417
|
+
*
|
|
418
|
+
* @param self - The record to retrieve value from.
|
|
419
|
+
* @param key - Key to retrieve from record.
|
|
420
|
+
*
|
|
421
|
+
* @example
|
|
422
|
+
* import { Record as R, Option } from "effect"
|
|
423
|
+
*
|
|
424
|
+
* const person: Record<string, unknown> = { name: "John Doe", age: 35 }
|
|
425
|
+
*
|
|
426
|
+
* assert.deepStrictEqual(R.get(person, "name"), Option.some("John Doe"))
|
|
427
|
+
* assert.deepStrictEqual(R.get(person, "email"), Option.none())
|
|
428
|
+
*
|
|
429
|
+
* @since 2.0.0
|
|
430
|
+
*/
|
|
306
431
|
<K extends string | symbol, A>(self: ReadonlyRecord<K, A>, key: NoInfer<K>): Option.Option<A>
|
|
307
432
|
} = dual(
|
|
308
433
|
2,
|
|
@@ -335,10 +460,55 @@ export const get: {
|
|
|
335
460
|
* @since 2.0.0
|
|
336
461
|
*/
|
|
337
462
|
export const modify: {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
463
|
+
/**
|
|
464
|
+
* Apply a function to the element at the specified key, creating a new record.
|
|
465
|
+
* If the key does not exist, the record is returned unchanged.
|
|
466
|
+
*
|
|
467
|
+
* @param self - The record to be updated.
|
|
468
|
+
* @param key - The key of the element to modify.
|
|
469
|
+
* @param f - The function to apply to the element.
|
|
470
|
+
*
|
|
471
|
+
* @example
|
|
472
|
+
* import { Record as R } from "effect"
|
|
473
|
+
*
|
|
474
|
+
* const f = (x: number) => x * 2
|
|
475
|
+
*
|
|
476
|
+
* assert.deepStrictEqual(
|
|
477
|
+
* R.modify({ a: 3 }, 'a', f),
|
|
478
|
+
* { a: 6 }
|
|
479
|
+
* )
|
|
480
|
+
* assert.deepStrictEqual(
|
|
481
|
+
* R.modify({ a: 3 } as Record<string, number>, 'b', f),
|
|
482
|
+
* { a: 3 }
|
|
483
|
+
* )
|
|
484
|
+
*
|
|
485
|
+
* @since 2.0.0
|
|
486
|
+
*/
|
|
487
|
+
<K extends string | symbol, A, B>(key: NoInfer<K>, f: (a: A) => B): (self: ReadonlyRecord<K, A>) => Record<K, A | B>
|
|
488
|
+
/**
|
|
489
|
+
* Apply a function to the element at the specified key, creating a new record.
|
|
490
|
+
* If the key does not exist, the record is returned unchanged.
|
|
491
|
+
*
|
|
492
|
+
* @param self - The record to be updated.
|
|
493
|
+
* @param key - The key of the element to modify.
|
|
494
|
+
* @param f - The function to apply to the element.
|
|
495
|
+
*
|
|
496
|
+
* @example
|
|
497
|
+
* import { Record as R } from "effect"
|
|
498
|
+
*
|
|
499
|
+
* const f = (x: number) => x * 2
|
|
500
|
+
*
|
|
501
|
+
* assert.deepStrictEqual(
|
|
502
|
+
* R.modify({ a: 3 }, 'a', f),
|
|
503
|
+
* { a: 6 }
|
|
504
|
+
* )
|
|
505
|
+
* assert.deepStrictEqual(
|
|
506
|
+
* R.modify({ a: 3 } as Record<string, number>, 'b', f),
|
|
507
|
+
* { a: 3 }
|
|
508
|
+
* )
|
|
509
|
+
*
|
|
510
|
+
* @since 2.0.0
|
|
511
|
+
*/
|
|
342
512
|
<K extends string | symbol, A, B>(self: ReadonlyRecord<K, A>, key: NoInfer<K>, f: (a: A) => B): Record<K, A | B>
|
|
343
513
|
} = dual(
|
|
344
514
|
3,
|
|
@@ -375,10 +545,58 @@ export const modify: {
|
|
|
375
545
|
* @since 2.0.0
|
|
376
546
|
*/
|
|
377
547
|
export const modifyOption: {
|
|
548
|
+
/**
|
|
549
|
+
* Apply a function to the element at the specified key, creating a new record,
|
|
550
|
+
* or return `None` if the key doesn't exist.
|
|
551
|
+
*
|
|
552
|
+
* @param self - The record to be updated.
|
|
553
|
+
* @param key - The key of the element to modify.
|
|
554
|
+
* @param f - The function to apply to the element.
|
|
555
|
+
*
|
|
556
|
+
* @example
|
|
557
|
+
* import { Record as R, Option } from "effect"
|
|
558
|
+
*
|
|
559
|
+
* const f = (x: number) => x * 2
|
|
560
|
+
*
|
|
561
|
+
* assert.deepStrictEqual(
|
|
562
|
+
* R.modifyOption({ a: 3 }, 'a', f),
|
|
563
|
+
* Option.some({ a: 6 })
|
|
564
|
+
* )
|
|
565
|
+
* assert.deepStrictEqual(
|
|
566
|
+
* R.modifyOption({ a: 3 } as Record<string, number>, 'b', f),
|
|
567
|
+
* Option.none()
|
|
568
|
+
* )
|
|
569
|
+
*
|
|
570
|
+
* @since 2.0.0
|
|
571
|
+
*/
|
|
378
572
|
<K extends string | symbol, A, B>(
|
|
379
573
|
key: NoInfer<K>,
|
|
380
574
|
f: (a: A) => B
|
|
381
575
|
): (self: ReadonlyRecord<K, A>) => Option.Option<Record<K, A | B>>
|
|
576
|
+
/**
|
|
577
|
+
* Apply a function to the element at the specified key, creating a new record,
|
|
578
|
+
* or return `None` if the key doesn't exist.
|
|
579
|
+
*
|
|
580
|
+
* @param self - The record to be updated.
|
|
581
|
+
* @param key - The key of the element to modify.
|
|
582
|
+
* @param f - The function to apply to the element.
|
|
583
|
+
*
|
|
584
|
+
* @example
|
|
585
|
+
* import { Record as R, Option } from "effect"
|
|
586
|
+
*
|
|
587
|
+
* const f = (x: number) => x * 2
|
|
588
|
+
*
|
|
589
|
+
* assert.deepStrictEqual(
|
|
590
|
+
* R.modifyOption({ a: 3 }, 'a', f),
|
|
591
|
+
* Option.some({ a: 6 })
|
|
592
|
+
* )
|
|
593
|
+
* assert.deepStrictEqual(
|
|
594
|
+
* R.modifyOption({ a: 3 } as Record<string, number>, 'b', f),
|
|
595
|
+
* Option.none()
|
|
596
|
+
* )
|
|
597
|
+
*
|
|
598
|
+
* @since 2.0.0
|
|
599
|
+
*/
|
|
382
600
|
<K extends string | symbol, A, B>(
|
|
383
601
|
self: ReadonlyRecord<K, A>,
|
|
384
602
|
key: NoInfer<K>,
|
|
@@ -417,15 +635,47 @@ export const modifyOption: {
|
|
|
417
635
|
* @since 2.0.0
|
|
418
636
|
*/
|
|
419
637
|
export const replaceOption: {
|
|
638
|
+
/**
|
|
639
|
+
* Replaces a value in the record with the new value passed as parameter.
|
|
640
|
+
*
|
|
641
|
+
* @param self - The record to be updated.
|
|
642
|
+
* @param key - The key to search for in the record.
|
|
643
|
+
* @param b - The new value to replace the existing value with.
|
|
644
|
+
*
|
|
645
|
+
* @example
|
|
646
|
+
* import { Record, Option } from "effect"
|
|
647
|
+
*
|
|
648
|
+
* assert.deepStrictEqual(
|
|
649
|
+
* Record.replaceOption({ a: 1, b: 2, c: 3 }, 'a', 10),
|
|
650
|
+
* Option.some({ a: 10, b: 2, c: 3 })
|
|
651
|
+
* )
|
|
652
|
+
* assert.deepStrictEqual(Record.replaceOption(Record.empty<string>(), 'a', 10), Option.none())
|
|
653
|
+
*
|
|
654
|
+
* @since 2.0.0
|
|
655
|
+
*/
|
|
420
656
|
<K extends string | symbol, B>(
|
|
421
657
|
key: NoInfer<K>,
|
|
422
658
|
b: B
|
|
423
659
|
): <A>(self: ReadonlyRecord<K, A>) => Option.Option<Record<K, A | B>>
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
660
|
+
/**
|
|
661
|
+
* Replaces a value in the record with the new value passed as parameter.
|
|
662
|
+
*
|
|
663
|
+
* @param self - The record to be updated.
|
|
664
|
+
* @param key - The key to search for in the record.
|
|
665
|
+
* @param b - The new value to replace the existing value with.
|
|
666
|
+
*
|
|
667
|
+
* @example
|
|
668
|
+
* import { Record, Option } from "effect"
|
|
669
|
+
*
|
|
670
|
+
* assert.deepStrictEqual(
|
|
671
|
+
* Record.replaceOption({ a: 1, b: 2, c: 3 }, 'a', 10),
|
|
672
|
+
* Option.some({ a: 10, b: 2, c: 3 })
|
|
673
|
+
* )
|
|
674
|
+
* assert.deepStrictEqual(Record.replaceOption(Record.empty<string>(), 'a', 10), Option.none())
|
|
675
|
+
*
|
|
676
|
+
* @since 2.0.0
|
|
677
|
+
*/
|
|
678
|
+
<K extends string | symbol, A, B>(self: ReadonlyRecord<K, A>, key: NoInfer<K>, b: B): Option.Option<Record<K, A | B>>
|
|
429
679
|
} = dual(
|
|
430
680
|
3,
|
|
431
681
|
<K extends string | symbol, A, B>(
|
|
@@ -450,7 +700,35 @@ export const replaceOption: {
|
|
|
450
700
|
* @since 2.0.0
|
|
451
701
|
*/
|
|
452
702
|
export const remove: {
|
|
703
|
+
/**
|
|
704
|
+
* If the given key exists in the record, returns a new record with the key removed,
|
|
705
|
+
* otherwise returns a copy of the original record.
|
|
706
|
+
*
|
|
707
|
+
* @param self - the record to remove the key from.
|
|
708
|
+
* @param key - the key to remove from the record.
|
|
709
|
+
*
|
|
710
|
+
* @example
|
|
711
|
+
* import { remove } from "effect/Record"
|
|
712
|
+
*
|
|
713
|
+
* assert.deepStrictEqual(remove({ a: 1, b: 2 }, "a"), { b: 2 })
|
|
714
|
+
*
|
|
715
|
+
* @since 2.0.0
|
|
716
|
+
*/
|
|
453
717
|
<K extends string | symbol, X extends K>(key: X): <A>(self: ReadonlyRecord<K, A>) => Record<Exclude<K, X>, A>
|
|
718
|
+
/**
|
|
719
|
+
* If the given key exists in the record, returns a new record with the key removed,
|
|
720
|
+
* otherwise returns a copy of the original record.
|
|
721
|
+
*
|
|
722
|
+
* @param self - the record to remove the key from.
|
|
723
|
+
* @param key - the key to remove from the record.
|
|
724
|
+
*
|
|
725
|
+
* @example
|
|
726
|
+
* import { remove } from "effect/Record"
|
|
727
|
+
*
|
|
728
|
+
* assert.deepStrictEqual(remove({ a: 1, b: 2 }, "a"), { b: 2 })
|
|
729
|
+
*
|
|
730
|
+
* @since 2.0.0
|
|
731
|
+
*/
|
|
454
732
|
<K extends string | symbol, A, X extends K>(self: ReadonlyRecord<K, A>, key: X): Record<Exclude<K, X>, A>
|
|
455
733
|
} = dual(
|
|
456
734
|
2,
|
|
@@ -482,9 +760,43 @@ export const remove: {
|
|
|
482
760
|
* @since 2.0.0
|
|
483
761
|
*/
|
|
484
762
|
export const pop: {
|
|
763
|
+
/**
|
|
764
|
+
* Retrieves the value of the property with the given `key` from a record and returns an `Option`
|
|
765
|
+
* of a tuple with the value and the record with the removed property.
|
|
766
|
+
* If the key is not present, returns `O.none`.
|
|
767
|
+
*
|
|
768
|
+
* @param self - The input record.
|
|
769
|
+
* @param key - The key of the property to retrieve.
|
|
770
|
+
*
|
|
771
|
+
* @example
|
|
772
|
+
* import { Record as R, Option } from "effect"
|
|
773
|
+
*
|
|
774
|
+
* assert.deepStrictEqual(R.pop({ a: 1, b: 2 }, "a"), Option.some([1, { b: 2 }]))
|
|
775
|
+
* assert.deepStrictEqual(R.pop({ a: 1, b: 2 } as Record<string, number>, "c"), Option.none())
|
|
776
|
+
*
|
|
777
|
+
* @category record
|
|
778
|
+
* @since 2.0.0
|
|
779
|
+
*/
|
|
485
780
|
<K extends string | symbol, X extends K>(
|
|
486
781
|
key: X
|
|
487
782
|
): <A>(self: ReadonlyRecord<K, A>) => Option.Option<[A, Record<Exclude<K, X>, A>]>
|
|
783
|
+
/**
|
|
784
|
+
* Retrieves the value of the property with the given `key` from a record and returns an `Option`
|
|
785
|
+
* of a tuple with the value and the record with the removed property.
|
|
786
|
+
* If the key is not present, returns `O.none`.
|
|
787
|
+
*
|
|
788
|
+
* @param self - The input record.
|
|
789
|
+
* @param key - The key of the property to retrieve.
|
|
790
|
+
*
|
|
791
|
+
* @example
|
|
792
|
+
* import { Record as R, Option } from "effect"
|
|
793
|
+
*
|
|
794
|
+
* assert.deepStrictEqual(R.pop({ a: 1, b: 2 }, "a"), Option.some([1, { b: 2 }]))
|
|
795
|
+
* assert.deepStrictEqual(R.pop({ a: 1, b: 2 } as Record<string, number>, "c"), Option.none())
|
|
796
|
+
*
|
|
797
|
+
* @category record
|
|
798
|
+
* @since 2.0.0
|
|
799
|
+
*/
|
|
488
800
|
<K extends string | symbol, A, X extends K>(
|
|
489
801
|
self: ReadonlyRecord<K, A>,
|
|
490
802
|
key: X
|
|
@@ -516,7 +828,47 @@ export const pop: {
|
|
|
516
828
|
* @since 2.0.0
|
|
517
829
|
*/
|
|
518
830
|
export const map: {
|
|
831
|
+
/**
|
|
832
|
+
* Maps a record into another record by applying a transformation function to each of its values.
|
|
833
|
+
*
|
|
834
|
+
* @param self - The record to be mapped.
|
|
835
|
+
* @param f - A transformation function that will be applied to each of the values in the record.
|
|
836
|
+
*
|
|
837
|
+
* @example
|
|
838
|
+
* import { map } from "effect/Record"
|
|
839
|
+
*
|
|
840
|
+
* const f = (n: number) => `-${n}`
|
|
841
|
+
*
|
|
842
|
+
* assert.deepStrictEqual(map({ a: 3, b: 5 }, f), { a: "-3", b: "-5" })
|
|
843
|
+
*
|
|
844
|
+
* const g = (n: number, key: string) => `${key.toUpperCase()}-${n}`
|
|
845
|
+
*
|
|
846
|
+
* assert.deepStrictEqual(map({ a: 3, b: 5 }, g), { a: "A-3", b: "B-5" })
|
|
847
|
+
*
|
|
848
|
+
* @category mapping
|
|
849
|
+
* @since 2.0.0
|
|
850
|
+
*/
|
|
519
851
|
<K extends string, A, B>(f: (a: A, key: NoInfer<K>) => B): (self: ReadonlyRecord<K, A>) => Record<K, B>
|
|
852
|
+
/**
|
|
853
|
+
* Maps a record into another record by applying a transformation function to each of its values.
|
|
854
|
+
*
|
|
855
|
+
* @param self - The record to be mapped.
|
|
856
|
+
* @param f - A transformation function that will be applied to each of the values in the record.
|
|
857
|
+
*
|
|
858
|
+
* @example
|
|
859
|
+
* import { map } from "effect/Record"
|
|
860
|
+
*
|
|
861
|
+
* const f = (n: number) => `-${n}`
|
|
862
|
+
*
|
|
863
|
+
* assert.deepStrictEqual(map({ a: 3, b: 5 }, f), { a: "-3", b: "-5" })
|
|
864
|
+
*
|
|
865
|
+
* const g = (n: number, key: string) => `${key.toUpperCase()}-${n}`
|
|
866
|
+
*
|
|
867
|
+
* assert.deepStrictEqual(map({ a: 3, b: 5 }, g), { a: "A-3", b: "B-5" })
|
|
868
|
+
*
|
|
869
|
+
* @category mapping
|
|
870
|
+
* @since 2.0.0
|
|
871
|
+
*/
|
|
520
872
|
<K extends string, A, B>(self: ReadonlyRecord<K, A>, f: (a: A, key: NoInfer<K>) => B): Record<K, B>
|
|
521
873
|
} = dual(
|
|
522
874
|
2,
|
|
@@ -541,13 +893,30 @@ export const map: {
|
|
|
541
893
|
* @since 2.0.0
|
|
542
894
|
*/
|
|
543
895
|
export const mapKeys: {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
896
|
+
/**
|
|
897
|
+
* Maps the keys of a `ReadonlyRecord` while preserving the corresponding values.
|
|
898
|
+
*
|
|
899
|
+
* @example
|
|
900
|
+
* import { mapKeys } from "effect/Record"
|
|
901
|
+
*
|
|
902
|
+
* assert.deepStrictEqual(mapKeys({ a: 3, b: 5 }, (key) => key.toUpperCase()), { A: 3, B: 5 })
|
|
903
|
+
*
|
|
904
|
+
* @category mapping
|
|
905
|
+
* @since 2.0.0
|
|
906
|
+
*/
|
|
907
|
+
<K extends string, A, K2 extends string>(f: (key: K, a: A) => K2): (self: ReadonlyRecord<K, A>) => Record<K2, A>
|
|
908
|
+
/**
|
|
909
|
+
* Maps the keys of a `ReadonlyRecord` while preserving the corresponding values.
|
|
910
|
+
*
|
|
911
|
+
* @example
|
|
912
|
+
* import { mapKeys } from "effect/Record"
|
|
913
|
+
*
|
|
914
|
+
* assert.deepStrictEqual(mapKeys({ a: 3, b: 5 }, (key) => key.toUpperCase()), { A: 3, B: 5 })
|
|
915
|
+
*
|
|
916
|
+
* @category mapping
|
|
917
|
+
* @since 2.0.0
|
|
918
|
+
*/
|
|
919
|
+
<K extends string, A, K2 extends string>(self: ReadonlyRecord<K, A>, f: (key: K, a: A) => K2): Record<K2, A>
|
|
551
920
|
} = dual(
|
|
552
921
|
2,
|
|
553
922
|
<K extends string, A, K2 extends string>(
|
|
@@ -575,13 +944,32 @@ export const mapKeys: {
|
|
|
575
944
|
* @since 2.0.0
|
|
576
945
|
*/
|
|
577
946
|
export const mapEntries: {
|
|
947
|
+
/**
|
|
948
|
+
* Maps entries of a `ReadonlyRecord` using the provided function, allowing modification of both keys and corresponding values.
|
|
949
|
+
*
|
|
950
|
+
* @example
|
|
951
|
+
* import { mapEntries } from "effect/Record"
|
|
952
|
+
*
|
|
953
|
+
* assert.deepStrictEqual(mapEntries({ a: 3, b: 5 }, (a, key) => [key.toUpperCase(), a + 1]), { A: 4, B: 6 })
|
|
954
|
+
*
|
|
955
|
+
* @category mapping
|
|
956
|
+
* @since 2.0.0
|
|
957
|
+
*/
|
|
578
958
|
<K extends string, A, K2 extends string, B>(
|
|
579
959
|
f: (a: A, key: K) => readonly [K2, B]
|
|
580
960
|
): (self: ReadonlyRecord<K, A>) => Record<K2, B>
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
961
|
+
/**
|
|
962
|
+
* Maps entries of a `ReadonlyRecord` using the provided function, allowing modification of both keys and corresponding values.
|
|
963
|
+
*
|
|
964
|
+
* @example
|
|
965
|
+
* import { mapEntries } from "effect/Record"
|
|
966
|
+
*
|
|
967
|
+
* assert.deepStrictEqual(mapEntries({ a: 3, b: 5 }, (a, key) => [key.toUpperCase(), a + 1]), { A: 4, B: 6 })
|
|
968
|
+
*
|
|
969
|
+
* @category mapping
|
|
970
|
+
* @since 2.0.0
|
|
971
|
+
*/
|
|
972
|
+
<K extends string, A, K2 extends string, B>(self: ReadonlyRecord<K, A>, f: (a: A, key: K) => [K2, B]): Record<K2, B>
|
|
585
973
|
} = dual(
|
|
586
974
|
2,
|
|
587
975
|
<K extends string, A, K2 extends string, B>(
|
|
@@ -614,9 +1002,41 @@ export const mapEntries: {
|
|
|
614
1002
|
* @since 2.0.0
|
|
615
1003
|
*/
|
|
616
1004
|
export const filterMap: {
|
|
1005
|
+
/**
|
|
1006
|
+
* Transforms a record into a record by applying the function `f` to each key and value in the original record.
|
|
1007
|
+
* If the function returns `Some`, the key-value pair is included in the output record.
|
|
1008
|
+
*
|
|
1009
|
+
* @param self - The input record.
|
|
1010
|
+
* @param f - The transformation function.
|
|
1011
|
+
*
|
|
1012
|
+
* @example
|
|
1013
|
+
* import { Record, Option } from "effect"
|
|
1014
|
+
*
|
|
1015
|
+
* const x = { a: 1, b: 2, c: 3 }
|
|
1016
|
+
* const f = (a: number, key: string) => a > 2 ? Option.some(a * 2) : Option.none()
|
|
1017
|
+
* assert.deepStrictEqual(Record.filterMap(x, f), { c: 6 })
|
|
1018
|
+
*
|
|
1019
|
+
* @since 2.0.0
|
|
1020
|
+
*/
|
|
617
1021
|
<K extends string, A, B>(
|
|
618
1022
|
f: (a: A, key: K) => Option.Option<B>
|
|
619
1023
|
): (self: ReadonlyRecord<K, A>) => Record<ReadonlyRecord.NonLiteralKey<K>, B>
|
|
1024
|
+
/**
|
|
1025
|
+
* Transforms a record into a record by applying the function `f` to each key and value in the original record.
|
|
1026
|
+
* If the function returns `Some`, the key-value pair is included in the output record.
|
|
1027
|
+
*
|
|
1028
|
+
* @param self - The input record.
|
|
1029
|
+
* @param f - The transformation function.
|
|
1030
|
+
*
|
|
1031
|
+
* @example
|
|
1032
|
+
* import { Record, Option } from "effect"
|
|
1033
|
+
*
|
|
1034
|
+
* const x = { a: 1, b: 2, c: 3 }
|
|
1035
|
+
* const f = (a: number, key: string) => a > 2 ? Option.some(a * 2) : Option.none()
|
|
1036
|
+
* assert.deepStrictEqual(Record.filterMap(x, f), { c: 6 })
|
|
1037
|
+
*
|
|
1038
|
+
* @since 2.0.0
|
|
1039
|
+
*/
|
|
620
1040
|
<K extends string, A, B>(
|
|
621
1041
|
self: ReadonlyRecord<K, A>,
|
|
622
1042
|
f: (a: A, key: K) => Option.Option<B>
|
|
@@ -654,16 +1074,76 @@ export const filterMap: {
|
|
|
654
1074
|
* @since 2.0.0
|
|
655
1075
|
*/
|
|
656
1076
|
export const filter: {
|
|
1077
|
+
/**
|
|
1078
|
+
* Selects properties from a record whose values match the given predicate.
|
|
1079
|
+
*
|
|
1080
|
+
* @param self - The record to filter.
|
|
1081
|
+
* @param predicate - A function that returns a `boolean` value to determine if the entry should be included in the new record.
|
|
1082
|
+
*
|
|
1083
|
+
* @example
|
|
1084
|
+
* import { filter } from "effect/Record"
|
|
1085
|
+
*
|
|
1086
|
+
* const x = { a: 1, b: 2, c: 3, d: 4 }
|
|
1087
|
+
* assert.deepStrictEqual(filter(x, (n) => n > 2), { c: 3, d: 4 })
|
|
1088
|
+
*
|
|
1089
|
+
* @category filtering
|
|
1090
|
+
* @since 2.0.0
|
|
1091
|
+
*/
|
|
657
1092
|
<K extends string, A, B extends A>(
|
|
658
1093
|
refinement: (a: NoInfer<A>, key: K) => a is B
|
|
659
1094
|
): (self: ReadonlyRecord<K, A>) => Record<ReadonlyRecord.NonLiteralKey<K>, B>
|
|
1095
|
+
/**
|
|
1096
|
+
* Selects properties from a record whose values match the given predicate.
|
|
1097
|
+
*
|
|
1098
|
+
* @param self - The record to filter.
|
|
1099
|
+
* @param predicate - A function that returns a `boolean` value to determine if the entry should be included in the new record.
|
|
1100
|
+
*
|
|
1101
|
+
* @example
|
|
1102
|
+
* import { filter } from "effect/Record"
|
|
1103
|
+
*
|
|
1104
|
+
* const x = { a: 1, b: 2, c: 3, d: 4 }
|
|
1105
|
+
* assert.deepStrictEqual(filter(x, (n) => n > 2), { c: 3, d: 4 })
|
|
1106
|
+
*
|
|
1107
|
+
* @category filtering
|
|
1108
|
+
* @since 2.0.0
|
|
1109
|
+
*/
|
|
660
1110
|
<K extends string, A>(
|
|
661
1111
|
predicate: (A: NoInfer<A>, key: K) => boolean
|
|
662
1112
|
): (self: ReadonlyRecord<K, A>) => Record<ReadonlyRecord.NonLiteralKey<K>, A>
|
|
1113
|
+
/**
|
|
1114
|
+
* Selects properties from a record whose values match the given predicate.
|
|
1115
|
+
*
|
|
1116
|
+
* @param self - The record to filter.
|
|
1117
|
+
* @param predicate - A function that returns a `boolean` value to determine if the entry should be included in the new record.
|
|
1118
|
+
*
|
|
1119
|
+
* @example
|
|
1120
|
+
* import { filter } from "effect/Record"
|
|
1121
|
+
*
|
|
1122
|
+
* const x = { a: 1, b: 2, c: 3, d: 4 }
|
|
1123
|
+
* assert.deepStrictEqual(filter(x, (n) => n > 2), { c: 3, d: 4 })
|
|
1124
|
+
*
|
|
1125
|
+
* @category filtering
|
|
1126
|
+
* @since 2.0.0
|
|
1127
|
+
*/
|
|
663
1128
|
<K extends string, A, B extends A>(
|
|
664
1129
|
self: ReadonlyRecord<K, A>,
|
|
665
1130
|
refinement: (a: A, key: K) => a is B
|
|
666
1131
|
): Record<ReadonlyRecord.NonLiteralKey<K>, B>
|
|
1132
|
+
/**
|
|
1133
|
+
* Selects properties from a record whose values match the given predicate.
|
|
1134
|
+
*
|
|
1135
|
+
* @param self - The record to filter.
|
|
1136
|
+
* @param predicate - A function that returns a `boolean` value to determine if the entry should be included in the new record.
|
|
1137
|
+
*
|
|
1138
|
+
* @example
|
|
1139
|
+
* import { filter } from "effect/Record"
|
|
1140
|
+
*
|
|
1141
|
+
* const x = { a: 1, b: 2, c: 3, d: 4 }
|
|
1142
|
+
* assert.deepStrictEqual(filter(x, (n) => n > 2), { c: 3, d: 4 })
|
|
1143
|
+
*
|
|
1144
|
+
* @category filtering
|
|
1145
|
+
* @since 2.0.0
|
|
1146
|
+
*/
|
|
667
1147
|
<K extends string, A>(
|
|
668
1148
|
self: ReadonlyRecord<K, A>,
|
|
669
1149
|
predicate: (a: A, key: K) => boolean
|
|
@@ -779,11 +1259,41 @@ export const getRights = <K extends string, R, L>(
|
|
|
779
1259
|
* @since 2.0.0
|
|
780
1260
|
*/
|
|
781
1261
|
export const partitionMap: {
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
1262
|
+
/**
|
|
1263
|
+
* Partitions the elements of a record into two groups: those that match a predicate, and those that don't.
|
|
1264
|
+
*
|
|
1265
|
+
* @param self - The record to partition.
|
|
1266
|
+
* @param f - The predicate function to apply to each element.
|
|
1267
|
+
*
|
|
1268
|
+
* @example
|
|
1269
|
+
* import { Record, Either } from "effect"
|
|
1270
|
+
*
|
|
1271
|
+
* const x = { a: 1, b: 2, c: 3 }
|
|
1272
|
+
* const f = (n: number) => (n % 2 === 0 ? Either.right(n) : Either.left(n))
|
|
1273
|
+
* assert.deepStrictEqual(Record.partitionMap(x, f), [{ a: 1, c: 3 }, { b: 2}])
|
|
1274
|
+
*
|
|
1275
|
+
* @category filtering
|
|
1276
|
+
* @since 2.0.0
|
|
1277
|
+
*/
|
|
1278
|
+
<K extends string, A, B, C>(f: (a: A, key: K) => Either<C, B>): (
|
|
785
1279
|
self: ReadonlyRecord<K, A>
|
|
786
1280
|
) => [left: Record<ReadonlyRecord.NonLiteralKey<K>, B>, right: Record<ReadonlyRecord.NonLiteralKey<K>, C>]
|
|
1281
|
+
/**
|
|
1282
|
+
* Partitions the elements of a record into two groups: those that match a predicate, and those that don't.
|
|
1283
|
+
*
|
|
1284
|
+
* @param self - The record to partition.
|
|
1285
|
+
* @param f - The predicate function to apply to each element.
|
|
1286
|
+
*
|
|
1287
|
+
* @example
|
|
1288
|
+
* import { Record, Either } from "effect"
|
|
1289
|
+
*
|
|
1290
|
+
* const x = { a: 1, b: 2, c: 3 }
|
|
1291
|
+
* const f = (n: number) => (n % 2 === 0 ? Either.right(n) : Either.left(n))
|
|
1292
|
+
* assert.deepStrictEqual(Record.partitionMap(x, f), [{ a: 1, c: 3 }, { b: 2}])
|
|
1293
|
+
*
|
|
1294
|
+
* @category filtering
|
|
1295
|
+
* @since 2.0.0
|
|
1296
|
+
*/
|
|
787
1297
|
<K extends string, A, B, C>(
|
|
788
1298
|
self: ReadonlyRecord<K, A>,
|
|
789
1299
|
f: (a: A, key: K) => Either<C, B>
|
|
@@ -847,24 +1357,87 @@ export const separate: <K extends string, A, B>(
|
|
|
847
1357
|
* @since 2.0.0
|
|
848
1358
|
*/
|
|
849
1359
|
export const partition: {
|
|
1360
|
+
/**
|
|
1361
|
+
* Partitions a record into two separate records based on the result of a predicate function.
|
|
1362
|
+
*
|
|
1363
|
+
* @param self - The input record to partition.
|
|
1364
|
+
* @param predicate - The partitioning function to determine the partitioning of each value of the record.
|
|
1365
|
+
*
|
|
1366
|
+
* @example
|
|
1367
|
+
* import { partition } from "effect/Record"
|
|
1368
|
+
*
|
|
1369
|
+
* assert.deepStrictEqual(
|
|
1370
|
+
* partition({ a: 1, b: 3 }, (n) => n > 2),
|
|
1371
|
+
* [{ a: 1 }, { b: 3 }]
|
|
1372
|
+
* )
|
|
1373
|
+
*
|
|
1374
|
+
* @category filtering
|
|
1375
|
+
* @since 2.0.0
|
|
1376
|
+
*/
|
|
850
1377
|
<K extends string, A, B extends A>(refinement: (a: NoInfer<A>, key: K) => a is B): (
|
|
851
1378
|
self: ReadonlyRecord<K, A>
|
|
852
1379
|
) => [
|
|
853
1380
|
excluded: Record<ReadonlyRecord.NonLiteralKey<K>, Exclude<A, B>>,
|
|
854
1381
|
satisfying: Record<ReadonlyRecord.NonLiteralKey<K>, B>
|
|
855
1382
|
]
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
1383
|
+
/**
|
|
1384
|
+
* Partitions a record into two separate records based on the result of a predicate function.
|
|
1385
|
+
*
|
|
1386
|
+
* @param self - The input record to partition.
|
|
1387
|
+
* @param predicate - The partitioning function to determine the partitioning of each value of the record.
|
|
1388
|
+
*
|
|
1389
|
+
* @example
|
|
1390
|
+
* import { partition } from "effect/Record"
|
|
1391
|
+
*
|
|
1392
|
+
* assert.deepStrictEqual(
|
|
1393
|
+
* partition({ a: 1, b: 3 }, (n) => n > 2),
|
|
1394
|
+
* [{ a: 1 }, { b: 3 }]
|
|
1395
|
+
* )
|
|
1396
|
+
*
|
|
1397
|
+
* @category filtering
|
|
1398
|
+
* @since 2.0.0
|
|
1399
|
+
*/
|
|
1400
|
+
<K extends string, A>(predicate: (a: NoInfer<A>, key: K) => boolean): (
|
|
859
1401
|
self: ReadonlyRecord<K, A>
|
|
860
1402
|
) => [excluded: Record<ReadonlyRecord.NonLiteralKey<K>, A>, satisfying: Record<ReadonlyRecord.NonLiteralKey<K>, A>]
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
1403
|
+
/**
|
|
1404
|
+
* Partitions a record into two separate records based on the result of a predicate function.
|
|
1405
|
+
*
|
|
1406
|
+
* @param self - The input record to partition.
|
|
1407
|
+
* @param predicate - The partitioning function to determine the partitioning of each value of the record.
|
|
1408
|
+
*
|
|
1409
|
+
* @example
|
|
1410
|
+
* import { partition } from "effect/Record"
|
|
1411
|
+
*
|
|
1412
|
+
* assert.deepStrictEqual(
|
|
1413
|
+
* partition({ a: 1, b: 3 }, (n) => n > 2),
|
|
1414
|
+
* [{ a: 1 }, { b: 3 }]
|
|
1415
|
+
* )
|
|
1416
|
+
*
|
|
1417
|
+
* @category filtering
|
|
1418
|
+
* @since 2.0.0
|
|
1419
|
+
*/
|
|
1420
|
+
<K extends string, A, B extends A>(self: ReadonlyRecord<K, A>, refinement: (a: A, key: K) => a is B): [
|
|
865
1421
|
excluded: Record<ReadonlyRecord.NonLiteralKey<K>, Exclude<A, B>>,
|
|
866
1422
|
satisfying: Record<ReadonlyRecord.NonLiteralKey<K>, B>
|
|
867
1423
|
]
|
|
1424
|
+
/**
|
|
1425
|
+
* Partitions a record into two separate records based on the result of a predicate function.
|
|
1426
|
+
*
|
|
1427
|
+
* @param self - The input record to partition.
|
|
1428
|
+
* @param predicate - The partitioning function to determine the partitioning of each value of the record.
|
|
1429
|
+
*
|
|
1430
|
+
* @example
|
|
1431
|
+
* import { partition } from "effect/Record"
|
|
1432
|
+
*
|
|
1433
|
+
* assert.deepStrictEqual(
|
|
1434
|
+
* partition({ a: 1, b: 3 }, (n) => n > 2),
|
|
1435
|
+
* [{ a: 1 }, { b: 3 }]
|
|
1436
|
+
* )
|
|
1437
|
+
*
|
|
1438
|
+
* @category filtering
|
|
1439
|
+
* @since 2.0.0
|
|
1440
|
+
*/
|
|
868
1441
|
<K extends string, A>(
|
|
869
1442
|
self: ReadonlyRecord<K, A>,
|
|
870
1443
|
predicate: (a: A, key: K) => boolean
|
|
@@ -923,10 +1496,40 @@ export const values = <K extends string, A>(self: ReadonlyRecord<K, A>): Array<A
|
|
|
923
1496
|
* @since 2.0.0
|
|
924
1497
|
*/
|
|
925
1498
|
export const set: {
|
|
1499
|
+
/**
|
|
1500
|
+
* Add a new key-value pair or update an existing key's value in a record.
|
|
1501
|
+
*
|
|
1502
|
+
* @param self - The record to which you want to add or update a key-value pair.
|
|
1503
|
+
* @param key - The key you want to add or update.
|
|
1504
|
+
* @param values - The value you want to associate with the key.
|
|
1505
|
+
*
|
|
1506
|
+
* @example
|
|
1507
|
+
* import { set } from "effect/Record"
|
|
1508
|
+
*
|
|
1509
|
+
* assert.deepStrictEqual(set("a", 5)({ a: 1, b: 2 }), { a: 5, b: 2 });
|
|
1510
|
+
* assert.deepStrictEqual(set("c", 5)({ a: 1, b: 2 }), { a: 1, b: 2, c: 5 });
|
|
1511
|
+
*
|
|
1512
|
+
* @since 2.0.0
|
|
1513
|
+
*/
|
|
926
1514
|
<K extends string | symbol, K1 extends K | ((string | symbol) & {}), B>(
|
|
927
1515
|
key: K1,
|
|
928
1516
|
value: B
|
|
929
1517
|
): <A>(self: ReadonlyRecord<K, A>) => Record<K | K1, A | B>
|
|
1518
|
+
/**
|
|
1519
|
+
* Add a new key-value pair or update an existing key's value in a record.
|
|
1520
|
+
*
|
|
1521
|
+
* @param self - The record to which you want to add or update a key-value pair.
|
|
1522
|
+
* @param key - The key you want to add or update.
|
|
1523
|
+
* @param values - The value you want to associate with the key.
|
|
1524
|
+
*
|
|
1525
|
+
* @example
|
|
1526
|
+
* import { set } from "effect/Record"
|
|
1527
|
+
*
|
|
1528
|
+
* assert.deepStrictEqual(set("a", 5)({ a: 1, b: 2 }), { a: 5, b: 2 });
|
|
1529
|
+
* assert.deepStrictEqual(set("c", 5)({ a: 1, b: 2 }), { a: 1, b: 2, c: 5 });
|
|
1530
|
+
*
|
|
1531
|
+
* @since 2.0.0
|
|
1532
|
+
*/
|
|
930
1533
|
<K extends string | symbol, A, K1 extends K | ((string | symbol) & {}), B>(
|
|
931
1534
|
self: ReadonlyRecord<K, A>,
|
|
932
1535
|
key: K1,
|
|
@@ -960,7 +1563,39 @@ export const set: {
|
|
|
960
1563
|
* @since 2.0.0
|
|
961
1564
|
*/
|
|
962
1565
|
export const replace: {
|
|
1566
|
+
/**
|
|
1567
|
+
* Replace a key's value in a record and return the updated record.
|
|
1568
|
+
* If the key does not exist in the record, a copy of the original record is returned.
|
|
1569
|
+
*
|
|
1570
|
+
* @param self - The original record.
|
|
1571
|
+
* @param key - The key to replace.
|
|
1572
|
+
* @param value - The new value to associate with the key.
|
|
1573
|
+
*
|
|
1574
|
+
* @example
|
|
1575
|
+
* import { Record } from "effect"
|
|
1576
|
+
*
|
|
1577
|
+
* assert.deepStrictEqual(Record.replace("a", 3)({ a: 1, b: 2 }), { a: 3, b: 2 });
|
|
1578
|
+
* assert.deepStrictEqual(Record.replace("c", 3)({ a: 1, b: 2 }), { a: 1, b: 2 });
|
|
1579
|
+
*
|
|
1580
|
+
* @since 2.0.0
|
|
1581
|
+
*/
|
|
963
1582
|
<K extends string | symbol, B>(key: NoInfer<K>, value: B): <A>(self: ReadonlyRecord<K, A>) => Record<K, A | B>
|
|
1583
|
+
/**
|
|
1584
|
+
* Replace a key's value in a record and return the updated record.
|
|
1585
|
+
* If the key does not exist in the record, a copy of the original record is returned.
|
|
1586
|
+
*
|
|
1587
|
+
* @param self - The original record.
|
|
1588
|
+
* @param key - The key to replace.
|
|
1589
|
+
* @param value - The new value to associate with the key.
|
|
1590
|
+
*
|
|
1591
|
+
* @example
|
|
1592
|
+
* import { Record } from "effect"
|
|
1593
|
+
*
|
|
1594
|
+
* assert.deepStrictEqual(Record.replace("a", 3)({ a: 1, b: 2 }), { a: 3, b: 2 });
|
|
1595
|
+
* assert.deepStrictEqual(Record.replace("c", 3)({ a: 1, b: 2 }), { a: 1, b: 2 });
|
|
1596
|
+
*
|
|
1597
|
+
* @since 2.0.0
|
|
1598
|
+
*/
|
|
964
1599
|
<K extends string | symbol, A, B>(self: ReadonlyRecord<K, A>, key: NoInfer<K>, value: B): Record<K, A | B>
|
|
965
1600
|
} = dual(
|
|
966
1601
|
3,
|
|
@@ -1004,7 +1639,25 @@ export const isSubrecordBy = <A>(equivalence: Equivalence<A>): {
|
|
|
1004
1639
|
* @since 2.0.0
|
|
1005
1640
|
*/
|
|
1006
1641
|
export const isSubrecord: {
|
|
1642
|
+
/**
|
|
1643
|
+
* Check if one record is a subrecord of another, meaning it contains all the keys and values found in the second record.
|
|
1644
|
+
* This comparison uses default equality checks (`Equal.equivalence()`).
|
|
1645
|
+
*
|
|
1646
|
+
* @param self - The first record to check.
|
|
1647
|
+
* @param that - The second record to compare against.
|
|
1648
|
+
*
|
|
1649
|
+
* @since 2.0.0
|
|
1650
|
+
*/
|
|
1007
1651
|
<K extends string, A>(that: ReadonlyRecord<K, A>): (self: ReadonlyRecord<K, A>) => boolean
|
|
1652
|
+
/**
|
|
1653
|
+
* Check if one record is a subrecord of another, meaning it contains all the keys and values found in the second record.
|
|
1654
|
+
* This comparison uses default equality checks (`Equal.equivalence()`).
|
|
1655
|
+
*
|
|
1656
|
+
* @param self - The first record to check.
|
|
1657
|
+
* @param that - The second record to compare against.
|
|
1658
|
+
*
|
|
1659
|
+
* @since 2.0.0
|
|
1660
|
+
*/
|
|
1008
1661
|
<K extends string, A>(self: ReadonlyRecord<K, A>, that: ReadonlyRecord<K, A>): boolean
|
|
1009
1662
|
} = isSubrecordBy(Equal.equivalence())
|
|
1010
1663
|
|
|
@@ -1019,11 +1672,32 @@ export const isSubrecord: {
|
|
|
1019
1672
|
* @since 2.0.0
|
|
1020
1673
|
*/
|
|
1021
1674
|
export const reduce: {
|
|
1022
|
-
|
|
1675
|
+
/**
|
|
1676
|
+
* Reduce a record to a single value by combining its entries with a specified function.
|
|
1677
|
+
*
|
|
1678
|
+
* @param self - The record to reduce.
|
|
1679
|
+
* @param zero - The initial value of the accumulator.
|
|
1680
|
+
* @param f - The function to combine entries (accumulator, value, key).
|
|
1681
|
+
*
|
|
1682
|
+
* @category folding
|
|
1683
|
+
* @since 2.0.0
|
|
1684
|
+
*/
|
|
1685
|
+
<Z, V, K extends string>(zero: Z, f: (accumulator: Z, value: V, key: K) => Z): (self: ReadonlyRecord<K, V>) => Z
|
|
1686
|
+
/**
|
|
1687
|
+
* Reduce a record to a single value by combining its entries with a specified function.
|
|
1688
|
+
*
|
|
1689
|
+
* @param self - The record to reduce.
|
|
1690
|
+
* @param zero - The initial value of the accumulator.
|
|
1691
|
+
* @param f - The function to combine entries (accumulator, value, key).
|
|
1692
|
+
*
|
|
1693
|
+
* @category folding
|
|
1694
|
+
* @since 2.0.0
|
|
1695
|
+
*/
|
|
1696
|
+
<K extends string, V, Z>(
|
|
1697
|
+
self: ReadonlyRecord<K, V>,
|
|
1023
1698
|
zero: Z,
|
|
1024
1699
|
f: (accumulator: Z, value: V, key: K) => Z
|
|
1025
|
-
):
|
|
1026
|
-
<K extends string, V, Z>(self: ReadonlyRecord<K, V>, zero: Z, f: (accumulator: Z, value: V, key: K) => Z): Z
|
|
1700
|
+
): Z
|
|
1027
1701
|
} = dual(
|
|
1028
1702
|
3,
|
|
1029
1703
|
<K extends string, V, Z>(
|
|
@@ -1048,14 +1722,46 @@ export const reduce: {
|
|
|
1048
1722
|
* @since 2.0.0
|
|
1049
1723
|
*/
|
|
1050
1724
|
export const every: {
|
|
1725
|
+
/**
|
|
1726
|
+
* Check if all entries in a record meet a specific condition.
|
|
1727
|
+
*
|
|
1728
|
+
* @param self - The record to check.
|
|
1729
|
+
* @param predicate - The condition to test entries (value, key).
|
|
1730
|
+
*
|
|
1731
|
+
* @since 2.0.0
|
|
1732
|
+
*/
|
|
1051
1733
|
<A, K extends string, B extends A>(
|
|
1052
1734
|
refinement: (value: A, key: K) => value is B
|
|
1053
1735
|
): (self: ReadonlyRecord<K, A>) => self is ReadonlyRecord<K, B>
|
|
1736
|
+
/**
|
|
1737
|
+
* Check if all entries in a record meet a specific condition.
|
|
1738
|
+
*
|
|
1739
|
+
* @param self - The record to check.
|
|
1740
|
+
* @param predicate - The condition to test entries (value, key).
|
|
1741
|
+
*
|
|
1742
|
+
* @since 2.0.0
|
|
1743
|
+
*/
|
|
1054
1744
|
<A, K extends string>(predicate: (value: A, key: K) => boolean): (self: ReadonlyRecord<K, A>) => boolean
|
|
1745
|
+
/**
|
|
1746
|
+
* Check if all entries in a record meet a specific condition.
|
|
1747
|
+
*
|
|
1748
|
+
* @param self - The record to check.
|
|
1749
|
+
* @param predicate - The condition to test entries (value, key).
|
|
1750
|
+
*
|
|
1751
|
+
* @since 2.0.0
|
|
1752
|
+
*/
|
|
1055
1753
|
<A, K extends string, B extends A>(
|
|
1056
1754
|
self: ReadonlyRecord<K, A>,
|
|
1057
1755
|
refinement: (value: A, key: K) => value is B
|
|
1058
1756
|
): self is ReadonlyRecord<K, B>
|
|
1757
|
+
/**
|
|
1758
|
+
* Check if all entries in a record meet a specific condition.
|
|
1759
|
+
*
|
|
1760
|
+
* @param self - The record to check.
|
|
1761
|
+
* @param predicate - The condition to test entries (value, key).
|
|
1762
|
+
*
|
|
1763
|
+
* @since 2.0.0
|
|
1764
|
+
*/
|
|
1059
1765
|
<K extends string, A>(self: ReadonlyRecord<K, A>, predicate: (value: A, key: K) => boolean): boolean
|
|
1060
1766
|
} = dual(
|
|
1061
1767
|
2,
|
|
@@ -1081,7 +1787,23 @@ export const every: {
|
|
|
1081
1787
|
* @since 2.0.0
|
|
1082
1788
|
*/
|
|
1083
1789
|
export const some: {
|
|
1790
|
+
/**
|
|
1791
|
+
* Check if any entry in a record meets a specific condition.
|
|
1792
|
+
*
|
|
1793
|
+
* @param self - The record to check.
|
|
1794
|
+
* @param predicate - The condition to test entries (value, key).
|
|
1795
|
+
*
|
|
1796
|
+
* @since 2.0.0
|
|
1797
|
+
*/
|
|
1084
1798
|
<A, K extends string>(predicate: (value: A, key: K) => boolean): (self: ReadonlyRecord<K, A>) => boolean
|
|
1799
|
+
/**
|
|
1800
|
+
* Check if any entry in a record meets a specific condition.
|
|
1801
|
+
*
|
|
1802
|
+
* @param self - The record to check.
|
|
1803
|
+
* @param predicate - The condition to test entries (value, key).
|
|
1804
|
+
*
|
|
1805
|
+
* @since 2.0.0
|
|
1806
|
+
*/
|
|
1085
1807
|
<K extends string, A>(self: ReadonlyRecord<K, A>, predicate: (value: A, key: K) => boolean): boolean
|
|
1086
1808
|
} = dual(
|
|
1087
1809
|
2,
|
|
@@ -1105,10 +1827,28 @@ export const some: {
|
|
|
1105
1827
|
* @since 2.0.0
|
|
1106
1828
|
*/
|
|
1107
1829
|
export const union: {
|
|
1830
|
+
/**
|
|
1831
|
+
* Merge two records, preserving entries that exist in either of the records.
|
|
1832
|
+
*
|
|
1833
|
+
* @param self - The first record.
|
|
1834
|
+
* @param that - The second record to combine with the first.
|
|
1835
|
+
* @param combine - A function to specify how to merge entries with the same key.
|
|
1836
|
+
*
|
|
1837
|
+
* @since 2.0.0
|
|
1838
|
+
*/
|
|
1108
1839
|
<K1 extends string, A, B, C>(
|
|
1109
1840
|
that: ReadonlyRecord<K1, B>,
|
|
1110
1841
|
combine: (selfValue: A, thatValue: B) => C
|
|
1111
1842
|
): <K0 extends string>(self: ReadonlyRecord<K0, A>) => Record<K0 | K1, A | B | C>
|
|
1843
|
+
/**
|
|
1844
|
+
* Merge two records, preserving entries that exist in either of the records.
|
|
1845
|
+
*
|
|
1846
|
+
* @param self - The first record.
|
|
1847
|
+
* @param that - The second record to combine with the first.
|
|
1848
|
+
* @param combine - A function to specify how to merge entries with the same key.
|
|
1849
|
+
*
|
|
1850
|
+
* @since 2.0.0
|
|
1851
|
+
*/
|
|
1112
1852
|
<K0 extends string, A, K1 extends string, B, C>(
|
|
1113
1853
|
self: ReadonlyRecord<K0, A>,
|
|
1114
1854
|
that: ReadonlyRecord<K1, B>,
|
|
@@ -1154,10 +1894,28 @@ export const union: {
|
|
|
1154
1894
|
* @since 2.0.0
|
|
1155
1895
|
*/
|
|
1156
1896
|
export const intersection: {
|
|
1897
|
+
/**
|
|
1898
|
+
* Merge two records, retaining only the entries that exist in both records.
|
|
1899
|
+
*
|
|
1900
|
+
* @param self - The first record.
|
|
1901
|
+
* @param that - The second record to merge with the first.
|
|
1902
|
+
* @param combine - A function to specify how to merge entries with the same key.
|
|
1903
|
+
*
|
|
1904
|
+
* @since 2.0.0
|
|
1905
|
+
*/
|
|
1157
1906
|
<K1 extends string, A, B, C>(
|
|
1158
1907
|
that: ReadonlyRecord<K1, B>,
|
|
1159
1908
|
combine: (selfValue: A, thatValue: B) => C
|
|
1160
1909
|
): <K0 extends string>(self: ReadonlyRecord<K0, A>) => Record<ReadonlyRecord.IntersectKeys<K0, K1>, C>
|
|
1910
|
+
/**
|
|
1911
|
+
* Merge two records, retaining only the entries that exist in both records.
|
|
1912
|
+
*
|
|
1913
|
+
* @param self - The first record.
|
|
1914
|
+
* @param that - The second record to merge with the first.
|
|
1915
|
+
* @param combine - A function to specify how to merge entries with the same key.
|
|
1916
|
+
*
|
|
1917
|
+
* @since 2.0.0
|
|
1918
|
+
*/
|
|
1161
1919
|
<K0 extends string, A, K1 extends string, B, C>(
|
|
1162
1920
|
self: ReadonlyRecord<K0, A>,
|
|
1163
1921
|
that: ReadonlyRecord<K1, B>,
|
|
@@ -1192,9 +1950,25 @@ export const intersection: {
|
|
|
1192
1950
|
* @since 2.0.0
|
|
1193
1951
|
*/
|
|
1194
1952
|
export const difference: {
|
|
1953
|
+
/**
|
|
1954
|
+
* Merge two records, preserving only the entries that are unique to each record.
|
|
1955
|
+
*
|
|
1956
|
+
* @param self - The first record.
|
|
1957
|
+
* @param that - The second record to compare with the first.
|
|
1958
|
+
*
|
|
1959
|
+
* @since 2.0.0
|
|
1960
|
+
*/
|
|
1195
1961
|
<K1 extends string, B>(
|
|
1196
1962
|
that: ReadonlyRecord<K1, B>
|
|
1197
1963
|
): <K0 extends string, A>(self: ReadonlyRecord<K0, A>) => Record<K0 | K1, A | B>
|
|
1964
|
+
/**
|
|
1965
|
+
* Merge two records, preserving only the entries that are unique to each record.
|
|
1966
|
+
*
|
|
1967
|
+
* @param self - The first record.
|
|
1968
|
+
* @param that - The second record to compare with the first.
|
|
1969
|
+
*
|
|
1970
|
+
* @since 2.0.0
|
|
1971
|
+
*/
|
|
1198
1972
|
<K0 extends string, A, K1 extends string, B>(
|
|
1199
1973
|
self: ReadonlyRecord<K0, A>,
|
|
1200
1974
|
that: ReadonlyRecord<K1, B>
|