effect 4.0.0-beta.70 → 4.0.0-beta.72
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 +1483 -239
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +617 -164
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +646 -52
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +331 -28
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +474 -18
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +292 -14
- package/dist/BigInt.js.map +1 -1
- package/dist/Boolean.d.ts +239 -19
- package/dist/Boolean.d.ts.map +1 -1
- package/dist/Boolean.js +163 -13
- package/dist/Boolean.js.map +1 -1
- package/dist/Brand.d.ts +53 -8
- package/dist/Brand.d.ts.map +1 -1
- package/dist/Brand.js +82 -11
- package/dist/Brand.js.map +1 -1
- package/dist/Cache.d.ts +73 -12
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +53 -15
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +488 -200
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +349 -129
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +539 -158
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +222 -89
- package/dist/Channel.js.map +1 -1
- package/dist/ChannelSchema.d.ts +81 -6
- package/dist/ChannelSchema.d.ts.map +1 -1
- package/dist/ChannelSchema.js +45 -4
- package/dist/ChannelSchema.js.map +1 -1
- package/dist/Chunk.d.ts +179 -54
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +65 -22
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +60 -3
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js +31 -1
- package/dist/Clock.js.map +1 -1
- package/dist/Combiner.d.ts +21 -21
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +14 -18
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +135 -50
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +109 -37
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +52 -29
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +21 -21
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +32 -7
- package/dist/Console.d.ts.map +1 -1
- package/dist/Console.js +32 -7
- package/dist/Console.js.map +1 -1
- package/dist/Context.d.ts +503 -48
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +191 -17
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +116 -6
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +92 -6
- package/dist/Cron.js.map +1 -1
- package/dist/Crypto.d.ts +30 -1
- package/dist/Crypto.d.ts.map +1 -1
- package/dist/Crypto.js +30 -1
- package/dist/Crypto.js.map +1 -1
- package/dist/Data.d.ts +92 -47
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +16 -12
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +313 -128
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +167 -68
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +345 -79
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +131 -12
- package/dist/Deferred.js.map +1 -1
- package/dist/Differ.d.ts +5 -0
- package/dist/Differ.d.ts.map +1 -1
- package/dist/Duration.d.ts +203 -50
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +112 -32
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +2006 -810
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +785 -350
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.d.ts +16 -2
- package/dist/Effectable.d.ts.map +1 -1
- package/dist/Effectable.js +16 -2
- package/dist/Effectable.js.map +1 -1
- package/dist/Encoding.d.ts +100 -8
- package/dist/Encoding.d.ts.map +1 -1
- package/dist/Encoding.js +141 -8
- package/dist/Encoding.js.map +1 -1
- package/dist/Equal.d.ts +10 -11
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +7 -8
- package/dist/Equal.js.map +1 -1
- package/dist/Equivalence.d.ts +46 -43
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +43 -35
- package/dist/Equivalence.js.map +1 -1
- package/dist/ErrorReporter.d.ts +135 -16
- package/dist/ErrorReporter.d.ts.map +1 -1
- package/dist/ErrorReporter.js +93 -12
- package/dist/ErrorReporter.js.map +1 -1
- package/dist/ExecutionPlan.d.ts +96 -26
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +28 -2
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Exit.d.ts +149 -101
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js +117 -80
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +321 -72
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js +152 -3
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +6 -6
- package/dist/FiberHandle.js +4 -4
- package/dist/FiberMap.d.ts +18 -18
- package/dist/FiberMap.js +8 -8
- package/dist/FiberSet.d.ts +21 -13
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +17 -9
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +79 -16
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +93 -33
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts +221 -2
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +155 -2
- package/dist/Filter.js.map +1 -1
- package/dist/Formatter.d.ts +4 -6
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +3 -5
- package/dist/Formatter.js.map +1 -1
- package/dist/Function.d.ts +164 -18
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +116 -15
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +297 -25
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +75 -12
- package/dist/Graph.js.map +1 -1
- package/dist/HKT.d.ts +59 -26
- package/dist/HKT.d.ts.map +1 -1
- package/dist/Hash.d.ts +95 -19
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +119 -17
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +35 -37
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +13 -15
- package/dist/HashMap.js.map +1 -1
- package/dist/HashRing.d.ts +210 -9
- package/dist/HashRing.d.ts.map +1 -1
- package/dist/HashRing.js +95 -5
- package/dist/HashRing.js.map +1 -1
- package/dist/HashSet.d.ts +16 -16
- package/dist/HashSet.js +6 -6
- package/dist/Inspectable.d.ts +47 -4
- package/dist/Inspectable.d.ts.map +1 -1
- package/dist/Inspectable.js +74 -17
- package/dist/Inspectable.js.map +1 -1
- package/dist/Iterable.d.ts +261 -81
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +123 -43
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonPatch.d.ts +34 -19
- package/dist/JsonPatch.d.ts.map +1 -1
- package/dist/JsonPatch.js +52 -44
- package/dist/JsonPatch.js.map +1 -1
- package/dist/JsonPointer.d.ts +5 -5
- package/dist/JsonPointer.js +5 -5
- package/dist/JsonSchema.d.ts +77 -33
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +45 -31
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Latch.d.ts +158 -13
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +79 -4
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +297 -101
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +94 -36
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +9 -2
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +1 -2
- package/dist/LayerMap.js.map +1 -1
- package/dist/LogLevel.d.ts +96 -21
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/LogLevel.js +68 -9
- package/dist/LogLevel.js.map +1 -1
- package/dist/Logger.d.ts +21 -7
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +26 -13
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +82 -10
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +33 -2
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Match.d.ts +215 -42
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +242 -59
- package/dist/Match.js.map +1 -1
- package/dist/Metric.d.ts +68 -41
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +60 -33
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +285 -40
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +128 -7
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableHashSet.d.ts +111 -4
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableHashSet.js +98 -39
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/MutableList.d.ts +24 -6
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +23 -5
- package/dist/MutableList.js.map +1 -1
- package/dist/MutableRef.d.ts +141 -4
- package/dist/MutableRef.d.ts.map +1 -1
- package/dist/MutableRef.js +73 -2
- package/dist/MutableRef.js.map +1 -1
- package/dist/Newtype.d.ts +20 -11
- package/dist/Newtype.d.ts.map +1 -1
- package/dist/Newtype.js +6 -6
- package/dist/Newtype.js.map +1 -1
- package/dist/NonEmptyIterable.d.ts +22 -6
- package/dist/NonEmptyIterable.d.ts.map +1 -1
- package/dist/NonEmptyIterable.js +6 -1
- package/dist/NonEmptyIterable.js.map +1 -1
- package/dist/Number.d.ts +434 -17
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +268 -13
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts +26 -33
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +18 -25
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +186 -150
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +75 -72
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +93 -120
- package/dist/Order.d.ts.map +1 -1
- package/dist/Order.js +149 -142
- package/dist/Order.js.map +1 -1
- package/dist/Ordering.d.ts +37 -5
- package/dist/Ordering.d.ts.map +1 -1
- package/dist/Ordering.js +22 -3
- package/dist/Ordering.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts +238 -15
- package/dist/PartitionedSemaphore.d.ts.map +1 -1
- package/dist/PartitionedSemaphore.js +106 -8
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Path.d.ts +34 -6
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +19 -5
- package/dist/Path.js.map +1 -1
- package/dist/Pipeable.d.ts +29 -4
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/Pipeable.js +16 -4
- package/dist/Pipeable.js.map +1 -1
- package/dist/PlatformError.d.ts +53 -4
- package/dist/PlatformError.d.ts.map +1 -1
- package/dist/PlatformError.js +45 -4
- package/dist/PlatformError.js.map +1 -1
- package/dist/Pool.d.ts +140 -14
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +63 -8
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts +98 -168
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/Predicate.js +109 -120
- package/dist/Predicate.js.map +1 -1
- package/dist/PrimaryKey.d.ts +75 -9
- package/dist/PrimaryKey.d.ts.map +1 -1
- package/dist/PrimaryKey.js +70 -9
- package/dist/PrimaryKey.js.map +1 -1
- package/dist/PubSub.d.ts +241 -66
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +187 -52
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts +148 -3
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Pull.js +69 -2
- package/dist/Pull.js.map +1 -1
- package/dist/Queue.d.ts +167 -59
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +163 -55
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +71 -16
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +35 -0
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +171 -9
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +49 -3
- package/dist/RcMap.js.map +1 -1
- package/dist/RcRef.d.ts +73 -18
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/RcRef.js +23 -3
- package/dist/RcRef.js.map +1 -1
- package/dist/Record.d.ts +174 -53
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +128 -23
- package/dist/Record.js.map +1 -1
- package/dist/Redactable.d.ts +27 -23
- package/dist/Redactable.d.ts.map +1 -1
- package/dist/Redactable.js +22 -18
- package/dist/Redactable.js.map +1 -1
- package/dist/Redacted.d.ts +82 -4
- package/dist/Redacted.d.ts.map +1 -1
- package/dist/Redacted.js +64 -4
- package/dist/Redacted.js.map +1 -1
- package/dist/Reducer.d.ts +17 -7
- package/dist/Reducer.d.ts.map +1 -1
- package/dist/Reducer.js +2 -4
- package/dist/Reducer.js.map +1 -1
- package/dist/Ref.d.ts +168 -32
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +135 -30
- package/dist/Ref.js.map +1 -1
- package/dist/References.d.ts +226 -30
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +162 -23
- package/dist/References.js.map +1 -1
- package/dist/RegExp.d.ts +15 -2
- package/dist/RegExp.d.ts.map +1 -1
- package/dist/RegExp.js +49 -3
- package/dist/RegExp.js.map +1 -1
- package/dist/Request.d.ts +218 -35
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +57 -10
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +213 -29
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +99 -11
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Resource.d.ts +62 -3
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +52 -3
- package/dist/Resource.js.map +1 -1
- package/dist/Result.d.ts +380 -57
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +176 -32
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +124 -14
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +150 -25
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +436 -115
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +344 -107
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +53 -4
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +42 -3
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +934 -239
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +655 -217
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +239 -28
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +239 -28
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +127 -129
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +115 -117
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts +45 -56
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +39 -50
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +254 -15
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +295 -33
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +106 -77
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +101 -71
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +92 -56
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +86 -50
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/SchemaUtils.d.ts +9 -0
- package/dist/SchemaUtils.d.ts.map +1 -1
- package/dist/SchemaUtils.js +38 -11
- package/dist/SchemaUtils.js.map +1 -1
- package/dist/Scope.d.ts +127 -25
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +91 -21
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.d.ts +364 -19
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +155 -7
- package/dist/ScopedCache.js.map +1 -1
- package/dist/ScopedRef.d.ts +69 -7
- package/dist/ScopedRef.d.ts.map +1 -1
- package/dist/ScopedRef.js +49 -5
- package/dist/ScopedRef.js.map +1 -1
- package/dist/Semaphore.d.ts +348 -29
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +103 -8
- package/dist/Semaphore.js.map +1 -1
- package/dist/Sink.d.ts +343 -45
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +194 -26
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +72 -17
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stdio.js +62 -16
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +774 -224
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +333 -91
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +219 -47
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +179 -29
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +54 -110
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +26 -42
- package/dist/Struct.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +341 -105
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +162 -44
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/Symbol.d.ts +25 -7
- package/dist/Symbol.d.ts.map +1 -1
- package/dist/Symbol.js +25 -7
- package/dist/Symbol.js.map +1 -1
- package/dist/SynchronizedRef.d.ts +529 -29
- package/dist/SynchronizedRef.d.ts.map +1 -1
- package/dist/SynchronizedRef.js +193 -11
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Take.d.ts +36 -13
- package/dist/Take.d.ts.map +1 -1
- package/dist/Take.js +5 -0
- package/dist/Take.js.map +1 -1
- package/dist/Terminal.d.ts +76 -20
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Terminal.js +41 -5
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +74 -7
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +74 -7
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +67 -30
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +7 -7
- package/dist/Trie.js.map +1 -1
- package/dist/Tuple.d.ts +96 -108
- package/dist/Tuple.d.ts.map +1 -1
- package/dist/Tuple.js +42 -52
- package/dist/Tuple.js.map +1 -1
- package/dist/TxChunk.d.ts +42 -9
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +42 -9
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +85 -2
- package/dist/TxDeferred.d.ts.map +1 -1
- package/dist/TxDeferred.js +56 -2
- package/dist/TxDeferred.js.map +1 -1
- package/dist/TxHashMap.d.ts +20 -20
- package/dist/TxHashMap.js +8 -8
- package/dist/TxHashSet.d.ts +14 -14
- package/dist/TxHashSet.js +6 -6
- package/dist/TxPriorityQueue.d.ts +43 -8
- package/dist/TxPriorityQueue.d.ts.map +1 -1
- package/dist/TxPriorityQueue.js +41 -6
- package/dist/TxPriorityQueue.js.map +1 -1
- package/dist/TxPubSub.d.ts +98 -8
- package/dist/TxPubSub.d.ts.map +1 -1
- package/dist/TxPubSub.js +70 -8
- package/dist/TxPubSub.js.map +1 -1
- package/dist/TxQueue.d.ts +58 -17
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +10 -10
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +88 -16
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +78 -14
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/TxRef.d.ts +113 -8
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +82 -8
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +173 -14
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +130 -14
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +206 -3
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.js +111 -3
- package/dist/TxSubscriptionRef.js.map +1 -1
- package/dist/Types.d.ts +68 -13
- package/dist/Types.d.ts.map +1 -1
- package/dist/UndefinedOr.d.ts +171 -30
- package/dist/UndefinedOr.d.ts.map +1 -1
- package/dist/UndefinedOr.js +115 -30
- package/dist/UndefinedOr.js.map +1 -1
- package/dist/Unify.d.ts +130 -22
- package/dist/Unify.d.ts.map +1 -1
- package/dist/Unify.js +36 -12
- package/dist/Unify.js.map +1 -1
- package/dist/Utils.d.ts +21 -16
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +14 -6
- package/dist/Utils.js.map +1 -1
- package/dist/index.d.ts +0 -5205
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -5205
- package/dist/index.js.map +1 -1
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/request.js +3 -1
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/schema/arbitrary.js +11 -1
- package/dist/internal/schema/arbitrary.js.map +1 -1
- package/dist/internal/schema/representation.js +21 -12
- package/dist/internal/schema/representation.js.map +1 -1
- package/dist/testing/TestConsole.d.ts +69 -0
- package/dist/testing/TestConsole.d.ts.map +1 -1
- package/dist/testing/TestConsole.js +73 -9
- package/dist/testing/TestConsole.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +79 -30
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +69 -31
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/testing/index.d.ts +0 -107
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +0 -107
- package/dist/testing/index.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +33 -5
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +33 -5
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +9 -0
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +43 -11
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +45 -6
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +73 -33
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.d.ts +104 -8
- package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.js +103 -7
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
- package/dist/unstable/ai/IdGenerator.d.ts +8 -3
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.js +8 -3
- package/dist/unstable/ai/IdGenerator.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +51 -7
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +50 -6
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +299 -169
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +278 -147
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +108 -14
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +80 -10
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +35 -13
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +34 -12
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +48 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +24 -3
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +23 -2
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +71 -13
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +35 -1
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.d.ts +34 -12
- package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.js +33 -11
- package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
- package/dist/unstable/ai/Telemetry.d.ts +40 -27
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +34 -26
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts +41 -25
- package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
- package/dist/unstable/ai/Tokenizer.js +41 -25
- package/dist/unstable/ai/Tokenizer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +85 -24
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +84 -23
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +1 -1
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +1 -1
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/index.d.ts +0 -560
- package/dist/unstable/ai/index.d.ts.map +1 -1
- package/dist/unstable/ai/index.js +0 -560
- package/dist/unstable/ai/index.js.map +1 -1
- package/dist/unstable/cli/Argument.js +1 -1
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +3 -3
- package/dist/unstable/cli/CliError.js +3 -3
- package/dist/unstable/cli/CliOutput.d.ts +1 -1
- package/dist/unstable/cli/Command.d.ts +136 -8
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +50 -4
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.d.ts +13 -0
- package/dist/unstable/cli/Completions.d.ts.map +1 -1
- package/dist/unstable/cli/Completions.js +41 -1
- package/dist/unstable/cli/Completions.js.map +1 -1
- package/dist/unstable/cli/Flag.d.ts +24 -12
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +18 -6
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +39 -8
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
- package/dist/unstable/cli/GlobalFlag.js +39 -8
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/Param.d.ts +128 -2
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +59 -7
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +3 -3
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +59 -10
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.d.ts +37 -7
- package/dist/unstable/cli/Prompt.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.js +51 -9
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/index.d.ts +0 -220
- package/dist/unstable/cli/index.d.ts.map +1 -1
- package/dist/unstable/cli/index.js +0 -220
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +1 -1
- package/dist/unstable/cluster/ClusterCron.d.ts +1 -1
- package/dist/unstable/cluster/ClusterError.d.ts +61 -22
- package/dist/unstable/cluster/ClusterError.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterError.js +61 -22
- package/dist/unstable/cluster/ClusterError.js.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.d.ts +58 -5
- package/dist/unstable/cluster/ClusterMetrics.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.js +58 -5
- package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts +87 -26
- package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.js +87 -26
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +49 -10
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.d.ts +6 -1
- package/dist/unstable/cluster/DeliverAt.d.ts.map +1 -1
- package/dist/unstable/cluster/DeliverAt.js +6 -1
- package/dist/unstable/cluster/DeliverAt.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +33 -6
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +32 -5
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityAddress.d.ts +19 -0
- package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityAddress.js +19 -0
- package/dist/unstable/cluster/EntityAddress.js.map +1 -1
- package/dist/unstable/cluster/EntityId.d.ts +44 -7
- package/dist/unstable/cluster/EntityId.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityId.js +44 -7
- package/dist/unstable/cluster/EntityId.js.map +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +5 -6
- package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityResource.js +4 -5
- package/dist/unstable/cluster/EntityResource.js.map +1 -1
- package/dist/unstable/cluster/EntityType.d.ts +19 -0
- package/dist/unstable/cluster/EntityType.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityType.js +19 -0
- package/dist/unstable/cluster/EntityType.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +11 -11
- package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
- package/dist/unstable/cluster/Envelope.js +11 -11
- package/dist/unstable/cluster/Envelope.js.map +1 -1
- package/dist/unstable/cluster/HttpRunner.d.ts +42 -22
- package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/HttpRunner.js +42 -22
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.d.ts +33 -14
- package/dist/unstable/cluster/K8sHttpClient.d.ts.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/MachineId.d.ts +35 -9
- package/dist/unstable/cluster/MachineId.d.ts.map +1 -1
- package/dist/unstable/cluster/MachineId.js +35 -9
- package/dist/unstable/cluster/MachineId.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +11 -11
- package/dist/unstable/cluster/Message.js +11 -11
- package/dist/unstable/cluster/MessageStorage.d.ts +38 -24
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +37 -23
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +18 -8
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +18 -8
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.d.ts +47 -14
- package/dist/unstable/cluster/Runner.d.ts.map +1 -1
- package/dist/unstable/cluster/Runner.js +47 -14
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.d.ts +52 -10
- package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.js +52 -10
- package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts +33 -16
- package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.js +33 -16
- package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts +19 -4
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +19 -4
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +25 -1
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +24 -0
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/ShardId.d.ts +24 -2
- package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardId.js +24 -2
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts +27 -3
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +63 -20
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +60 -16
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +61 -17
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts +27 -14
- package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingRegistrationEvent.js +28 -15
- package/dist/unstable/cluster/ShardingRegistrationEvent.js.map +1 -1
- package/dist/unstable/cluster/SingleRunner.d.ts +26 -1
- package/dist/unstable/cluster/SingleRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/SingleRunner.js +26 -1
- package/dist/unstable/cluster/SingleRunner.js.map +1 -1
- package/dist/unstable/cluster/Singleton.d.ts +51 -9
- package/dist/unstable/cluster/Singleton.d.ts.map +1 -1
- package/dist/unstable/cluster/Singleton.js +51 -9
- package/dist/unstable/cluster/Singleton.js.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts +27 -13
- package/dist/unstable/cluster/SingletonAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.js +27 -13
- package/dist/unstable/cluster/SingletonAddress.js.map +1 -1
- package/dist/unstable/cluster/Snowflake.d.ts +19 -5
- package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
- package/dist/unstable/cluster/Snowflake.js +19 -5
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/SocketRunner.d.ts +27 -1
- package/dist/unstable/cluster/SocketRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/SocketRunner.js +27 -1
- package/dist/unstable/cluster/SocketRunner.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts +38 -0
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +73 -13
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts +20 -0
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +20 -0
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/TestRunner.d.ts +25 -14
- package/dist/unstable/cluster/TestRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/TestRunner.js +25 -14
- package/dist/unstable/cluster/TestRunner.js.map +1 -1
- package/dist/unstable/cluster/index.d.ts +0 -790
- package/dist/unstable/cluster/index.d.ts.map +1 -1
- package/dist/unstable/cluster/index.js +0 -790
- package/dist/unstable/cluster/index.js.map +1 -1
- package/dist/unstable/devtools/DevTools.d.ts +41 -11
- package/dist/unstable/devtools/DevTools.d.ts.map +1 -1
- package/dist/unstable/devtools/DevTools.js +41 -11
- package/dist/unstable/devtools/DevTools.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.d.ts +38 -0
- package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js +68 -11
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js +24 -16
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/devtools/DevToolsServer.d.ts +20 -13
- package/dist/unstable/devtools/DevToolsServer.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsServer.js +20 -13
- package/dist/unstable/devtools/DevToolsServer.js.map +1 -1
- package/dist/unstable/devtools/index.d.ts +0 -58
- package/dist/unstable/devtools/index.d.ts.map +1 -1
- package/dist/unstable/devtools/index.js +0 -58
- package/dist/unstable/devtools/index.js.map +1 -1
- package/dist/unstable/encoding/Msgpack.d.ts +2 -1
- package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.js +30 -14
- package/dist/unstable/encoding/Msgpack.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +28 -14
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Ndjson.js +28 -14
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +38 -17
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +3 -3
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/encoding/index.d.ts +0 -49
- package/dist/unstable/encoding/index.d.ts.map +1 -1
- package/dist/unstable/encoding/index.js +0 -49
- package/dist/unstable/encoding/index.js.map +1 -1
- package/dist/unstable/eventlog/Event.d.ts.map +1 -1
- package/dist/unstable/eventlog/Event.js +28 -13
- package/dist/unstable/eventlog/Event.js.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts +23 -15
- package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventGroup.js +22 -14
- package/dist/unstable/eventlog/EventGroup.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +7 -7
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js +36 -19
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +63 -25
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +61 -23
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +8 -3
- package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js +8 -3
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +49 -40
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js +28 -28
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +14 -4
- package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js +14 -4
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.d.ts +7 -2
- package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.js +7 -2
- package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +24 -2
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.js +24 -2
- package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +82 -7
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +119 -22
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +33 -7
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js +68 -24
- package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.d.ts +21 -0
- package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js +50 -14
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts +39 -15
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js +39 -15
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +30 -11
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/index.d.ts +0 -240
- package/dist/unstable/eventlog/index.d.ts.map +1 -1
- package/dist/unstable/eventlog/index.js +0 -240
- package/dist/unstable/eventlog/index.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +99 -52
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +77 -30
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts +43 -13
- package/dist/unstable/http/Etag.d.ts.map +1 -1
- package/dist/unstable/http/Etag.js +43 -13
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.d.ts +59 -17
- package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/unstable/http/FetchHttpClient.js +59 -17
- package/dist/unstable/http/FetchHttpClient.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +60 -22
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +58 -20
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +6 -2
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpBody.js +59 -15
- package/dist/unstable/http/HttpBody.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +66 -30
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +17 -7
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.d.ts +15 -14
- package/dist/unstable/http/HttpClientError.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientError.js +39 -22
- package/dist/unstable/http/HttpClientError.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts +37 -16
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +37 -16
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +35 -16
- package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js +33 -14
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +3 -3
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpEffect.js +3 -3
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts +46 -20
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMethod.js +46 -20
- package/dist/unstable/http/HttpMethod.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +19 -14
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +54 -26
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts +34 -21
- package/dist/unstable/http/HttpServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpServer.js +34 -21
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +41 -28
- package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerError.js +39 -26
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +53 -21
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +20 -5
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js +28 -14
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +64 -42
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +48 -26
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +30 -13
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpStaticServer.js +29 -12
- package/dist/unstable/http/HttpStaticServer.js.map +1 -1
- package/dist/unstable/http/HttpTraceContext.d.ts +32 -19
- package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js +32 -19
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +39 -19
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +39 -19
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/Template.d.ts +27 -14
- package/dist/unstable/http/Template.d.ts.map +1 -1
- package/dist/unstable/http/Template.js +25 -12
- package/dist/unstable/http/Template.js.map +1 -1
- package/dist/unstable/http/Url.d.ts +41 -28
- package/dist/unstable/http/Url.d.ts.map +1 -1
- package/dist/unstable/http/Url.js +32 -17
- package/dist/unstable/http/Url.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +43 -28
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +40 -25
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/http/index.d.ts +0 -452
- package/dist/unstable/http/index.d.ts.map +1 -1
- package/dist/unstable/http/index.js +0 -452
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.d.ts +50 -26
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +3 -3
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +3 -3
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +39 -25
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +28 -16
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +51 -23
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +2 -2
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +37 -17
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +34 -23
- package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +49 -25
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +49 -25
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +4 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js +28 -16
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +43 -43
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +42 -42
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts +54 -24
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.js +54 -24
- package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.js +28 -16
- package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiTest.js +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +7 -1
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +45 -27
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/httpapi/index.d.ts +0 -311
- package/dist/unstable/httpapi/index.d.ts.map +1 -1
- package/dist/unstable/httpapi/index.js +0 -311
- package/dist/unstable/httpapi/index.js.map +1 -1
- package/dist/unstable/observability/Otlp.d.ts +31 -16
- package/dist/unstable/observability/Otlp.d.ts.map +1 -1
- package/dist/unstable/observability/Otlp.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +31 -15
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpResource.js +33 -15
- package/dist/unstable/observability/OtlpResource.js.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.d.ts +27 -16
- package/dist/unstable/observability/OtlpSerialization.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.js +27 -16
- package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts +3 -3
- package/dist/unstable/observability/PrometheusMetrics.js +3 -3
- package/dist/unstable/observability/index.d.ts +0 -183
- package/dist/unstable/observability/index.d.ts.map +1 -1
- package/dist/unstable/observability/index.js +0 -183
- package/dist/unstable/observability/index.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +12 -4
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +10 -2
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +8 -3
- package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistable.js +8 -3
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.d.ts +29 -16
- package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js +27 -14
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +10 -5
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js +9 -4
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +20 -10
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +19 -9
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts.map +1 -1
- package/dist/unstable/persistence/Redis.js +33 -15
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/persistence/index.d.ts +0 -147
- package/dist/unstable/persistence/index.d.ts.map +1 -1
- package/dist/unstable/persistence/index.js +0 -147
- package/dist/unstable/persistence/index.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +14 -14
- package/dist/unstable/process/ChildProcess.js +7 -7
- package/dist/unstable/process/ChildProcessSpawner.d.ts +17 -5
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +17 -5
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/process/index.d.ts +0 -45
- package/dist/unstable/process/index.d.ts.map +1 -1
- package/dist/unstable/process/index.js +0 -45
- package/dist/unstable/process/index.js.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.d.ts +74 -22
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.js +52 -20
- package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +81 -35
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +70 -32
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomRef.d.ts +32 -16
- package/dist/unstable/reactivity/AtomRef.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRef.js +52 -25
- package/dist/unstable/reactivity/AtomRef.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.d.ts +81 -20
- package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +81 -20
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/Hydration.d.ts +6 -1
- package/dist/unstable/reactivity/Hydration.d.ts.map +1 -1
- package/dist/unstable/reactivity/Hydration.js +37 -17
- package/dist/unstable/reactivity/Hydration.js.map +1 -1
- package/dist/unstable/reactivity/Reactivity.d.ts +44 -21
- package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js +44 -21
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/reactivity/index.d.ts +0 -166
- package/dist/unstable/reactivity/index.d.ts.map +1 -1
- package/dist/unstable/reactivity/index.js +0 -166
- package/dist/unstable/reactivity/index.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +47 -32
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +15 -11
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +27 -12
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +27 -12
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.d.ts +31 -17
- package/dist/unstable/rpc/RpcClientError.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClientError.js +31 -17
- package/dist/unstable/rpc/RpcClientError.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts +29 -18
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMessage.d.ts +37 -19
- package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.js +4 -4
- package/dist/unstable/rpc/RpcMessage.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +31 -21
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js +31 -21
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +30 -20
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.js +30 -20
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +50 -33
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +48 -31
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +22 -17
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +22 -17
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/RpcTest.d.ts +31 -15
- package/dist/unstable/rpc/RpcTest.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcTest.js +31 -15
- package/dist/unstable/rpc/RpcTest.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts +29 -14
- package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcWorker.js.map +1 -1
- package/dist/unstable/rpc/index.d.ts +0 -272
- package/dist/unstable/rpc/index.d.ts.map +1 -1
- package/dist/unstable/rpc/index.js +0 -272
- package/dist/unstable/rpc/index.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +32 -33
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +25 -26
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +1 -1
- package/dist/unstable/schema/VariantSchema.js +1 -1
- package/dist/unstable/schema/index.d.ts +0 -37
- package/dist/unstable/schema/index.d.ts.map +1 -1
- package/dist/unstable/schema/index.js +0 -37
- package/dist/unstable/schema/index.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +8 -2
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +8 -2
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.d.ts +2 -2
- package/dist/unstable/socket/SocketServer.js +1 -1
- package/dist/unstable/socket/index.d.ts +0 -44
- package/dist/unstable/socket/index.d.ts.map +1 -1
- package/dist/unstable/socket/index.js +0 -44
- package/dist/unstable/socket/index.js.map +1 -1
- package/dist/unstable/sql/Migrator.d.ts.map +1 -1
- package/dist/unstable/sql/Migrator.js +39 -18
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +7 -2
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +7 -2
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.d.ts +1 -1
- package/dist/unstable/sql/SqlConnection.js +1 -1
- package/dist/unstable/sql/SqlError.d.ts +2 -2
- package/dist/unstable/sql/SqlError.d.ts.map +1 -1
- package/dist/unstable/sql/SqlError.js +33 -17
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts +3 -3
- package/dist/unstable/sql/SqlResolver.js +1 -1
- package/dist/unstable/sql/SqlSchema.d.ts +51 -21
- package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
- package/dist/unstable/sql/SqlSchema.js +51 -21
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +1 -1
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +34 -14
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/sql/index.d.ts +0 -178
- package/dist/unstable/sql/index.d.ts.map +1 -1
- package/dist/unstable/sql/index.js +0 -178
- package/dist/unstable/sql/index.js.map +1 -1
- package/dist/unstable/workers/Transferable.d.ts +32 -21
- package/dist/unstable/workers/Transferable.d.ts.map +1 -1
- package/dist/unstable/workers/Transferable.js +32 -21
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts +37 -24
- package/dist/unstable/workers/Worker.d.ts.map +1 -1
- package/dist/unstable/workers/Worker.js +35 -22
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workers/WorkerError.d.ts +1 -1
- package/dist/unstable/workers/WorkerError.d.ts.map +1 -1
- package/dist/unstable/workers/WorkerError.js +32 -16
- package/dist/unstable/workers/WorkerError.js.map +1 -1
- package/dist/unstable/workers/WorkerRunner.d.ts +31 -20
- package/dist/unstable/workers/WorkerRunner.d.ts.map +1 -1
- package/dist/unstable/workers/WorkerRunner.js +31 -20
- package/dist/unstable/workers/WorkerRunner.js.map +1 -1
- package/dist/unstable/workers/index.d.ts +0 -80
- package/dist/unstable/workers/index.d.ts.map +1 -1
- package/dist/unstable/workers/index.js +0 -80
- package/dist/unstable/workers/index.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts +2 -2
- package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableClock.js +25 -13
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +12 -12
- package/dist/unstable/workflow/DurableDeferred.js +7 -7
- package/dist/unstable/workflow/DurableQueue.d.ts +36 -18
- package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableQueue.js +36 -18
- package/dist/unstable/workflow/DurableQueue.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +22 -23
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +17 -18
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +26 -8
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +25 -7
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/index.d.ts +0 -160
- package/dist/unstable/workflow/index.d.ts.map +1 -1
- package/dist/unstable/workflow/index.js +0 -160
- package/dist/unstable/workflow/index.js.map +1 -1
- package/package.json +1 -1
- package/src/Array.ts +1557 -312
- package/src/BigDecimal.ts +646 -52
- package/src/BigInt.ts +474 -18
- package/src/Boolean.ts +239 -19
- package/src/Brand.ts +102 -11
- package/src/Cache.ts +96 -24
- package/src/Cause.ts +488 -200
- package/src/Channel.ts +647 -191
- package/src/ChannelSchema.ts +99 -6
- package/src/Chunk.ts +187 -54
- package/src/Clock.ts +60 -3
- package/src/Combiner.ts +21 -21
- package/src/Config.ts +135 -50
- package/src/ConfigProvider.ts +52 -29
- package/src/Console.ts +32 -7
- package/src/Context.ts +516 -50
- package/src/Cron.ts +116 -6
- package/src/Crypto.ts +30 -1
- package/src/Data.ts +92 -47
- package/src/DateTime.ts +313 -128
- package/src/Deferred.ts +345 -79
- package/src/Differ.ts +5 -0
- package/src/Duration.ts +203 -50
- package/src/Effect.ts +2044 -816
- package/src/Effectable.ts +16 -2
- package/src/Encoding.ts +146 -9
- package/src/Equal.ts +10 -11
- package/src/Equivalence.ts +49 -46
- package/src/ErrorReporter.ts +135 -16
- package/src/ExecutionPlan.ts +96 -26
- package/src/Exit.ts +149 -101
- package/src/Fiber.ts +321 -72
- package/src/FiberHandle.ts +6 -6
- package/src/FiberMap.ts +20 -20
- package/src/FiberSet.ts +21 -13
- package/src/FileSystem.ts +119 -39
- package/src/Filter.ts +221 -2
- package/src/Formatter.ts +4 -6
- package/src/Function.ts +164 -18
- package/src/Graph.ts +297 -25
- package/src/HKT.ts +59 -26
- package/src/Hash.ts +143 -23
- package/src/HashMap.ts +35 -37
- package/src/HashRing.ts +210 -9
- package/src/HashSet.ts +16 -16
- package/src/Inspectable.ts +86 -17
- package/src/Iterable.ts +261 -81
- package/src/JsonPatch.ts +79 -56
- package/src/JsonPointer.ts +5 -5
- package/src/JsonSchema.ts +77 -33
- package/src/Latch.ts +164 -13
- package/src/Layer.ts +297 -101
- package/src/LayerMap.ts +9 -2
- package/src/LogLevel.ts +96 -21
- package/src/Logger.ts +31 -15
- package/src/ManagedRuntime.ts +82 -10
- package/src/Match.ts +250 -59
- package/src/Metric.ts +68 -41
- package/src/MutableHashMap.ts +381 -52
- package/src/MutableHashSet.ts +145 -41
- package/src/MutableList.ts +24 -6
- package/src/MutableRef.ts +141 -4
- package/src/Newtype.ts +20 -11
- package/src/NonEmptyIterable.ts +22 -6
- package/src/Number.ts +434 -17
- package/src/Optic.ts +26 -33
- package/src/Option.ts +186 -150
- package/src/Order.ts +163 -161
- package/src/Ordering.ts +37 -5
- package/src/PartitionedSemaphore.ts +238 -15
- package/src/Path.ts +34 -6
- package/src/Pipeable.ts +29 -4
- package/src/PlatformError.ts +53 -4
- package/src/Pool.ts +174 -32
- package/src/Predicate.ts +151 -196
- package/src/PrimaryKey.ts +75 -9
- package/src/PubSub.ts +241 -66
- package/src/Pull.ts +148 -3
- package/src/Queue.ts +167 -59
- package/src/Random.ts +71 -16
- package/src/RcMap.ts +171 -9
- package/src/RcRef.ts +73 -18
- package/src/Record.ts +174 -53
- package/src/Redactable.ts +27 -23
- package/src/Redacted.ts +82 -4
- package/src/Reducer.ts +17 -7
- package/src/Ref.ts +332 -54
- package/src/References.ts +226 -30
- package/src/RegExp.ts +49 -3
- package/src/Request.ts +218 -35
- package/src/RequestResolver.ts +268 -36
- package/src/Resource.ts +62 -3
- package/src/Result.ts +380 -57
- package/src/Runtime.ts +172 -32
- package/src/Schedule.ts +510 -145
- package/src/Scheduler.ts +53 -4
- package/src/Schema.ts +975 -264
- package/src/SchemaAST.ts +239 -28
- package/src/SchemaGetter.ts +127 -129
- package/src/SchemaIssue.ts +45 -56
- package/src/SchemaParser.ts +295 -33
- package/src/SchemaRepresentation.ts +106 -77
- package/src/SchemaTransformation.ts +92 -56
- package/src/SchemaUtils.ts +38 -11
- package/src/Scope.ts +127 -25
- package/src/ScopedCache.ts +418 -21
- package/src/ScopedRef.ts +69 -7
- package/src/Semaphore.ts +348 -29
- package/src/Sink.ts +343 -45
- package/src/Stdio.ts +72 -17
- package/src/Stream.ts +880 -242
- package/src/String.ts +221 -49
- package/src/Struct.ts +54 -110
- package/src/SubscriptionRef.ts +341 -105
- package/src/Symbol.ts +25 -7
- package/src/SynchronizedRef.ts +529 -29
- package/src/Take.ts +36 -13
- package/src/Terminal.ts +76 -20
- package/src/Tracer.ts +74 -7
- package/src/Trie.ts +67 -30
- package/src/Tuple.ts +96 -108
- package/src/TxChunk.ts +42 -9
- package/src/TxDeferred.ts +85 -2
- package/src/TxHashMap.ts +22 -22
- package/src/TxHashSet.ts +22 -22
- package/src/TxPriorityQueue.ts +43 -8
- package/src/TxPubSub.ts +98 -8
- package/src/TxQueue.ts +58 -17
- package/src/TxReentrantLock.ts +88 -16
- package/src/TxRef.ts +113 -8
- package/src/TxSemaphore.ts +173 -14
- package/src/TxSubscriptionRef.ts +206 -3
- package/src/Types.ts +68 -13
- package/src/UndefinedOr.ts +171 -30
- package/src/Unify.ts +130 -22
- package/src/Utils.ts +21 -16
- package/src/index.ts +0 -5205
- package/src/internal/effect.ts +59 -29
- package/src/internal/request.ts +3 -1
- package/src/internal/schema/arbitrary.ts +14 -1
- package/src/internal/schema/representation.ts +37 -14
- package/src/testing/TestConsole.ts +105 -9
- package/src/testing/TestSchema.ts +81 -31
- package/src/testing/index.ts +0 -107
- package/src/unstable/ai/AiError.ts +33 -5
- package/src/unstable/ai/AnthropicStructuredOutput.ts +43 -11
- package/src/unstable/ai/Chat.ts +82 -33
- package/src/unstable/ai/EmbeddingModel.ts +104 -8
- package/src/unstable/ai/IdGenerator.ts +8 -3
- package/src/unstable/ai/LanguageModel.ts +51 -7
- package/src/unstable/ai/McpSchema.ts +299 -169
- package/src/unstable/ai/McpServer.ts +108 -14
- package/src/unstable/ai/Model.ts +35 -13
- package/src/unstable/ai/OpenAiStructuredOutput.ts +48 -1
- package/src/unstable/ai/Prompt.ts +24 -3
- package/src/unstable/ai/Response.ts +71 -13
- package/src/unstable/ai/ResponseIdTracker.ts +34 -12
- package/src/unstable/ai/Telemetry.ts +40 -27
- package/src/unstable/ai/Tokenizer.ts +41 -25
- package/src/unstable/ai/Tool.ts +85 -24
- package/src/unstable/ai/Toolkit.ts +32 -4
- package/src/unstable/ai/index.ts +0 -560
- package/src/unstable/cli/Argument.ts +1 -1
- package/src/unstable/cli/CliError.ts +3 -3
- package/src/unstable/cli/CliOutput.ts +1 -1
- package/src/unstable/cli/Command.ts +136 -8
- package/src/unstable/cli/Completions.ts +41 -1
- package/src/unstable/cli/Flag.ts +24 -12
- package/src/unstable/cli/GlobalFlag.ts +39 -8
- package/src/unstable/cli/Param.ts +137 -11
- package/src/unstable/cli/Primitive.ts +59 -10
- package/src/unstable/cli/Prompt.ts +63 -14
- package/src/unstable/cli/index.ts +0 -220
- package/src/unstable/cli/internal/parser.ts +1 -1
- package/src/unstable/cluster/ClusterCron.ts +1 -1
- package/src/unstable/cluster/ClusterError.ts +61 -22
- package/src/unstable/cluster/ClusterMetrics.ts +58 -5
- package/src/unstable/cluster/ClusterSchema.ts +87 -26
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +63 -11
- package/src/unstable/cluster/DeliverAt.ts +6 -1
- package/src/unstable/cluster/Entity.ts +33 -6
- package/src/unstable/cluster/EntityAddress.ts +19 -0
- package/src/unstable/cluster/EntityId.ts +44 -7
- package/src/unstable/cluster/EntityResource.ts +5 -6
- package/src/unstable/cluster/EntityType.ts +19 -0
- package/src/unstable/cluster/Envelope.ts +11 -11
- package/src/unstable/cluster/HttpRunner.ts +42 -22
- package/src/unstable/cluster/K8sHttpClient.ts +32 -13
- package/src/unstable/cluster/MachineId.ts +35 -9
- package/src/unstable/cluster/Message.ts +11 -11
- package/src/unstable/cluster/MessageStorage.ts +38 -24
- package/src/unstable/cluster/Reply.ts +18 -8
- package/src/unstable/cluster/Runner.ts +47 -14
- package/src/unstable/cluster/RunnerAddress.ts +52 -10
- package/src/unstable/cluster/RunnerHealth.ts +33 -16
- package/src/unstable/cluster/RunnerServer.ts +19 -4
- package/src/unstable/cluster/Runners.ts +25 -1
- package/src/unstable/cluster/ShardId.ts +24 -2
- package/src/unstable/cluster/Sharding.ts +63 -20
- package/src/unstable/cluster/ShardingConfig.ts +60 -16
- package/src/unstable/cluster/ShardingRegistrationEvent.ts +27 -14
- package/src/unstable/cluster/SingleRunner.ts +26 -1
- package/src/unstable/cluster/Singleton.ts +51 -9
- package/src/unstable/cluster/SingletonAddress.ts +27 -13
- package/src/unstable/cluster/Snowflake.ts +19 -5
- package/src/unstable/cluster/SocketRunner.ts +27 -1
- package/src/unstable/cluster/SqlMessageStorage.ts +73 -13
- package/src/unstable/cluster/SqlRunnerStorage.ts +20 -0
- package/src/unstable/cluster/TestRunner.ts +25 -14
- package/src/unstable/cluster/index.ts +0 -790
- package/src/unstable/devtools/DevTools.ts +41 -11
- package/src/unstable/devtools/DevToolsClient.ts +68 -11
- package/src/unstable/devtools/DevToolsSchema.ts +24 -16
- package/src/unstable/devtools/DevToolsServer.ts +18 -11
- package/src/unstable/devtools/index.ts +0 -58
- package/src/unstable/encoding/Msgpack.ts +30 -14
- package/src/unstable/encoding/Ndjson.ts +28 -14
- package/src/unstable/encoding/Sse.ts +38 -17
- package/src/unstable/encoding/index.ts +0 -49
- package/src/unstable/eventlog/Event.ts +30 -15
- package/src/unstable/eventlog/EventGroup.ts +23 -15
- package/src/unstable/eventlog/EventJournal.ts +38 -21
- package/src/unstable/eventlog/EventLog.ts +63 -25
- package/src/unstable/eventlog/EventLogEncryption.ts +8 -3
- package/src/unstable/eventlog/EventLogMessage.ts +49 -40
- package/src/unstable/eventlog/EventLogRemote.ts +14 -4
- package/src/unstable/eventlog/EventLogServer.ts +36 -17
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +24 -2
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +119 -22
- package/src/unstable/eventlog/EventLogSessionAuth.ts +68 -24
- package/src/unstable/eventlog/SqlEventJournal.ts +50 -14
- package/src/unstable/eventlog/SqlEventLogServerEncrypted.ts +39 -15
- package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +30 -11
- package/src/unstable/eventlog/index.ts +0 -240
- package/src/unstable/http/Cookies.ts +97 -50
- package/src/unstable/http/Etag.ts +43 -13
- package/src/unstable/http/FetchHttpClient.ts +59 -17
- package/src/unstable/http/Headers.ts +62 -24
- package/src/unstable/http/HttpBody.ts +59 -15
- package/src/unstable/http/HttpClient.ts +119 -33
- package/src/unstable/http/HttpClientError.ts +41 -24
- package/src/unstable/http/HttpClientRequest.ts +37 -16
- package/src/unstable/http/HttpClientResponse.ts +33 -14
- package/src/unstable/http/HttpEffect.ts +35 -18
- package/src/unstable/http/HttpMethod.ts +46 -20
- package/src/unstable/http/HttpRouter.ts +58 -30
- package/src/unstable/http/HttpServer.ts +34 -21
- package/src/unstable/http/HttpServerError.ts +41 -28
- package/src/unstable/http/HttpServerRequest.ts +51 -19
- package/src/unstable/http/HttpServerRespondable.ts +28 -14
- package/src/unstable/http/HttpServerResponse.ts +66 -44
- package/src/unstable/http/HttpStaticServer.ts +29 -12
- package/src/unstable/http/HttpTraceContext.ts +32 -19
- package/src/unstable/http/Multipart.ts +39 -19
- package/src/unstable/http/Template.ts +25 -12
- package/src/unstable/http/Url.ts +41 -28
- package/src/unstable/http/UrlParams.ts +43 -28
- package/src/unstable/http/index.ts +0 -452
- package/src/unstable/httpapi/HttpApi.ts +48 -24
- package/src/unstable/httpapi/HttpApiBuilder.ts +40 -26
- package/src/unstable/httpapi/HttpApiClient.ts +28 -16
- package/src/unstable/httpapi/HttpApiEndpoint.ts +51 -23
- package/src/unstable/httpapi/HttpApiError.ts +38 -18
- package/src/unstable/httpapi/HttpApiGroup.ts +34 -23
- package/src/unstable/httpapi/HttpApiMiddleware.ts +49 -25
- package/src/unstable/httpapi/HttpApiScalar.ts +32 -17
- package/src/unstable/httpapi/HttpApiSchema.ts +43 -43
- package/src/unstable/httpapi/HttpApiSecurity.ts +54 -24
- package/src/unstable/httpapi/HttpApiSwagger.ts +28 -16
- package/src/unstable/httpapi/HttpApiTest.ts +1 -1
- package/src/unstable/httpapi/OpenApi.ts +43 -25
- package/src/unstable/httpapi/index.ts +0 -311
- package/src/unstable/observability/Otlp.ts +31 -16
- package/src/unstable/observability/OtlpLogger.ts +31 -15
- package/src/unstable/observability/OtlpResource.ts +33 -15
- package/src/unstable/observability/OtlpSerialization.ts +25 -14
- package/src/unstable/observability/PrometheusMetrics.ts +3 -3
- package/src/unstable/observability/index.ts +0 -183
- package/src/unstable/persistence/KeyValueStore.ts +12 -4
- package/src/unstable/persistence/Persistable.ts +8 -3
- package/src/unstable/persistence/PersistedCache.ts +27 -14
- package/src/unstable/persistence/PersistedQueue.ts +10 -5
- package/src/unstable/persistence/RateLimiter.ts +20 -10
- package/src/unstable/persistence/Redis.ts +33 -15
- package/src/unstable/persistence/index.ts +0 -147
- package/src/unstable/process/ChildProcess.ts +14 -14
- package/src/unstable/process/ChildProcessSpawner.ts +17 -5
- package/src/unstable/process/index.ts +0 -45
- package/src/unstable/reactivity/AsyncResult.ts +96 -24
- package/src/unstable/reactivity/Atom.ts +89 -35
- package/src/unstable/reactivity/AtomRef.ts +58 -25
- package/src/unstable/reactivity/AtomRegistry.ts +79 -18
- package/src/unstable/reactivity/Hydration.ts +37 -17
- package/src/unstable/reactivity/Reactivity.ts +42 -19
- package/src/unstable/reactivity/index.ts +0 -166
- package/src/unstable/rpc/Rpc.ts +47 -32
- package/src/unstable/rpc/RpcClient.ts +58 -34
- package/src/unstable/rpc/RpcClientError.ts +29 -15
- package/src/unstable/rpc/RpcGroup.ts +28 -17
- package/src/unstable/rpc/RpcMessage.ts +37 -19
- package/src/unstable/rpc/RpcMiddleware.ts +31 -21
- package/src/unstable/rpc/RpcSchema.ts +30 -20
- package/src/unstable/rpc/RpcSerialization.ts +48 -31
- package/src/unstable/rpc/RpcServer.ts +53 -40
- package/src/unstable/rpc/RpcTest.ts +29 -13
- package/src/unstable/rpc/RpcWorker.ts +29 -14
- package/src/unstable/rpc/index.ts +0 -272
- package/src/unstable/schema/Model.ts +32 -33
- package/src/unstable/schema/VariantSchema.ts +1 -1
- package/src/unstable/schema/index.ts +0 -37
- package/src/unstable/socket/Socket.ts +8 -2
- package/src/unstable/socket/SocketServer.ts +2 -2
- package/src/unstable/socket/index.ts +0 -44
- package/src/unstable/sql/Migrator.ts +39 -18
- package/src/unstable/sql/SqlClient.ts +7 -2
- package/src/unstable/sql/SqlConnection.ts +1 -1
- package/src/unstable/sql/SqlError.ts +33 -17
- package/src/unstable/sql/SqlResolver.ts +3 -3
- package/src/unstable/sql/SqlSchema.ts +51 -21
- package/src/unstable/sql/Statement.ts +35 -15
- package/src/unstable/sql/index.ts +0 -178
- package/src/unstable/workers/Transferable.ts +32 -21
- package/src/unstable/workers/Worker.ts +35 -22
- package/src/unstable/workers/WorkerError.ts +35 -19
- package/src/unstable/workers/WorkerRunner.ts +29 -18
- package/src/unstable/workers/index.ts +0 -80
- package/src/unstable/workflow/DurableClock.ts +25 -13
- package/src/unstable/workflow/DurableDeferred.ts +12 -12
- package/src/unstable/workflow/DurableQueue.ts +34 -16
- package/src/unstable/workflow/Workflow.ts +22 -23
- package/src/unstable/workflow/WorkflowEngine.ts +26 -8
- package/src/unstable/workflow/index.ts +0 -160
package/src/Array.ts
CHANGED
|
@@ -1,79 +1,80 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* -
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* -
|
|
14
|
-
*
|
|
15
|
-
* `
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* {@link
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* -
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* -
|
|
37
|
-
*
|
|
38
|
-
* -
|
|
39
|
-
*
|
|
40
|
-
* -
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* - {@link
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
2
|
+
* The `Array` module provides functional operations for JavaScript arrays,
|
|
3
|
+
* readonly arrays, and arrays that are known to contain at least one element.
|
|
4
|
+
* Operations that transform, reorder, or update collections allocate new arrays
|
|
5
|
+
* instead of mutating their inputs, while preserving useful type information
|
|
6
|
+
* such as non-emptiness when the operation can prove it.
|
|
7
|
+
*
|
|
8
|
+
* **Mental model**
|
|
9
|
+
*
|
|
10
|
+
* - A regular `Array<A>` is still the built-in JavaScript array type; this
|
|
11
|
+
* module supplies functional constructors, combinators, searches, folds,
|
|
12
|
+
* grouping, sorting, and set-like operations around it.
|
|
13
|
+
* - {@link NonEmptyReadonlyArray} and {@link NonEmptyArray} encode
|
|
14
|
+
* non-emptiness at the type level. APIs with `NonEmpty` in the name can avoid
|
|
15
|
+
* `Option` because an element is guaranteed to exist.
|
|
16
|
+
* - Most functions are dual. You can call them data-first, such as
|
|
17
|
+
* `Array.map(values, f)`, or data-last in a pipeline, such as
|
|
18
|
+
* `pipe(values, Array.map(f))`.
|
|
19
|
+
* - Safe element access returns {@link Option}; unsafe or `NonEmpty` variants
|
|
20
|
+
* are for code that already has a proof an index or element exists.
|
|
21
|
+
* - Set-like operations such as {@link union}, {@link intersection}, and
|
|
22
|
+
* {@link difference} use the {@link Equal} protocol by default. Use the
|
|
23
|
+
* `*With` variants when equality is domain-specific.
|
|
24
|
+
*
|
|
25
|
+
* **Common tasks**
|
|
26
|
+
*
|
|
27
|
+
* - Create arrays with {@link make}, {@link of}, {@link empty},
|
|
28
|
+
* {@link fromIterable}, {@link range}, {@link makeBy}, {@link replicate}, and
|
|
29
|
+
* {@link unfold}.
|
|
30
|
+
* - Access edges or indexes with {@link head}, {@link last}, {@link get},
|
|
31
|
+
* {@link tail}, and {@link init}.
|
|
32
|
+
* - Transform and flatten with {@link map}, {@link flatMap}, and
|
|
33
|
+
* {@link flatten}.
|
|
34
|
+
* - Keep, split, or deduplicate values with {@link filter}, {@link partition},
|
|
35
|
+
* {@link dedupe}, and {@link dedupeAdjacent}.
|
|
36
|
+
* - Combine collections with {@link append}, {@link prepend}, {@link appendAll},
|
|
37
|
+
* {@link prependAll}, {@link zip}, and {@link cartesian}.
|
|
38
|
+
* - Chunk, window, and slice with {@link splitAt}, {@link chunksOf},
|
|
39
|
+
* {@link span}, and {@link window}.
|
|
40
|
+
* - Sort with {@link sort}, {@link sortWith}, and {@link sortBy}.
|
|
41
|
+
* - Fold or aggregate with {@link reduce}, {@link scan}, {@link join}, and
|
|
42
|
+
* {@link countBy}.
|
|
43
|
+
* - Match empty and non-empty cases with {@link match}, {@link matchLeft}, and
|
|
44
|
+
* {@link matchRight}.
|
|
45
|
+
*
|
|
46
|
+
* **Gotchas**
|
|
47
|
+
*
|
|
48
|
+
* - {@link fromIterable} returns the original array reference when the input is
|
|
49
|
+
* already an array. Use {@link copy} when you need a fresh shallow copy.
|
|
50
|
+
* - {@link makeBy}, {@link range}, and {@link replicate} always return
|
|
51
|
+
* non-empty arrays. `range(start, end)` is inclusive and returns `[start]`
|
|
52
|
+
* when `start > end`.
|
|
53
|
+
* - Functions returning {@link Option}, such as {@link head} and
|
|
54
|
+
* {@link findFirst}, return `Option.none()` for empty inputs instead of
|
|
55
|
+
* throwing.
|
|
56
|
+
* - `NonEmpty` return types describe what the function can prove, not what may
|
|
57
|
+
* happen for a particular runtime value after filtering.
|
|
58
|
+
*
|
|
59
|
+
* **Example** (Filtering and transforming)
|
|
60
|
+
*
|
|
61
|
+
* ```ts
|
|
62
|
+
* import { Array, Option, pipe } from "effect"
|
|
63
|
+
*
|
|
64
|
+
* const numbers = [1, 2, 3, 4, 5]
|
|
65
|
+
*
|
|
66
|
+
* const doubledEvens = pipe(
|
|
67
|
+
* numbers,
|
|
68
|
+
* Array.filter((n) => n % 2 === 0),
|
|
69
|
+
* Array.map((n) => n * 2)
|
|
70
|
+
* )
|
|
71
71
|
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
72
|
+
* console.log(doubledEvens)
|
|
73
|
+
* // [4, 8]
|
|
74
74
|
*
|
|
75
|
-
* const
|
|
76
|
-
* console.log(
|
|
75
|
+
* const first = Array.head(doubledEvens)
|
|
76
|
+
* console.log(Option.getOrElse(first, () => 0))
|
|
77
|
+
* // 4
|
|
77
78
|
* ```
|
|
78
79
|
*
|
|
79
80
|
* @see {@link make} — create a non-empty array from elements
|
|
@@ -101,12 +102,12 @@ import * as Tuple from "./Tuple.ts"
|
|
|
101
102
|
import type { NoInfer, TupleOf } from "./Types.ts"
|
|
102
103
|
|
|
103
104
|
/**
|
|
104
|
-
*
|
|
105
|
+
* Exposes the global array constructor.
|
|
105
106
|
*
|
|
106
107
|
* **When to use**
|
|
107
108
|
*
|
|
108
|
-
* Use
|
|
109
|
-
*
|
|
109
|
+
* Use to access native JavaScript array constructor methods such as `isArray`
|
|
110
|
+
* or `from` from the Effect module namespace.
|
|
110
111
|
*
|
|
111
112
|
* **Example** (Using the Array constructor)
|
|
112
113
|
*
|
|
@@ -137,7 +138,7 @@ export interface ReadonlyArrayTypeLambda extends TypeLambda {
|
|
|
137
138
|
*
|
|
138
139
|
* **When to use**
|
|
139
140
|
*
|
|
140
|
-
* Use this type when you need to ensure non-emptiness at the type level while
|
|
141
|
+
* Use when you use this type when you need to ensure non-emptiness at the type level while
|
|
141
142
|
* preventing mutation. Many Array module functions accept or return this type.
|
|
142
143
|
*
|
|
143
144
|
* **Example** (Typing a non-empty array)
|
|
@@ -160,6 +161,11 @@ export type NonEmptyReadonlyArray<A> = readonly [A, ...Array<A>]
|
|
|
160
161
|
/**
|
|
161
162
|
* A mutable array guaranteed to have at least one element.
|
|
162
163
|
*
|
|
164
|
+
* **When to use**
|
|
165
|
+
*
|
|
166
|
+
* Use when mutation is acceptable and non-emptiness must be tracked at the type
|
|
167
|
+
* level.
|
|
168
|
+
*
|
|
163
169
|
* **Details**
|
|
164
170
|
*
|
|
165
171
|
* This is the mutable counterpart of {@link NonEmptyReadonlyArray}. Most Array
|
|
@@ -188,7 +194,7 @@ export type NonEmptyArray<A> = [A, ...Array<A>]
|
|
|
188
194
|
*
|
|
189
195
|
* **When to use**
|
|
190
196
|
*
|
|
191
|
-
*
|
|
197
|
+
* Use when you have literal values and want a typed non-empty array.
|
|
192
198
|
* - The element type is inferred as the union of all arguments.
|
|
193
199
|
* - Always returns a `NonEmptyArray` since at least one argument is required.
|
|
194
200
|
*
|
|
@@ -216,7 +222,7 @@ export const make = <Elements extends NonEmptyArray<unknown>>(
|
|
|
216
222
|
*
|
|
217
223
|
* **When to use**
|
|
218
224
|
*
|
|
219
|
-
*
|
|
225
|
+
* Use when you need a pre-sized array and will fill it imperatively.
|
|
220
226
|
* - Elements are typed as `A | undefined` since slots are empty.
|
|
221
227
|
* - Prefer {@link makeBy} when you can compute each element from its index.
|
|
222
228
|
*
|
|
@@ -241,7 +247,7 @@ export const allocate = <A = never>(n: number): Array<A | undefined> => new Arra
|
|
|
241
247
|
*
|
|
242
248
|
* **When to use**
|
|
243
249
|
*
|
|
244
|
-
*
|
|
250
|
+
* Use when you need an array whose values depend on the index.
|
|
245
251
|
* - `n` is normalized to an integer >= 1 — always returns at least one element.
|
|
246
252
|
* - Dual: `Array.makeBy(5, f)` or `pipe(5, Array.makeBy(f))`.
|
|
247
253
|
*
|
|
@@ -266,7 +272,7 @@ export const makeBy: {
|
|
|
266
272
|
*
|
|
267
273
|
* **When to use**
|
|
268
274
|
*
|
|
269
|
-
*
|
|
275
|
+
* Use when you need an array whose values depend on the index.
|
|
270
276
|
* - `n` is normalized to an integer >= 1 — always returns at least one element.
|
|
271
277
|
* - Dual: `Array.makeBy(5, f)` or `pipe(5, Array.makeBy(f))`.
|
|
272
278
|
*
|
|
@@ -291,7 +297,7 @@ export const makeBy: {
|
|
|
291
297
|
*
|
|
292
298
|
* **When to use**
|
|
293
299
|
*
|
|
294
|
-
*
|
|
300
|
+
* Use when you need an array whose values depend on the index.
|
|
295
301
|
* - `n` is normalized to an integer >= 1 — always returns at least one element.
|
|
296
302
|
* - Dual: `Array.makeBy(5, f)` or `pipe(5, Array.makeBy(f))`.
|
|
297
303
|
*
|
|
@@ -326,7 +332,7 @@ export const makeBy: {
|
|
|
326
332
|
*
|
|
327
333
|
* **When to use**
|
|
328
334
|
*
|
|
329
|
-
*
|
|
335
|
+
* Use when you need a sequence of consecutive integers.
|
|
330
336
|
* - If `start > end`, returns `[start]`.
|
|
331
337
|
* - Always returns a `NonEmptyArray`.
|
|
332
338
|
*
|
|
@@ -352,7 +358,7 @@ export const range = (start: number, end: number): NonEmptyArray<number> =>
|
|
|
352
358
|
*
|
|
353
359
|
* **When to use**
|
|
354
360
|
*
|
|
355
|
-
*
|
|
361
|
+
* Use when you need multiple copies of the same value.
|
|
356
362
|
* - `n` is normalized to an integer >= 1 — always returns at least one element.
|
|
357
363
|
* - Dual: `Array.replicate("a", 3)` or `pipe("a", Array.replicate(3))`.
|
|
358
364
|
*
|
|
@@ -376,7 +382,7 @@ export const replicate: {
|
|
|
376
382
|
*
|
|
377
383
|
* **When to use**
|
|
378
384
|
*
|
|
379
|
-
*
|
|
385
|
+
* Use when you need multiple copies of the same value.
|
|
380
386
|
* - `n` is normalized to an integer >= 1 — always returns at least one element.
|
|
381
387
|
* - Dual: `Array.replicate("a", 3)` or `pipe("a", Array.replicate(3))`.
|
|
382
388
|
*
|
|
@@ -400,7 +406,7 @@ export const replicate: {
|
|
|
400
406
|
*
|
|
401
407
|
* **When to use**
|
|
402
408
|
*
|
|
403
|
-
*
|
|
409
|
+
* Use when you need multiple copies of the same value.
|
|
404
410
|
* - `n` is normalized to an integer >= 1 — always returns at least one element.
|
|
405
411
|
* - Dual: `Array.replicate("a", 3)` or `pipe("a", Array.replicate(3))`.
|
|
406
412
|
*
|
|
@@ -424,6 +430,10 @@ export const replicate: {
|
|
|
424
430
|
/**
|
|
425
431
|
* Converts an `Iterable` to an `Array`.
|
|
426
432
|
*
|
|
433
|
+
* **When to use**
|
|
434
|
+
*
|
|
435
|
+
* Use to convert any `Iterable` (Set, Generator, etc.) into an array.
|
|
436
|
+
*
|
|
427
437
|
* **Details**
|
|
428
438
|
*
|
|
429
439
|
* - If the input is already an array, returns it **by reference** (no copy).
|
|
@@ -452,6 +462,11 @@ export const fromIterable = <A>(collection: Iterable<A>): Array<A> =>
|
|
|
452
462
|
/**
|
|
453
463
|
* Normalizes a value that is either a single element or an array into an array.
|
|
454
464
|
*
|
|
465
|
+
* **When to use**
|
|
466
|
+
*
|
|
467
|
+
* Use to normalize input that may be a single value or an array into a consistent
|
|
468
|
+
* array.
|
|
469
|
+
*
|
|
455
470
|
* **Details**
|
|
456
471
|
*
|
|
457
472
|
* - If the input is already an array, returns it by reference.
|
|
@@ -478,6 +493,11 @@ export const ensure = <A>(self: ReadonlyArray<A> | A): Array<A> => Array.isArray
|
|
|
478
493
|
/**
|
|
479
494
|
* Converts a record into an array of `[key, value]` tuples.
|
|
480
495
|
*
|
|
496
|
+
* **When to use**
|
|
497
|
+
*
|
|
498
|
+
* Use to convert a record into an array of key-value tuples for iteration or
|
|
499
|
+
* transformation.
|
|
500
|
+
*
|
|
481
501
|
* **Details**
|
|
482
502
|
*
|
|
483
503
|
* - Key order follows `Object.entries` semantics.
|
|
@@ -492,6 +512,9 @@ export const ensure = <A>(self: ReadonlyArray<A> | A): Array<A> => Array.isArray
|
|
|
492
512
|
* console.log(result) // [["a", 1], ["b", 2], ["c", 3]]
|
|
493
513
|
* ```
|
|
494
514
|
*
|
|
515
|
+
* @see {@link Record.toEntries} the equivalent function from the Record module
|
|
516
|
+
* @see {@link Record.fromEntries} to build a record from an array of tuples
|
|
517
|
+
*
|
|
495
518
|
* @category converting
|
|
496
519
|
* @since 2.0.0
|
|
497
520
|
*/
|
|
@@ -500,6 +523,10 @@ export const fromRecord: <K extends string, A>(self: Readonly<Record<K, A>>) =>
|
|
|
500
523
|
/**
|
|
501
524
|
* Converts an `Option` to an array: `Some(a)` becomes `[a]`, `None` becomes `[]`.
|
|
502
525
|
*
|
|
526
|
+
* **When to use**
|
|
527
|
+
*
|
|
528
|
+
* Use to convert a single `Option` into an array for downstream array operations.
|
|
529
|
+
*
|
|
503
530
|
* **Example** (Option to array)
|
|
504
531
|
*
|
|
505
532
|
* ```ts
|
|
@@ -521,7 +548,7 @@ export const fromOption: <A>(self: Option.Option<A>) => Array<A> = Option.toArra
|
|
|
521
548
|
*
|
|
522
549
|
* **When to use**
|
|
523
550
|
*
|
|
524
|
-
*
|
|
551
|
+
* Use when you need to branch on whether an array has elements.
|
|
525
552
|
* - `onNonEmpty` receives a `NonEmptyReadonlyArray`.
|
|
526
553
|
* - Dual: data-first or data-last.
|
|
527
554
|
*
|
|
@@ -550,7 +577,7 @@ export const match: {
|
|
|
550
577
|
*
|
|
551
578
|
* **When to use**
|
|
552
579
|
*
|
|
553
|
-
*
|
|
580
|
+
* Use when you need to branch on whether an array has elements.
|
|
554
581
|
* - `onNonEmpty` receives a `NonEmptyReadonlyArray`.
|
|
555
582
|
* - Dual: data-first or data-last.
|
|
556
583
|
*
|
|
@@ -584,7 +611,7 @@ export const match: {
|
|
|
584
611
|
*
|
|
585
612
|
* **When to use**
|
|
586
613
|
*
|
|
587
|
-
*
|
|
614
|
+
* Use when you need to branch on whether an array has elements.
|
|
588
615
|
* - `onNonEmpty` receives a `NonEmptyReadonlyArray`.
|
|
589
616
|
* - Dual: data-first or data-last.
|
|
590
617
|
*
|
|
@@ -626,10 +653,14 @@ export const match: {
|
|
|
626
653
|
* Pattern-matches on an array from the left, providing the first element and
|
|
627
654
|
* the remaining elements separately.
|
|
628
655
|
*
|
|
656
|
+
* **When to use**
|
|
657
|
+
*
|
|
658
|
+
* Use to pattern-match when you need the first element and remaining elements as
|
|
659
|
+
* separate values.
|
|
660
|
+
*
|
|
629
661
|
* **Details**
|
|
630
662
|
*
|
|
631
|
-
*
|
|
632
|
-
* - Use when you want to process the first element differently from the rest.
|
|
663
|
+
* `onNonEmpty` receives `(head, tail)` where `tail` is the rest of the array.
|
|
633
664
|
*
|
|
634
665
|
* **Example** (Head and tail destructuring)
|
|
635
666
|
*
|
|
@@ -655,10 +686,14 @@ export const matchLeft: {
|
|
|
655
686
|
* Pattern-matches on an array from the left, providing the first element and
|
|
656
687
|
* the remaining elements separately.
|
|
657
688
|
*
|
|
689
|
+
* **When to use**
|
|
690
|
+
*
|
|
691
|
+
* Use to pattern-match when you need the first element and remaining elements as
|
|
692
|
+
* separate values.
|
|
693
|
+
*
|
|
658
694
|
* **Details**
|
|
659
695
|
*
|
|
660
|
-
*
|
|
661
|
-
* - Use when you want to process the first element differently from the rest.
|
|
696
|
+
* `onNonEmpty` receives `(head, tail)` where `tail` is the rest of the array.
|
|
662
697
|
*
|
|
663
698
|
* **Example** (Head and tail destructuring)
|
|
664
699
|
*
|
|
@@ -689,10 +724,14 @@ export const matchLeft: {
|
|
|
689
724
|
* Pattern-matches on an array from the left, providing the first element and
|
|
690
725
|
* the remaining elements separately.
|
|
691
726
|
*
|
|
727
|
+
* **When to use**
|
|
728
|
+
*
|
|
729
|
+
* Use to pattern-match when you need the first element and remaining elements as
|
|
730
|
+
* separate values.
|
|
731
|
+
*
|
|
692
732
|
* **Details**
|
|
693
733
|
*
|
|
694
|
-
*
|
|
695
|
-
* - Use when you want to process the first element differently from the rest.
|
|
734
|
+
* `onNonEmpty` receives `(head, tail)` where `tail` is the rest of the array.
|
|
696
735
|
*
|
|
697
736
|
* **Example** (Head and tail destructuring)
|
|
698
737
|
*
|
|
@@ -732,10 +771,14 @@ export const matchLeft: {
|
|
|
732
771
|
* Pattern-matches on an array from the right, providing all elements except the
|
|
733
772
|
* last and the last element separately.
|
|
734
773
|
*
|
|
774
|
+
* **When to use**
|
|
775
|
+
*
|
|
776
|
+
* Use to pattern-match when you need all but the last element and the last element
|
|
777
|
+
* as separate values.
|
|
778
|
+
*
|
|
735
779
|
* **Details**
|
|
736
780
|
*
|
|
737
|
-
*
|
|
738
|
-
* - Use when you want to process the last element differently from the rest.
|
|
781
|
+
* `onNonEmpty` receives `(init, last)` where `init` is everything but the last element.
|
|
739
782
|
*
|
|
740
783
|
* **Example** (Init and last destructuring)
|
|
741
784
|
*
|
|
@@ -761,10 +804,14 @@ export const matchRight: {
|
|
|
761
804
|
* Pattern-matches on an array from the right, providing all elements except the
|
|
762
805
|
* last and the last element separately.
|
|
763
806
|
*
|
|
807
|
+
* **When to use**
|
|
808
|
+
*
|
|
809
|
+
* Use to pattern-match when you need all but the last element and the last element
|
|
810
|
+
* as separate values.
|
|
811
|
+
*
|
|
764
812
|
* **Details**
|
|
765
813
|
*
|
|
766
|
-
*
|
|
767
|
-
* - Use when you want to process the last element differently from the rest.
|
|
814
|
+
* `onNonEmpty` receives `(init, last)` where `init` is everything but the last element.
|
|
768
815
|
*
|
|
769
816
|
* **Example** (Init and last destructuring)
|
|
770
817
|
*
|
|
@@ -795,10 +842,14 @@ export const matchRight: {
|
|
|
795
842
|
* Pattern-matches on an array from the right, providing all elements except the
|
|
796
843
|
* last and the last element separately.
|
|
797
844
|
*
|
|
845
|
+
* **When to use**
|
|
846
|
+
*
|
|
847
|
+
* Use to pattern-match when you need all but the last element and the last element
|
|
848
|
+
* as separate values.
|
|
849
|
+
*
|
|
798
850
|
* **Details**
|
|
799
851
|
*
|
|
800
|
-
*
|
|
801
|
-
* - Use when you want to process the last element differently from the rest.
|
|
852
|
+
* `onNonEmpty` receives `(init, last)` where `init` is everything but the last element.
|
|
802
853
|
*
|
|
803
854
|
* **Example** (Init and last destructuring)
|
|
804
855
|
*
|
|
@@ -840,10 +891,13 @@ export const matchRight: {
|
|
|
840
891
|
/**
|
|
841
892
|
* Adds a single element to the front of an iterable, returning a `NonEmptyArray`.
|
|
842
893
|
*
|
|
894
|
+
* **When to use**
|
|
895
|
+
*
|
|
896
|
+
* Use to add a single element at the start of an iterable and get a `NonEmptyArray`.
|
|
897
|
+
*
|
|
843
898
|
* **Details**
|
|
844
899
|
*
|
|
845
900
|
* - Always returns a non-empty array.
|
|
846
|
-
* - Does not mutate the input.
|
|
847
901
|
*
|
|
848
902
|
* **Example** (Prepending an element)
|
|
849
903
|
*
|
|
@@ -864,10 +918,13 @@ export const prepend: {
|
|
|
864
918
|
/**
|
|
865
919
|
* Adds a single element to the front of an iterable, returning a `NonEmptyArray`.
|
|
866
920
|
*
|
|
921
|
+
* **When to use**
|
|
922
|
+
*
|
|
923
|
+
* Use to add a single element at the start of an iterable and get a `NonEmptyArray`.
|
|
924
|
+
*
|
|
867
925
|
* **Details**
|
|
868
926
|
*
|
|
869
927
|
* - Always returns a non-empty array.
|
|
870
|
-
* - Does not mutate the input.
|
|
871
928
|
*
|
|
872
929
|
* **Example** (Prepending an element)
|
|
873
930
|
*
|
|
@@ -888,10 +945,13 @@ export const prepend: {
|
|
|
888
945
|
/**
|
|
889
946
|
* Adds a single element to the front of an iterable, returning a `NonEmptyArray`.
|
|
890
947
|
*
|
|
948
|
+
* **When to use**
|
|
949
|
+
*
|
|
950
|
+
* Use to add a single element at the start of an iterable and get a `NonEmptyArray`.
|
|
951
|
+
*
|
|
891
952
|
* **Details**
|
|
892
953
|
*
|
|
893
954
|
* - Always returns a non-empty array.
|
|
894
|
-
* - Does not mutate the input.
|
|
895
955
|
*
|
|
896
956
|
* **Example** (Prepending an element)
|
|
897
957
|
*
|
|
@@ -914,10 +974,13 @@ export const prepend: {
|
|
|
914
974
|
/**
|
|
915
975
|
* Prepends all elements from a prefix iterable to the front of an array.
|
|
916
976
|
*
|
|
977
|
+
* **When to use**
|
|
978
|
+
*
|
|
979
|
+
* Use to prepend multiple elements from an iterable to the front of an array.
|
|
980
|
+
*
|
|
917
981
|
* **Details**
|
|
918
982
|
*
|
|
919
983
|
* - If either input is non-empty, the result is a `NonEmptyArray`.
|
|
920
|
-
* - Does not mutate the input.
|
|
921
984
|
*
|
|
922
985
|
* **Example** (Prepending multiple elements)
|
|
923
986
|
*
|
|
@@ -938,10 +1001,13 @@ export const prependAll: {
|
|
|
938
1001
|
/**
|
|
939
1002
|
* Prepends all elements from a prefix iterable to the front of an array.
|
|
940
1003
|
*
|
|
1004
|
+
* **When to use**
|
|
1005
|
+
*
|
|
1006
|
+
* Use to prepend multiple elements from an iterable to the front of an array.
|
|
1007
|
+
*
|
|
941
1008
|
* **Details**
|
|
942
1009
|
*
|
|
943
1010
|
* - If either input is non-empty, the result is a `NonEmptyArray`.
|
|
944
|
-
* - Does not mutate the input.
|
|
945
1011
|
*
|
|
946
1012
|
* **Example** (Prepending multiple elements)
|
|
947
1013
|
*
|
|
@@ -962,10 +1028,13 @@ export const prependAll: {
|
|
|
962
1028
|
/**
|
|
963
1029
|
* Prepends all elements from a prefix iterable to the front of an array.
|
|
964
1030
|
*
|
|
1031
|
+
* **When to use**
|
|
1032
|
+
*
|
|
1033
|
+
* Use to prepend multiple elements from an iterable to the front of an array.
|
|
1034
|
+
*
|
|
965
1035
|
* **Details**
|
|
966
1036
|
*
|
|
967
1037
|
* - If either input is non-empty, the result is a `NonEmptyArray`.
|
|
968
|
-
* - Does not mutate the input.
|
|
969
1038
|
*
|
|
970
1039
|
* **Example** (Prepending multiple elements)
|
|
971
1040
|
*
|
|
@@ -986,10 +1055,13 @@ export const prependAll: {
|
|
|
986
1055
|
/**
|
|
987
1056
|
* Prepends all elements from a prefix iterable to the front of an array.
|
|
988
1057
|
*
|
|
1058
|
+
* **When to use**
|
|
1059
|
+
*
|
|
1060
|
+
* Use to prepend multiple elements from an iterable to the front of an array.
|
|
1061
|
+
*
|
|
989
1062
|
* **Details**
|
|
990
1063
|
*
|
|
991
1064
|
* - If either input is non-empty, the result is a `NonEmptyArray`.
|
|
992
|
-
* - Does not mutate the input.
|
|
993
1065
|
*
|
|
994
1066
|
* **Example** (Prepending multiple elements)
|
|
995
1067
|
*
|
|
@@ -1010,10 +1082,13 @@ export const prependAll: {
|
|
|
1010
1082
|
/**
|
|
1011
1083
|
* Prepends all elements from a prefix iterable to the front of an array.
|
|
1012
1084
|
*
|
|
1085
|
+
* **When to use**
|
|
1086
|
+
*
|
|
1087
|
+
* Use to prepend multiple elements from an iterable to the front of an array.
|
|
1088
|
+
*
|
|
1013
1089
|
* **Details**
|
|
1014
1090
|
*
|
|
1015
1091
|
* - If either input is non-empty, the result is a `NonEmptyArray`.
|
|
1016
|
-
* - Does not mutate the input.
|
|
1017
1092
|
*
|
|
1018
1093
|
* **Example** (Prepending multiple elements)
|
|
1019
1094
|
*
|
|
@@ -1039,10 +1114,14 @@ export const prependAll: {
|
|
|
1039
1114
|
/**
|
|
1040
1115
|
* Adds a single element to the end of an iterable, returning a `NonEmptyArray`.
|
|
1041
1116
|
*
|
|
1117
|
+
* **When to use**
|
|
1118
|
+
*
|
|
1119
|
+
* Use to add one element to the end of an iterable and get a new
|
|
1120
|
+
* `NonEmptyArray`.
|
|
1121
|
+
*
|
|
1042
1122
|
* **Details**
|
|
1043
1123
|
*
|
|
1044
1124
|
* - Always returns a non-empty array.
|
|
1045
|
-
* - Does not mutate the input.
|
|
1046
1125
|
*
|
|
1047
1126
|
* **Example** (Appending an element)
|
|
1048
1127
|
*
|
|
@@ -1063,10 +1142,14 @@ export const append: {
|
|
|
1063
1142
|
/**
|
|
1064
1143
|
* Adds a single element to the end of an iterable, returning a `NonEmptyArray`.
|
|
1065
1144
|
*
|
|
1145
|
+
* **When to use**
|
|
1146
|
+
*
|
|
1147
|
+
* Use to add one element to the end of an iterable and get a new
|
|
1148
|
+
* `NonEmptyArray`.
|
|
1149
|
+
*
|
|
1066
1150
|
* **Details**
|
|
1067
1151
|
*
|
|
1068
1152
|
* - Always returns a non-empty array.
|
|
1069
|
-
* - Does not mutate the input.
|
|
1070
1153
|
*
|
|
1071
1154
|
* **Example** (Appending an element)
|
|
1072
1155
|
*
|
|
@@ -1087,10 +1170,14 @@ export const append: {
|
|
|
1087
1170
|
/**
|
|
1088
1171
|
* Adds a single element to the end of an iterable, returning a `NonEmptyArray`.
|
|
1089
1172
|
*
|
|
1173
|
+
* **When to use**
|
|
1174
|
+
*
|
|
1175
|
+
* Use to add one element to the end of an iterable and get a new
|
|
1176
|
+
* `NonEmptyArray`.
|
|
1177
|
+
*
|
|
1090
1178
|
* **Details**
|
|
1091
1179
|
*
|
|
1092
1180
|
* - Always returns a non-empty array.
|
|
1093
|
-
* - Does not mutate the input.
|
|
1094
1181
|
*
|
|
1095
1182
|
* **Example** (Appending an element)
|
|
1096
1183
|
*
|
|
@@ -1113,10 +1200,14 @@ export const append: {
|
|
|
1113
1200
|
/**
|
|
1114
1201
|
* Concatenates two iterables into a single array.
|
|
1115
1202
|
*
|
|
1203
|
+
* **When to use**
|
|
1204
|
+
*
|
|
1205
|
+
* Use to combine two iterable inputs into a new array with the second input's
|
|
1206
|
+
* elements after the first.
|
|
1207
|
+
*
|
|
1116
1208
|
* **Details**
|
|
1117
1209
|
*
|
|
1118
1210
|
* - If either input is non-empty, the result is a `NonEmptyArray`.
|
|
1119
|
-
* - Does not mutate the inputs.
|
|
1120
1211
|
*
|
|
1121
1212
|
* **Example** (Concatenating arrays)
|
|
1122
1213
|
*
|
|
@@ -1137,10 +1228,14 @@ export const appendAll: {
|
|
|
1137
1228
|
/**
|
|
1138
1229
|
* Concatenates two iterables into a single array.
|
|
1139
1230
|
*
|
|
1231
|
+
* **When to use**
|
|
1232
|
+
*
|
|
1233
|
+
* Use to combine two iterable inputs into a new array with the second input's
|
|
1234
|
+
* elements after the first.
|
|
1235
|
+
*
|
|
1140
1236
|
* **Details**
|
|
1141
1237
|
*
|
|
1142
1238
|
* - If either input is non-empty, the result is a `NonEmptyArray`.
|
|
1143
|
-
* - Does not mutate the inputs.
|
|
1144
1239
|
*
|
|
1145
1240
|
* **Example** (Concatenating arrays)
|
|
1146
1241
|
*
|
|
@@ -1161,10 +1256,14 @@ export const appendAll: {
|
|
|
1161
1256
|
/**
|
|
1162
1257
|
* Concatenates two iterables into a single array.
|
|
1163
1258
|
*
|
|
1259
|
+
* **When to use**
|
|
1260
|
+
*
|
|
1261
|
+
* Use to combine two iterable inputs into a new array with the second input's
|
|
1262
|
+
* elements after the first.
|
|
1263
|
+
*
|
|
1164
1264
|
* **Details**
|
|
1165
1265
|
*
|
|
1166
1266
|
* - If either input is non-empty, the result is a `NonEmptyArray`.
|
|
1167
|
-
* - Does not mutate the inputs.
|
|
1168
1267
|
*
|
|
1169
1268
|
* **Example** (Concatenating arrays)
|
|
1170
1269
|
*
|
|
@@ -1185,10 +1284,14 @@ export const appendAll: {
|
|
|
1185
1284
|
/**
|
|
1186
1285
|
* Concatenates two iterables into a single array.
|
|
1187
1286
|
*
|
|
1287
|
+
* **When to use**
|
|
1288
|
+
*
|
|
1289
|
+
* Use to combine two iterable inputs into a new array with the second input's
|
|
1290
|
+
* elements after the first.
|
|
1291
|
+
*
|
|
1188
1292
|
* **Details**
|
|
1189
1293
|
*
|
|
1190
1294
|
* - If either input is non-empty, the result is a `NonEmptyArray`.
|
|
1191
|
-
* - Does not mutate the inputs.
|
|
1192
1295
|
*
|
|
1193
1296
|
* **Example** (Concatenating arrays)
|
|
1194
1297
|
*
|
|
@@ -1209,10 +1312,14 @@ export const appendAll: {
|
|
|
1209
1312
|
/**
|
|
1210
1313
|
* Concatenates two iterables into a single array.
|
|
1211
1314
|
*
|
|
1315
|
+
* **When to use**
|
|
1316
|
+
*
|
|
1317
|
+
* Use to combine two iterable inputs into a new array with the second input's
|
|
1318
|
+
* elements after the first.
|
|
1319
|
+
*
|
|
1212
1320
|
* **Details**
|
|
1213
1321
|
*
|
|
1214
1322
|
* - If either input is non-empty, the result is a `NonEmptyArray`.
|
|
1215
|
-
* - Does not mutate the inputs.
|
|
1216
1323
|
*
|
|
1217
1324
|
* **Example** (Concatenating arrays)
|
|
1218
1325
|
*
|
|
@@ -1236,7 +1343,11 @@ export const appendAll: {
|
|
|
1236
1343
|
)
|
|
1237
1344
|
|
|
1238
1345
|
/**
|
|
1239
|
-
*
|
|
1346
|
+
* Folds left-to-right while keeping every intermediate accumulator value.
|
|
1347
|
+
*
|
|
1348
|
+
* **When to use**
|
|
1349
|
+
*
|
|
1350
|
+
* Use to compute a running accumulator where each intermediate value is needed.
|
|
1240
1351
|
*
|
|
1241
1352
|
* **Details**
|
|
1242
1353
|
*
|
|
@@ -1261,7 +1372,11 @@ export const appendAll: {
|
|
|
1261
1372
|
*/
|
|
1262
1373
|
export const scan: {
|
|
1263
1374
|
/**
|
|
1264
|
-
*
|
|
1375
|
+
* Folds left-to-right while keeping every intermediate accumulator value.
|
|
1376
|
+
*
|
|
1377
|
+
* **When to use**
|
|
1378
|
+
*
|
|
1379
|
+
* Use to compute a running accumulator where each intermediate value is needed.
|
|
1265
1380
|
*
|
|
1266
1381
|
* **Details**
|
|
1267
1382
|
*
|
|
@@ -1286,7 +1401,11 @@ export const scan: {
|
|
|
1286
1401
|
*/
|
|
1287
1402
|
<B, A>(b: B, f: (b: B, a: A) => B): (self: Iterable<A>) => NonEmptyArray<B>
|
|
1288
1403
|
/**
|
|
1289
|
-
*
|
|
1404
|
+
* Folds left-to-right while keeping every intermediate accumulator value.
|
|
1405
|
+
*
|
|
1406
|
+
* **When to use**
|
|
1407
|
+
*
|
|
1408
|
+
* Use to compute a running accumulator where each intermediate value is needed.
|
|
1290
1409
|
*
|
|
1291
1410
|
* **Details**
|
|
1292
1411
|
*
|
|
@@ -1321,7 +1440,12 @@ export const scan: {
|
|
|
1321
1440
|
})
|
|
1322
1441
|
|
|
1323
1442
|
/**
|
|
1324
|
-
*
|
|
1443
|
+
* Folds right-to-left while keeping every intermediate accumulator value.
|
|
1444
|
+
*
|
|
1445
|
+
* **When to use**
|
|
1446
|
+
*
|
|
1447
|
+
* Use to compute a running accumulator from right to left where each intermediate
|
|
1448
|
+
* value is needed.
|
|
1325
1449
|
*
|
|
1326
1450
|
* **Details**
|
|
1327
1451
|
*
|
|
@@ -1345,7 +1469,12 @@ export const scan: {
|
|
|
1345
1469
|
*/
|
|
1346
1470
|
export const scanRight: {
|
|
1347
1471
|
/**
|
|
1348
|
-
*
|
|
1472
|
+
* Folds right-to-left while keeping every intermediate accumulator value.
|
|
1473
|
+
*
|
|
1474
|
+
* **When to use**
|
|
1475
|
+
*
|
|
1476
|
+
* Use to compute a running accumulator from right to left where each intermediate
|
|
1477
|
+
* value is needed.
|
|
1349
1478
|
*
|
|
1350
1479
|
* **Details**
|
|
1351
1480
|
*
|
|
@@ -1369,7 +1498,12 @@ export const scanRight: {
|
|
|
1369
1498
|
*/
|
|
1370
1499
|
<B, A>(b: B, f: (b: B, a: A) => B): (self: Iterable<A>) => NonEmptyArray<B>
|
|
1371
1500
|
/**
|
|
1372
|
-
*
|
|
1501
|
+
* Folds right-to-left while keeping every intermediate accumulator value.
|
|
1502
|
+
*
|
|
1503
|
+
* **When to use**
|
|
1504
|
+
*
|
|
1505
|
+
* Use to compute a running accumulator from right to left where each intermediate
|
|
1506
|
+
* value is needed.
|
|
1373
1507
|
*
|
|
1374
1508
|
* **Details**
|
|
1375
1509
|
*
|
|
@@ -1403,7 +1537,11 @@ export const scanRight: {
|
|
|
1403
1537
|
})
|
|
1404
1538
|
|
|
1405
1539
|
/**
|
|
1406
|
-
*
|
|
1540
|
+
* Checks whether a value is an `Array`.
|
|
1541
|
+
*
|
|
1542
|
+
* **When to use**
|
|
1543
|
+
*
|
|
1544
|
+
* Use to verify a value is a mutable array, narrowing its type to `Array<unknown>`.
|
|
1407
1545
|
*
|
|
1408
1546
|
* **Details**
|
|
1409
1547
|
*
|
|
@@ -1427,7 +1565,11 @@ export const scanRight: {
|
|
|
1427
1565
|
*/
|
|
1428
1566
|
export const isArray: {
|
|
1429
1567
|
/**
|
|
1430
|
-
*
|
|
1568
|
+
* Checks whether a value is an `Array`.
|
|
1569
|
+
*
|
|
1570
|
+
* **When to use**
|
|
1571
|
+
*
|
|
1572
|
+
* Use to verify a value is a mutable array, narrowing its type to `Array<unknown>`.
|
|
1431
1573
|
*
|
|
1432
1574
|
* **Details**
|
|
1433
1575
|
*
|
|
@@ -1451,7 +1593,11 @@ export const isArray: {
|
|
|
1451
1593
|
*/
|
|
1452
1594
|
(self: unknown): self is Array<unknown>
|
|
1453
1595
|
/**
|
|
1454
|
-
*
|
|
1596
|
+
* Checks whether a value is an `Array`.
|
|
1597
|
+
*
|
|
1598
|
+
* **When to use**
|
|
1599
|
+
*
|
|
1600
|
+
* Use to verify a value is a mutable array, narrowing its type to `Array<unknown>`.
|
|
1455
1601
|
*
|
|
1456
1602
|
* **Details**
|
|
1457
1603
|
*
|
|
@@ -1477,7 +1623,7 @@ export const isArray: {
|
|
|
1477
1623
|
} = Array.isArray
|
|
1478
1624
|
|
|
1479
1625
|
/**
|
|
1480
|
-
*
|
|
1626
|
+
* Checks whether a mutable `Array` is empty, narrowing the type to `[]`.
|
|
1481
1627
|
*
|
|
1482
1628
|
* **Example** (Checking for an empty array)
|
|
1483
1629
|
*
|
|
@@ -1497,7 +1643,7 @@ export const isArray: {
|
|
|
1497
1643
|
export const isArrayEmpty = <A>(self: Array<A>): self is [] => self.length === 0
|
|
1498
1644
|
|
|
1499
1645
|
/**
|
|
1500
|
-
*
|
|
1646
|
+
* Checks whether a `ReadonlyArray` is empty, narrowing the type to `readonly []`.
|
|
1501
1647
|
*
|
|
1502
1648
|
* **Example** (Checking for an empty readonly array)
|
|
1503
1649
|
*
|
|
@@ -1517,7 +1663,7 @@ export const isArrayEmpty = <A>(self: Array<A>): self is [] => self.length === 0
|
|
|
1517
1663
|
export const isReadonlyArrayEmpty: <A>(self: ReadonlyArray<A>) => self is readonly [] = isArrayEmpty as any
|
|
1518
1664
|
|
|
1519
1665
|
/**
|
|
1520
|
-
*
|
|
1666
|
+
* Checks whether a mutable `Array` is non-empty, narrowing the type to
|
|
1521
1667
|
* `NonEmptyArray`.
|
|
1522
1668
|
*
|
|
1523
1669
|
* **Example** (Checking for a non-empty array)
|
|
@@ -1538,7 +1684,7 @@ export const isReadonlyArrayEmpty: <A>(self: ReadonlyArray<A>) => self is readon
|
|
|
1538
1684
|
export const isArrayNonEmpty: <A>(self: Array<A>) => self is NonEmptyArray<A> = internalArray.isArrayNonEmpty
|
|
1539
1685
|
|
|
1540
1686
|
/**
|
|
1541
|
-
*
|
|
1687
|
+
* Checks whether a `ReadonlyArray` is non-empty, narrowing the type to
|
|
1542
1688
|
* `NonEmptyReadonlyArray`.
|
|
1543
1689
|
*
|
|
1544
1690
|
* **Example** (Checking for a non-empty readonly array)
|
|
@@ -1562,6 +1708,10 @@ export const isReadonlyArrayNonEmpty: <A>(self: ReadonlyArray<A>) => self is Non
|
|
|
1562
1708
|
/**
|
|
1563
1709
|
* Returns the number of elements in a `ReadonlyArray`.
|
|
1564
1710
|
*
|
|
1711
|
+
* **When to use**
|
|
1712
|
+
*
|
|
1713
|
+
* Use when you need length as a composable function rather than a property access.
|
|
1714
|
+
*
|
|
1565
1715
|
* **Example** (Getting the length)
|
|
1566
1716
|
*
|
|
1567
1717
|
* ```ts
|
|
@@ -1583,9 +1733,14 @@ export function isOutOfBounds<A>(i: number, as: ReadonlyArray<A>): boolean {
|
|
|
1583
1733
|
const clamp = <A>(i: number, as: ReadonlyArray<A>): number => Math.floor(Math.min(Math.max(0, i), as.length))
|
|
1584
1734
|
|
|
1585
1735
|
/**
|
|
1586
|
-
*
|
|
1736
|
+
* Reads an element at the given index safely, returning `Option.some` or
|
|
1587
1737
|
* `Option.none` if the index is out of bounds.
|
|
1588
1738
|
*
|
|
1739
|
+
* **When to use**
|
|
1740
|
+
*
|
|
1741
|
+
* Use when you need to read an array element by index and handle an
|
|
1742
|
+
* out-of-bounds index as `Option.none`.
|
|
1743
|
+
*
|
|
1589
1744
|
* **Details**
|
|
1590
1745
|
*
|
|
1591
1746
|
* - The index is floored to an integer.
|
|
@@ -1600,18 +1755,23 @@ const clamp = <A>(i: number, as: ReadonlyArray<A>): number => Math.floor(Math.mi
|
|
|
1600
1755
|
* console.log(Array.get([1, 2, 3], 10)) // None
|
|
1601
1756
|
* ```
|
|
1602
1757
|
*
|
|
1603
|
-
* @see {@link getUnsafe}
|
|
1604
|
-
* @see {@link head}
|
|
1605
|
-
* @see {@link last}
|
|
1758
|
+
* @see {@link getUnsafe} for indexed access that throws when the index is out of bounds
|
|
1759
|
+
* @see {@link head} for reading the first element as an `Option`
|
|
1760
|
+
* @see {@link last} for reading the last element as an `Option`
|
|
1606
1761
|
*
|
|
1607
1762
|
* @category getters
|
|
1608
1763
|
* @since 2.0.0
|
|
1609
1764
|
*/
|
|
1610
1765
|
export const get: {
|
|
1611
1766
|
/**
|
|
1612
|
-
*
|
|
1767
|
+
* Reads an element at the given index safely, returning `Option.some` or
|
|
1613
1768
|
* `Option.none` if the index is out of bounds.
|
|
1614
1769
|
*
|
|
1770
|
+
* **When to use**
|
|
1771
|
+
*
|
|
1772
|
+
* Use when you need to read an array element by index and handle an
|
|
1773
|
+
* out-of-bounds index as `Option.none`.
|
|
1774
|
+
*
|
|
1615
1775
|
* **Details**
|
|
1616
1776
|
*
|
|
1617
1777
|
* - The index is floored to an integer.
|
|
@@ -1626,18 +1786,23 @@ export const get: {
|
|
|
1626
1786
|
* console.log(Array.get([1, 2, 3], 10)) // None
|
|
1627
1787
|
* ```
|
|
1628
1788
|
*
|
|
1629
|
-
* @see {@link getUnsafe}
|
|
1630
|
-
* @see {@link head}
|
|
1631
|
-
* @see {@link last}
|
|
1789
|
+
* @see {@link getUnsafe} for indexed access that throws when the index is out of bounds
|
|
1790
|
+
* @see {@link head} for reading the first element as an `Option`
|
|
1791
|
+
* @see {@link last} for reading the last element as an `Option`
|
|
1632
1792
|
*
|
|
1633
1793
|
* @category getters
|
|
1634
1794
|
* @since 2.0.0
|
|
1635
1795
|
*/
|
|
1636
1796
|
(index: number): <A>(self: ReadonlyArray<A>) => Option.Option<A>
|
|
1637
1797
|
/**
|
|
1638
|
-
*
|
|
1798
|
+
* Reads an element at the given index safely, returning `Option.some` or
|
|
1639
1799
|
* `Option.none` if the index is out of bounds.
|
|
1640
1800
|
*
|
|
1801
|
+
* **When to use**
|
|
1802
|
+
*
|
|
1803
|
+
* Use when you need to read an array element by index and handle an
|
|
1804
|
+
* out-of-bounds index as `Option.none`.
|
|
1805
|
+
*
|
|
1641
1806
|
* **Details**
|
|
1642
1807
|
*
|
|
1643
1808
|
* - The index is floored to an integer.
|
|
@@ -1652,9 +1817,9 @@ export const get: {
|
|
|
1652
1817
|
* console.log(Array.get([1, 2, 3], 10)) // None
|
|
1653
1818
|
* ```
|
|
1654
1819
|
*
|
|
1655
|
-
* @see {@link getUnsafe}
|
|
1656
|
-
* @see {@link head}
|
|
1657
|
-
* @see {@link last}
|
|
1820
|
+
* @see {@link getUnsafe} for indexed access that throws when the index is out of bounds
|
|
1821
|
+
* @see {@link head} for reading the first element as an `Option`
|
|
1822
|
+
* @see {@link last} for reading the last element as an `Option`
|
|
1658
1823
|
*
|
|
1659
1824
|
* @category getters
|
|
1660
1825
|
* @since 2.0.0
|
|
@@ -1668,6 +1833,11 @@ export const get: {
|
|
|
1668
1833
|
/**
|
|
1669
1834
|
* Reads an element at the given index, throwing if the index is out of bounds.
|
|
1670
1835
|
*
|
|
1836
|
+
* **When to use**
|
|
1837
|
+
*
|
|
1838
|
+
* Use to read an element at a known valid index when out-of-bounds would be a
|
|
1839
|
+
* programming error.
|
|
1840
|
+
*
|
|
1671
1841
|
* **Details**
|
|
1672
1842
|
*
|
|
1673
1843
|
* - Throws an `Error` with the message `"Index out of bounds: <i>"`.
|
|
@@ -1691,6 +1861,11 @@ export const getUnsafe: {
|
|
|
1691
1861
|
/**
|
|
1692
1862
|
* Reads an element at the given index, throwing if the index is out of bounds.
|
|
1693
1863
|
*
|
|
1864
|
+
* **When to use**
|
|
1865
|
+
*
|
|
1866
|
+
* Use to read an element at a known valid index when out-of-bounds would be a
|
|
1867
|
+
* programming error.
|
|
1868
|
+
*
|
|
1694
1869
|
* **Details**
|
|
1695
1870
|
*
|
|
1696
1871
|
* - Throws an `Error` with the message `"Index out of bounds: <i>"`.
|
|
@@ -1714,6 +1889,11 @@ export const getUnsafe: {
|
|
|
1714
1889
|
/**
|
|
1715
1890
|
* Reads an element at the given index, throwing if the index is out of bounds.
|
|
1716
1891
|
*
|
|
1892
|
+
* **When to use**
|
|
1893
|
+
*
|
|
1894
|
+
* Use to read an element at a known valid index when out-of-bounds would be a
|
|
1895
|
+
* programming error.
|
|
1896
|
+
*
|
|
1717
1897
|
* **Details**
|
|
1718
1898
|
*
|
|
1719
1899
|
* - Throws an `Error` with the message `"Index out of bounds: <i>"`.
|
|
@@ -1745,6 +1925,11 @@ export const getUnsafe: {
|
|
|
1745
1925
|
/**
|
|
1746
1926
|
* Splits a non-empty array into its first element and the remaining elements.
|
|
1747
1927
|
*
|
|
1928
|
+
* **When to use**
|
|
1929
|
+
*
|
|
1930
|
+
* Use when you have a `NonEmptyReadonlyArray` and need both its first element
|
|
1931
|
+
* and the remaining elements as separate values.
|
|
1932
|
+
*
|
|
1748
1933
|
* **Details**
|
|
1749
1934
|
*
|
|
1750
1935
|
* - Returns a tuple `[head, tail]`.
|
|
@@ -1759,9 +1944,9 @@ export const getUnsafe: {
|
|
|
1759
1944
|
* console.log(result) // [1, [2, 3, 4]]
|
|
1760
1945
|
* ```
|
|
1761
1946
|
*
|
|
1762
|
-
* @see {@link unappend}
|
|
1763
|
-
* @see {@link headNonEmpty}
|
|
1764
|
-
* @see {@link tailNonEmpty}
|
|
1947
|
+
* @see {@link unappend} for splitting a non-empty array into init and last
|
|
1948
|
+
* @see {@link headNonEmpty} for getting only the first element
|
|
1949
|
+
* @see {@link tailNonEmpty} for getting only the elements after the first
|
|
1765
1950
|
*
|
|
1766
1951
|
* @category splitting
|
|
1767
1952
|
* @since 2.0.0
|
|
@@ -1774,6 +1959,11 @@ export const unprepend = <A>(
|
|
|
1774
1959
|
* Splits a non-empty array into all elements except the last, and the last
|
|
1775
1960
|
* element.
|
|
1776
1961
|
*
|
|
1962
|
+
* **When to use**
|
|
1963
|
+
*
|
|
1964
|
+
* Use to split a non-empty array from the end when you need both the elements
|
|
1965
|
+
* before the last element and the last element.
|
|
1966
|
+
*
|
|
1777
1967
|
* **Details**
|
|
1778
1968
|
*
|
|
1779
1969
|
* - Returns a tuple `[init, last]`.
|
|
@@ -1788,9 +1978,9 @@ export const unprepend = <A>(
|
|
|
1788
1978
|
* console.log(result) // [[1, 2, 3], 4]
|
|
1789
1979
|
* ```
|
|
1790
1980
|
*
|
|
1791
|
-
* @see {@link unprepend}
|
|
1792
|
-
* @see {@link initNonEmpty}
|
|
1793
|
-
* @see {@link lastNonEmpty}
|
|
1981
|
+
* @see {@link unprepend} for splitting a non-empty array into head and tail
|
|
1982
|
+
* @see {@link initNonEmpty} for getting only the elements before the last
|
|
1983
|
+
* @see {@link lastNonEmpty} for getting only the last element
|
|
1794
1984
|
*
|
|
1795
1985
|
* @category splitting
|
|
1796
1986
|
* @since 2.0.0
|
|
@@ -1800,9 +1990,13 @@ export const unappend = <A>(
|
|
|
1800
1990
|
): [arrayWithoutLastElement: Array<A>, lastElement: A] => [initNonEmpty(self), lastNonEmpty(self)]
|
|
1801
1991
|
|
|
1802
1992
|
/**
|
|
1803
|
-
* Returns the first element of an array wrapped in `Option.some`, or
|
|
1993
|
+
* Returns the first element of an array safely wrapped in `Option.some`, or
|
|
1804
1994
|
* `Option.none` if the array is empty.
|
|
1805
1995
|
*
|
|
1996
|
+
* **When to use**
|
|
1997
|
+
*
|
|
1998
|
+
* Use to safely get the first element of an array that may be empty.
|
|
1999
|
+
*
|
|
1806
2000
|
* **Example** (Getting the first element)
|
|
1807
2001
|
*
|
|
1808
2002
|
* ```ts
|
|
@@ -1824,6 +2018,11 @@ export const head: <A>(self: ReadonlyArray<A>) => Option.Option<A> = get(0)
|
|
|
1824
2018
|
* Returns the first element of a `NonEmptyReadonlyArray` directly (no `Option`
|
|
1825
2019
|
* wrapper).
|
|
1826
2020
|
*
|
|
2021
|
+
* **When to use**
|
|
2022
|
+
*
|
|
2023
|
+
* Use to get the first element without `Option` wrapping when the array is known
|
|
2024
|
+
* to be non-empty.
|
|
2025
|
+
*
|
|
1827
2026
|
* **Example** (Getting the head of a non-empty array)
|
|
1828
2027
|
*
|
|
1829
2028
|
* ```ts
|
|
@@ -1840,9 +2039,13 @@ export const head: <A>(self: ReadonlyArray<A>) => Option.Option<A> = get(0)
|
|
|
1840
2039
|
export const headNonEmpty: <A>(self: NonEmptyReadonlyArray<A>) => A = getUnsafe(0)
|
|
1841
2040
|
|
|
1842
2041
|
/**
|
|
1843
|
-
* Returns the last element of an array wrapped in `Option.some`, or
|
|
2042
|
+
* Returns the last element of an array safely wrapped in `Option.some`, or
|
|
1844
2043
|
* `Option.none` if the array is empty.
|
|
1845
2044
|
*
|
|
2045
|
+
* **When to use**
|
|
2046
|
+
*
|
|
2047
|
+
* Use to safely get the last element of an array that may be empty.
|
|
2048
|
+
*
|
|
1846
2049
|
* **Example** (Getting the last element)
|
|
1847
2050
|
*
|
|
1848
2051
|
* ```ts
|
|
@@ -1865,6 +2068,11 @@ export const last = <A>(self: ReadonlyArray<A>): Option.Option<A> =>
|
|
|
1865
2068
|
* Returns the last element of a `NonEmptyReadonlyArray` directly (no `Option`
|
|
1866
2069
|
* wrapper).
|
|
1867
2070
|
*
|
|
2071
|
+
* **When to use**
|
|
2072
|
+
*
|
|
2073
|
+
* Use to get the last element without `Option` wrapping when the array is known
|
|
2074
|
+
* to be non-empty.
|
|
2075
|
+
*
|
|
1868
2076
|
* **Example** (Getting the last of a non-empty array)
|
|
1869
2077
|
*
|
|
1870
2078
|
* ```ts
|
|
@@ -1881,7 +2089,11 @@ export const last = <A>(self: ReadonlyArray<A>): Option.Option<A> =>
|
|
|
1881
2089
|
export const lastNonEmpty = <A>(self: NonEmptyReadonlyArray<A>): A => self[self.length - 1]
|
|
1882
2090
|
|
|
1883
2091
|
/**
|
|
1884
|
-
* Returns all elements except the first, wrapped in an `Option`.
|
|
2092
|
+
* Returns all elements except the first safely, wrapped in an `Option`.
|
|
2093
|
+
*
|
|
2094
|
+
* **When to use**
|
|
2095
|
+
*
|
|
2096
|
+
* Use to safely get all elements after the first when the iterable may be empty.
|
|
1885
2097
|
*
|
|
1886
2098
|
* **Details**
|
|
1887
2099
|
*
|
|
@@ -1911,6 +2123,10 @@ export function tail<A>(self: Iterable<A>): Option.Option<Array<A>> {
|
|
|
1911
2123
|
/**
|
|
1912
2124
|
* Returns all elements except the first of a `NonEmptyReadonlyArray`.
|
|
1913
2125
|
*
|
|
2126
|
+
* **When to use**
|
|
2127
|
+
*
|
|
2128
|
+
* Use to get all elements after the first when the array is known to be non-empty.
|
|
2129
|
+
*
|
|
1914
2130
|
* **Example** (Getting the tail of a non-empty array)
|
|
1915
2131
|
*
|
|
1916
2132
|
* ```ts
|
|
@@ -1928,7 +2144,11 @@ export function tail<A>(self: Iterable<A>): Option.Option<Array<A>> {
|
|
|
1928
2144
|
export const tailNonEmpty = <A>(self: NonEmptyReadonlyArray<A>): Array<A> => self.slice(1)
|
|
1929
2145
|
|
|
1930
2146
|
/**
|
|
1931
|
-
* Returns all elements except the last, wrapped in an `Option`.
|
|
2147
|
+
* Returns all elements except the last safely, wrapped in an `Option`.
|
|
2148
|
+
*
|
|
2149
|
+
* **When to use**
|
|
2150
|
+
*
|
|
2151
|
+
* Use to safely get all elements before the last when the iterable may be empty.
|
|
1932
2152
|
*
|
|
1933
2153
|
* **Details**
|
|
1934
2154
|
*
|
|
@@ -1958,6 +2178,10 @@ export function init<A>(self: Iterable<A>): Option.Option<Array<A>> {
|
|
|
1958
2178
|
/**
|
|
1959
2179
|
* Returns all elements except the last of a `NonEmptyReadonlyArray`.
|
|
1960
2180
|
*
|
|
2181
|
+
* **When to use**
|
|
2182
|
+
*
|
|
2183
|
+
* Use to get all elements before the last when the array is known to be non-empty.
|
|
2184
|
+
*
|
|
1961
2185
|
* **Example** (Getting init of a non-empty array)
|
|
1962
2186
|
*
|
|
1963
2187
|
* ```ts
|
|
@@ -1977,6 +2201,10 @@ export const initNonEmpty = <A>(self: NonEmptyReadonlyArray<A>): Array<A> => sel
|
|
|
1977
2201
|
/**
|
|
1978
2202
|
* Keeps the first `n` elements, creating a new array.
|
|
1979
2203
|
*
|
|
2204
|
+
* **When to use**
|
|
2205
|
+
*
|
|
2206
|
+
* Use to keep up to the first `n` elements from an iterable as a new array.
|
|
2207
|
+
*
|
|
1980
2208
|
* **Details**
|
|
1981
2209
|
*
|
|
1982
2210
|
* - `n` is clamped to `[0, length]`.
|
|
@@ -1990,9 +2218,9 @@ export const initNonEmpty = <A>(self: NonEmptyReadonlyArray<A>): Array<A> => sel
|
|
|
1990
2218
|
* console.log(Array.take([1, 2, 3, 4, 5], 3)) // [1, 2, 3]
|
|
1991
2219
|
* ```
|
|
1992
2220
|
*
|
|
1993
|
-
* @see {@link takeRight}
|
|
1994
|
-
* @see {@link takeWhile}
|
|
1995
|
-
* @see {@link drop}
|
|
2221
|
+
* @see {@link takeRight} for keeping elements from the end
|
|
2222
|
+
* @see {@link takeWhile} for keeping an initial prefix while a predicate holds
|
|
2223
|
+
* @see {@link drop} for removing elements from the start
|
|
1996
2224
|
*
|
|
1997
2225
|
* @category getters
|
|
1998
2226
|
* @since 2.0.0
|
|
@@ -2001,6 +2229,10 @@ export const take: {
|
|
|
2001
2229
|
/**
|
|
2002
2230
|
* Keeps the first `n` elements, creating a new array.
|
|
2003
2231
|
*
|
|
2232
|
+
* **When to use**
|
|
2233
|
+
*
|
|
2234
|
+
* Use to keep up to the first `n` elements from an iterable as a new array.
|
|
2235
|
+
*
|
|
2004
2236
|
* **Details**
|
|
2005
2237
|
*
|
|
2006
2238
|
* - `n` is clamped to `[0, length]`.
|
|
@@ -2014,9 +2246,9 @@ export const take: {
|
|
|
2014
2246
|
* console.log(Array.take([1, 2, 3, 4, 5], 3)) // [1, 2, 3]
|
|
2015
2247
|
* ```
|
|
2016
2248
|
*
|
|
2017
|
-
* @see {@link takeRight}
|
|
2018
|
-
* @see {@link takeWhile}
|
|
2019
|
-
* @see {@link drop}
|
|
2249
|
+
* @see {@link takeRight} for keeping elements from the end
|
|
2250
|
+
* @see {@link takeWhile} for keeping an initial prefix while a predicate holds
|
|
2251
|
+
* @see {@link drop} for removing elements from the start
|
|
2020
2252
|
*
|
|
2021
2253
|
* @category getters
|
|
2022
2254
|
* @since 2.0.0
|
|
@@ -2025,6 +2257,10 @@ export const take: {
|
|
|
2025
2257
|
/**
|
|
2026
2258
|
* Keeps the first `n` elements, creating a new array.
|
|
2027
2259
|
*
|
|
2260
|
+
* **When to use**
|
|
2261
|
+
*
|
|
2262
|
+
* Use to keep up to the first `n` elements from an iterable as a new array.
|
|
2263
|
+
*
|
|
2028
2264
|
* **Details**
|
|
2029
2265
|
*
|
|
2030
2266
|
* - `n` is clamped to `[0, length]`.
|
|
@@ -2038,9 +2274,9 @@ export const take: {
|
|
|
2038
2274
|
* console.log(Array.take([1, 2, 3, 4, 5], 3)) // [1, 2, 3]
|
|
2039
2275
|
* ```
|
|
2040
2276
|
*
|
|
2041
|
-
* @see {@link takeRight}
|
|
2042
|
-
* @see {@link takeWhile}
|
|
2043
|
-
* @see {@link drop}
|
|
2277
|
+
* @see {@link takeRight} for keeping elements from the end
|
|
2278
|
+
* @see {@link takeWhile} for keeping an initial prefix while a predicate holds
|
|
2279
|
+
* @see {@link drop} for removing elements from the start
|
|
2044
2280
|
*
|
|
2045
2281
|
* @category getters
|
|
2046
2282
|
* @since 2.0.0
|
|
@@ -2054,6 +2290,10 @@ export const take: {
|
|
|
2054
2290
|
/**
|
|
2055
2291
|
* Keeps the last `n` elements, creating a new array.
|
|
2056
2292
|
*
|
|
2293
|
+
* **When to use**
|
|
2294
|
+
*
|
|
2295
|
+
* Use to keep the last `n` elements of an iterable.
|
|
2296
|
+
*
|
|
2057
2297
|
* **Details**
|
|
2058
2298
|
*
|
|
2059
2299
|
* - `n` is clamped to `[0, length]`.
|
|
@@ -2077,6 +2317,10 @@ export const takeRight: {
|
|
|
2077
2317
|
/**
|
|
2078
2318
|
* Keeps the last `n` elements, creating a new array.
|
|
2079
2319
|
*
|
|
2320
|
+
* **When to use**
|
|
2321
|
+
*
|
|
2322
|
+
* Use to keep the last `n` elements of an iterable.
|
|
2323
|
+
*
|
|
2080
2324
|
* **Details**
|
|
2081
2325
|
*
|
|
2082
2326
|
* - `n` is clamped to `[0, length]`.
|
|
@@ -2100,6 +2344,10 @@ export const takeRight: {
|
|
|
2100
2344
|
/**
|
|
2101
2345
|
* Keeps the last `n` elements, creating a new array.
|
|
2102
2346
|
*
|
|
2347
|
+
* **When to use**
|
|
2348
|
+
*
|
|
2349
|
+
* Use to keep the last `n` elements of an iterable.
|
|
2350
|
+
*
|
|
2103
2351
|
* **Details**
|
|
2104
2352
|
*
|
|
2105
2353
|
* - `n` is clamped to `[0, length]`.
|
|
@@ -2130,6 +2378,11 @@ export const takeRight: {
|
|
|
2130
2378
|
* Takes elements from the start while the predicate holds, stopping at the
|
|
2131
2379
|
* first element that fails.
|
|
2132
2380
|
*
|
|
2381
|
+
* **When to use**
|
|
2382
|
+
*
|
|
2383
|
+
* Use to keep the leading elements of an iterable while each element satisfies
|
|
2384
|
+
* a predicate, returning the retained prefix as an array.
|
|
2385
|
+
*
|
|
2133
2386
|
* **Details**
|
|
2134
2387
|
*
|
|
2135
2388
|
* - Supports refinements for type narrowing.
|
|
@@ -2143,9 +2396,9 @@ export const takeRight: {
|
|
|
2143
2396
|
* console.log(Array.takeWhile([1, 3, 2, 4, 1, 2], (x) => x < 4)) // [1, 3, 2]
|
|
2144
2397
|
* ```
|
|
2145
2398
|
*
|
|
2146
|
-
* @see {@link take}
|
|
2147
|
-
* @see {@link dropWhile}
|
|
2148
|
-
* @see {@link span}
|
|
2399
|
+
* @see {@link take} for keeping a fixed number of leading elements
|
|
2400
|
+
* @see {@link dropWhile} for removing the matching prefix and keeping the rest
|
|
2401
|
+
* @see {@link span} for splitting the matching prefix from the remaining elements
|
|
2149
2402
|
*
|
|
2150
2403
|
* @category getters
|
|
2151
2404
|
* @since 2.0.0
|
|
@@ -2155,6 +2408,11 @@ export const takeWhile: {
|
|
|
2155
2408
|
* Takes elements from the start while the predicate holds, stopping at the
|
|
2156
2409
|
* first element that fails.
|
|
2157
2410
|
*
|
|
2411
|
+
* **When to use**
|
|
2412
|
+
*
|
|
2413
|
+
* Use to keep the leading elements of an iterable while each element satisfies
|
|
2414
|
+
* a predicate, returning the retained prefix as an array.
|
|
2415
|
+
*
|
|
2158
2416
|
* **Details**
|
|
2159
2417
|
*
|
|
2160
2418
|
* - Supports refinements for type narrowing.
|
|
@@ -2168,9 +2426,9 @@ export const takeWhile: {
|
|
|
2168
2426
|
* console.log(Array.takeWhile([1, 3, 2, 4, 1, 2], (x) => x < 4)) // [1, 3, 2]
|
|
2169
2427
|
* ```
|
|
2170
2428
|
*
|
|
2171
|
-
* @see {@link take}
|
|
2172
|
-
* @see {@link dropWhile}
|
|
2173
|
-
* @see {@link span}
|
|
2429
|
+
* @see {@link take} for keeping a fixed number of leading elements
|
|
2430
|
+
* @see {@link dropWhile} for removing the matching prefix and keeping the rest
|
|
2431
|
+
* @see {@link span} for splitting the matching prefix from the remaining elements
|
|
2174
2432
|
*
|
|
2175
2433
|
* @category getters
|
|
2176
2434
|
* @since 2.0.0
|
|
@@ -2180,6 +2438,11 @@ export const takeWhile: {
|
|
|
2180
2438
|
* Takes elements from the start while the predicate holds, stopping at the
|
|
2181
2439
|
* first element that fails.
|
|
2182
2440
|
*
|
|
2441
|
+
* **When to use**
|
|
2442
|
+
*
|
|
2443
|
+
* Use to keep the leading elements of an iterable while each element satisfies
|
|
2444
|
+
* a predicate, returning the retained prefix as an array.
|
|
2445
|
+
*
|
|
2183
2446
|
* **Details**
|
|
2184
2447
|
*
|
|
2185
2448
|
* - Supports refinements for type narrowing.
|
|
@@ -2193,9 +2456,9 @@ export const takeWhile: {
|
|
|
2193
2456
|
* console.log(Array.takeWhile([1, 3, 2, 4, 1, 2], (x) => x < 4)) // [1, 3, 2]
|
|
2194
2457
|
* ```
|
|
2195
2458
|
*
|
|
2196
|
-
* @see {@link take}
|
|
2197
|
-
* @see {@link dropWhile}
|
|
2198
|
-
* @see {@link span}
|
|
2459
|
+
* @see {@link take} for keeping a fixed number of leading elements
|
|
2460
|
+
* @see {@link dropWhile} for removing the matching prefix and keeping the rest
|
|
2461
|
+
* @see {@link span} for splitting the matching prefix from the remaining elements
|
|
2199
2462
|
*
|
|
2200
2463
|
* @category getters
|
|
2201
2464
|
* @since 2.0.0
|
|
@@ -2205,6 +2468,11 @@ export const takeWhile: {
|
|
|
2205
2468
|
* Takes elements from the start while the predicate holds, stopping at the
|
|
2206
2469
|
* first element that fails.
|
|
2207
2470
|
*
|
|
2471
|
+
* **When to use**
|
|
2472
|
+
*
|
|
2473
|
+
* Use to keep the leading elements of an iterable while each element satisfies
|
|
2474
|
+
* a predicate, returning the retained prefix as an array.
|
|
2475
|
+
*
|
|
2208
2476
|
* **Details**
|
|
2209
2477
|
*
|
|
2210
2478
|
* - Supports refinements for type narrowing.
|
|
@@ -2218,9 +2486,9 @@ export const takeWhile: {
|
|
|
2218
2486
|
* console.log(Array.takeWhile([1, 3, 2, 4, 1, 2], (x) => x < 4)) // [1, 3, 2]
|
|
2219
2487
|
* ```
|
|
2220
2488
|
*
|
|
2221
|
-
* @see {@link take}
|
|
2222
|
-
* @see {@link dropWhile}
|
|
2223
|
-
* @see {@link span}
|
|
2489
|
+
* @see {@link take} for keeping a fixed number of leading elements
|
|
2490
|
+
* @see {@link dropWhile} for removing the matching prefix and keeping the rest
|
|
2491
|
+
* @see {@link span} for splitting the matching prefix from the remaining elements
|
|
2224
2492
|
*
|
|
2225
2493
|
* @category getters
|
|
2226
2494
|
* @since 2.0.0
|
|
@@ -2230,6 +2498,11 @@ export const takeWhile: {
|
|
|
2230
2498
|
* Takes elements from the start while the predicate holds, stopping at the
|
|
2231
2499
|
* first element that fails.
|
|
2232
2500
|
*
|
|
2501
|
+
* **When to use**
|
|
2502
|
+
*
|
|
2503
|
+
* Use to keep the leading elements of an iterable while each element satisfies
|
|
2504
|
+
* a predicate, returning the retained prefix as an array.
|
|
2505
|
+
*
|
|
2233
2506
|
* **Details**
|
|
2234
2507
|
*
|
|
2235
2508
|
* - Supports refinements for type narrowing.
|
|
@@ -2243,9 +2516,9 @@ export const takeWhile: {
|
|
|
2243
2516
|
* console.log(Array.takeWhile([1, 3, 2, 4, 1, 2], (x) => x < 4)) // [1, 3, 2]
|
|
2244
2517
|
* ```
|
|
2245
2518
|
*
|
|
2246
|
-
* @see {@link take}
|
|
2247
|
-
* @see {@link dropWhile}
|
|
2248
|
-
* @see {@link span}
|
|
2519
|
+
* @see {@link take} for keeping a fixed number of leading elements
|
|
2520
|
+
* @see {@link dropWhile} for removing the matching prefix and keeping the rest
|
|
2521
|
+
* @see {@link span} for splitting the matching prefix from the remaining elements
|
|
2249
2522
|
*
|
|
2250
2523
|
* @category getters
|
|
2251
2524
|
* @since 2.0.0
|
|
@@ -2267,11 +2540,19 @@ export const takeWhile: {
|
|
|
2267
2540
|
/**
|
|
2268
2541
|
* Takes elements from the start while a `Filter` succeeds, collecting transformed values.
|
|
2269
2542
|
*
|
|
2543
|
+
* **When to use**
|
|
2544
|
+
*
|
|
2545
|
+
* Use when you need to take a prefix of elements while a function can
|
|
2546
|
+
* successfully extract or transform them, stopping at the first element
|
|
2547
|
+
* that produces a failure result.
|
|
2548
|
+
*
|
|
2270
2549
|
* **Details**
|
|
2271
2550
|
*
|
|
2272
2551
|
* - The filter receives `(element, index)`.
|
|
2273
2552
|
* - Stops at the first filter failure.
|
|
2274
2553
|
*
|
|
2554
|
+
* @see {@link takeWhile} for taking a prefix based on a boolean predicate
|
|
2555
|
+
*
|
|
2275
2556
|
* @category getters
|
|
2276
2557
|
* @since 4.0.0
|
|
2277
2558
|
*/
|
|
@@ -2279,11 +2560,19 @@ export const takeWhileFilter: {
|
|
|
2279
2560
|
/**
|
|
2280
2561
|
* Takes elements from the start while a `Filter` succeeds, collecting transformed values.
|
|
2281
2562
|
*
|
|
2563
|
+
* **When to use**
|
|
2564
|
+
*
|
|
2565
|
+
* Use when you need to take a prefix of elements while a function can
|
|
2566
|
+
* successfully extract or transform them, stopping at the first element
|
|
2567
|
+
* that produces a failure result.
|
|
2568
|
+
*
|
|
2282
2569
|
* **Details**
|
|
2283
2570
|
*
|
|
2284
2571
|
* - The filter receives `(element, index)`.
|
|
2285
2572
|
* - Stops at the first filter failure.
|
|
2286
2573
|
*
|
|
2574
|
+
* @see {@link takeWhile} for taking a prefix based on a boolean predicate
|
|
2575
|
+
*
|
|
2287
2576
|
* @category getters
|
|
2288
2577
|
* @since 4.0.0
|
|
2289
2578
|
*/
|
|
@@ -2291,11 +2580,19 @@ export const takeWhileFilter: {
|
|
|
2291
2580
|
/**
|
|
2292
2581
|
* Takes elements from the start while a `Filter` succeeds, collecting transformed values.
|
|
2293
2582
|
*
|
|
2583
|
+
* **When to use**
|
|
2584
|
+
*
|
|
2585
|
+
* Use when you need to take a prefix of elements while a function can
|
|
2586
|
+
* successfully extract or transform them, stopping at the first element
|
|
2587
|
+
* that produces a failure result.
|
|
2588
|
+
*
|
|
2294
2589
|
* **Details**
|
|
2295
2590
|
*
|
|
2296
2591
|
* - The filter receives `(element, index)`.
|
|
2297
2592
|
* - Stops at the first filter failure.
|
|
2298
2593
|
*
|
|
2594
|
+
* @see {@link takeWhile} for taking a prefix based on a boolean predicate
|
|
2595
|
+
*
|
|
2299
2596
|
* @category getters
|
|
2300
2597
|
* @since 4.0.0
|
|
2301
2598
|
*/
|
|
@@ -2332,6 +2629,11 @@ const spanIndex = <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean
|
|
|
2332
2629
|
* Splits an iterable into two arrays: the longest prefix where the predicate
|
|
2333
2630
|
* holds, and the remaining elements.
|
|
2334
2631
|
*
|
|
2632
|
+
* **When to use**
|
|
2633
|
+
*
|
|
2634
|
+
* Use to split an iterable into the longest prefix that satisfies a predicate
|
|
2635
|
+
* and the elements after that prefix when you need both parts.
|
|
2636
|
+
*
|
|
2335
2637
|
* **Details**
|
|
2336
2638
|
*
|
|
2337
2639
|
* - Equivalent to `[takeWhile(pred), dropWhile(pred)]` but more efficient
|
|
@@ -2346,9 +2648,9 @@ const spanIndex = <A>(self: Iterable<A>, predicate: (a: A, i: number) => boolean
|
|
|
2346
2648
|
* console.log(Array.span([1, 3, 2, 4, 5], (x) => x % 2 === 1)) // [[1, 3], [2, 4, 5]]
|
|
2347
2649
|
* ```
|
|
2348
2650
|
*
|
|
2349
|
-
* @see {@link takeWhile}
|
|
2350
|
-
* @see {@link dropWhile}
|
|
2351
|
-
* @see {@link splitWhere}
|
|
2651
|
+
* @see {@link takeWhile} for keeping only the matching prefix
|
|
2652
|
+
* @see {@link dropWhile} for keeping only the elements after the matching prefix
|
|
2653
|
+
* @see {@link splitWhere} for splitting at the first element that satisfies a predicate
|
|
2352
2654
|
*
|
|
2353
2655
|
* @category splitting
|
|
2354
2656
|
* @since 2.0.0
|
|
@@ -2358,6 +2660,11 @@ export const span: {
|
|
|
2358
2660
|
* Splits an iterable into two arrays: the longest prefix where the predicate
|
|
2359
2661
|
* holds, and the remaining elements.
|
|
2360
2662
|
*
|
|
2663
|
+
* **When to use**
|
|
2664
|
+
*
|
|
2665
|
+
* Use to split an iterable into the longest prefix that satisfies a predicate
|
|
2666
|
+
* and the elements after that prefix when you need both parts.
|
|
2667
|
+
*
|
|
2361
2668
|
* **Details**
|
|
2362
2669
|
*
|
|
2363
2670
|
* - Equivalent to `[takeWhile(pred), dropWhile(pred)]` but more efficient
|
|
@@ -2372,9 +2679,9 @@ export const span: {
|
|
|
2372
2679
|
* console.log(Array.span([1, 3, 2, 4, 5], (x) => x % 2 === 1)) // [[1, 3], [2, 4, 5]]
|
|
2373
2680
|
* ```
|
|
2374
2681
|
*
|
|
2375
|
-
* @see {@link takeWhile}
|
|
2376
|
-
* @see {@link dropWhile}
|
|
2377
|
-
* @see {@link splitWhere}
|
|
2682
|
+
* @see {@link takeWhile} for keeping only the matching prefix
|
|
2683
|
+
* @see {@link dropWhile} for keeping only the elements after the matching prefix
|
|
2684
|
+
* @see {@link splitWhere} for splitting at the first element that satisfies a predicate
|
|
2378
2685
|
*
|
|
2379
2686
|
* @category splitting
|
|
2380
2687
|
* @since 2.0.0
|
|
@@ -2384,6 +2691,11 @@ export const span: {
|
|
|
2384
2691
|
* Splits an iterable into two arrays: the longest prefix where the predicate
|
|
2385
2692
|
* holds, and the remaining elements.
|
|
2386
2693
|
*
|
|
2694
|
+
* **When to use**
|
|
2695
|
+
*
|
|
2696
|
+
* Use to split an iterable into the longest prefix that satisfies a predicate
|
|
2697
|
+
* and the elements after that prefix when you need both parts.
|
|
2698
|
+
*
|
|
2387
2699
|
* **Details**
|
|
2388
2700
|
*
|
|
2389
2701
|
* - Equivalent to `[takeWhile(pred), dropWhile(pred)]` but more efficient
|
|
@@ -2398,9 +2710,9 @@ export const span: {
|
|
|
2398
2710
|
* console.log(Array.span([1, 3, 2, 4, 5], (x) => x % 2 === 1)) // [[1, 3], [2, 4, 5]]
|
|
2399
2711
|
* ```
|
|
2400
2712
|
*
|
|
2401
|
-
* @see {@link takeWhile}
|
|
2402
|
-
* @see {@link dropWhile}
|
|
2403
|
-
* @see {@link splitWhere}
|
|
2713
|
+
* @see {@link takeWhile} for keeping only the matching prefix
|
|
2714
|
+
* @see {@link dropWhile} for keeping only the elements after the matching prefix
|
|
2715
|
+
* @see {@link splitWhere} for splitting at the first element that satisfies a predicate
|
|
2404
2716
|
*
|
|
2405
2717
|
* @category splitting
|
|
2406
2718
|
* @since 2.0.0
|
|
@@ -2410,6 +2722,11 @@ export const span: {
|
|
|
2410
2722
|
* Splits an iterable into two arrays: the longest prefix where the predicate
|
|
2411
2723
|
* holds, and the remaining elements.
|
|
2412
2724
|
*
|
|
2725
|
+
* **When to use**
|
|
2726
|
+
*
|
|
2727
|
+
* Use to split an iterable into the longest prefix that satisfies a predicate
|
|
2728
|
+
* and the elements after that prefix when you need both parts.
|
|
2729
|
+
*
|
|
2413
2730
|
* **Details**
|
|
2414
2731
|
*
|
|
2415
2732
|
* - Equivalent to `[takeWhile(pred), dropWhile(pred)]` but more efficient
|
|
@@ -2424,9 +2741,9 @@ export const span: {
|
|
|
2424
2741
|
* console.log(Array.span([1, 3, 2, 4, 5], (x) => x % 2 === 1)) // [[1, 3], [2, 4, 5]]
|
|
2425
2742
|
* ```
|
|
2426
2743
|
*
|
|
2427
|
-
* @see {@link takeWhile}
|
|
2428
|
-
* @see {@link dropWhile}
|
|
2429
|
-
* @see {@link splitWhere}
|
|
2744
|
+
* @see {@link takeWhile} for keeping only the matching prefix
|
|
2745
|
+
* @see {@link dropWhile} for keeping only the elements after the matching prefix
|
|
2746
|
+
* @see {@link splitWhere} for splitting at the first element that satisfies a predicate
|
|
2430
2747
|
*
|
|
2431
2748
|
* @category splitting
|
|
2432
2749
|
* @since 2.0.0
|
|
@@ -2436,6 +2753,11 @@ export const span: {
|
|
|
2436
2753
|
* Splits an iterable into two arrays: the longest prefix where the predicate
|
|
2437
2754
|
* holds, and the remaining elements.
|
|
2438
2755
|
*
|
|
2756
|
+
* **When to use**
|
|
2757
|
+
*
|
|
2758
|
+
* Use to split an iterable into the longest prefix that satisfies a predicate
|
|
2759
|
+
* and the elements after that prefix when you need both parts.
|
|
2760
|
+
*
|
|
2439
2761
|
* **Details**
|
|
2440
2762
|
*
|
|
2441
2763
|
* - Equivalent to `[takeWhile(pred), dropWhile(pred)]` but more efficient
|
|
@@ -2450,9 +2772,9 @@ export const span: {
|
|
|
2450
2772
|
* console.log(Array.span([1, 3, 2, 4, 5], (x) => x % 2 === 1)) // [[1, 3], [2, 4, 5]]
|
|
2451
2773
|
* ```
|
|
2452
2774
|
*
|
|
2453
|
-
* @see {@link takeWhile}
|
|
2454
|
-
* @see {@link dropWhile}
|
|
2455
|
-
* @see {@link splitWhere}
|
|
2775
|
+
* @see {@link takeWhile} for keeping only the matching prefix
|
|
2776
|
+
* @see {@link dropWhile} for keeping only the elements after the matching prefix
|
|
2777
|
+
* @see {@link splitWhere} for splitting at the first element that satisfies a predicate
|
|
2456
2778
|
*
|
|
2457
2779
|
* @category splitting
|
|
2458
2780
|
* @since 2.0.0
|
|
@@ -2469,6 +2791,11 @@ export const span: {
|
|
|
2469
2791
|
/**
|
|
2470
2792
|
* Removes the first `n` elements, creating a new array.
|
|
2471
2793
|
*
|
|
2794
|
+
* **When to use**
|
|
2795
|
+
*
|
|
2796
|
+
* Use to keep the suffix of an iterable after skipping a fixed number of
|
|
2797
|
+
* leading elements.
|
|
2798
|
+
*
|
|
2472
2799
|
* **Details**
|
|
2473
2800
|
*
|
|
2474
2801
|
* - `n` is clamped to `[0, length]`.
|
|
@@ -2482,9 +2809,9 @@ export const span: {
|
|
|
2482
2809
|
* console.log(Array.drop([1, 2, 3, 4, 5], 2)) // [3, 4, 5]
|
|
2483
2810
|
* ```
|
|
2484
2811
|
*
|
|
2485
|
-
* @see {@link dropRight}
|
|
2486
|
-
* @see {@link dropWhile}
|
|
2487
|
-
* @see {@link take}
|
|
2812
|
+
* @see {@link dropRight} for removing a fixed number of elements from the end
|
|
2813
|
+
* @see {@link dropWhile} for removing a prefix based on a predicate instead of a fixed count
|
|
2814
|
+
* @see {@link take} for keeping a fixed number of elements from the start
|
|
2488
2815
|
*
|
|
2489
2816
|
* @category getters
|
|
2490
2817
|
* @since 2.0.0
|
|
@@ -2493,6 +2820,11 @@ export const drop: {
|
|
|
2493
2820
|
/**
|
|
2494
2821
|
* Removes the first `n` elements, creating a new array.
|
|
2495
2822
|
*
|
|
2823
|
+
* **When to use**
|
|
2824
|
+
*
|
|
2825
|
+
* Use to keep the suffix of an iterable after skipping a fixed number of
|
|
2826
|
+
* leading elements.
|
|
2827
|
+
*
|
|
2496
2828
|
* **Details**
|
|
2497
2829
|
*
|
|
2498
2830
|
* - `n` is clamped to `[0, length]`.
|
|
@@ -2506,9 +2838,9 @@ export const drop: {
|
|
|
2506
2838
|
* console.log(Array.drop([1, 2, 3, 4, 5], 2)) // [3, 4, 5]
|
|
2507
2839
|
* ```
|
|
2508
2840
|
*
|
|
2509
|
-
* @see {@link dropRight}
|
|
2510
|
-
* @see {@link dropWhile}
|
|
2511
|
-
* @see {@link take}
|
|
2841
|
+
* @see {@link dropRight} for removing a fixed number of elements from the end
|
|
2842
|
+
* @see {@link dropWhile} for removing a prefix based on a predicate instead of a fixed count
|
|
2843
|
+
* @see {@link take} for keeping a fixed number of elements from the start
|
|
2512
2844
|
*
|
|
2513
2845
|
* @category getters
|
|
2514
2846
|
* @since 2.0.0
|
|
@@ -2517,6 +2849,11 @@ export const drop: {
|
|
|
2517
2849
|
/**
|
|
2518
2850
|
* Removes the first `n` elements, creating a new array.
|
|
2519
2851
|
*
|
|
2852
|
+
* **When to use**
|
|
2853
|
+
*
|
|
2854
|
+
* Use to keep the suffix of an iterable after skipping a fixed number of
|
|
2855
|
+
* leading elements.
|
|
2856
|
+
*
|
|
2520
2857
|
* **Details**
|
|
2521
2858
|
*
|
|
2522
2859
|
* - `n` is clamped to `[0, length]`.
|
|
@@ -2530,9 +2867,9 @@ export const drop: {
|
|
|
2530
2867
|
* console.log(Array.drop([1, 2, 3, 4, 5], 2)) // [3, 4, 5]
|
|
2531
2868
|
* ```
|
|
2532
2869
|
*
|
|
2533
|
-
* @see {@link dropRight}
|
|
2534
|
-
* @see {@link dropWhile}
|
|
2535
|
-
* @see {@link take}
|
|
2870
|
+
* @see {@link dropRight} for removing a fixed number of elements from the end
|
|
2871
|
+
* @see {@link dropWhile} for removing a prefix based on a predicate instead of a fixed count
|
|
2872
|
+
* @see {@link take} for keeping a fixed number of elements from the start
|
|
2536
2873
|
*
|
|
2537
2874
|
* @category getters
|
|
2538
2875
|
* @since 2.0.0
|
|
@@ -2546,9 +2883,13 @@ export const drop: {
|
|
|
2546
2883
|
/**
|
|
2547
2884
|
* Removes the last `n` elements, creating a new array.
|
|
2548
2885
|
*
|
|
2886
|
+
* **When to use**
|
|
2887
|
+
*
|
|
2888
|
+
* Use to remove the last `n` elements from an iterable.
|
|
2889
|
+
*
|
|
2549
2890
|
* **Details**
|
|
2550
2891
|
*
|
|
2551
|
-
*
|
|
2892
|
+
* `n` is clamped to `[0, length]`.
|
|
2552
2893
|
*
|
|
2553
2894
|
* **Example** (Dropping from the end)
|
|
2554
2895
|
*
|
|
@@ -2568,9 +2909,13 @@ export const dropRight: {
|
|
|
2568
2909
|
/**
|
|
2569
2910
|
* Removes the last `n` elements, creating a new array.
|
|
2570
2911
|
*
|
|
2912
|
+
* **When to use**
|
|
2913
|
+
*
|
|
2914
|
+
* Use to remove the last `n` elements from an iterable.
|
|
2915
|
+
*
|
|
2571
2916
|
* **Details**
|
|
2572
2917
|
*
|
|
2573
|
-
*
|
|
2918
|
+
* `n` is clamped to `[0, length]`.
|
|
2574
2919
|
*
|
|
2575
2920
|
* **Example** (Dropping from the end)
|
|
2576
2921
|
*
|
|
@@ -2590,9 +2935,13 @@ export const dropRight: {
|
|
|
2590
2935
|
/**
|
|
2591
2936
|
* Removes the last `n` elements, creating a new array.
|
|
2592
2937
|
*
|
|
2938
|
+
* **When to use**
|
|
2939
|
+
*
|
|
2940
|
+
* Use to remove the last `n` elements from an iterable.
|
|
2941
|
+
*
|
|
2593
2942
|
* **Details**
|
|
2594
2943
|
*
|
|
2595
|
-
*
|
|
2944
|
+
* `n` is clamped to `[0, length]`.
|
|
2596
2945
|
*
|
|
2597
2946
|
* **Example** (Dropping from the end)
|
|
2598
2947
|
*
|
|
@@ -2617,9 +2966,13 @@ export const dropRight: {
|
|
|
2617
2966
|
/**
|
|
2618
2967
|
* Drops elements from the start while the predicate holds, returning the rest.
|
|
2619
2968
|
*
|
|
2969
|
+
* **When to use**
|
|
2970
|
+
*
|
|
2971
|
+
* Use to remove a leading prefix of elements that satisfy a predicate.
|
|
2972
|
+
*
|
|
2620
2973
|
* **Details**
|
|
2621
2974
|
*
|
|
2622
|
-
*
|
|
2975
|
+
* The predicate receives `(element, index)`.
|
|
2623
2976
|
*
|
|
2624
2977
|
* **Example** (Dropping while condition holds)
|
|
2625
2978
|
*
|
|
@@ -2639,9 +2992,13 @@ export const dropWhile: {
|
|
|
2639
2992
|
/**
|
|
2640
2993
|
* Drops elements from the start while the predicate holds, returning the rest.
|
|
2641
2994
|
*
|
|
2995
|
+
* **When to use**
|
|
2996
|
+
*
|
|
2997
|
+
* Use to remove a leading prefix of elements that satisfy a predicate.
|
|
2998
|
+
*
|
|
2642
2999
|
* **Details**
|
|
2643
3000
|
*
|
|
2644
|
-
*
|
|
3001
|
+
* The predicate receives `(element, index)`.
|
|
2645
3002
|
*
|
|
2646
3003
|
* **Example** (Dropping while condition holds)
|
|
2647
3004
|
*
|
|
@@ -2661,9 +3018,13 @@ export const dropWhile: {
|
|
|
2661
3018
|
/**
|
|
2662
3019
|
* Drops elements from the start while the predicate holds, returning the rest.
|
|
2663
3020
|
*
|
|
3021
|
+
* **When to use**
|
|
3022
|
+
*
|
|
3023
|
+
* Use to remove a leading prefix of elements that satisfy a predicate.
|
|
3024
|
+
*
|
|
2664
3025
|
* **Details**
|
|
2665
3026
|
*
|
|
2666
|
-
*
|
|
3027
|
+
* The predicate receives `(element, index)`.
|
|
2667
3028
|
*
|
|
2668
3029
|
* **Example** (Dropping while condition holds)
|
|
2669
3030
|
*
|
|
@@ -2695,11 +3056,19 @@ export const dropWhile: {
|
|
|
2695
3056
|
/**
|
|
2696
3057
|
* Drops elements from the start while a `Filter` succeeds.
|
|
2697
3058
|
*
|
|
3059
|
+
* **When to use**
|
|
3060
|
+
*
|
|
3061
|
+
* Use when dropping a prefix requires computing a `Result` per element instead
|
|
3062
|
+
* of a simple boolean predicate.
|
|
3063
|
+
*
|
|
2698
3064
|
* **Details**
|
|
2699
3065
|
*
|
|
2700
3066
|
* - The filter receives `(element, index)`.
|
|
2701
3067
|
* - Returns the remaining original elements after the first filter failure.
|
|
2702
3068
|
*
|
|
3069
|
+
* @see {@link dropWhile} for dropping a prefix with a simple boolean predicate
|
|
3070
|
+
* @see {@link takeWhileFilter} for keeping only the matching prefix
|
|
3071
|
+
*
|
|
2703
3072
|
* @category getters
|
|
2704
3073
|
* @since 4.0.0
|
|
2705
3074
|
*/
|
|
@@ -2707,11 +3076,19 @@ export const dropWhileFilter: {
|
|
|
2707
3076
|
/**
|
|
2708
3077
|
* Drops elements from the start while a `Filter` succeeds.
|
|
2709
3078
|
*
|
|
3079
|
+
* **When to use**
|
|
3080
|
+
*
|
|
3081
|
+
* Use when dropping a prefix requires computing a `Result` per element instead
|
|
3082
|
+
* of a simple boolean predicate.
|
|
3083
|
+
*
|
|
2710
3084
|
* **Details**
|
|
2711
3085
|
*
|
|
2712
3086
|
* - The filter receives `(element, index)`.
|
|
2713
3087
|
* - Returns the remaining original elements after the first filter failure.
|
|
2714
3088
|
*
|
|
3089
|
+
* @see {@link dropWhile} for dropping a prefix with a simple boolean predicate
|
|
3090
|
+
* @see {@link takeWhileFilter} for keeping only the matching prefix
|
|
3091
|
+
*
|
|
2715
3092
|
* @category getters
|
|
2716
3093
|
* @since 4.0.0
|
|
2717
3094
|
*/
|
|
@@ -2719,11 +3096,19 @@ export const dropWhileFilter: {
|
|
|
2719
3096
|
/**
|
|
2720
3097
|
* Drops elements from the start while a `Filter` succeeds.
|
|
2721
3098
|
*
|
|
3099
|
+
* **When to use**
|
|
3100
|
+
*
|
|
3101
|
+
* Use when dropping a prefix requires computing a `Result` per element instead
|
|
3102
|
+
* of a simple boolean predicate.
|
|
3103
|
+
*
|
|
2722
3104
|
* **Details**
|
|
2723
3105
|
*
|
|
2724
3106
|
* - The filter receives `(element, index)`.
|
|
2725
3107
|
* - Returns the remaining original elements after the first filter failure.
|
|
2726
3108
|
*
|
|
3109
|
+
* @see {@link dropWhile} for dropping a prefix with a simple boolean predicate
|
|
3110
|
+
* @see {@link takeWhileFilter} for keeping only the matching prefix
|
|
3111
|
+
*
|
|
2727
3112
|
* @category getters
|
|
2728
3113
|
* @since 4.0.0
|
|
2729
3114
|
*/
|
|
@@ -2747,6 +3132,11 @@ export const dropWhileFilter: {
|
|
|
2747
3132
|
* Returns the index of the first element matching the predicate, wrapped in an
|
|
2748
3133
|
* `Option`.
|
|
2749
3134
|
*
|
|
3135
|
+
* **When to use**
|
|
3136
|
+
*
|
|
3137
|
+
* Use to find the index of the first matching element from the start of an
|
|
3138
|
+
* iterable.
|
|
3139
|
+
*
|
|
2750
3140
|
* **Example** (Finding an index)
|
|
2751
3141
|
*
|
|
2752
3142
|
* ```ts
|
|
@@ -2766,6 +3156,11 @@ export const findFirstIndex: {
|
|
|
2766
3156
|
* Returns the index of the first element matching the predicate, wrapped in an
|
|
2767
3157
|
* `Option`.
|
|
2768
3158
|
*
|
|
3159
|
+
* **When to use**
|
|
3160
|
+
*
|
|
3161
|
+
* Use to find the index of the first matching element from the start of an
|
|
3162
|
+
* iterable.
|
|
3163
|
+
*
|
|
2769
3164
|
* **Example** (Finding an index)
|
|
2770
3165
|
*
|
|
2771
3166
|
* ```ts
|
|
@@ -2785,6 +3180,11 @@ export const findFirstIndex: {
|
|
|
2785
3180
|
* Returns the index of the first element matching the predicate, wrapped in an
|
|
2786
3181
|
* `Option`.
|
|
2787
3182
|
*
|
|
3183
|
+
* **When to use**
|
|
3184
|
+
*
|
|
3185
|
+
* Use to find the index of the first matching element from the start of an
|
|
3186
|
+
* iterable.
|
|
3187
|
+
*
|
|
2788
3188
|
* **Example** (Finding an index)
|
|
2789
3189
|
*
|
|
2790
3190
|
* ```ts
|
|
@@ -2815,6 +3215,10 @@ export const findFirstIndex: {
|
|
|
2815
3215
|
* Returns the index of the last element matching the predicate, wrapped in an
|
|
2816
3216
|
* `Option`.
|
|
2817
3217
|
*
|
|
3218
|
+
* **When to use**
|
|
3219
|
+
*
|
|
3220
|
+
* Use to find the index of the last matching element from the end of an array.
|
|
3221
|
+
*
|
|
2818
3222
|
* **Example** (Finding the last matching index)
|
|
2819
3223
|
*
|
|
2820
3224
|
* ```ts
|
|
@@ -2834,6 +3238,10 @@ export const findLastIndex: {
|
|
|
2834
3238
|
* Returns the index of the last element matching the predicate, wrapped in an
|
|
2835
3239
|
* `Option`.
|
|
2836
3240
|
*
|
|
3241
|
+
* **When to use**
|
|
3242
|
+
*
|
|
3243
|
+
* Use to find the index of the last matching element from the end of an array.
|
|
3244
|
+
*
|
|
2837
3245
|
* **Example** (Finding the last matching index)
|
|
2838
3246
|
*
|
|
2839
3247
|
* ```ts
|
|
@@ -2853,6 +3261,10 @@ export const findLastIndex: {
|
|
|
2853
3261
|
* Returns the index of the last element matching the predicate, wrapped in an
|
|
2854
3262
|
* `Option`.
|
|
2855
3263
|
*
|
|
3264
|
+
* **When to use**
|
|
3265
|
+
*
|
|
3266
|
+
* Use to find the index of the last matching element from the end of an array.
|
|
3267
|
+
*
|
|
2856
3268
|
* **Example** (Finding the last matching index)
|
|
2857
3269
|
*
|
|
2858
3270
|
* ```ts
|
|
@@ -2882,6 +3294,11 @@ export const findLastIndex: {
|
|
|
2882
3294
|
* Returns the first element matching a predicate, refinement, or mapping
|
|
2883
3295
|
* function, wrapped in `Option`.
|
|
2884
3296
|
*
|
|
3297
|
+
* **When to use**
|
|
3298
|
+
*
|
|
3299
|
+
* Use to scan an iterable in iteration order and return the first selected
|
|
3300
|
+
* element or mapped value as an `Option`.
|
|
3301
|
+
*
|
|
2885
3302
|
* **Details**
|
|
2886
3303
|
*
|
|
2887
3304
|
* - Accepts a predicate `(a, i) => boolean`, a refinement, or a function
|
|
@@ -2908,6 +3325,11 @@ export const findFirst: {
|
|
|
2908
3325
|
* Returns the first element matching a predicate, refinement, or mapping
|
|
2909
3326
|
* function, wrapped in `Option`.
|
|
2910
3327
|
*
|
|
3328
|
+
* **When to use**
|
|
3329
|
+
*
|
|
3330
|
+
* Use to scan an iterable in iteration order and return the first selected
|
|
3331
|
+
* element or mapped value as an `Option`.
|
|
3332
|
+
*
|
|
2911
3333
|
* **Details**
|
|
2912
3334
|
*
|
|
2913
3335
|
* - Accepts a predicate `(a, i) => boolean`, a refinement, or a function
|
|
@@ -2934,6 +3356,11 @@ export const findFirst: {
|
|
|
2934
3356
|
* Returns the first element matching a predicate, refinement, or mapping
|
|
2935
3357
|
* function, wrapped in `Option`.
|
|
2936
3358
|
*
|
|
3359
|
+
* **When to use**
|
|
3360
|
+
*
|
|
3361
|
+
* Use to scan an iterable in iteration order and return the first selected
|
|
3362
|
+
* element or mapped value as an `Option`.
|
|
3363
|
+
*
|
|
2937
3364
|
* **Details**
|
|
2938
3365
|
*
|
|
2939
3366
|
* - Accepts a predicate `(a, i) => boolean`, a refinement, or a function
|
|
@@ -2960,6 +3387,11 @@ export const findFirst: {
|
|
|
2960
3387
|
* Returns the first element matching a predicate, refinement, or mapping
|
|
2961
3388
|
* function, wrapped in `Option`.
|
|
2962
3389
|
*
|
|
3390
|
+
* **When to use**
|
|
3391
|
+
*
|
|
3392
|
+
* Use to scan an iterable in iteration order and return the first selected
|
|
3393
|
+
* element or mapped value as an `Option`.
|
|
3394
|
+
*
|
|
2963
3395
|
* **Details**
|
|
2964
3396
|
*
|
|
2965
3397
|
* - Accepts a predicate `(a, i) => boolean`, a refinement, or a function
|
|
@@ -2986,6 +3418,11 @@ export const findFirst: {
|
|
|
2986
3418
|
* Returns the first element matching a predicate, refinement, or mapping
|
|
2987
3419
|
* function, wrapped in `Option`.
|
|
2988
3420
|
*
|
|
3421
|
+
* **When to use**
|
|
3422
|
+
*
|
|
3423
|
+
* Use to scan an iterable in iteration order and return the first selected
|
|
3424
|
+
* element or mapped value as an `Option`.
|
|
3425
|
+
*
|
|
2989
3426
|
* **Details**
|
|
2990
3427
|
*
|
|
2991
3428
|
* - Accepts a predicate `(a, i) => boolean`, a refinement, or a function
|
|
@@ -3012,6 +3449,11 @@ export const findFirst: {
|
|
|
3012
3449
|
* Returns the first element matching a predicate, refinement, or mapping
|
|
3013
3450
|
* function, wrapped in `Option`.
|
|
3014
3451
|
*
|
|
3452
|
+
* **When to use**
|
|
3453
|
+
*
|
|
3454
|
+
* Use to scan an iterable in iteration order and return the first selected
|
|
3455
|
+
* element or mapped value as an `Option`.
|
|
3456
|
+
*
|
|
3015
3457
|
* **Details**
|
|
3016
3458
|
*
|
|
3017
3459
|
* - Accepts a predicate `(a, i) => boolean`, a refinement, or a function
|
|
@@ -3038,6 +3480,11 @@ export const findFirst: {
|
|
|
3038
3480
|
* Returns the first element matching a predicate, refinement, or mapping
|
|
3039
3481
|
* function, wrapped in `Option`.
|
|
3040
3482
|
*
|
|
3483
|
+
* **When to use**
|
|
3484
|
+
*
|
|
3485
|
+
* Use to scan an iterable in iteration order and return the first selected
|
|
3486
|
+
* element or mapped value as an `Option`.
|
|
3487
|
+
*
|
|
3041
3488
|
* **Details**
|
|
3042
3489
|
*
|
|
3043
3490
|
* - Accepts a predicate `(a, i) => boolean`, a refinement, or a function
|
|
@@ -3066,6 +3513,10 @@ export const findFirst: {
|
|
|
3066
3513
|
* Returns the first selected value together with its index, wrapped in an
|
|
3067
3514
|
* `Option`.
|
|
3068
3515
|
*
|
|
3516
|
+
* **When to use**
|
|
3517
|
+
*
|
|
3518
|
+
* Use to find both the first matching element and its index in one pass.
|
|
3519
|
+
*
|
|
3069
3520
|
* **Details**
|
|
3070
3521
|
*
|
|
3071
3522
|
* Accepts a predicate, a refinement, or a function returning `Option`. For an
|
|
@@ -3091,6 +3542,10 @@ export const findFirstWithIndex: {
|
|
|
3091
3542
|
* Returns the first selected value together with its index, wrapped in an
|
|
3092
3543
|
* `Option`.
|
|
3093
3544
|
*
|
|
3545
|
+
* **When to use**
|
|
3546
|
+
*
|
|
3547
|
+
* Use to find both the first matching element and its index in one pass.
|
|
3548
|
+
*
|
|
3094
3549
|
* **Details**
|
|
3095
3550
|
*
|
|
3096
3551
|
* Accepts a predicate, a refinement, or a function returning `Option`. For an
|
|
@@ -3116,6 +3571,10 @@ export const findFirstWithIndex: {
|
|
|
3116
3571
|
* Returns the first selected value together with its index, wrapped in an
|
|
3117
3572
|
* `Option`.
|
|
3118
3573
|
*
|
|
3574
|
+
* **When to use**
|
|
3575
|
+
*
|
|
3576
|
+
* Use to find both the first matching element and its index in one pass.
|
|
3577
|
+
*
|
|
3119
3578
|
* **Details**
|
|
3120
3579
|
*
|
|
3121
3580
|
* Accepts a predicate, a refinement, or a function returning `Option`. For an
|
|
@@ -3141,6 +3600,10 @@ export const findFirstWithIndex: {
|
|
|
3141
3600
|
* Returns the first selected value together with its index, wrapped in an
|
|
3142
3601
|
* `Option`.
|
|
3143
3602
|
*
|
|
3603
|
+
* **When to use**
|
|
3604
|
+
*
|
|
3605
|
+
* Use to find both the first matching element and its index in one pass.
|
|
3606
|
+
*
|
|
3144
3607
|
* **Details**
|
|
3145
3608
|
*
|
|
3146
3609
|
* Accepts a predicate, a refinement, or a function returning `Option`. For an
|
|
@@ -3166,6 +3629,10 @@ export const findFirstWithIndex: {
|
|
|
3166
3629
|
* Returns the first selected value together with its index, wrapped in an
|
|
3167
3630
|
* `Option`.
|
|
3168
3631
|
*
|
|
3632
|
+
* **When to use**
|
|
3633
|
+
*
|
|
3634
|
+
* Use to find both the first matching element and its index in one pass.
|
|
3635
|
+
*
|
|
3169
3636
|
* **Details**
|
|
3170
3637
|
*
|
|
3171
3638
|
* Accepts a predicate, a refinement, or a function returning `Option`. For an
|
|
@@ -3191,6 +3658,10 @@ export const findFirstWithIndex: {
|
|
|
3191
3658
|
* Returns the first selected value together with its index, wrapped in an
|
|
3192
3659
|
* `Option`.
|
|
3193
3660
|
*
|
|
3661
|
+
* **When to use**
|
|
3662
|
+
*
|
|
3663
|
+
* Use to find both the first matching element and its index in one pass.
|
|
3664
|
+
*
|
|
3194
3665
|
* **Details**
|
|
3195
3666
|
*
|
|
3196
3667
|
* Accepts a predicate, a refinement, or a function returning `Option`. For an
|
|
@@ -3216,6 +3687,10 @@ export const findFirstWithIndex: {
|
|
|
3216
3687
|
* Returns the first selected value together with its index, wrapped in an
|
|
3217
3688
|
* `Option`.
|
|
3218
3689
|
*
|
|
3690
|
+
* **When to use**
|
|
3691
|
+
*
|
|
3692
|
+
* Use to find both the first matching element and its index in one pass.
|
|
3693
|
+
*
|
|
3219
3694
|
* **Details**
|
|
3220
3695
|
*
|
|
3221
3696
|
* Accepts a predicate, a refinement, or a function returning `Option`. For an
|
|
@@ -3265,6 +3740,10 @@ export const findFirstWithIndex: {
|
|
|
3265
3740
|
* Returns the last element matching a predicate, refinement, or mapping
|
|
3266
3741
|
* function, wrapped in `Option`.
|
|
3267
3742
|
*
|
|
3743
|
+
* **When to use**
|
|
3744
|
+
*
|
|
3745
|
+
* Use to find the last matching element from the end of an array.
|
|
3746
|
+
*
|
|
3268
3747
|
* **Details**
|
|
3269
3748
|
*
|
|
3270
3749
|
* - Searches from the end of the array.
|
|
@@ -3289,6 +3768,10 @@ export const findLast: {
|
|
|
3289
3768
|
* Returns the last element matching a predicate, refinement, or mapping
|
|
3290
3769
|
* function, wrapped in `Option`.
|
|
3291
3770
|
*
|
|
3771
|
+
* **When to use**
|
|
3772
|
+
*
|
|
3773
|
+
* Use to find the last matching element from the end of an array.
|
|
3774
|
+
*
|
|
3292
3775
|
* **Details**
|
|
3293
3776
|
*
|
|
3294
3777
|
* - Searches from the end of the array.
|
|
@@ -3313,6 +3796,10 @@ export const findLast: {
|
|
|
3313
3796
|
* Returns the last element matching a predicate, refinement, or mapping
|
|
3314
3797
|
* function, wrapped in `Option`.
|
|
3315
3798
|
*
|
|
3799
|
+
* **When to use**
|
|
3800
|
+
*
|
|
3801
|
+
* Use to find the last matching element from the end of an array.
|
|
3802
|
+
*
|
|
3316
3803
|
* **Details**
|
|
3317
3804
|
*
|
|
3318
3805
|
* - Searches from the end of the array.
|
|
@@ -3337,6 +3824,10 @@ export const findLast: {
|
|
|
3337
3824
|
* Returns the last element matching a predicate, refinement, or mapping
|
|
3338
3825
|
* function, wrapped in `Option`.
|
|
3339
3826
|
*
|
|
3827
|
+
* **When to use**
|
|
3828
|
+
*
|
|
3829
|
+
* Use to find the last matching element from the end of an array.
|
|
3830
|
+
*
|
|
3340
3831
|
* **Details**
|
|
3341
3832
|
*
|
|
3342
3833
|
* - Searches from the end of the array.
|
|
@@ -3361,6 +3852,10 @@ export const findLast: {
|
|
|
3361
3852
|
* Returns the last element matching a predicate, refinement, or mapping
|
|
3362
3853
|
* function, wrapped in `Option`.
|
|
3363
3854
|
*
|
|
3855
|
+
* **When to use**
|
|
3856
|
+
*
|
|
3857
|
+
* Use to find the last matching element from the end of an array.
|
|
3858
|
+
*
|
|
3364
3859
|
* **Details**
|
|
3365
3860
|
*
|
|
3366
3861
|
* - Searches from the end of the array.
|
|
@@ -3385,6 +3880,10 @@ export const findLast: {
|
|
|
3385
3880
|
* Returns the last element matching a predicate, refinement, or mapping
|
|
3386
3881
|
* function, wrapped in `Option`.
|
|
3387
3882
|
*
|
|
3883
|
+
* **When to use**
|
|
3884
|
+
*
|
|
3885
|
+
* Use to find the last matching element from the end of an array.
|
|
3886
|
+
*
|
|
3388
3887
|
* **Details**
|
|
3389
3888
|
*
|
|
3390
3889
|
* - Searches from the end of the array.
|
|
@@ -3409,6 +3908,10 @@ export const findLast: {
|
|
|
3409
3908
|
* Returns the last element matching a predicate, refinement, or mapping
|
|
3410
3909
|
* function, wrapped in `Option`.
|
|
3411
3910
|
*
|
|
3911
|
+
* **When to use**
|
|
3912
|
+
*
|
|
3913
|
+
* Use to find the last matching element from the end of an array.
|
|
3914
|
+
*
|
|
3412
3915
|
* **Details**
|
|
3413
3916
|
*
|
|
3414
3917
|
* - Searches from the end of the array.
|
|
@@ -3454,13 +3957,16 @@ export const findLast: {
|
|
|
3454
3957
|
)
|
|
3455
3958
|
|
|
3456
3959
|
/**
|
|
3457
|
-
* Inserts an element at the specified index, returning a new `NonEmptyArray`
|
|
3960
|
+
* Inserts an element at the specified index safely, returning a new `NonEmptyArray`
|
|
3458
3961
|
* wrapped in an `Option`.
|
|
3459
3962
|
*
|
|
3963
|
+
* **When to use**
|
|
3964
|
+
*
|
|
3965
|
+
* Use to insert a single element at a specific position in an array.
|
|
3966
|
+
*
|
|
3460
3967
|
* **Details**
|
|
3461
3968
|
*
|
|
3462
3969
|
* - Valid indices: `0` to `length` (inclusive — inserting at `length` appends).
|
|
3463
|
-
* - Does not mutate the input.
|
|
3464
3970
|
*
|
|
3465
3971
|
* **Example** (Inserting at an index)
|
|
3466
3972
|
*
|
|
@@ -3478,13 +3984,16 @@ export const findLast: {
|
|
|
3478
3984
|
*/
|
|
3479
3985
|
export const insertAt: {
|
|
3480
3986
|
/**
|
|
3481
|
-
* Inserts an element at the specified index, returning a new `NonEmptyArray`
|
|
3987
|
+
* Inserts an element at the specified index safely, returning a new `NonEmptyArray`
|
|
3482
3988
|
* wrapped in an `Option`.
|
|
3483
3989
|
*
|
|
3990
|
+
* **When to use**
|
|
3991
|
+
*
|
|
3992
|
+
* Use to insert a single element at a specific position in an array.
|
|
3993
|
+
*
|
|
3484
3994
|
* **Details**
|
|
3485
3995
|
*
|
|
3486
3996
|
* - Valid indices: `0` to `length` (inclusive — inserting at `length` appends).
|
|
3487
|
-
* - Does not mutate the input.
|
|
3488
3997
|
*
|
|
3489
3998
|
* **Example** (Inserting at an index)
|
|
3490
3999
|
*
|
|
@@ -3502,13 +4011,16 @@ export const insertAt: {
|
|
|
3502
4011
|
*/
|
|
3503
4012
|
<B>(i: number, b: B): <A>(self: Iterable<A>) => Option.Option<NonEmptyArray<A | B>>
|
|
3504
4013
|
/**
|
|
3505
|
-
* Inserts an element at the specified index, returning a new `NonEmptyArray`
|
|
4014
|
+
* Inserts an element at the specified index safely, returning a new `NonEmptyArray`
|
|
3506
4015
|
* wrapped in an `Option`.
|
|
3507
4016
|
*
|
|
4017
|
+
* **When to use**
|
|
4018
|
+
*
|
|
4019
|
+
* Use to insert a single element at a specific position in an array.
|
|
4020
|
+
*
|
|
3508
4021
|
* **Details**
|
|
3509
4022
|
*
|
|
3510
4023
|
* - Valid indices: `0` to `length` (inclusive — inserting at `length` appends).
|
|
3511
|
-
* - Does not mutate the input.
|
|
3512
4024
|
*
|
|
3513
4025
|
* **Example** (Inserting at an index)
|
|
3514
4026
|
*
|
|
@@ -3535,13 +4047,16 @@ export const insertAt: {
|
|
|
3535
4047
|
})
|
|
3536
4048
|
|
|
3537
4049
|
/**
|
|
3538
|
-
* Replaces the element at the specified index with a new value, returning the
|
|
4050
|
+
* Replaces the element at the specified index safely with a new value, returning the
|
|
3539
4051
|
* updated array in `Option.some`.
|
|
3540
4052
|
*
|
|
4053
|
+
* **When to use**
|
|
4054
|
+
*
|
|
4055
|
+
* Use to set a fixed replacement value at a specific index.
|
|
4056
|
+
*
|
|
3541
4057
|
* **Details**
|
|
3542
4058
|
*
|
|
3543
4059
|
* - Returns `Option.none()` when the index is out of bounds.
|
|
3544
|
-
* - Does not mutate the input.
|
|
3545
4060
|
*
|
|
3546
4061
|
* **Example** (Replacing an element)
|
|
3547
4062
|
*
|
|
@@ -3559,13 +4074,16 @@ export const insertAt: {
|
|
|
3559
4074
|
*/
|
|
3560
4075
|
export const replace: {
|
|
3561
4076
|
/**
|
|
3562
|
-
* Replaces the element at the specified index with a new value, returning the
|
|
4077
|
+
* Replaces the element at the specified index safely with a new value, returning the
|
|
3563
4078
|
* updated array in `Option.some`.
|
|
3564
4079
|
*
|
|
4080
|
+
* **When to use**
|
|
4081
|
+
*
|
|
4082
|
+
* Use to set a fixed replacement value at a specific index.
|
|
4083
|
+
*
|
|
3565
4084
|
* **Details**
|
|
3566
4085
|
*
|
|
3567
4086
|
* - Returns `Option.none()` when the index is out of bounds.
|
|
3568
|
-
* - Does not mutate the input.
|
|
3569
4087
|
*
|
|
3570
4088
|
* **Example** (Replacing an element)
|
|
3571
4089
|
*
|
|
@@ -3585,13 +4103,16 @@ export const replace: {
|
|
|
3585
4103
|
self: S
|
|
3586
4104
|
) => Option.Option<ReadonlyArray.With<S, ReadonlyArray.Infer<S> | B>>
|
|
3587
4105
|
/**
|
|
3588
|
-
* Replaces the element at the specified index with a new value, returning the
|
|
4106
|
+
* Replaces the element at the specified index safely with a new value, returning the
|
|
3589
4107
|
* updated array in `Option.some`.
|
|
3590
4108
|
*
|
|
4109
|
+
* **When to use**
|
|
4110
|
+
*
|
|
4111
|
+
* Use to set a fixed replacement value at a specific index.
|
|
4112
|
+
*
|
|
3591
4113
|
* **Details**
|
|
3592
4114
|
*
|
|
3593
4115
|
* - Returns `Option.none()` when the index is out of bounds.
|
|
3594
|
-
* - Does not mutate the input.
|
|
3595
4116
|
*
|
|
3596
4117
|
* **Example** (Replacing an element)
|
|
3597
4118
|
*
|
|
@@ -3614,13 +4135,17 @@ export const replace: {
|
|
|
3614
4135
|
)
|
|
3615
4136
|
|
|
3616
4137
|
/**
|
|
3617
|
-
* Applies a function to the element at the specified index, returning the
|
|
4138
|
+
* Applies a function to the element at the specified index safely, returning the
|
|
3618
4139
|
* updated array in `Option.some`.
|
|
3619
4140
|
*
|
|
4141
|
+
* **When to use**
|
|
4142
|
+
*
|
|
4143
|
+
* Use to derive a replacement value from the current element at a specific
|
|
4144
|
+
* index while leaving the other elements unchanged.
|
|
4145
|
+
*
|
|
3620
4146
|
* **Details**
|
|
3621
4147
|
*
|
|
3622
4148
|
* - Returns `Option.none()` when the index is out of bounds.
|
|
3623
|
-
* - Does not mutate the input.
|
|
3624
4149
|
*
|
|
3625
4150
|
* **Example** (Modifying an element)
|
|
3626
4151
|
*
|
|
@@ -3640,13 +4165,17 @@ export const replace: {
|
|
|
3640
4165
|
*/
|
|
3641
4166
|
export const modify: {
|
|
3642
4167
|
/**
|
|
3643
|
-
* Applies a function to the element at the specified index, returning the
|
|
4168
|
+
* Applies a function to the element at the specified index safely, returning the
|
|
3644
4169
|
* updated array in `Option.some`.
|
|
3645
4170
|
*
|
|
4171
|
+
* **When to use**
|
|
4172
|
+
*
|
|
4173
|
+
* Use to derive a replacement value from the current element at a specific
|
|
4174
|
+
* index while leaving the other elements unchanged.
|
|
4175
|
+
*
|
|
3646
4176
|
* **Details**
|
|
3647
4177
|
*
|
|
3648
4178
|
* - Returns `Option.none()` when the index is out of bounds.
|
|
3649
|
-
* - Does not mutate the input.
|
|
3650
4179
|
*
|
|
3651
4180
|
* **Example** (Modifying an element)
|
|
3652
4181
|
*
|
|
@@ -3666,13 +4195,17 @@ export const modify: {
|
|
|
3666
4195
|
*/
|
|
3667
4196
|
<A, B, S extends Iterable<A> = Iterable<A>>(i: number, f: (a: ReadonlyArray.Infer<S>) => B): (self: S) => Option.Option<ReadonlyArray.With<S, ReadonlyArray.Infer<S> | B>>
|
|
3668
4197
|
/**
|
|
3669
|
-
* Applies a function to the element at the specified index, returning the
|
|
4198
|
+
* Applies a function to the element at the specified index safely, returning the
|
|
3670
4199
|
* updated array in `Option.some`.
|
|
3671
4200
|
*
|
|
4201
|
+
* **When to use**
|
|
4202
|
+
*
|
|
4203
|
+
* Use to derive a replacement value from the current element at a specific
|
|
4204
|
+
* index while leaving the other elements unchanged.
|
|
4205
|
+
*
|
|
3672
4206
|
* **Details**
|
|
3673
4207
|
*
|
|
3674
4208
|
* - Returns `Option.none()` when the index is out of bounds.
|
|
3675
|
-
* - Does not mutate the input.
|
|
3676
4209
|
*
|
|
3677
4210
|
* **Example** (Modifying an element)
|
|
3678
4211
|
*
|
|
@@ -3706,9 +4239,9 @@ export const modify: {
|
|
|
3706
4239
|
* Removes the element at the specified index, returning a new array. If the
|
|
3707
4240
|
* index is out of bounds, returns a copy of the original.
|
|
3708
4241
|
*
|
|
3709
|
-
* **
|
|
4242
|
+
* **When to use**
|
|
3710
4243
|
*
|
|
3711
|
-
*
|
|
4244
|
+
* Use to remove a single element at a known index.
|
|
3712
4245
|
*
|
|
3713
4246
|
* **Example** (Removing an element)
|
|
3714
4247
|
*
|
|
@@ -3730,9 +4263,9 @@ export const remove: {
|
|
|
3730
4263
|
* Removes the element at the specified index, returning a new array. If the
|
|
3731
4264
|
* index is out of bounds, returns a copy of the original.
|
|
3732
4265
|
*
|
|
3733
|
-
* **
|
|
4266
|
+
* **When to use**
|
|
3734
4267
|
*
|
|
3735
|
-
*
|
|
4268
|
+
* Use to remove a single element at a known index.
|
|
3736
4269
|
*
|
|
3737
4270
|
* **Example** (Removing an element)
|
|
3738
4271
|
*
|
|
@@ -3754,9 +4287,9 @@ export const remove: {
|
|
|
3754
4287
|
* Removes the element at the specified index, returning a new array. If the
|
|
3755
4288
|
* index is out of bounds, returns a copy of the original.
|
|
3756
4289
|
*
|
|
3757
|
-
* **
|
|
4290
|
+
* **When to use**
|
|
3758
4291
|
*
|
|
3759
|
-
*
|
|
4292
|
+
* Use to remove a single element at a known index.
|
|
3760
4293
|
*
|
|
3761
4294
|
* **Example** (Removing an element)
|
|
3762
4295
|
*
|
|
@@ -3786,9 +4319,12 @@ export const remove: {
|
|
|
3786
4319
|
/**
|
|
3787
4320
|
* Reverses an iterable into a new array.
|
|
3788
4321
|
*
|
|
4322
|
+
* **When to use**
|
|
4323
|
+
*
|
|
4324
|
+
* Use to reverse the order of elements without mutating the original input.
|
|
4325
|
+
*
|
|
3789
4326
|
* **Details**
|
|
3790
4327
|
*
|
|
3791
|
-
* - Does not mutate the input.
|
|
3792
4328
|
* - Preserves `NonEmptyArray` in the return type.
|
|
3793
4329
|
*
|
|
3794
4330
|
* **Example** (Reversing an array)
|
|
@@ -3810,9 +4346,12 @@ export const reverse = <S extends Iterable<any>>(
|
|
|
3810
4346
|
/**
|
|
3811
4347
|
* Sorts an array by the given `Order`, returning a new array.
|
|
3812
4348
|
*
|
|
4349
|
+
* **When to use**
|
|
4350
|
+
*
|
|
4351
|
+
* Use to sort an array using a single `Order` comparator.
|
|
4352
|
+
*
|
|
3813
4353
|
* **Details**
|
|
3814
4354
|
*
|
|
3815
|
-
* - Does not mutate the input.
|
|
3816
4355
|
* - Preserves `NonEmptyArray` in the return type.
|
|
3817
4356
|
* - Use {@link sortWith} to sort by a derived key, or {@link sortBy} for
|
|
3818
4357
|
* multi-key sorting.
|
|
@@ -3835,9 +4374,12 @@ export const sort: {
|
|
|
3835
4374
|
/**
|
|
3836
4375
|
* Sorts an array by the given `Order`, returning a new array.
|
|
3837
4376
|
*
|
|
4377
|
+
* **When to use**
|
|
4378
|
+
*
|
|
4379
|
+
* Use to sort an array using a single `Order` comparator.
|
|
4380
|
+
*
|
|
3838
4381
|
* **Details**
|
|
3839
4382
|
*
|
|
3840
|
-
* - Does not mutate the input.
|
|
3841
4383
|
* - Preserves `NonEmptyArray` in the return type.
|
|
3842
4384
|
* - Use {@link sortWith} to sort by a derived key, or {@link sortBy} for
|
|
3843
4385
|
* multi-key sorting.
|
|
@@ -3860,9 +4402,12 @@ export const sort: {
|
|
|
3860
4402
|
/**
|
|
3861
4403
|
* Sorts an array by the given `Order`, returning a new array.
|
|
3862
4404
|
*
|
|
4405
|
+
* **When to use**
|
|
4406
|
+
*
|
|
4407
|
+
* Use to sort an array using a single `Order` comparator.
|
|
4408
|
+
*
|
|
3863
4409
|
* **Details**
|
|
3864
4410
|
*
|
|
3865
|
-
* - Does not mutate the input.
|
|
3866
4411
|
* - Preserves `NonEmptyArray` in the return type.
|
|
3867
4412
|
* - Use {@link sortWith} to sort by a derived key, or {@link sortBy} for
|
|
3868
4413
|
* multi-key sorting.
|
|
@@ -3885,9 +4430,12 @@ export const sort: {
|
|
|
3885
4430
|
/**
|
|
3886
4431
|
* Sorts an array by the given `Order`, returning a new array.
|
|
3887
4432
|
*
|
|
4433
|
+
* **When to use**
|
|
4434
|
+
*
|
|
4435
|
+
* Use to sort an array using a single `Order` comparator.
|
|
4436
|
+
*
|
|
3888
4437
|
* **Details**
|
|
3889
4438
|
*
|
|
3890
|
-
* - Does not mutate the input.
|
|
3891
4439
|
* - Preserves `NonEmptyArray` in the return type.
|
|
3892
4440
|
* - Use {@link sortWith} to sort by a derived key, or {@link sortBy} for
|
|
3893
4441
|
* multi-key sorting.
|
|
@@ -3917,10 +4465,14 @@ export const sort: {
|
|
|
3917
4465
|
* Sorts an array by a derived key using a mapping function and an `Order` for
|
|
3918
4466
|
* that key.
|
|
3919
4467
|
*
|
|
4468
|
+
* **When to use**
|
|
4469
|
+
*
|
|
4470
|
+
* Use when values need to be sorted by a derived key, such as a string length
|
|
4471
|
+
* or object field, while the output should keep the original values.
|
|
4472
|
+
*
|
|
3920
4473
|
* **Details**
|
|
3921
4474
|
*
|
|
3922
4475
|
* - Equivalent to `sort(Order.mapInput(order, f))` but more convenient.
|
|
3923
|
-
* - Does not mutate the input.
|
|
3924
4476
|
*
|
|
3925
4477
|
* **Example** (Sorting strings by length)
|
|
3926
4478
|
*
|
|
@@ -3931,8 +4483,8 @@ export const sort: {
|
|
|
3931
4483
|
* // ["b", "cc", "aaa"]
|
|
3932
4484
|
* ```
|
|
3933
4485
|
*
|
|
3934
|
-
* @see {@link sort}
|
|
3935
|
-
* @see {@link sortBy}
|
|
4486
|
+
* @see {@link sort} for sorting with an `Order` that compares the elements directly
|
|
4487
|
+
* @see {@link sortBy} for sorting with multiple `Order`s applied in sequence
|
|
3936
4488
|
*
|
|
3937
4489
|
* @category elements
|
|
3938
4490
|
* @since 2.0.0
|
|
@@ -3942,10 +4494,14 @@ export const sortWith: {
|
|
|
3942
4494
|
* Sorts an array by a derived key using a mapping function and an `Order` for
|
|
3943
4495
|
* that key.
|
|
3944
4496
|
*
|
|
4497
|
+
* **When to use**
|
|
4498
|
+
*
|
|
4499
|
+
* Use when values need to be sorted by a derived key, such as a string length
|
|
4500
|
+
* or object field, while the output should keep the original values.
|
|
4501
|
+
*
|
|
3945
4502
|
* **Details**
|
|
3946
4503
|
*
|
|
3947
4504
|
* - Equivalent to `sort(Order.mapInput(order, f))` but more convenient.
|
|
3948
|
-
* - Does not mutate the input.
|
|
3949
4505
|
*
|
|
3950
4506
|
* **Example** (Sorting strings by length)
|
|
3951
4507
|
*
|
|
@@ -3956,8 +4512,8 @@ export const sortWith: {
|
|
|
3956
4512
|
* // ["b", "cc", "aaa"]
|
|
3957
4513
|
* ```
|
|
3958
4514
|
*
|
|
3959
|
-
* @see {@link sort}
|
|
3960
|
-
* @see {@link sortBy}
|
|
4515
|
+
* @see {@link sort} for sorting with an `Order` that compares the elements directly
|
|
4516
|
+
* @see {@link sortBy} for sorting with multiple `Order`s applied in sequence
|
|
3961
4517
|
*
|
|
3962
4518
|
* @category elements
|
|
3963
4519
|
* @since 2.0.0
|
|
@@ -3967,10 +4523,14 @@ export const sortWith: {
|
|
|
3967
4523
|
* Sorts an array by a derived key using a mapping function and an `Order` for
|
|
3968
4524
|
* that key.
|
|
3969
4525
|
*
|
|
4526
|
+
* **When to use**
|
|
4527
|
+
*
|
|
4528
|
+
* Use when values need to be sorted by a derived key, such as a string length
|
|
4529
|
+
* or object field, while the output should keep the original values.
|
|
4530
|
+
*
|
|
3970
4531
|
* **Details**
|
|
3971
4532
|
*
|
|
3972
4533
|
* - Equivalent to `sort(Order.mapInput(order, f))` but more convenient.
|
|
3973
|
-
* - Does not mutate the input.
|
|
3974
4534
|
*
|
|
3975
4535
|
* **Example** (Sorting strings by length)
|
|
3976
4536
|
*
|
|
@@ -3981,8 +4541,8 @@ export const sortWith: {
|
|
|
3981
4541
|
* // ["b", "cc", "aaa"]
|
|
3982
4542
|
* ```
|
|
3983
4543
|
*
|
|
3984
|
-
* @see {@link sort}
|
|
3985
|
-
* @see {@link sortBy}
|
|
4544
|
+
* @see {@link sort} for sorting with an `Order` that compares the elements directly
|
|
4545
|
+
* @see {@link sortBy} for sorting with multiple `Order`s applied in sequence
|
|
3986
4546
|
*
|
|
3987
4547
|
* @category elements
|
|
3988
4548
|
* @since 2.0.0
|
|
@@ -3992,10 +4552,14 @@ export const sortWith: {
|
|
|
3992
4552
|
* Sorts an array by a derived key using a mapping function and an `Order` for
|
|
3993
4553
|
* that key.
|
|
3994
4554
|
*
|
|
4555
|
+
* **When to use**
|
|
4556
|
+
*
|
|
4557
|
+
* Use when values need to be sorted by a derived key, such as a string length
|
|
4558
|
+
* or object field, while the output should keep the original values.
|
|
4559
|
+
*
|
|
3995
4560
|
* **Details**
|
|
3996
4561
|
*
|
|
3997
4562
|
* - Equivalent to `sort(Order.mapInput(order, f))` but more convenient.
|
|
3998
|
-
* - Does not mutate the input.
|
|
3999
4563
|
*
|
|
4000
4564
|
* **Example** (Sorting strings by length)
|
|
4001
4565
|
*
|
|
@@ -4006,8 +4570,8 @@ export const sortWith: {
|
|
|
4006
4570
|
* // ["b", "cc", "aaa"]
|
|
4007
4571
|
* ```
|
|
4008
4572
|
*
|
|
4009
|
-
* @see {@link sort}
|
|
4010
|
-
* @see {@link sortBy}
|
|
4573
|
+
* @see {@link sort} for sorting with an `Order` that compares the elements directly
|
|
4574
|
+
* @see {@link sortBy} for sorting with multiple `Order`s applied in sequence
|
|
4011
4575
|
*
|
|
4012
4576
|
* @category elements
|
|
4013
4577
|
* @since 2.0.0
|
|
@@ -4023,6 +4587,11 @@ export const sortWith: {
|
|
|
4023
4587
|
* Sorts an array by multiple `Order`s applied in sequence: the first order is
|
|
4024
4588
|
* used first; ties are broken by the second order, and so on.
|
|
4025
4589
|
*
|
|
4590
|
+
* **When to use**
|
|
4591
|
+
*
|
|
4592
|
+
* Use to sort by multiple criteria where later orders break ties from earlier
|
|
4593
|
+
* ones.
|
|
4594
|
+
*
|
|
4026
4595
|
* **Details**
|
|
4027
4596
|
*
|
|
4028
4597
|
* - Data-last only (returns a function).
|
|
@@ -4075,6 +4644,10 @@ export const sortBy = <S extends Iterable<any>>(
|
|
|
4075
4644
|
* Pairs elements from two iterables by position. If the iterables differ in
|
|
4076
4645
|
* length, the extra elements from the longer one are discarded.
|
|
4077
4646
|
*
|
|
4647
|
+
* **When to use**
|
|
4648
|
+
*
|
|
4649
|
+
* Use to pair corresponding elements from two iterables when you need simple pairs without a custom combiner.
|
|
4650
|
+
*
|
|
4078
4651
|
* **Details**
|
|
4079
4652
|
*
|
|
4080
4653
|
* - Returns `NonEmptyArray` when both inputs are non-empty.
|
|
@@ -4098,6 +4671,10 @@ export const zip: {
|
|
|
4098
4671
|
* Pairs elements from two iterables by position. If the iterables differ in
|
|
4099
4672
|
* length, the extra elements from the longer one are discarded.
|
|
4100
4673
|
*
|
|
4674
|
+
* **When to use**
|
|
4675
|
+
*
|
|
4676
|
+
* Use to pair corresponding elements from two iterables when you need simple pairs without a custom combiner.
|
|
4677
|
+
*
|
|
4101
4678
|
* **Details**
|
|
4102
4679
|
*
|
|
4103
4680
|
* - Returns `NonEmptyArray` when both inputs are non-empty.
|
|
@@ -4121,6 +4698,10 @@ export const zip: {
|
|
|
4121
4698
|
* Pairs elements from two iterables by position. If the iterables differ in
|
|
4122
4699
|
* length, the extra elements from the longer one are discarded.
|
|
4123
4700
|
*
|
|
4701
|
+
* **When to use**
|
|
4702
|
+
*
|
|
4703
|
+
* Use to pair corresponding elements from two iterables when you need simple pairs without a custom combiner.
|
|
4704
|
+
*
|
|
4124
4705
|
* **Details**
|
|
4125
4706
|
*
|
|
4126
4707
|
* - Returns `NonEmptyArray` when both inputs are non-empty.
|
|
@@ -4144,6 +4725,10 @@ export const zip: {
|
|
|
4144
4725
|
* Pairs elements from two iterables by position. If the iterables differ in
|
|
4145
4726
|
* length, the extra elements from the longer one are discarded.
|
|
4146
4727
|
*
|
|
4728
|
+
* **When to use**
|
|
4729
|
+
*
|
|
4730
|
+
* Use to pair corresponding elements from two iterables when you need simple pairs without a custom combiner.
|
|
4731
|
+
*
|
|
4147
4732
|
* **Details**
|
|
4148
4733
|
*
|
|
4149
4734
|
* - Returns `NonEmptyArray` when both inputs are non-empty.
|
|
@@ -4167,6 +4752,10 @@ export const zip: {
|
|
|
4167
4752
|
* Pairs elements from two iterables by position. If the iterables differ in
|
|
4168
4753
|
* length, the extra elements from the longer one are discarded.
|
|
4169
4754
|
*
|
|
4755
|
+
* **When to use**
|
|
4756
|
+
*
|
|
4757
|
+
* Use to pair corresponding elements from two iterables when you need simple pairs without a custom combiner.
|
|
4758
|
+
*
|
|
4170
4759
|
* **Details**
|
|
4171
4760
|
*
|
|
4172
4761
|
* - Returns `NonEmptyArray` when both inputs are non-empty.
|
|
@@ -4336,6 +4925,10 @@ export const unzip: <S extends Iterable<readonly [any, any]>>(
|
|
|
4336
4925
|
/**
|
|
4337
4926
|
* Places a separator element between every pair of elements.
|
|
4338
4927
|
*
|
|
4928
|
+
* **When to use**
|
|
4929
|
+
*
|
|
4930
|
+
* Use to insert a separator between elements, for example when preparing data for display or concatenation.
|
|
4931
|
+
*
|
|
4339
4932
|
* **Details**
|
|
4340
4933
|
*
|
|
4341
4934
|
* - Preserves `NonEmptyArray` in the return type.
|
|
@@ -4358,6 +4951,10 @@ export const intersperse: {
|
|
|
4358
4951
|
/**
|
|
4359
4952
|
* Places a separator element between every pair of elements.
|
|
4360
4953
|
*
|
|
4954
|
+
* **When to use**
|
|
4955
|
+
*
|
|
4956
|
+
* Use to insert a separator between elements, for example when preparing data for display or concatenation.
|
|
4957
|
+
*
|
|
4361
4958
|
* **Details**
|
|
4362
4959
|
*
|
|
4363
4960
|
* - Preserves `NonEmptyArray` in the return type.
|
|
@@ -4380,6 +4977,10 @@ export const intersperse: {
|
|
|
4380
4977
|
/**
|
|
4381
4978
|
* Places a separator element between every pair of elements.
|
|
4382
4979
|
*
|
|
4980
|
+
* **When to use**
|
|
4981
|
+
*
|
|
4982
|
+
* Use to insert a separator between elements, for example when preparing data for display or concatenation.
|
|
4983
|
+
*
|
|
4383
4984
|
* **Details**
|
|
4384
4985
|
*
|
|
4385
4986
|
* - Preserves `NonEmptyArray` in the return type.
|
|
@@ -4402,6 +5003,10 @@ export const intersperse: {
|
|
|
4402
5003
|
/**
|
|
4403
5004
|
* Places a separator element between every pair of elements.
|
|
4404
5005
|
*
|
|
5006
|
+
* **When to use**
|
|
5007
|
+
*
|
|
5008
|
+
* Use to insert a separator between elements, for example when preparing data for display or concatenation.
|
|
5009
|
+
*
|
|
4405
5010
|
* **Details**
|
|
4406
5011
|
*
|
|
4407
5012
|
* - Preserves `NonEmptyArray` in the return type.
|
|
@@ -4441,6 +5046,10 @@ export const intersperse: {
|
|
|
4441
5046
|
* Applies a function to the first element of a non-empty array, returning a
|
|
4442
5047
|
* new array.
|
|
4443
5048
|
*
|
|
5049
|
+
* **When to use**
|
|
5050
|
+
*
|
|
5051
|
+
* Use to transform the first element of a non-empty array while preserving the rest.
|
|
5052
|
+
*
|
|
4444
5053
|
* **Example** (Modifying the head)
|
|
4445
5054
|
*
|
|
4446
5055
|
* ```ts
|
|
@@ -4460,6 +5069,10 @@ export const modifyHeadNonEmpty: {
|
|
|
4460
5069
|
* Applies a function to the first element of a non-empty array, returning a
|
|
4461
5070
|
* new array.
|
|
4462
5071
|
*
|
|
5072
|
+
* **When to use**
|
|
5073
|
+
*
|
|
5074
|
+
* Use to transform the first element of a non-empty array while preserving the rest.
|
|
5075
|
+
*
|
|
4463
5076
|
* **Example** (Modifying the head)
|
|
4464
5077
|
*
|
|
4465
5078
|
* ```ts
|
|
@@ -4479,6 +5092,10 @@ export const modifyHeadNonEmpty: {
|
|
|
4479
5092
|
* Applies a function to the first element of a non-empty array, returning a
|
|
4480
5093
|
* new array.
|
|
4481
5094
|
*
|
|
5095
|
+
* **When to use**
|
|
5096
|
+
*
|
|
5097
|
+
* Use to transform the first element of a non-empty array while preserving the rest.
|
|
5098
|
+
*
|
|
4482
5099
|
* **Example** (Modifying the head)
|
|
4483
5100
|
*
|
|
4484
5101
|
* ```ts
|
|
@@ -4684,9 +5301,14 @@ export const setLastNonEmpty: {
|
|
|
4684
5301
|
)
|
|
4685
5302
|
|
|
4686
5303
|
/**
|
|
4687
|
-
*
|
|
5304
|
+
* Transforms an array by rotating it `n` steps. Positive `n` rotates right; negative `n`
|
|
4688
5305
|
* rotates left.
|
|
4689
5306
|
*
|
|
5307
|
+
* **When to use**
|
|
5308
|
+
*
|
|
5309
|
+
* Use when elements should wrap around the end of the array rather than being
|
|
5310
|
+
* dropped.
|
|
5311
|
+
*
|
|
4690
5312
|
* **Details**
|
|
4691
5313
|
*
|
|
4692
5314
|
* - `n` is rounded to the nearest integer before rotating.
|
|
@@ -4701,14 +5323,22 @@ export const setLastNonEmpty: {
|
|
|
4701
5323
|
* console.log(Array.rotate(["a", "b", "c", "d"], 2)) // ["c", "d", "a", "b"]
|
|
4702
5324
|
* ```
|
|
4703
5325
|
*
|
|
5326
|
+
* @see {@link take} for taking a fixed number of elements from the start
|
|
5327
|
+
* @see {@link drop} for dropping a fixed number of elements from the start
|
|
5328
|
+
*
|
|
4704
5329
|
* @category elements
|
|
4705
5330
|
* @since 2.0.0
|
|
4706
5331
|
*/
|
|
4707
5332
|
export const rotate: {
|
|
4708
5333
|
/**
|
|
4709
|
-
*
|
|
5334
|
+
* Transforms an array by rotating it `n` steps. Positive `n` rotates right; negative `n`
|
|
4710
5335
|
* rotates left.
|
|
4711
5336
|
*
|
|
5337
|
+
* **When to use**
|
|
5338
|
+
*
|
|
5339
|
+
* Use when elements should wrap around the end of the array rather than being
|
|
5340
|
+
* dropped.
|
|
5341
|
+
*
|
|
4712
5342
|
* **Details**
|
|
4713
5343
|
*
|
|
4714
5344
|
* - `n` is rounded to the nearest integer before rotating.
|
|
@@ -4723,14 +5353,22 @@ export const rotate: {
|
|
|
4723
5353
|
* console.log(Array.rotate(["a", "b", "c", "d"], 2)) // ["c", "d", "a", "b"]
|
|
4724
5354
|
* ```
|
|
4725
5355
|
*
|
|
5356
|
+
* @see {@link take} for taking a fixed number of elements from the start
|
|
5357
|
+
* @see {@link drop} for dropping a fixed number of elements from the start
|
|
5358
|
+
*
|
|
4726
5359
|
* @category elements
|
|
4727
5360
|
* @since 2.0.0
|
|
4728
5361
|
*/
|
|
4729
5362
|
(n: number): <S extends Iterable<any>>(self: S) => ReadonlyArray.With<S, ReadonlyArray.Infer<S>>
|
|
4730
5363
|
/**
|
|
4731
|
-
*
|
|
5364
|
+
* Transforms an array by rotating it `n` steps. Positive `n` rotates right; negative `n`
|
|
4732
5365
|
* rotates left.
|
|
4733
5366
|
*
|
|
5367
|
+
* **When to use**
|
|
5368
|
+
*
|
|
5369
|
+
* Use when elements should wrap around the end of the array rather than being
|
|
5370
|
+
* dropped.
|
|
5371
|
+
*
|
|
4734
5372
|
* **Details**
|
|
4735
5373
|
*
|
|
4736
5374
|
* - `n` is rounded to the nearest integer before rotating.
|
|
@@ -4745,14 +5383,22 @@ export const rotate: {
|
|
|
4745
5383
|
* console.log(Array.rotate(["a", "b", "c", "d"], 2)) // ["c", "d", "a", "b"]
|
|
4746
5384
|
* ```
|
|
4747
5385
|
*
|
|
5386
|
+
* @see {@link take} for taking a fixed number of elements from the start
|
|
5387
|
+
* @see {@link drop} for dropping a fixed number of elements from the start
|
|
5388
|
+
*
|
|
4748
5389
|
* @category elements
|
|
4749
5390
|
* @since 2.0.0
|
|
4750
5391
|
*/
|
|
4751
5392
|
<A>(self: NonEmptyReadonlyArray<A>, n: number): NonEmptyArray<A>
|
|
4752
5393
|
/**
|
|
4753
|
-
*
|
|
5394
|
+
* Transforms an array by rotating it `n` steps. Positive `n` rotates right; negative `n`
|
|
4754
5395
|
* rotates left.
|
|
4755
5396
|
*
|
|
5397
|
+
* **When to use**
|
|
5398
|
+
*
|
|
5399
|
+
* Use when elements should wrap around the end of the array rather than being
|
|
5400
|
+
* dropped.
|
|
5401
|
+
*
|
|
4756
5402
|
* **Details**
|
|
4757
5403
|
*
|
|
4758
5404
|
* - `n` is rounded to the nearest integer before rotating.
|
|
@@ -4767,6 +5413,9 @@ export const rotate: {
|
|
|
4767
5413
|
* console.log(Array.rotate(["a", "b", "c", "d"], 2)) // ["c", "d", "a", "b"]
|
|
4768
5414
|
* ```
|
|
4769
5415
|
*
|
|
5416
|
+
* @see {@link take} for taking a fixed number of elements from the start
|
|
5417
|
+
* @see {@link drop} for dropping a fixed number of elements from the start
|
|
5418
|
+
*
|
|
4770
5419
|
* @category elements
|
|
4771
5420
|
* @since 2.0.0
|
|
4772
5421
|
*/
|
|
@@ -4792,6 +5441,11 @@ export const rotate: {
|
|
|
4792
5441
|
/**
|
|
4793
5442
|
* Returns a membership-test function using a custom equivalence.
|
|
4794
5443
|
*
|
|
5444
|
+
* **When to use**
|
|
5445
|
+
*
|
|
5446
|
+
* Use when checking membership with caller-provided equality instead of
|
|
5447
|
+
* `Equal.equivalence()`.
|
|
5448
|
+
*
|
|
4795
5449
|
* **Example** (Custom equality check)
|
|
4796
5450
|
*
|
|
4797
5451
|
* ```ts
|
|
@@ -4801,7 +5455,7 @@ export const rotate: {
|
|
|
4801
5455
|
* console.log(pipe([1, 2, 3, 4], containsNumber(3))) // true
|
|
4802
5456
|
* ```
|
|
4803
5457
|
*
|
|
4804
|
-
* @see {@link contains}
|
|
5458
|
+
* @see {@link contains} for the `Equal.equivalence()` variant
|
|
4805
5459
|
*
|
|
4806
5460
|
* @category elements
|
|
4807
5461
|
* @since 2.0.0
|
|
@@ -4820,9 +5474,14 @@ export const containsWith = <A>(isEquivalent: (self: A, that: A) => boolean): {
|
|
|
4820
5474
|
})
|
|
4821
5475
|
|
|
4822
5476
|
/**
|
|
4823
|
-
*
|
|
5477
|
+
* Checks whether an array contains a value, using `Equal.equivalence()` for
|
|
4824
5478
|
* comparison.
|
|
4825
5479
|
*
|
|
5480
|
+
* **When to use**
|
|
5481
|
+
*
|
|
5482
|
+
* Use to check membership with Effect's default equality instead of providing a
|
|
5483
|
+
* comparison function.
|
|
5484
|
+
*
|
|
4826
5485
|
* **Example** (Checking membership)
|
|
4827
5486
|
*
|
|
4828
5487
|
* ```ts
|
|
@@ -4838,9 +5497,14 @@ export const containsWith = <A>(isEquivalent: (self: A, that: A) => boolean): {
|
|
|
4838
5497
|
*/
|
|
4839
5498
|
export const contains: {
|
|
4840
5499
|
/**
|
|
4841
|
-
*
|
|
5500
|
+
* Checks whether an array contains a value, using `Equal.equivalence()` for
|
|
4842
5501
|
* comparison.
|
|
4843
5502
|
*
|
|
5503
|
+
* **When to use**
|
|
5504
|
+
*
|
|
5505
|
+
* Use to check membership with Effect's default equality instead of providing a
|
|
5506
|
+
* comparison function.
|
|
5507
|
+
*
|
|
4844
5508
|
* **Example** (Checking membership)
|
|
4845
5509
|
*
|
|
4846
5510
|
* ```ts
|
|
@@ -4856,9 +5520,14 @@ export const contains: {
|
|
|
4856
5520
|
*/
|
|
4857
5521
|
<A>(a: A): (self: Iterable<A>) => boolean
|
|
4858
5522
|
/**
|
|
4859
|
-
*
|
|
5523
|
+
* Checks whether an array contains a value, using `Equal.equivalence()` for
|
|
4860
5524
|
* comparison.
|
|
4861
5525
|
*
|
|
5526
|
+
* **When to use**
|
|
5527
|
+
*
|
|
5528
|
+
* Use to check membership with Effect's default equality instead of providing a
|
|
5529
|
+
* comparison function.
|
|
5530
|
+
*
|
|
4862
5531
|
* **Example** (Checking membership)
|
|
4863
5532
|
*
|
|
4864
5533
|
* ```ts
|
|
@@ -4876,8 +5545,13 @@ export const contains: {
|
|
|
4876
5545
|
} = containsWith(Equal.asEquivalence())
|
|
4877
5546
|
|
|
4878
5547
|
/**
|
|
4879
|
-
*
|
|
4880
|
-
*
|
|
5548
|
+
* Applies a function repeatedly to consume prefixes of the array and collect
|
|
5549
|
+
* the values it produces.
|
|
5550
|
+
*
|
|
5551
|
+
* **When to use**
|
|
5552
|
+
*
|
|
5553
|
+
* Use when the grouping logic is custom and each step needs to return both a
|
|
5554
|
+
* value and the remaining input.
|
|
4881
5555
|
*
|
|
4882
5556
|
* **Details**
|
|
4883
5557
|
*
|
|
@@ -4906,8 +5580,13 @@ export const contains: {
|
|
|
4906
5580
|
*/
|
|
4907
5581
|
export const chop: {
|
|
4908
5582
|
/**
|
|
4909
|
-
*
|
|
4910
|
-
*
|
|
5583
|
+
* Applies a function repeatedly to consume prefixes of the array and collect
|
|
5584
|
+
* the values it produces.
|
|
5585
|
+
*
|
|
5586
|
+
* **When to use**
|
|
5587
|
+
*
|
|
5588
|
+
* Use when the grouping logic is custom and each step needs to return both a
|
|
5589
|
+
* value and the remaining input.
|
|
4911
5590
|
*
|
|
4912
5591
|
* **Details**
|
|
4913
5592
|
*
|
|
@@ -4938,8 +5617,13 @@ export const chop: {
|
|
|
4938
5617
|
f: (as: NonEmptyReadonlyArray<ReadonlyArray.Infer<S>>) => readonly [B, ReadonlyArray<ReadonlyArray.Infer<S>>]
|
|
4939
5618
|
): (self: S) => ReadonlyArray.With<S, ReadonlyArray.Infer<S>>
|
|
4940
5619
|
/**
|
|
4941
|
-
*
|
|
4942
|
-
*
|
|
5620
|
+
* Applies a function repeatedly to consume prefixes of the array and collect
|
|
5621
|
+
* the values it produces.
|
|
5622
|
+
*
|
|
5623
|
+
* **When to use**
|
|
5624
|
+
*
|
|
5625
|
+
* Use when the grouping logic is custom and each step needs to return both a
|
|
5626
|
+
* value and the remaining input.
|
|
4943
5627
|
*
|
|
4944
5628
|
* **Details**
|
|
4945
5629
|
*
|
|
@@ -4971,8 +5655,13 @@ export const chop: {
|
|
|
4971
5655
|
f: (as: NonEmptyReadonlyArray<A>) => readonly [B, ReadonlyArray<A>]
|
|
4972
5656
|
): NonEmptyArray<B>
|
|
4973
5657
|
/**
|
|
4974
|
-
*
|
|
4975
|
-
*
|
|
5658
|
+
* Applies a function repeatedly to consume prefixes of the array and collect
|
|
5659
|
+
* the values it produces.
|
|
5660
|
+
*
|
|
5661
|
+
* **When to use**
|
|
5662
|
+
*
|
|
5663
|
+
* Use when the grouping logic is custom and each step needs to return both a
|
|
5664
|
+
* value and the remaining input.
|
|
4976
5665
|
*
|
|
4977
5666
|
* **Details**
|
|
4978
5667
|
*
|
|
@@ -5025,6 +5714,10 @@ export const chop: {
|
|
|
5025
5714
|
/**
|
|
5026
5715
|
* Splits an iterable into two arrays at the given index.
|
|
5027
5716
|
*
|
|
5717
|
+
* **When to use**
|
|
5718
|
+
*
|
|
5719
|
+
* Use to divide an array into a prefix and suffix at a specific position.
|
|
5720
|
+
*
|
|
5028
5721
|
* **Details**
|
|
5029
5722
|
*
|
|
5030
5723
|
* - `n` can be `0` (all elements in the second array).
|
|
@@ -5048,6 +5741,10 @@ export const splitAt: {
|
|
|
5048
5741
|
/**
|
|
5049
5742
|
* Splits an iterable into two arrays at the given index.
|
|
5050
5743
|
*
|
|
5744
|
+
* **When to use**
|
|
5745
|
+
*
|
|
5746
|
+
* Use to divide an array into a prefix and suffix at a specific position.
|
|
5747
|
+
*
|
|
5051
5748
|
* **Details**
|
|
5052
5749
|
*
|
|
5053
5750
|
* - `n` can be `0` (all elements in the second array).
|
|
@@ -5071,6 +5768,10 @@ export const splitAt: {
|
|
|
5071
5768
|
/**
|
|
5072
5769
|
* Splits an iterable into two arrays at the given index.
|
|
5073
5770
|
*
|
|
5771
|
+
* **When to use**
|
|
5772
|
+
*
|
|
5773
|
+
* Use to divide an array into a prefix and suffix at a specific position.
|
|
5774
|
+
*
|
|
5074
5775
|
* **Details**
|
|
5075
5776
|
*
|
|
5076
5777
|
* - `n` can be `0` (all elements in the second array).
|
|
@@ -5170,6 +5871,10 @@ export const splitAtNonEmpty: {
|
|
|
5170
5871
|
/**
|
|
5171
5872
|
* Splits an iterable into `n` roughly equal-sized chunks.
|
|
5172
5873
|
*
|
|
5874
|
+
* **When to use**
|
|
5875
|
+
*
|
|
5876
|
+
* Use to distribute elements across a fixed number of groups, such as when splitting work across threads.
|
|
5877
|
+
*
|
|
5173
5878
|
* **Details**
|
|
5174
5879
|
*
|
|
5175
5880
|
* - Uses `chunksOf(ceil(length / n))` internally.
|
|
@@ -5192,6 +5897,10 @@ export const split: {
|
|
|
5192
5897
|
/**
|
|
5193
5898
|
* Splits an iterable into `n` roughly equal-sized chunks.
|
|
5194
5899
|
*
|
|
5900
|
+
* **When to use**
|
|
5901
|
+
*
|
|
5902
|
+
* Use to distribute elements across a fixed number of groups, such as when splitting work across threads.
|
|
5903
|
+
*
|
|
5195
5904
|
* **Details**
|
|
5196
5905
|
*
|
|
5197
5906
|
* - Uses `chunksOf(ceil(length / n))` internally.
|
|
@@ -5214,6 +5923,10 @@ export const split: {
|
|
|
5214
5923
|
/**
|
|
5215
5924
|
* Splits an iterable into `n` roughly equal-sized chunks.
|
|
5216
5925
|
*
|
|
5926
|
+
* **When to use**
|
|
5927
|
+
*
|
|
5928
|
+
* Use to distribute elements across a fixed number of groups, such as when splitting work across threads.
|
|
5929
|
+
*
|
|
5217
5930
|
* **Details**
|
|
5218
5931
|
*
|
|
5219
5932
|
* - Uses `chunksOf(ceil(length / n))` internally.
|
|
@@ -5242,6 +5955,10 @@ export const split: {
|
|
|
5242
5955
|
* Splits an iterable at the first element matching the predicate. The matching
|
|
5243
5956
|
* element is included in the second array.
|
|
5244
5957
|
*
|
|
5958
|
+
* **When to use**
|
|
5959
|
+
*
|
|
5960
|
+
* Use to split an array at a condition boundary when you know which element marks the transition point.
|
|
5961
|
+
*
|
|
5245
5962
|
* **Example** (Splitting at a condition)
|
|
5246
5963
|
*
|
|
5247
5964
|
* ```ts
|
|
@@ -5261,6 +5978,10 @@ export const splitWhere: {
|
|
|
5261
5978
|
* Splits an iterable at the first element matching the predicate. The matching
|
|
5262
5979
|
* element is included in the second array.
|
|
5263
5980
|
*
|
|
5981
|
+
* **When to use**
|
|
5982
|
+
*
|
|
5983
|
+
* Use to split an array at a condition boundary when you know which element marks the transition point.
|
|
5984
|
+
*
|
|
5264
5985
|
* **Example** (Splitting at a condition)
|
|
5265
5986
|
*
|
|
5266
5987
|
* ```ts
|
|
@@ -5280,6 +6001,10 @@ export const splitWhere: {
|
|
|
5280
6001
|
* Splits an iterable at the first element matching the predicate. The matching
|
|
5281
6002
|
* element is included in the second array.
|
|
5282
6003
|
*
|
|
6004
|
+
* **When to use**
|
|
6005
|
+
*
|
|
6006
|
+
* Use to split an array at a condition boundary when you know which element marks the transition point.
|
|
6007
|
+
*
|
|
5283
6008
|
* **Example** (Splitting at a condition)
|
|
5284
6009
|
*
|
|
5285
6010
|
* ```ts
|
|
@@ -5304,6 +6029,11 @@ export const splitWhere: {
|
|
|
5304
6029
|
/**
|
|
5305
6030
|
* Creates a shallow copy of an array.
|
|
5306
6031
|
*
|
|
6032
|
+
* **When to use**
|
|
6033
|
+
*
|
|
6034
|
+
* Use to create a distinct array reference for an existing array, for example
|
|
6035
|
+
* before mutating the returned array.
|
|
6036
|
+
*
|
|
5307
6037
|
* **Details**
|
|
5308
6038
|
*
|
|
5309
6039
|
* - Preserves `NonEmptyArray` in the return type.
|
|
@@ -5329,6 +6059,11 @@ export const copy: {
|
|
|
5329
6059
|
/**
|
|
5330
6060
|
* Creates a shallow copy of an array.
|
|
5331
6061
|
*
|
|
6062
|
+
* **When to use**
|
|
6063
|
+
*
|
|
6064
|
+
* Use to create a distinct array reference for an existing array, for example
|
|
6065
|
+
* before mutating the returned array.
|
|
6066
|
+
*
|
|
5332
6067
|
* **Details**
|
|
5333
6068
|
*
|
|
5334
6069
|
* - Preserves `NonEmptyArray` in the return type.
|
|
@@ -5354,6 +6089,11 @@ export const copy: {
|
|
|
5354
6089
|
/**
|
|
5355
6090
|
* Creates a shallow copy of an array.
|
|
5356
6091
|
*
|
|
6092
|
+
* **When to use**
|
|
6093
|
+
*
|
|
6094
|
+
* Use to create a distinct array reference for an existing array, for example
|
|
6095
|
+
* before mutating the returned array.
|
|
6096
|
+
*
|
|
5357
6097
|
* **Details**
|
|
5358
6098
|
*
|
|
5359
6099
|
* - Preserves `NonEmptyArray` in the return type.
|
|
@@ -5382,6 +6122,10 @@ export const copy: {
|
|
|
5382
6122
|
* Pads or truncates an array to exactly `n` elements, filling with `fill`
|
|
5383
6123
|
* if the array is shorter, or slicing if longer.
|
|
5384
6124
|
*
|
|
6125
|
+
* **When to use**
|
|
6126
|
+
*
|
|
6127
|
+
* Use to ensure an array has a specific length, padding with a fill value or truncating as needed.
|
|
6128
|
+
*
|
|
5385
6129
|
* **Details**
|
|
5386
6130
|
*
|
|
5387
6131
|
* - Returns an empty array when `n <= 0`.
|
|
@@ -5405,6 +6149,10 @@ export const pad: {
|
|
|
5405
6149
|
* Pads or truncates an array to exactly `n` elements, filling with `fill`
|
|
5406
6150
|
* if the array is shorter, or slicing if longer.
|
|
5407
6151
|
*
|
|
6152
|
+
* **When to use**
|
|
6153
|
+
*
|
|
6154
|
+
* Use to ensure an array has a specific length, padding with a fill value or truncating as needed.
|
|
6155
|
+
*
|
|
5408
6156
|
* **Details**
|
|
5409
6157
|
*
|
|
5410
6158
|
* - Returns an empty array when `n <= 0`.
|
|
@@ -5430,6 +6178,10 @@ export const pad: {
|
|
|
5430
6178
|
* Pads or truncates an array to exactly `n` elements, filling with `fill`
|
|
5431
6179
|
* if the array is shorter, or slicing if longer.
|
|
5432
6180
|
*
|
|
6181
|
+
* **When to use**
|
|
6182
|
+
*
|
|
6183
|
+
* Use to ensure an array has a specific length, padding with a fill value or truncating as needed.
|
|
6184
|
+
*
|
|
5433
6185
|
* **Details**
|
|
5434
6186
|
*
|
|
5435
6187
|
* - Returns an empty array when `n <= 0`.
|
|
@@ -5463,6 +6215,11 @@ export const pad: {
|
|
|
5463
6215
|
* Splits an iterable into chunks of length `n`. The last chunk may be shorter
|
|
5464
6216
|
* if `n` does not evenly divide the length.
|
|
5465
6217
|
*
|
|
6218
|
+
* **When to use**
|
|
6219
|
+
*
|
|
6220
|
+
* Use to divide an iterable into non-overlapping chunks with a maximum chunk
|
|
6221
|
+
* size.
|
|
6222
|
+
*
|
|
5466
6223
|
* **Details**
|
|
5467
6224
|
*
|
|
5468
6225
|
* - `chunksOf(n)([])` is `[]`, not `[[]]`.
|
|
@@ -5488,6 +6245,11 @@ export const chunksOf: {
|
|
|
5488
6245
|
* Splits an iterable into chunks of length `n`. The last chunk may be shorter
|
|
5489
6246
|
* if `n` does not evenly divide the length.
|
|
5490
6247
|
*
|
|
6248
|
+
* **When to use**
|
|
6249
|
+
*
|
|
6250
|
+
* Use to divide an iterable into non-overlapping chunks with a maximum chunk
|
|
6251
|
+
* size.
|
|
6252
|
+
*
|
|
5491
6253
|
* **Details**
|
|
5492
6254
|
*
|
|
5493
6255
|
* - `chunksOf(n)([])` is `[]`, not `[[]]`.
|
|
@@ -5515,6 +6277,11 @@ export const chunksOf: {
|
|
|
5515
6277
|
* Splits an iterable into chunks of length `n`. The last chunk may be shorter
|
|
5516
6278
|
* if `n` does not evenly divide the length.
|
|
5517
6279
|
*
|
|
6280
|
+
* **When to use**
|
|
6281
|
+
*
|
|
6282
|
+
* Use to divide an iterable into non-overlapping chunks with a maximum chunk
|
|
6283
|
+
* size.
|
|
6284
|
+
*
|
|
5518
6285
|
* **Details**
|
|
5519
6286
|
*
|
|
5520
6287
|
* - `chunksOf(n)([])` is `[]`, not `[[]]`.
|
|
@@ -5540,6 +6307,11 @@ export const chunksOf: {
|
|
|
5540
6307
|
* Splits an iterable into chunks of length `n`. The last chunk may be shorter
|
|
5541
6308
|
* if `n` does not evenly divide the length.
|
|
5542
6309
|
*
|
|
6310
|
+
* **When to use**
|
|
6311
|
+
*
|
|
6312
|
+
* Use to divide an iterable into non-overlapping chunks with a maximum chunk
|
|
6313
|
+
* size.
|
|
6314
|
+
*
|
|
5543
6315
|
* **Details**
|
|
5544
6316
|
*
|
|
5545
6317
|
* - `chunksOf(n)([])` is `[]`, not `[[]]`.
|
|
@@ -5572,6 +6344,10 @@ export const chunksOf: {
|
|
|
5572
6344
|
/**
|
|
5573
6345
|
* Creates overlapping sliding windows of size `n`.
|
|
5574
6346
|
*
|
|
6347
|
+
* **When to use**
|
|
6348
|
+
*
|
|
6349
|
+
* Use to process sequences with a moving window, such as for computing running averages or detecting patterns.
|
|
6350
|
+
*
|
|
5575
6351
|
* **Details**
|
|
5576
6352
|
*
|
|
5577
6353
|
* - Returns an empty array if `n <= 0` or the array has fewer than `n` elements.
|
|
@@ -5595,6 +6371,10 @@ export const window: {
|
|
|
5595
6371
|
/**
|
|
5596
6372
|
* Creates overlapping sliding windows of size `n`.
|
|
5597
6373
|
*
|
|
6374
|
+
* **When to use**
|
|
6375
|
+
*
|
|
6376
|
+
* Use to process sequences with a moving window, such as for computing running averages or detecting patterns.
|
|
6377
|
+
*
|
|
5598
6378
|
* **Details**
|
|
5599
6379
|
*
|
|
5600
6380
|
* - Returns an empty array if `n <= 0` or the array has fewer than `n` elements.
|
|
@@ -5618,6 +6398,10 @@ export const window: {
|
|
|
5618
6398
|
/**
|
|
5619
6399
|
* Creates overlapping sliding windows of size `n`.
|
|
5620
6400
|
*
|
|
6401
|
+
* **When to use**
|
|
6402
|
+
*
|
|
6403
|
+
* Use to process sequences with a moving window, such as for computing running averages or detecting patterns.
|
|
6404
|
+
*
|
|
5621
6405
|
* **Details**
|
|
5622
6406
|
*
|
|
5623
6407
|
* - Returns an empty array if `n <= 0` or the array has fewer than `n` elements.
|
|
@@ -5652,6 +6436,11 @@ export const window: {
|
|
|
5652
6436
|
/**
|
|
5653
6437
|
* Groups consecutive equal elements using a custom equivalence function.
|
|
5654
6438
|
*
|
|
6439
|
+
* **When to use**
|
|
6440
|
+
*
|
|
6441
|
+
* Use when a non-empty array is already arranged so matching elements are
|
|
6442
|
+
* adjacent and you need a custom equivalence function.
|
|
6443
|
+
*
|
|
5655
6444
|
* **Details**
|
|
5656
6445
|
*
|
|
5657
6446
|
* - Only groups **adjacent** elements — non-adjacent duplicates stay separate.
|
|
@@ -5666,8 +6455,8 @@ export const window: {
|
|
|
5666
6455
|
* // [["a", "a"], ["b", "b", "b"], ["c"], ["a"]]
|
|
5667
6456
|
* ```
|
|
5668
6457
|
*
|
|
5669
|
-
* @see {@link group}
|
|
5670
|
-
* @see {@link groupBy}
|
|
6458
|
+
* @see {@link group} for grouping adjacent elements with `Equal.equivalence()`
|
|
6459
|
+
* @see {@link groupBy} for grouping all elements into a record by key, regardless of adjacency
|
|
5671
6460
|
*
|
|
5672
6461
|
* @category grouping
|
|
5673
6462
|
* @since 2.0.0
|
|
@@ -5676,6 +6465,11 @@ export const groupWith: {
|
|
|
5676
6465
|
/**
|
|
5677
6466
|
* Groups consecutive equal elements using a custom equivalence function.
|
|
5678
6467
|
*
|
|
6468
|
+
* **When to use**
|
|
6469
|
+
*
|
|
6470
|
+
* Use when a non-empty array is already arranged so matching elements are
|
|
6471
|
+
* adjacent and you need a custom equivalence function.
|
|
6472
|
+
*
|
|
5679
6473
|
* **Details**
|
|
5680
6474
|
*
|
|
5681
6475
|
* - Only groups **adjacent** elements — non-adjacent duplicates stay separate.
|
|
@@ -5690,8 +6484,8 @@ export const groupWith: {
|
|
|
5690
6484
|
* // [["a", "a"], ["b", "b", "b"], ["c"], ["a"]]
|
|
5691
6485
|
* ```
|
|
5692
6486
|
*
|
|
5693
|
-
* @see {@link group}
|
|
5694
|
-
* @see {@link groupBy}
|
|
6487
|
+
* @see {@link group} for grouping adjacent elements with `Equal.equivalence()`
|
|
6488
|
+
* @see {@link groupBy} for grouping all elements into a record by key, regardless of adjacency
|
|
5695
6489
|
*
|
|
5696
6490
|
* @category grouping
|
|
5697
6491
|
* @since 2.0.0
|
|
@@ -5700,6 +6494,11 @@ export const groupWith: {
|
|
|
5700
6494
|
/**
|
|
5701
6495
|
* Groups consecutive equal elements using a custom equivalence function.
|
|
5702
6496
|
*
|
|
6497
|
+
* **When to use**
|
|
6498
|
+
*
|
|
6499
|
+
* Use when a non-empty array is already arranged so matching elements are
|
|
6500
|
+
* adjacent and you need a custom equivalence function.
|
|
6501
|
+
*
|
|
5703
6502
|
* **Details**
|
|
5704
6503
|
*
|
|
5705
6504
|
* - Only groups **adjacent** elements — non-adjacent duplicates stay separate.
|
|
@@ -5714,8 +6513,8 @@ export const groupWith: {
|
|
|
5714
6513
|
* // [["a", "a"], ["b", "b", "b"], ["c"], ["a"]]
|
|
5715
6514
|
* ```
|
|
5716
6515
|
*
|
|
5717
|
-
* @see {@link group}
|
|
5718
|
-
* @see {@link groupBy}
|
|
6516
|
+
* @see {@link group} for grouping adjacent elements with `Equal.equivalence()`
|
|
6517
|
+
* @see {@link groupBy} for grouping all elements into a record by key, regardless of adjacency
|
|
5719
6518
|
*
|
|
5720
6519
|
* @category grouping
|
|
5721
6520
|
* @since 2.0.0
|
|
@@ -5746,6 +6545,11 @@ export const groupWith: {
|
|
|
5746
6545
|
/**
|
|
5747
6546
|
* Groups consecutive equal elements using `Equal.equivalence()`.
|
|
5748
6547
|
*
|
|
6548
|
+
* **When to use**
|
|
6549
|
+
*
|
|
6550
|
+
* Use when equal values are already adjacent and Effect's default equality is
|
|
6551
|
+
* the right comparison.
|
|
6552
|
+
*
|
|
5749
6553
|
* **Details**
|
|
5750
6554
|
*
|
|
5751
6555
|
* - Only groups **adjacent** elements.
|
|
@@ -5772,6 +6576,10 @@ export const group: <A>(self: NonEmptyReadonlyArray<A>) => NonEmptyArray<NonEmpt
|
|
|
5772
6576
|
* Groups elements into a record by a key-returning function. Each key maps
|
|
5773
6577
|
* to a `NonEmptyArray` of elements that produced that key.
|
|
5774
6578
|
*
|
|
6579
|
+
* **When to use**
|
|
6580
|
+
*
|
|
6581
|
+
* Use to build buckets of elements indexed by a computed string or symbol key.
|
|
6582
|
+
*
|
|
5775
6583
|
* **Details**
|
|
5776
6584
|
*
|
|
5777
6585
|
* - Unlike {@link group}/{@link groupWith}, elements do not need to be
|
|
@@ -5805,6 +6613,10 @@ export const groupBy: {
|
|
|
5805
6613
|
* Groups elements into a record by a key-returning function. Each key maps
|
|
5806
6614
|
* to a `NonEmptyArray` of elements that produced that key.
|
|
5807
6615
|
*
|
|
6616
|
+
* **When to use**
|
|
6617
|
+
*
|
|
6618
|
+
* Use to build buckets of elements indexed by a computed string or symbol key.
|
|
6619
|
+
*
|
|
5808
6620
|
* **Details**
|
|
5809
6621
|
*
|
|
5810
6622
|
* - Unlike {@link group}/{@link groupWith}, elements do not need to be
|
|
@@ -5838,6 +6650,10 @@ export const groupBy: {
|
|
|
5838
6650
|
* Groups elements into a record by a key-returning function. Each key maps
|
|
5839
6651
|
* to a `NonEmptyArray` of elements that produced that key.
|
|
5840
6652
|
*
|
|
6653
|
+
* **When to use**
|
|
6654
|
+
*
|
|
6655
|
+
* Use to build buckets of elements indexed by a computed string or symbol key.
|
|
6656
|
+
*
|
|
5841
6657
|
* **Details**
|
|
5842
6658
|
*
|
|
5843
6659
|
* - Unlike {@link group}/{@link groupWith}, elements do not need to be
|
|
@@ -5887,6 +6703,11 @@ export const groupBy: {
|
|
|
5887
6703
|
* Computes the union of two arrays using a custom equivalence, removing
|
|
5888
6704
|
* duplicates.
|
|
5889
6705
|
*
|
|
6706
|
+
* **When to use**
|
|
6707
|
+
*
|
|
6708
|
+
* Use when you need the union of two arrays but duplicate detection must use a
|
|
6709
|
+
* custom equivalence instead of the default `Equal.equivalence()`.
|
|
6710
|
+
*
|
|
5890
6711
|
* **Example** (Union with custom equality)
|
|
5891
6712
|
*
|
|
5892
6713
|
* ```ts
|
|
@@ -5895,9 +6716,9 @@ export const groupBy: {
|
|
|
5895
6716
|
* console.log(Array.unionWith([1, 2], [2, 3], (a, b) => a === b)) // [1, 2, 3]
|
|
5896
6717
|
* ```
|
|
5897
6718
|
*
|
|
5898
|
-
* @see {@link union}
|
|
5899
|
-
* @see {@link
|
|
5900
|
-
* @see {@link
|
|
6719
|
+
* @see {@link union} for the `Equal.equivalence()` variant
|
|
6720
|
+
* @see {@link intersectionWith} for keeping elements present in both arrays
|
|
6721
|
+
* @see {@link differenceWith} for keeping elements present only in the first array
|
|
5901
6722
|
*
|
|
5902
6723
|
* @category elements
|
|
5903
6724
|
* @since 2.0.0
|
|
@@ -5907,6 +6728,11 @@ export const unionWith: {
|
|
|
5907
6728
|
* Computes the union of two arrays using a custom equivalence, removing
|
|
5908
6729
|
* duplicates.
|
|
5909
6730
|
*
|
|
6731
|
+
* **When to use**
|
|
6732
|
+
*
|
|
6733
|
+
* Use when you need the union of two arrays but duplicate detection must use a
|
|
6734
|
+
* custom equivalence instead of the default `Equal.equivalence()`.
|
|
6735
|
+
*
|
|
5910
6736
|
* **Example** (Union with custom equality)
|
|
5911
6737
|
*
|
|
5912
6738
|
* ```ts
|
|
@@ -5915,9 +6741,9 @@ export const unionWith: {
|
|
|
5915
6741
|
* console.log(Array.unionWith([1, 2], [2, 3], (a, b) => a === b)) // [1, 2, 3]
|
|
5916
6742
|
* ```
|
|
5917
6743
|
*
|
|
5918
|
-
* @see {@link union}
|
|
5919
|
-
* @see {@link
|
|
5920
|
-
* @see {@link
|
|
6744
|
+
* @see {@link union} for the `Equal.equivalence()` variant
|
|
6745
|
+
* @see {@link intersectionWith} for keeping elements present in both arrays
|
|
6746
|
+
* @see {@link differenceWith} for keeping elements present only in the first array
|
|
5921
6747
|
*
|
|
5922
6748
|
* @category elements
|
|
5923
6749
|
* @since 2.0.0
|
|
@@ -5930,6 +6756,11 @@ export const unionWith: {
|
|
|
5930
6756
|
* Computes the union of two arrays using a custom equivalence, removing
|
|
5931
6757
|
* duplicates.
|
|
5932
6758
|
*
|
|
6759
|
+
* **When to use**
|
|
6760
|
+
*
|
|
6761
|
+
* Use when you need the union of two arrays but duplicate detection must use a
|
|
6762
|
+
* custom equivalence instead of the default `Equal.equivalence()`.
|
|
6763
|
+
*
|
|
5933
6764
|
* **Example** (Union with custom equality)
|
|
5934
6765
|
*
|
|
5935
6766
|
* ```ts
|
|
@@ -5938,9 +6769,9 @@ export const unionWith: {
|
|
|
5938
6769
|
* console.log(Array.unionWith([1, 2], [2, 3], (a, b) => a === b)) // [1, 2, 3]
|
|
5939
6770
|
* ```
|
|
5940
6771
|
*
|
|
5941
|
-
* @see {@link union}
|
|
5942
|
-
* @see {@link
|
|
5943
|
-
* @see {@link
|
|
6772
|
+
* @see {@link union} for the `Equal.equivalence()` variant
|
|
6773
|
+
* @see {@link intersectionWith} for keeping elements present in both arrays
|
|
6774
|
+
* @see {@link differenceWith} for keeping elements present only in the first array
|
|
5944
6775
|
*
|
|
5945
6776
|
* @category elements
|
|
5946
6777
|
* @since 2.0.0
|
|
@@ -5954,6 +6785,11 @@ export const unionWith: {
|
|
|
5954
6785
|
* Computes the union of two arrays using a custom equivalence, removing
|
|
5955
6786
|
* duplicates.
|
|
5956
6787
|
*
|
|
6788
|
+
* **When to use**
|
|
6789
|
+
*
|
|
6790
|
+
* Use when you need the union of two arrays but duplicate detection must use a
|
|
6791
|
+
* custom equivalence instead of the default `Equal.equivalence()`.
|
|
6792
|
+
*
|
|
5957
6793
|
* **Example** (Union with custom equality)
|
|
5958
6794
|
*
|
|
5959
6795
|
* ```ts
|
|
@@ -5962,9 +6798,9 @@ export const unionWith: {
|
|
|
5962
6798
|
* console.log(Array.unionWith([1, 2], [2, 3], (a, b) => a === b)) // [1, 2, 3]
|
|
5963
6799
|
* ```
|
|
5964
6800
|
*
|
|
5965
|
-
* @see {@link union}
|
|
5966
|
-
* @see {@link
|
|
5967
|
-
* @see {@link
|
|
6801
|
+
* @see {@link union} for the `Equal.equivalence()` variant
|
|
6802
|
+
* @see {@link intersectionWith} for keeping elements present in both arrays
|
|
6803
|
+
* @see {@link differenceWith} for keeping elements present only in the first array
|
|
5968
6804
|
*
|
|
5969
6805
|
* @category elements
|
|
5970
6806
|
* @since 2.0.0
|
|
@@ -5978,6 +6814,11 @@ export const unionWith: {
|
|
|
5978
6814
|
* Computes the union of two arrays using a custom equivalence, removing
|
|
5979
6815
|
* duplicates.
|
|
5980
6816
|
*
|
|
6817
|
+
* **When to use**
|
|
6818
|
+
*
|
|
6819
|
+
* Use when you need the union of two arrays but duplicate detection must use a
|
|
6820
|
+
* custom equivalence instead of the default `Equal.equivalence()`.
|
|
6821
|
+
*
|
|
5981
6822
|
* **Example** (Union with custom equality)
|
|
5982
6823
|
*
|
|
5983
6824
|
* ```ts
|
|
@@ -5986,9 +6827,9 @@ export const unionWith: {
|
|
|
5986
6827
|
* console.log(Array.unionWith([1, 2], [2, 3], (a, b) => a === b)) // [1, 2, 3]
|
|
5987
6828
|
* ```
|
|
5988
6829
|
*
|
|
5989
|
-
* @see {@link union}
|
|
5990
|
-
* @see {@link
|
|
5991
|
-
* @see {@link
|
|
6830
|
+
* @see {@link union} for the `Equal.equivalence()` variant
|
|
6831
|
+
* @see {@link intersectionWith} for keeping elements present in both arrays
|
|
6832
|
+
* @see {@link differenceWith} for keeping elements present only in the first array
|
|
5992
6833
|
*
|
|
5993
6834
|
* @category elements
|
|
5994
6835
|
* @since 2.0.0
|
|
@@ -6141,6 +6982,11 @@ export const union: {
|
|
|
6141
6982
|
* Computes the intersection of two arrays using a custom equivalence. Order is
|
|
6142
6983
|
* determined by the first array.
|
|
6143
6984
|
*
|
|
6985
|
+
* **When to use**
|
|
6986
|
+
*
|
|
6987
|
+
* Use when keeping only values present in both arrays and equality must be
|
|
6988
|
+
* defined by a custom comparator, such as matching objects by id.
|
|
6989
|
+
*
|
|
6144
6990
|
* **Example** (Intersection with custom equality)
|
|
6145
6991
|
*
|
|
6146
6992
|
* ```ts
|
|
@@ -6152,9 +6998,9 @@ export const union: {
|
|
|
6152
6998
|
* console.log(Array.intersectionWith(isEquivalent)(array2)(array1)) // [{ id: 1 }, { id: 3 }]
|
|
6153
6999
|
* ```
|
|
6154
7000
|
*
|
|
6155
|
-
* @see {@link intersection}
|
|
6156
|
-
* @see {@link
|
|
6157
|
-
* @see {@link
|
|
7001
|
+
* @see {@link intersection} for the `Equal.equivalence()` variant
|
|
7002
|
+
* @see {@link unionWith} for keeping values from either array with custom equality
|
|
7003
|
+
* @see {@link differenceWith} for keeping values only from the first array with custom equality
|
|
6158
7004
|
*
|
|
6159
7005
|
* @category elements
|
|
6160
7006
|
* @since 2.0.0
|
|
@@ -6239,6 +7085,11 @@ export const intersection: {
|
|
|
6239
7085
|
* Computes elements in the first array that are not in the second, using a
|
|
6240
7086
|
* custom equivalence.
|
|
6241
7087
|
*
|
|
7088
|
+
* **When to use**
|
|
7089
|
+
*
|
|
7090
|
+
* Use when keeping only values from the first array and equality must be
|
|
7091
|
+
* defined by a custom comparator, such as matching objects by id.
|
|
7092
|
+
*
|
|
6242
7093
|
* **Example** (Difference with custom equality)
|
|
6243
7094
|
*
|
|
6244
7095
|
* ```ts
|
|
@@ -6248,9 +7099,9 @@ export const intersection: {
|
|
|
6248
7099
|
* console.log(diff) // [1]
|
|
6249
7100
|
* ```
|
|
6250
7101
|
*
|
|
6251
|
-
* @see {@link difference}
|
|
6252
|
-
* @see {@link
|
|
6253
|
-
* @see {@link
|
|
7102
|
+
* @see {@link difference} for the `Equal.equivalence()` variant
|
|
7103
|
+
* @see {@link unionWith} for keeping values from either array with custom equality
|
|
7104
|
+
* @see {@link intersectionWith} for keeping values present in both arrays with custom equality
|
|
6254
7105
|
*
|
|
6255
7106
|
* @category elements
|
|
6256
7107
|
* @since 2.0.0
|
|
@@ -6273,6 +7124,11 @@ export const differenceWith = <A>(isEquivalent: (self: A, that: A) => boolean):
|
|
|
6273
7124
|
* Computes elements in the first array that are not in the second, using
|
|
6274
7125
|
* `Equal.equivalence()`.
|
|
6275
7126
|
*
|
|
7127
|
+
* **When to use**
|
|
7128
|
+
*
|
|
7129
|
+
* Use when you need to keep values from the first array that are absent from
|
|
7130
|
+
* the second and the default `Equal.equivalence()` comparison is appropriate.
|
|
7131
|
+
*
|
|
6276
7132
|
* **Example** (Array difference)
|
|
6277
7133
|
*
|
|
6278
7134
|
* ```ts
|
|
@@ -6293,6 +7149,11 @@ export const difference: {
|
|
|
6293
7149
|
* Computes elements in the first array that are not in the second, using
|
|
6294
7150
|
* `Equal.equivalence()`.
|
|
6295
7151
|
*
|
|
7152
|
+
* **When to use**
|
|
7153
|
+
*
|
|
7154
|
+
* Use when you need to keep values from the first array that are absent from
|
|
7155
|
+
* the second and the default `Equal.equivalence()` comparison is appropriate.
|
|
7156
|
+
*
|
|
6296
7157
|
* **Example** (Array difference)
|
|
6297
7158
|
*
|
|
6298
7159
|
* ```ts
|
|
@@ -6313,6 +7174,11 @@ export const difference: {
|
|
|
6313
7174
|
* Computes elements in the first array that are not in the second, using
|
|
6314
7175
|
* `Equal.equivalence()`.
|
|
6315
7176
|
*
|
|
7177
|
+
* **When to use**
|
|
7178
|
+
*
|
|
7179
|
+
* Use when you need to keep values from the first array that are absent from
|
|
7180
|
+
* the second and the default `Equal.equivalence()` comparison is appropriate.
|
|
7181
|
+
*
|
|
6316
7182
|
* **Example** (Array difference)
|
|
6317
7183
|
*
|
|
6318
7184
|
* ```ts
|
|
@@ -6334,6 +7200,10 @@ export const difference: {
|
|
|
6334
7200
|
/**
|
|
6335
7201
|
* Creates an empty array.
|
|
6336
7202
|
*
|
|
7203
|
+
* **When to use**
|
|
7204
|
+
*
|
|
7205
|
+
* Use to create a typed empty array without allocating placeholder elements.
|
|
7206
|
+
*
|
|
6337
7207
|
* **Example** (Creating an empty array)
|
|
6338
7208
|
*
|
|
6339
7209
|
* ```ts
|
|
@@ -6492,6 +7362,10 @@ export declare namespace ReadonlyArray {
|
|
|
6492
7362
|
/**
|
|
6493
7363
|
* Transforms each element using a function, returning a new array.
|
|
6494
7364
|
*
|
|
7365
|
+
* **When to use**
|
|
7366
|
+
*
|
|
7367
|
+
* Use to transform each element independently while preserving the array shape.
|
|
7368
|
+
*
|
|
6495
7369
|
* **Details**
|
|
6496
7370
|
*
|
|
6497
7371
|
* - The function receives `(element, index)`.
|
|
@@ -6514,6 +7388,10 @@ export const map: {
|
|
|
6514
7388
|
/**
|
|
6515
7389
|
* Transforms each element using a function, returning a new array.
|
|
6516
7390
|
*
|
|
7391
|
+
* **When to use**
|
|
7392
|
+
*
|
|
7393
|
+
* Use to transform each element independently while preserving the array shape.
|
|
7394
|
+
*
|
|
6517
7395
|
* **Details**
|
|
6518
7396
|
*
|
|
6519
7397
|
* - The function receives `(element, index)`.
|
|
@@ -6536,6 +7414,10 @@ export const map: {
|
|
|
6536
7414
|
/**
|
|
6537
7415
|
* Transforms each element using a function, returning a new array.
|
|
6538
7416
|
*
|
|
7417
|
+
* **When to use**
|
|
7418
|
+
*
|
|
7419
|
+
* Use to transform each element independently while preserving the array shape.
|
|
7420
|
+
*
|
|
6539
7421
|
* **Details**
|
|
6540
7422
|
*
|
|
6541
7423
|
* - The function receives `(element, index)`.
|
|
@@ -6560,6 +7442,11 @@ export const map: {
|
|
|
6560
7442
|
/**
|
|
6561
7443
|
* Maps each element to an array and flattens the results into a single array.
|
|
6562
7444
|
*
|
|
7445
|
+
* **When to use**
|
|
7446
|
+
*
|
|
7447
|
+
* Use to map each element to zero or more values and concatenate the results in
|
|
7448
|
+
* one pass.
|
|
7449
|
+
*
|
|
6563
7450
|
* **Details**
|
|
6564
7451
|
*
|
|
6565
7452
|
* - The function receives `(element, index)`.
|
|
@@ -6583,6 +7470,11 @@ export const flatMap: {
|
|
|
6583
7470
|
/**
|
|
6584
7471
|
* Maps each element to an array and flattens the results into a single array.
|
|
6585
7472
|
*
|
|
7473
|
+
* **When to use**
|
|
7474
|
+
*
|
|
7475
|
+
* Use to map each element to zero or more values and concatenate the results in
|
|
7476
|
+
* one pass.
|
|
7477
|
+
*
|
|
6586
7478
|
* **Details**
|
|
6587
7479
|
*
|
|
6588
7480
|
* - The function receives `(element, index)`.
|
|
@@ -6606,6 +7498,11 @@ export const flatMap: {
|
|
|
6606
7498
|
/**
|
|
6607
7499
|
* Maps each element to an array and flattens the results into a single array.
|
|
6608
7500
|
*
|
|
7501
|
+
* **When to use**
|
|
7502
|
+
*
|
|
7503
|
+
* Use to map each element to zero or more values and concatenate the results in
|
|
7504
|
+
* one pass.
|
|
7505
|
+
*
|
|
6609
7506
|
* **Details**
|
|
6610
7507
|
*
|
|
6611
7508
|
* - The function receives `(element, index)`.
|
|
@@ -6632,6 +7529,11 @@ export const flatMap: {
|
|
|
6632
7529
|
/**
|
|
6633
7530
|
* Maps each element to an array and flattens the results into a single array.
|
|
6634
7531
|
*
|
|
7532
|
+
* **When to use**
|
|
7533
|
+
*
|
|
7534
|
+
* Use to map each element to zero or more values and concatenate the results in
|
|
7535
|
+
* one pass.
|
|
7536
|
+
*
|
|
6635
7537
|
* **Details**
|
|
6636
7538
|
*
|
|
6637
7539
|
* - The function receives `(element, index)`.
|
|
@@ -6672,6 +7574,11 @@ export const flatMap: {
|
|
|
6672
7574
|
/**
|
|
6673
7575
|
* Flattens a nested array of arrays into a single array.
|
|
6674
7576
|
*
|
|
7577
|
+
* **When to use**
|
|
7578
|
+
*
|
|
7579
|
+
* Use to collapse one level of nested arrays when no per-element mapping is
|
|
7580
|
+
* needed.
|
|
7581
|
+
*
|
|
6675
7582
|
* **Example** (Flattening nested arrays)
|
|
6676
7583
|
*
|
|
6677
7584
|
* ```ts
|
|
@@ -6691,6 +7598,11 @@ export const flatten: <const S extends ReadonlyArray<ReadonlyArray<any>>>(self:
|
|
|
6691
7598
|
/**
|
|
6692
7599
|
* Extracts all `Some` values from an iterable of `Option`s, discarding `None`s.
|
|
6693
7600
|
*
|
|
7601
|
+
* **When to use**
|
|
7602
|
+
*
|
|
7603
|
+
* Use to collect only present values from `Option` values while discarding
|
|
7604
|
+
* `None` values.
|
|
7605
|
+
*
|
|
6694
7606
|
* **Example** (Extracting Some values)
|
|
6695
7607
|
*
|
|
6696
7608
|
* ```ts
|
|
@@ -6722,6 +7634,11 @@ export const getSomes: <T extends Iterable<Option.Option<X>>, X = any>(
|
|
|
6722
7634
|
* Extracts all failure values from an iterable of `Result`s, discarding
|
|
6723
7635
|
* successes.
|
|
6724
7636
|
*
|
|
7637
|
+
* **When to use**
|
|
7638
|
+
*
|
|
7639
|
+
* Use to collect only failure values from `Result` values while discarding
|
|
7640
|
+
* successes.
|
|
7641
|
+
*
|
|
6725
7642
|
* **Example** (Extracting failures)
|
|
6726
7643
|
*
|
|
6727
7644
|
* ```ts
|
|
@@ -6754,6 +7671,11 @@ export const getFailures = <T extends Iterable<Result.Result<any, any>>>(
|
|
|
6754
7671
|
* Extracts all success values from an iterable of `Result`s, discarding
|
|
6755
7672
|
* failures.
|
|
6756
7673
|
*
|
|
7674
|
+
* **When to use**
|
|
7675
|
+
*
|
|
7676
|
+
* Use to collect only success values from `Result` values while discarding
|
|
7677
|
+
* failures.
|
|
7678
|
+
*
|
|
6757
7679
|
* **Example** (Extracting successes)
|
|
6758
7680
|
*
|
|
6759
7681
|
* ```ts
|
|
@@ -6785,6 +7707,11 @@ export const getSuccesses = <T extends Iterable<Result.Result<any, any>>>(
|
|
|
6785
7707
|
/**
|
|
6786
7708
|
* Keeps transformed values for elements where a `Filter` succeeds.
|
|
6787
7709
|
*
|
|
7710
|
+
* **When to use**
|
|
7711
|
+
*
|
|
7712
|
+
* Use to transform elements with a `Result`-returning filter while discarding
|
|
7713
|
+
* failures.
|
|
7714
|
+
*
|
|
6788
7715
|
* **Details**
|
|
6789
7716
|
*
|
|
6790
7717
|
* - The filter receives `(element, index)`.
|
|
@@ -6800,6 +7727,7 @@ export const getSuccesses = <T extends Iterable<Result.Result<any, any>>>(
|
|
|
6800
7727
|
* ```
|
|
6801
7728
|
*
|
|
6802
7729
|
* @see {@link filter} — keep original elements matching a predicate
|
|
7730
|
+
* @see {@link partition} for keeping both failures and successes
|
|
6803
7731
|
*
|
|
6804
7732
|
* @category filtering
|
|
6805
7733
|
* @since 2.0.0
|
|
@@ -6808,6 +7736,11 @@ export const filterMap: {
|
|
|
6808
7736
|
/**
|
|
6809
7737
|
* Keeps transformed values for elements where a `Filter` succeeds.
|
|
6810
7738
|
*
|
|
7739
|
+
* **When to use**
|
|
7740
|
+
*
|
|
7741
|
+
* Use to transform elements with a `Result`-returning filter while discarding
|
|
7742
|
+
* failures.
|
|
7743
|
+
*
|
|
6811
7744
|
* **Details**
|
|
6812
7745
|
*
|
|
6813
7746
|
* - The filter receives `(element, index)`.
|
|
@@ -6823,6 +7756,7 @@ export const filterMap: {
|
|
|
6823
7756
|
* ```
|
|
6824
7757
|
*
|
|
6825
7758
|
* @see {@link filter} — keep original elements matching a predicate
|
|
7759
|
+
* @see {@link partition} for keeping both failures and successes
|
|
6826
7760
|
*
|
|
6827
7761
|
* @category filtering
|
|
6828
7762
|
* @since 2.0.0
|
|
@@ -6831,6 +7765,11 @@ export const filterMap: {
|
|
|
6831
7765
|
/**
|
|
6832
7766
|
* Keeps transformed values for elements where a `Filter` succeeds.
|
|
6833
7767
|
*
|
|
7768
|
+
* **When to use**
|
|
7769
|
+
*
|
|
7770
|
+
* Use to transform elements with a `Result`-returning filter while discarding
|
|
7771
|
+
* failures.
|
|
7772
|
+
*
|
|
6834
7773
|
* **Details**
|
|
6835
7774
|
*
|
|
6836
7775
|
* - The filter receives `(element, index)`.
|
|
@@ -6846,6 +7785,7 @@ export const filterMap: {
|
|
|
6846
7785
|
* ```
|
|
6847
7786
|
*
|
|
6848
7787
|
* @see {@link filter} — keep original elements matching a predicate
|
|
7788
|
+
* @see {@link partition} for keeping both failures and successes
|
|
6849
7789
|
*
|
|
6850
7790
|
* @category filtering
|
|
6851
7791
|
* @since 2.0.0
|
|
@@ -6866,6 +7806,10 @@ export const filterMap: {
|
|
|
6866
7806
|
/**
|
|
6867
7807
|
* Keeps only elements satisfying a predicate (or refinement).
|
|
6868
7808
|
*
|
|
7809
|
+
* **When to use**
|
|
7810
|
+
*
|
|
7811
|
+
* Use to keep original elements that satisfy a boolean predicate or refinement.
|
|
7812
|
+
*
|
|
6869
7813
|
* **Details**
|
|
6870
7814
|
*
|
|
6871
7815
|
* - The predicate receives `(element, index)`.
|
|
@@ -6880,6 +7824,7 @@ export const filterMap: {
|
|
|
6880
7824
|
* ```
|
|
6881
7825
|
*
|
|
6882
7826
|
* @see {@link partition} — split into matching and non-matching
|
|
7827
|
+
* @see {@link filterMap} for transforming while filtering
|
|
6883
7828
|
*
|
|
6884
7829
|
* @category filtering
|
|
6885
7830
|
* @since 2.0.0
|
|
@@ -6888,6 +7833,10 @@ export const filter: {
|
|
|
6888
7833
|
/**
|
|
6889
7834
|
* Keeps only elements satisfying a predicate (or refinement).
|
|
6890
7835
|
*
|
|
7836
|
+
* **When to use**
|
|
7837
|
+
*
|
|
7838
|
+
* Use to keep original elements that satisfy a boolean predicate or refinement.
|
|
7839
|
+
*
|
|
6891
7840
|
* **Details**
|
|
6892
7841
|
*
|
|
6893
7842
|
* - The predicate receives `(element, index)`.
|
|
@@ -6902,6 +7851,7 @@ export const filter: {
|
|
|
6902
7851
|
* ```
|
|
6903
7852
|
*
|
|
6904
7853
|
* @see {@link partition} — split into matching and non-matching
|
|
7854
|
+
* @see {@link filterMap} for transforming while filtering
|
|
6905
7855
|
*
|
|
6906
7856
|
* @category filtering
|
|
6907
7857
|
* @since 2.0.0
|
|
@@ -6910,6 +7860,10 @@ export const filter: {
|
|
|
6910
7860
|
/**
|
|
6911
7861
|
* Keeps only elements satisfying a predicate (or refinement).
|
|
6912
7862
|
*
|
|
7863
|
+
* **When to use**
|
|
7864
|
+
*
|
|
7865
|
+
* Use to keep original elements that satisfy a boolean predicate or refinement.
|
|
7866
|
+
*
|
|
6913
7867
|
* **Details**
|
|
6914
7868
|
*
|
|
6915
7869
|
* - The predicate receives `(element, index)`.
|
|
@@ -6924,6 +7878,7 @@ export const filter: {
|
|
|
6924
7878
|
* ```
|
|
6925
7879
|
*
|
|
6926
7880
|
* @see {@link partition} — split into matching and non-matching
|
|
7881
|
+
* @see {@link filterMap} for transforming while filtering
|
|
6927
7882
|
*
|
|
6928
7883
|
* @category filtering
|
|
6929
7884
|
* @since 2.0.0
|
|
@@ -6932,6 +7887,10 @@ export const filter: {
|
|
|
6932
7887
|
/**
|
|
6933
7888
|
* Keeps only elements satisfying a predicate (or refinement).
|
|
6934
7889
|
*
|
|
7890
|
+
* **When to use**
|
|
7891
|
+
*
|
|
7892
|
+
* Use to keep original elements that satisfy a boolean predicate or refinement.
|
|
7893
|
+
*
|
|
6935
7894
|
* **Details**
|
|
6936
7895
|
*
|
|
6937
7896
|
* - The predicate receives `(element, index)`.
|
|
@@ -6946,6 +7905,7 @@ export const filter: {
|
|
|
6946
7905
|
* ```
|
|
6947
7906
|
*
|
|
6948
7907
|
* @see {@link partition} — split into matching and non-matching
|
|
7908
|
+
* @see {@link filterMap} for transforming while filtering
|
|
6949
7909
|
*
|
|
6950
7910
|
* @category filtering
|
|
6951
7911
|
* @since 2.0.0
|
|
@@ -6954,6 +7914,10 @@ export const filter: {
|
|
|
6954
7914
|
/**
|
|
6955
7915
|
* Keeps only elements satisfying a predicate (or refinement).
|
|
6956
7916
|
*
|
|
7917
|
+
* **When to use**
|
|
7918
|
+
*
|
|
7919
|
+
* Use to keep original elements that satisfy a boolean predicate or refinement.
|
|
7920
|
+
*
|
|
6957
7921
|
* **Details**
|
|
6958
7922
|
*
|
|
6959
7923
|
* - The predicate receives `(element, index)`.
|
|
@@ -6968,6 +7932,7 @@ export const filter: {
|
|
|
6968
7932
|
* ```
|
|
6969
7933
|
*
|
|
6970
7934
|
* @see {@link partition} — split into matching and non-matching
|
|
7935
|
+
* @see {@link filterMap} for transforming while filtering
|
|
6971
7936
|
*
|
|
6972
7937
|
* @category filtering
|
|
6973
7938
|
* @since 2.0.0
|
|
@@ -6990,6 +7955,11 @@ export const filter: {
|
|
|
6990
7955
|
/**
|
|
6991
7956
|
* Splits an iterable using a `Filter` into failures and successes.
|
|
6992
7957
|
*
|
|
7958
|
+
* **When to use**
|
|
7959
|
+
*
|
|
7960
|
+
* Use to evaluate each element with a `Result`-returning filter and keep both
|
|
7961
|
+
* failure and success values.
|
|
7962
|
+
*
|
|
6993
7963
|
* **Details**
|
|
6994
7964
|
*
|
|
6995
7965
|
* - Returns `[excluded, satisfying]`.
|
|
@@ -7007,6 +7977,7 @@ export const filter: {
|
|
|
7007
7977
|
* ```
|
|
7008
7978
|
*
|
|
7009
7979
|
* @see {@link filter} — keep only matching elements
|
|
7980
|
+
* @see {@link filterMap} for discarding failures
|
|
7010
7981
|
* @see {@link separate} — split an iterable of `Result` values
|
|
7011
7982
|
*
|
|
7012
7983
|
* @category filtering
|
|
@@ -7016,6 +7987,11 @@ export const partition: {
|
|
|
7016
7987
|
/**
|
|
7017
7988
|
* Splits an iterable using a `Filter` into failures and successes.
|
|
7018
7989
|
*
|
|
7990
|
+
* **When to use**
|
|
7991
|
+
*
|
|
7992
|
+
* Use to evaluate each element with a `Result`-returning filter and keep both
|
|
7993
|
+
* failure and success values.
|
|
7994
|
+
*
|
|
7019
7995
|
* **Details**
|
|
7020
7996
|
*
|
|
7021
7997
|
* - Returns `[excluded, satisfying]`.
|
|
@@ -7033,6 +8009,7 @@ export const partition: {
|
|
|
7033
8009
|
* ```
|
|
7034
8010
|
*
|
|
7035
8011
|
* @see {@link filter} — keep only matching elements
|
|
8012
|
+
* @see {@link filterMap} for discarding failures
|
|
7036
8013
|
* @see {@link separate} — split an iterable of `Result` values
|
|
7037
8014
|
*
|
|
7038
8015
|
* @category filtering
|
|
@@ -7042,6 +8019,11 @@ export const partition: {
|
|
|
7042
8019
|
/**
|
|
7043
8020
|
* Splits an iterable using a `Filter` into failures and successes.
|
|
7044
8021
|
*
|
|
8022
|
+
* **When to use**
|
|
8023
|
+
*
|
|
8024
|
+
* Use to evaluate each element with a `Result`-returning filter and keep both
|
|
8025
|
+
* failure and success values.
|
|
8026
|
+
*
|
|
7045
8027
|
* **Details**
|
|
7046
8028
|
*
|
|
7047
8029
|
* - Returns `[excluded, satisfying]`.
|
|
@@ -7059,6 +8041,7 @@ export const partition: {
|
|
|
7059
8041
|
* ```
|
|
7060
8042
|
*
|
|
7061
8043
|
* @see {@link filter} — keep only matching elements
|
|
8044
|
+
* @see {@link filterMap} for discarding failures
|
|
7062
8045
|
* @see {@link separate} — split an iterable of `Result` values
|
|
7063
8046
|
*
|
|
7064
8047
|
* @category filtering
|
|
@@ -7089,6 +8072,10 @@ export const partition: {
|
|
|
7089
8072
|
/**
|
|
7090
8073
|
* Separates an iterable of `Result`s into failure values and success values.
|
|
7091
8074
|
*
|
|
8075
|
+
* **When to use**
|
|
8076
|
+
*
|
|
8077
|
+
* Use to split existing `Result` values into failure and success arrays.
|
|
8078
|
+
*
|
|
7092
8079
|
* **Details**
|
|
7093
8080
|
*
|
|
7094
8081
|
* - Returns `[failures, successes]`.
|
|
@@ -7108,6 +8095,7 @@ export const partition: {
|
|
|
7108
8095
|
*
|
|
7109
8096
|
* @see {@link getFailures} — extract only failures
|
|
7110
8097
|
* @see {@link getSuccesses} — extract only successes
|
|
8098
|
+
* @see {@link partition} for computing `Result` values while splitting
|
|
7111
8099
|
*
|
|
7112
8100
|
* @category filtering
|
|
7113
8101
|
* @since 2.0.0
|
|
@@ -7122,6 +8110,10 @@ export const separate: <T extends Iterable<Result.Result<any, any>>>(
|
|
|
7122
8110
|
/**
|
|
7123
8111
|
* Folds an iterable from left to right into a single value.
|
|
7124
8112
|
*
|
|
8113
|
+
* **When to use**
|
|
8114
|
+
*
|
|
8115
|
+
* Use to combine all elements into one accumulated value from left to right.
|
|
8116
|
+
*
|
|
7125
8117
|
* **Details**
|
|
7126
8118
|
*
|
|
7127
8119
|
* - The function receives `(accumulator, element, index)`.
|
|
@@ -7144,6 +8136,10 @@ export const reduce: {
|
|
|
7144
8136
|
/**
|
|
7145
8137
|
* Folds an iterable from left to right into a single value.
|
|
7146
8138
|
*
|
|
8139
|
+
* **When to use**
|
|
8140
|
+
*
|
|
8141
|
+
* Use to combine all elements into one accumulated value from left to right.
|
|
8142
|
+
*
|
|
7147
8143
|
* **Details**
|
|
7148
8144
|
*
|
|
7149
8145
|
* - The function receives `(accumulator, element, index)`.
|
|
@@ -7166,6 +8162,10 @@ export const reduce: {
|
|
|
7166
8162
|
/**
|
|
7167
8163
|
* Folds an iterable from left to right into a single value.
|
|
7168
8164
|
*
|
|
8165
|
+
* **When to use**
|
|
8166
|
+
*
|
|
8167
|
+
* Use to combine all elements into one accumulated value from left to right.
|
|
8168
|
+
*
|
|
7169
8169
|
* **Details**
|
|
7170
8170
|
*
|
|
7171
8171
|
* - The function receives `(accumulator, element, index)`.
|
|
@@ -7194,6 +8194,11 @@ export const reduce: {
|
|
|
7194
8194
|
/**
|
|
7195
8195
|
* Folds an iterable from right to left into a single value.
|
|
7196
8196
|
*
|
|
8197
|
+
* **When to use**
|
|
8198
|
+
*
|
|
8199
|
+
* Use when folding order matters and values must be combined from right to
|
|
8200
|
+
* left.
|
|
8201
|
+
*
|
|
7197
8202
|
* **Details**
|
|
7198
8203
|
*
|
|
7199
8204
|
* - The function receives `(accumulator, element, index)`.
|
|
@@ -7216,6 +8221,11 @@ export const reduceRight: {
|
|
|
7216
8221
|
/**
|
|
7217
8222
|
* Folds an iterable from right to left into a single value.
|
|
7218
8223
|
*
|
|
8224
|
+
* **When to use**
|
|
8225
|
+
*
|
|
8226
|
+
* Use when folding order matters and values must be combined from right to
|
|
8227
|
+
* left.
|
|
8228
|
+
*
|
|
7219
8229
|
* **Details**
|
|
7220
8230
|
*
|
|
7221
8231
|
* - The function receives `(accumulator, element, index)`.
|
|
@@ -7238,6 +8248,11 @@ export const reduceRight: {
|
|
|
7238
8248
|
/**
|
|
7239
8249
|
* Folds an iterable from right to left into a single value.
|
|
7240
8250
|
*
|
|
8251
|
+
* **When to use**
|
|
8252
|
+
*
|
|
8253
|
+
* Use when folding order matters and values must be combined from right to
|
|
8254
|
+
* left.
|
|
8255
|
+
*
|
|
7241
8256
|
* **Details**
|
|
7242
8257
|
*
|
|
7243
8258
|
* - The function receives `(accumulator, element, index)`.
|
|
@@ -7340,6 +8355,10 @@ export const liftOption = <A extends Array<unknown>, B>(
|
|
|
7340
8355
|
* Converts a nullable value to an array: `null`/`undefined` becomes `[]`,
|
|
7341
8356
|
* anything else becomes `[value]`.
|
|
7342
8357
|
*
|
|
8358
|
+
* **When to use**
|
|
8359
|
+
*
|
|
8360
|
+
* Use to treat a nullable single value as zero or one array element.
|
|
8361
|
+
*
|
|
7343
8362
|
* **Example** (Nullable to array)
|
|
7344
8363
|
*
|
|
7345
8364
|
* ```ts
|
|
@@ -7390,6 +8409,11 @@ export const liftNullishOr = <A extends Array<unknown>, B>(
|
|
|
7390
8409
|
* Maps each element with a nullable-returning function, keeping only non-null /
|
|
7391
8410
|
* non-undefined results.
|
|
7392
8411
|
*
|
|
8412
|
+
* **When to use**
|
|
8413
|
+
*
|
|
8414
|
+
* Use when mapping and filtering in one step, where the mapper can return
|
|
8415
|
+
* `null` or `undefined` to skip elements.
|
|
8416
|
+
*
|
|
7393
8417
|
* **Example** (FlatMapping with nullable)
|
|
7394
8418
|
*
|
|
7395
8419
|
* ```ts
|
|
@@ -7399,6 +8423,9 @@ export const liftNullishOr = <A extends Array<unknown>, B>(
|
|
|
7399
8423
|
* // [1, 3]
|
|
7400
8424
|
* ```
|
|
7401
8425
|
*
|
|
8426
|
+
* @see {@link flatMap} for mapping each element to an array and flattening
|
|
8427
|
+
* @see {@link fromNullishOr} for converting a single nullable value to an array
|
|
8428
|
+
*
|
|
7402
8429
|
* @category sequencing
|
|
7403
8430
|
* @since 4.0.0
|
|
7404
8431
|
*/
|
|
@@ -7407,6 +8434,11 @@ export const flatMapNullishOr: {
|
|
|
7407
8434
|
* Maps each element with a nullable-returning function, keeping only non-null /
|
|
7408
8435
|
* non-undefined results.
|
|
7409
8436
|
*
|
|
8437
|
+
* **When to use**
|
|
8438
|
+
*
|
|
8439
|
+
* Use when mapping and filtering in one step, where the mapper can return
|
|
8440
|
+
* `null` or `undefined` to skip elements.
|
|
8441
|
+
*
|
|
7410
8442
|
* **Example** (FlatMapping with nullable)
|
|
7411
8443
|
*
|
|
7412
8444
|
* ```ts
|
|
@@ -7416,6 +8448,9 @@ export const flatMapNullishOr: {
|
|
|
7416
8448
|
* // [1, 3]
|
|
7417
8449
|
* ```
|
|
7418
8450
|
*
|
|
8451
|
+
* @see {@link flatMap} for mapping each element to an array and flattening
|
|
8452
|
+
* @see {@link fromNullishOr} for converting a single nullable value to an array
|
|
8453
|
+
*
|
|
7419
8454
|
* @category sequencing
|
|
7420
8455
|
* @since 4.0.0
|
|
7421
8456
|
*/
|
|
@@ -7424,6 +8459,11 @@ export const flatMapNullishOr: {
|
|
|
7424
8459
|
* Maps each element with a nullable-returning function, keeping only non-null /
|
|
7425
8460
|
* non-undefined results.
|
|
7426
8461
|
*
|
|
8462
|
+
* **When to use**
|
|
8463
|
+
*
|
|
8464
|
+
* Use when mapping and filtering in one step, where the mapper can return
|
|
8465
|
+
* `null` or `undefined` to skip elements.
|
|
8466
|
+
*
|
|
7427
8467
|
* **Example** (FlatMapping with nullable)
|
|
7428
8468
|
*
|
|
7429
8469
|
* ```ts
|
|
@@ -7433,6 +8473,9 @@ export const flatMapNullishOr: {
|
|
|
7433
8473
|
* // [1, 3]
|
|
7434
8474
|
* ```
|
|
7435
8475
|
*
|
|
8476
|
+
* @see {@link flatMap} for mapping each element to an array and flattening
|
|
8477
|
+
* @see {@link fromNullishOr} for converting a single nullable value to an array
|
|
8478
|
+
*
|
|
7436
8479
|
* @category sequencing
|
|
7437
8480
|
* @since 4.0.0
|
|
7438
8481
|
*/
|
|
@@ -7476,9 +8519,14 @@ export const liftResult = <A extends Array<unknown>, E, B>(
|
|
|
7476
8519
|
}
|
|
7477
8520
|
|
|
7478
8521
|
/**
|
|
7479
|
-
*
|
|
8522
|
+
* Checks whether all elements satisfy the predicate. Supports refinements for
|
|
7480
8523
|
* type narrowing.
|
|
7481
8524
|
*
|
|
8525
|
+
* **When to use**
|
|
8526
|
+
*
|
|
8527
|
+
* Use to check that all elements satisfy a predicate, including
|
|
8528
|
+
* refinement-based type narrowing.
|
|
8529
|
+
*
|
|
7482
8530
|
* **Example** (Testing all elements)
|
|
7483
8531
|
*
|
|
7484
8532
|
* ```ts
|
|
@@ -7495,9 +8543,14 @@ export const liftResult = <A extends Array<unknown>, E, B>(
|
|
|
7495
8543
|
*/
|
|
7496
8544
|
export const every: {
|
|
7497
8545
|
/**
|
|
7498
|
-
*
|
|
8546
|
+
* Checks whether all elements satisfy the predicate. Supports refinements for
|
|
7499
8547
|
* type narrowing.
|
|
7500
8548
|
*
|
|
8549
|
+
* **When to use**
|
|
8550
|
+
*
|
|
8551
|
+
* Use to check that all elements satisfy a predicate, including
|
|
8552
|
+
* refinement-based type narrowing.
|
|
8553
|
+
*
|
|
7501
8554
|
* **Example** (Testing all elements)
|
|
7502
8555
|
*
|
|
7503
8556
|
* ```ts
|
|
@@ -7514,9 +8567,14 @@ export const every: {
|
|
|
7514
8567
|
*/
|
|
7515
8568
|
<A, B extends A>(refinement: (a: NoInfer<A>, i: number) => a is B): (self: ReadonlyArray<A>) => self is ReadonlyArray<B>
|
|
7516
8569
|
/**
|
|
7517
|
-
*
|
|
8570
|
+
* Checks whether all elements satisfy the predicate. Supports refinements for
|
|
7518
8571
|
* type narrowing.
|
|
7519
8572
|
*
|
|
8573
|
+
* **When to use**
|
|
8574
|
+
*
|
|
8575
|
+
* Use to check that all elements satisfy a predicate, including
|
|
8576
|
+
* refinement-based type narrowing.
|
|
8577
|
+
*
|
|
7520
8578
|
* **Example** (Testing all elements)
|
|
7521
8579
|
*
|
|
7522
8580
|
* ```ts
|
|
@@ -7533,9 +8591,14 @@ export const every: {
|
|
|
7533
8591
|
*/
|
|
7534
8592
|
<A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: ReadonlyArray<A>) => boolean
|
|
7535
8593
|
/**
|
|
7536
|
-
*
|
|
8594
|
+
* Checks whether all elements satisfy the predicate. Supports refinements for
|
|
7537
8595
|
* type narrowing.
|
|
7538
8596
|
*
|
|
8597
|
+
* **When to use**
|
|
8598
|
+
*
|
|
8599
|
+
* Use to check that all elements satisfy a predicate, including
|
|
8600
|
+
* refinement-based type narrowing.
|
|
8601
|
+
*
|
|
7539
8602
|
* **Example** (Testing all elements)
|
|
7540
8603
|
*
|
|
7541
8604
|
* ```ts
|
|
@@ -7552,9 +8615,14 @@ export const every: {
|
|
|
7552
8615
|
*/
|
|
7553
8616
|
<A, B extends A>(self: ReadonlyArray<A>, refinement: (a: A, i: number) => a is B): self is ReadonlyArray<B>
|
|
7554
8617
|
/**
|
|
7555
|
-
*
|
|
8618
|
+
* Checks whether all elements satisfy the predicate. Supports refinements for
|
|
7556
8619
|
* type narrowing.
|
|
7557
8620
|
*
|
|
8621
|
+
* **When to use**
|
|
8622
|
+
*
|
|
8623
|
+
* Use to check that all elements satisfy a predicate, including
|
|
8624
|
+
* refinement-based type narrowing.
|
|
8625
|
+
*
|
|
7558
8626
|
* **Example** (Testing all elements)
|
|
7559
8627
|
*
|
|
7560
8628
|
* ```ts
|
|
@@ -7577,7 +8645,7 @@ export const every: {
|
|
|
7577
8645
|
)
|
|
7578
8646
|
|
|
7579
8647
|
/**
|
|
7580
|
-
*
|
|
8648
|
+
* Checks whether at least one element satisfies the predicate. Narrows the type
|
|
7581
8649
|
* to `NonEmptyReadonlyArray` on success.
|
|
7582
8650
|
*
|
|
7583
8651
|
* **Example** (Testing for any match)
|
|
@@ -7597,7 +8665,7 @@ export const every: {
|
|
|
7597
8665
|
*/
|
|
7598
8666
|
export const some: {
|
|
7599
8667
|
/**
|
|
7600
|
-
*
|
|
8668
|
+
* Checks whether at least one element satisfies the predicate. Narrows the type
|
|
7601
8669
|
* to `NonEmptyReadonlyArray` on success.
|
|
7602
8670
|
*
|
|
7603
8671
|
* **Example** (Testing for any match)
|
|
@@ -7617,7 +8685,7 @@ export const some: {
|
|
|
7617
8685
|
*/
|
|
7618
8686
|
<A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: ReadonlyArray<A>) => self is NonEmptyReadonlyArray<A>
|
|
7619
8687
|
/**
|
|
7620
|
-
*
|
|
8688
|
+
* Checks whether at least one element satisfies the predicate. Narrows the type
|
|
7621
8689
|
* to `NonEmptyReadonlyArray` on success.
|
|
7622
8690
|
*
|
|
7623
8691
|
* **Example** (Testing for any match)
|
|
@@ -7646,6 +8714,11 @@ export const some: {
|
|
|
7646
8714
|
* Applies a function to each suffix of the array (starting from each index),
|
|
7647
8715
|
* collecting the results.
|
|
7648
8716
|
*
|
|
8717
|
+
* **When to use**
|
|
8718
|
+
*
|
|
8719
|
+
* Use when a computation depends on every suffix of an array, such as
|
|
8720
|
+
* cumulative aggregations from each position.
|
|
8721
|
+
*
|
|
7649
8722
|
* **Details**
|
|
7650
8723
|
*
|
|
7651
8724
|
* - For index `i`, the function receives `self.slice(i)`.
|
|
@@ -7658,6 +8731,8 @@ export const some: {
|
|
|
7658
8731
|
* console.log(Array.extend([1, 2, 3], (as) => as.length)) // [3, 2, 1]
|
|
7659
8732
|
* ```
|
|
7660
8733
|
*
|
|
8734
|
+
* @see {@link scan} for keeping intermediate accumulator values during a fold
|
|
8735
|
+
*
|
|
7661
8736
|
* @category mapping
|
|
7662
8737
|
* @since 2.0.0
|
|
7663
8738
|
*/
|
|
@@ -7666,6 +8741,11 @@ export const extend: {
|
|
|
7666
8741
|
* Applies a function to each suffix of the array (starting from each index),
|
|
7667
8742
|
* collecting the results.
|
|
7668
8743
|
*
|
|
8744
|
+
* **When to use**
|
|
8745
|
+
*
|
|
8746
|
+
* Use when a computation depends on every suffix of an array, such as
|
|
8747
|
+
* cumulative aggregations from each position.
|
|
8748
|
+
*
|
|
7669
8749
|
* **Details**
|
|
7670
8750
|
*
|
|
7671
8751
|
* - For index `i`, the function receives `self.slice(i)`.
|
|
@@ -7678,6 +8758,8 @@ export const extend: {
|
|
|
7678
8758
|
* console.log(Array.extend([1, 2, 3], (as) => as.length)) // [3, 2, 1]
|
|
7679
8759
|
* ```
|
|
7680
8760
|
*
|
|
8761
|
+
* @see {@link scan} for keeping intermediate accumulator values during a fold
|
|
8762
|
+
*
|
|
7681
8763
|
* @category mapping
|
|
7682
8764
|
* @since 2.0.0
|
|
7683
8765
|
*/
|
|
@@ -7686,6 +8768,11 @@ export const extend: {
|
|
|
7686
8768
|
* Applies a function to each suffix of the array (starting from each index),
|
|
7687
8769
|
* collecting the results.
|
|
7688
8770
|
*
|
|
8771
|
+
* **When to use**
|
|
8772
|
+
*
|
|
8773
|
+
* Use when a computation depends on every suffix of an array, such as
|
|
8774
|
+
* cumulative aggregations from each position.
|
|
8775
|
+
*
|
|
7689
8776
|
* **Details**
|
|
7690
8777
|
*
|
|
7691
8778
|
* - For index `i`, the function receives `self.slice(i)`.
|
|
@@ -7698,6 +8785,8 @@ export const extend: {
|
|
|
7698
8785
|
* console.log(Array.extend([1, 2, 3], (as) => as.length)) // [3, 2, 1]
|
|
7699
8786
|
* ```
|
|
7700
8787
|
*
|
|
8788
|
+
* @see {@link scan} for keeping intermediate accumulator values during a fold
|
|
8789
|
+
*
|
|
7701
8790
|
* @category mapping
|
|
7702
8791
|
* @since 2.0.0
|
|
7703
8792
|
*/
|
|
@@ -7907,6 +8996,11 @@ export const makeEquivalence: <A>(
|
|
|
7907
8996
|
/**
|
|
7908
8997
|
* Runs a side-effect for each element. The callback receives `(element, index)`.
|
|
7909
8998
|
*
|
|
8999
|
+
* **When to use**
|
|
9000
|
+
*
|
|
9001
|
+
* Use to iterate over an array for side-effects only, when no transformed
|
|
9002
|
+
* result is needed.
|
|
9003
|
+
*
|
|
7910
9004
|
* **Example** (Iterating with side-effects)
|
|
7911
9005
|
*
|
|
7912
9006
|
* ```ts
|
|
@@ -7915,6 +9009,8 @@ export const makeEquivalence: <A>(
|
|
|
7915
9009
|
* Array.forEach([1, 2, 3], (n) => console.log(n)) // 1, 2, 3
|
|
7916
9010
|
* ```
|
|
7917
9011
|
*
|
|
9012
|
+
* @see {@link map} for transforming each element into a new array
|
|
9013
|
+
*
|
|
7918
9014
|
* @category elements
|
|
7919
9015
|
* @since 2.0.0
|
|
7920
9016
|
*/
|
|
@@ -7922,6 +9018,11 @@ export const forEach: {
|
|
|
7922
9018
|
/**
|
|
7923
9019
|
* Runs a side-effect for each element. The callback receives `(element, index)`.
|
|
7924
9020
|
*
|
|
9021
|
+
* **When to use**
|
|
9022
|
+
*
|
|
9023
|
+
* Use to iterate over an array for side-effects only, when no transformed
|
|
9024
|
+
* result is needed.
|
|
9025
|
+
*
|
|
7925
9026
|
* **Example** (Iterating with side-effects)
|
|
7926
9027
|
*
|
|
7927
9028
|
* ```ts
|
|
@@ -7930,6 +9031,8 @@ export const forEach: {
|
|
|
7930
9031
|
* Array.forEach([1, 2, 3], (n) => console.log(n)) // 1, 2, 3
|
|
7931
9032
|
* ```
|
|
7932
9033
|
*
|
|
9034
|
+
* @see {@link map} for transforming each element into a new array
|
|
9035
|
+
*
|
|
7933
9036
|
* @category elements
|
|
7934
9037
|
* @since 2.0.0
|
|
7935
9038
|
*/
|
|
@@ -7937,6 +9040,11 @@ export const forEach: {
|
|
|
7937
9040
|
/**
|
|
7938
9041
|
* Runs a side-effect for each element. The callback receives `(element, index)`.
|
|
7939
9042
|
*
|
|
9043
|
+
* **When to use**
|
|
9044
|
+
*
|
|
9045
|
+
* Use to iterate over an array for side-effects only, when no transformed
|
|
9046
|
+
* result is needed.
|
|
9047
|
+
*
|
|
7940
9048
|
* **Example** (Iterating with side-effects)
|
|
7941
9049
|
*
|
|
7942
9050
|
* ```ts
|
|
@@ -7945,6 +9053,8 @@ export const forEach: {
|
|
|
7945
9053
|
* Array.forEach([1, 2, 3], (n) => console.log(n)) // 1, 2, 3
|
|
7946
9054
|
* ```
|
|
7947
9055
|
*
|
|
9056
|
+
* @see {@link map} for transforming each element into a new array
|
|
9057
|
+
*
|
|
7948
9058
|
* @category elements
|
|
7949
9059
|
* @since 2.0.0
|
|
7950
9060
|
*/
|
|
@@ -7955,6 +9065,11 @@ export const forEach: {
|
|
|
7955
9065
|
* Removes duplicates using a custom equivalence, preserving the order of the
|
|
7956
9066
|
* first occurrence.
|
|
7957
9067
|
*
|
|
9068
|
+
* **When to use**
|
|
9069
|
+
*
|
|
9070
|
+
* Use to remove all duplicate elements with a custom equivalence when default
|
|
9071
|
+
* equality is not appropriate.
|
|
9072
|
+
*
|
|
7958
9073
|
* **Example** (Deduplicating with custom equality)
|
|
7959
9074
|
*
|
|
7960
9075
|
* ```ts
|
|
@@ -7974,6 +9089,11 @@ export const dedupeWith: {
|
|
|
7974
9089
|
* Removes duplicates using a custom equivalence, preserving the order of the
|
|
7975
9090
|
* first occurrence.
|
|
7976
9091
|
*
|
|
9092
|
+
* **When to use**
|
|
9093
|
+
*
|
|
9094
|
+
* Use to remove all duplicate elements with a custom equivalence when default
|
|
9095
|
+
* equality is not appropriate.
|
|
9096
|
+
*
|
|
7977
9097
|
* **Example** (Deduplicating with custom equality)
|
|
7978
9098
|
*
|
|
7979
9099
|
* ```ts
|
|
@@ -7995,6 +9115,11 @@ export const dedupeWith: {
|
|
|
7995
9115
|
* Removes duplicates using a custom equivalence, preserving the order of the
|
|
7996
9116
|
* first occurrence.
|
|
7997
9117
|
*
|
|
9118
|
+
* **When to use**
|
|
9119
|
+
*
|
|
9120
|
+
* Use to remove all duplicate elements with a custom equivalence when default
|
|
9121
|
+
* equality is not appropriate.
|
|
9122
|
+
*
|
|
7998
9123
|
* **Example** (Deduplicating with custom equality)
|
|
7999
9124
|
*
|
|
8000
9125
|
* ```ts
|
|
@@ -8017,6 +9142,11 @@ export const dedupeWith: {
|
|
|
8017
9142
|
* Removes duplicates using a custom equivalence, preserving the order of the
|
|
8018
9143
|
* first occurrence.
|
|
8019
9144
|
*
|
|
9145
|
+
* **When to use**
|
|
9146
|
+
*
|
|
9147
|
+
* Use to remove all duplicate elements with a custom equivalence when default
|
|
9148
|
+
* equality is not appropriate.
|
|
9149
|
+
*
|
|
8020
9150
|
* **Example** (Deduplicating with custom equality)
|
|
8021
9151
|
*
|
|
8022
9152
|
* ```ts
|
|
@@ -8054,6 +9184,11 @@ export const dedupeWith: {
|
|
|
8054
9184
|
* Removes duplicates using `Equal.equivalence()`, preserving the order of the
|
|
8055
9185
|
* first occurrence.
|
|
8056
9186
|
*
|
|
9187
|
+
* **When to use**
|
|
9188
|
+
*
|
|
9189
|
+
* Use to remove repeated values from an iterable when Effect's default equality
|
|
9190
|
+
* is the right comparison, preserving the first occurrence.
|
|
9191
|
+
*
|
|
8057
9192
|
* **Example** (Removing duplicates)
|
|
8058
9193
|
*
|
|
8059
9194
|
* ```ts
|
|
@@ -8076,6 +9211,12 @@ export const dedupe = <S extends Iterable<any>>(
|
|
|
8076
9211
|
/**
|
|
8077
9212
|
* Removes consecutive duplicate elements using a custom equivalence.
|
|
8078
9213
|
*
|
|
9214
|
+
* **When to use**
|
|
9215
|
+
*
|
|
9216
|
+
* Use when consecutive duplicates should be collapsed using a custom
|
|
9217
|
+
* equivalence, while equivalent values that appear later should remain in the
|
|
9218
|
+
* result.
|
|
9219
|
+
*
|
|
8079
9220
|
* **Details**
|
|
8080
9221
|
*
|
|
8081
9222
|
* - Non-adjacent duplicates are preserved.
|
|
@@ -8099,6 +9240,12 @@ export const dedupeAdjacentWith: {
|
|
|
8099
9240
|
/**
|
|
8100
9241
|
* Removes consecutive duplicate elements using a custom equivalence.
|
|
8101
9242
|
*
|
|
9243
|
+
* **When to use**
|
|
9244
|
+
*
|
|
9245
|
+
* Use when consecutive duplicates should be collapsed using a custom
|
|
9246
|
+
* equivalence, while equivalent values that appear later should remain in the
|
|
9247
|
+
* result.
|
|
9248
|
+
*
|
|
8102
9249
|
* **Details**
|
|
8103
9250
|
*
|
|
8104
9251
|
* - Non-adjacent duplicates are preserved.
|
|
@@ -8122,6 +9269,12 @@ export const dedupeAdjacentWith: {
|
|
|
8122
9269
|
/**
|
|
8123
9270
|
* Removes consecutive duplicate elements using a custom equivalence.
|
|
8124
9271
|
*
|
|
9272
|
+
* **When to use**
|
|
9273
|
+
*
|
|
9274
|
+
* Use when consecutive duplicates should be collapsed using a custom
|
|
9275
|
+
* equivalence, while equivalent values that appear later should remain in the
|
|
9276
|
+
* result.
|
|
9277
|
+
*
|
|
8125
9278
|
* **Details**
|
|
8126
9279
|
*
|
|
8127
9280
|
* - Non-adjacent duplicates are preserved.
|
|
@@ -8157,6 +9310,11 @@ export const dedupeAdjacentWith: {
|
|
|
8157
9310
|
/**
|
|
8158
9311
|
* Removes consecutive duplicate elements using `Equal.equivalence()`.
|
|
8159
9312
|
*
|
|
9313
|
+
* **When to use**
|
|
9314
|
+
*
|
|
9315
|
+
* Use when you need to collapse consecutive duplicates while preserving later
|
|
9316
|
+
* non-consecutive repeats, and the default equality is sufficient.
|
|
9317
|
+
*
|
|
8160
9318
|
* **Example** (Removing adjacent duplicates)
|
|
8161
9319
|
*
|
|
8162
9320
|
* ```ts
|
|
@@ -8229,6 +9387,11 @@ export const join: {
|
|
|
8229
9387
|
/**
|
|
8230
9388
|
* Maps over an array while threading an accumulator through each step, returning both the final state and the mapped array.
|
|
8231
9389
|
*
|
|
9390
|
+
* **When to use**
|
|
9391
|
+
*
|
|
9392
|
+
* Use when mapping needs state threaded through each element and the final state
|
|
9393
|
+
* is also needed.
|
|
9394
|
+
*
|
|
8232
9395
|
* **Details**
|
|
8233
9396
|
*
|
|
8234
9397
|
* - Combines `map` and `reduce` in a single pass.
|
|
@@ -8255,6 +9418,11 @@ export const mapAccum: {
|
|
|
8255
9418
|
/**
|
|
8256
9419
|
* Maps over an array while threading an accumulator through each step, returning both the final state and the mapped array.
|
|
8257
9420
|
*
|
|
9421
|
+
* **When to use**
|
|
9422
|
+
*
|
|
9423
|
+
* Use when mapping needs state threaded through each element and the final state
|
|
9424
|
+
* is also needed.
|
|
9425
|
+
*
|
|
8258
9426
|
* **Details**
|
|
8259
9427
|
*
|
|
8260
9428
|
* - Combines `map` and `reduce` in a single pass.
|
|
@@ -8281,6 +9449,11 @@ export const mapAccum: {
|
|
|
8281
9449
|
/**
|
|
8282
9450
|
* Maps over an array while threading an accumulator through each step, returning both the final state and the mapped array.
|
|
8283
9451
|
*
|
|
9452
|
+
* **When to use**
|
|
9453
|
+
*
|
|
9454
|
+
* Use when mapping needs state threaded through each element and the final state
|
|
9455
|
+
* is also needed.
|
|
9456
|
+
*
|
|
8284
9457
|
* **Details**
|
|
8285
9458
|
*
|
|
8286
9459
|
* - Combines `map` and `reduce` in a single pass.
|
|
@@ -8327,6 +9500,11 @@ export const mapAccum: {
|
|
|
8327
9500
|
/**
|
|
8328
9501
|
* Computes the cartesian product of two arrays, applying a combiner to each pair.
|
|
8329
9502
|
*
|
|
9503
|
+
* **When to use**
|
|
9504
|
+
*
|
|
9505
|
+
* Use to compute every combination from two arrays and immediately transform
|
|
9506
|
+
* each pair into a custom result.
|
|
9507
|
+
*
|
|
8330
9508
|
* **Details**
|
|
8331
9509
|
*
|
|
8332
9510
|
* - Produces every combination of an element from `self` with an element from `that`.
|
|
@@ -8342,7 +9520,7 @@ export const mapAccum: {
|
|
|
8342
9520
|
* console.log(result) // ["1-a", "1-b", "2-a", "2-b"]
|
|
8343
9521
|
* ```
|
|
8344
9522
|
*
|
|
8345
|
-
* @see {@link cartesian}
|
|
9523
|
+
* @see {@link cartesian} for returning tuples instead of applying a combiner
|
|
8346
9524
|
*
|
|
8347
9525
|
* @category elements
|
|
8348
9526
|
* @since 2.0.0
|
|
@@ -8351,6 +9529,11 @@ export const cartesianWith: {
|
|
|
8351
9529
|
/**
|
|
8352
9530
|
* Computes the cartesian product of two arrays, applying a combiner to each pair.
|
|
8353
9531
|
*
|
|
9532
|
+
* **When to use**
|
|
9533
|
+
*
|
|
9534
|
+
* Use to compute every combination from two arrays and immediately transform
|
|
9535
|
+
* each pair into a custom result.
|
|
9536
|
+
*
|
|
8354
9537
|
* **Details**
|
|
8355
9538
|
*
|
|
8356
9539
|
* - Produces every combination of an element from `self` with an element from `that`.
|
|
@@ -8366,7 +9549,7 @@ export const cartesianWith: {
|
|
|
8366
9549
|
* console.log(result) // ["1-a", "1-b", "2-a", "2-b"]
|
|
8367
9550
|
* ```
|
|
8368
9551
|
*
|
|
8369
|
-
* @see {@link cartesian}
|
|
9552
|
+
* @see {@link cartesian} for returning tuples instead of applying a combiner
|
|
8370
9553
|
*
|
|
8371
9554
|
* @category elements
|
|
8372
9555
|
* @since 2.0.0
|
|
@@ -8375,6 +9558,11 @@ export const cartesianWith: {
|
|
|
8375
9558
|
/**
|
|
8376
9559
|
* Computes the cartesian product of two arrays, applying a combiner to each pair.
|
|
8377
9560
|
*
|
|
9561
|
+
* **When to use**
|
|
9562
|
+
*
|
|
9563
|
+
* Use to compute every combination from two arrays and immediately transform
|
|
9564
|
+
* each pair into a custom result.
|
|
9565
|
+
*
|
|
8378
9566
|
* **Details**
|
|
8379
9567
|
*
|
|
8380
9568
|
* - Produces every combination of an element from `self` with an element from `that`.
|
|
@@ -8390,7 +9578,7 @@ export const cartesianWith: {
|
|
|
8390
9578
|
* console.log(result) // ["1-a", "1-b", "2-a", "2-b"]
|
|
8391
9579
|
* ```
|
|
8392
9580
|
*
|
|
8393
|
-
* @see {@link cartesian}
|
|
9581
|
+
* @see {@link cartesian} for returning tuples instead of applying a combiner
|
|
8394
9582
|
*
|
|
8395
9583
|
* @category elements
|
|
8396
9584
|
* @since 2.0.0
|
|
@@ -8405,6 +9593,10 @@ export const cartesianWith: {
|
|
|
8405
9593
|
/**
|
|
8406
9594
|
* Computes the cartesian product of two arrays, returning all pairs as tuples.
|
|
8407
9595
|
*
|
|
9596
|
+
* **When to use**
|
|
9597
|
+
*
|
|
9598
|
+
* Use when you need every `[a, b]` pair from two arrays as tuples.
|
|
9599
|
+
*
|
|
8408
9600
|
* **Details**
|
|
8409
9601
|
*
|
|
8410
9602
|
* - Produces every `[a, b]` combination of an element from `self` with an element from `that`.
|
|
@@ -8428,6 +9620,10 @@ export const cartesian: {
|
|
|
8428
9620
|
/**
|
|
8429
9621
|
* Computes the cartesian product of two arrays, returning all pairs as tuples.
|
|
8430
9622
|
*
|
|
9623
|
+
* **When to use**
|
|
9624
|
+
*
|
|
9625
|
+
* Use when you need every `[a, b]` pair from two arrays as tuples.
|
|
9626
|
+
*
|
|
8431
9627
|
* **Details**
|
|
8432
9628
|
*
|
|
8433
9629
|
* - Produces every `[a, b]` combination of an element from `self` with an element from `that`.
|
|
@@ -8451,6 +9647,10 @@ export const cartesian: {
|
|
|
8451
9647
|
/**
|
|
8452
9648
|
* Computes the cartesian product of two arrays, returning all pairs as tuples.
|
|
8453
9649
|
*
|
|
9650
|
+
* **When to use**
|
|
9651
|
+
*
|
|
9652
|
+
* Use when you need every `[a, b]` pair from two arrays as tuples.
|
|
9653
|
+
*
|
|
8454
9654
|
* **Details**
|
|
8455
9655
|
*
|
|
8456
9656
|
* - Produces every `[a, b]` combination of an element from `self` with an element from `that`.
|
|
@@ -8481,11 +9681,11 @@ export const cartesian: {
|
|
|
8481
9681
|
// -------------------------------------------------------------------------------------
|
|
8482
9682
|
|
|
8483
9683
|
/**
|
|
8484
|
-
*
|
|
9684
|
+
* Provides the starting point for the "do simulation" — an array comprehension pattern.
|
|
8485
9685
|
*
|
|
8486
9686
|
* **When to use**
|
|
8487
9687
|
*
|
|
8488
|
-
*
|
|
9688
|
+
* Use when begin a pipeline with `Do`, then use {@link bind} to introduce array variables and {@link let_ let} for plain values.
|
|
8489
9689
|
* - Each `bind` produces the cartesian product of all bound variables (like nested loops).
|
|
8490
9690
|
* - Use `filter` and `map` in the pipeline to add conditions and transformations.
|
|
8491
9691
|
*
|
|
@@ -8514,7 +9714,12 @@ export const cartesian: {
|
|
|
8514
9714
|
export const Do: ReadonlyArray<{}> = of({})
|
|
8515
9715
|
|
|
8516
9716
|
/**
|
|
8517
|
-
*
|
|
9717
|
+
* Adds a new array variable to a do-notation scope, producing the cartesian product with all previous bindings.
|
|
9718
|
+
*
|
|
9719
|
+
* **When to use**
|
|
9720
|
+
*
|
|
9721
|
+
* Use to add another array-producing binding to an `Array.Do` pipeline, pairing
|
|
9722
|
+
* each existing scope with every value returned by the callback.
|
|
8518
9723
|
*
|
|
8519
9724
|
* **Details**
|
|
8520
9725
|
*
|
|
@@ -8545,7 +9750,12 @@ export const Do: ReadonlyArray<{}> = of({})
|
|
|
8545
9750
|
*/
|
|
8546
9751
|
export const bind: {
|
|
8547
9752
|
/**
|
|
8548
|
-
*
|
|
9753
|
+
* Adds a new array variable to a do-notation scope, producing the cartesian product with all previous bindings.
|
|
9754
|
+
*
|
|
9755
|
+
* **When to use**
|
|
9756
|
+
*
|
|
9757
|
+
* Use to add another array-producing binding to an `Array.Do` pipeline, pairing
|
|
9758
|
+
* each existing scope with every value returned by the callback.
|
|
8549
9759
|
*
|
|
8550
9760
|
* **Details**
|
|
8551
9761
|
*
|
|
@@ -8578,7 +9788,12 @@ export const bind: {
|
|
|
8578
9788
|
self: ReadonlyArray<A>
|
|
8579
9789
|
) => Array<{ [K in N | keyof A]: K extends keyof A ? A[K] : B }>
|
|
8580
9790
|
/**
|
|
8581
|
-
*
|
|
9791
|
+
* Adds a new array variable to a do-notation scope, producing the cartesian product with all previous bindings.
|
|
9792
|
+
*
|
|
9793
|
+
* **When to use**
|
|
9794
|
+
*
|
|
9795
|
+
* Use to add another array-producing binding to an `Array.Do` pipeline, pairing
|
|
9796
|
+
* each existing scope with every value returned by the callback.
|
|
8582
9797
|
*
|
|
8583
9798
|
* **Details**
|
|
8584
9799
|
*
|
|
@@ -8615,7 +9830,12 @@ export const bind: {
|
|
|
8615
9830
|
} = internalDoNotation.bind<ReadonlyArrayTypeLambda>(map, flatMap) as any
|
|
8616
9831
|
|
|
8617
9832
|
/**
|
|
8618
|
-
*
|
|
9833
|
+
* Wraps each array element in an object with the given key, starting a do-notation scope.
|
|
9834
|
+
*
|
|
9835
|
+
* **When to use**
|
|
9836
|
+
*
|
|
9837
|
+
* Use when you already have an array and want to start a do-notation pipeline
|
|
9838
|
+
* by naming each element.
|
|
8619
9839
|
*
|
|
8620
9840
|
* **Details**
|
|
8621
9841
|
*
|
|
@@ -8642,7 +9862,12 @@ export const bind: {
|
|
|
8642
9862
|
*/
|
|
8643
9863
|
export const bindTo: {
|
|
8644
9864
|
/**
|
|
8645
|
-
*
|
|
9865
|
+
* Wraps each array element in an object with the given key, starting a do-notation scope.
|
|
9866
|
+
*
|
|
9867
|
+
* **When to use**
|
|
9868
|
+
*
|
|
9869
|
+
* Use when you already have an array and want to start a do-notation pipeline
|
|
9870
|
+
* by naming each element.
|
|
8646
9871
|
*
|
|
8647
9872
|
* **Details**
|
|
8648
9873
|
*
|
|
@@ -8669,7 +9894,12 @@ export const bindTo: {
|
|
|
8669
9894
|
*/
|
|
8670
9895
|
<N extends string>(tag: N): <A>(self: ReadonlyArray<A>) => Array<{ [K in N]: A }>
|
|
8671
9896
|
/**
|
|
8672
|
-
*
|
|
9897
|
+
* Wraps each array element in an object with the given key, starting a do-notation scope.
|
|
9898
|
+
*
|
|
9899
|
+
* **When to use**
|
|
9900
|
+
*
|
|
9901
|
+
* Use when you already have an array and want to start a do-notation pipeline
|
|
9902
|
+
* by naming each element.
|
|
8673
9903
|
*
|
|
8674
9904
|
* **Details**
|
|
8675
9905
|
*
|
|
@@ -8768,7 +9998,12 @@ export function makeReducerConcat<A>(): Reducer.Reducer<Array<A>> {
|
|
|
8768
9998
|
}
|
|
8769
9999
|
|
|
8770
10000
|
/**
|
|
8771
|
-
*
|
|
10001
|
+
* Computes the number of elements in an iterable that satisfy a predicate.
|
|
10002
|
+
*
|
|
10003
|
+
* **When to use**
|
|
10004
|
+
*
|
|
10005
|
+
* Use to count how many elements satisfy a predicate when you only need the
|
|
10006
|
+
* number of matches instead of the matching elements.
|
|
8772
10007
|
*
|
|
8773
10008
|
* **Details**
|
|
8774
10009
|
*
|
|
@@ -8791,7 +10026,12 @@ export function makeReducerConcat<A>(): Reducer.Reducer<Array<A>> {
|
|
|
8791
10026
|
*/
|
|
8792
10027
|
export const countBy: {
|
|
8793
10028
|
/**
|
|
8794
|
-
*
|
|
10029
|
+
* Computes the number of elements in an iterable that satisfy a predicate.
|
|
10030
|
+
*
|
|
10031
|
+
* **When to use**
|
|
10032
|
+
*
|
|
10033
|
+
* Use to count how many elements satisfy a predicate when you only need the
|
|
10034
|
+
* number of matches instead of the matching elements.
|
|
8795
10035
|
*
|
|
8796
10036
|
* **Details**
|
|
8797
10037
|
*
|
|
@@ -8814,7 +10054,12 @@ export const countBy: {
|
|
|
8814
10054
|
*/
|
|
8815
10055
|
<A>(predicate: (a: NoInfer<A>, i: number) => boolean): (self: Iterable<A>) => number
|
|
8816
10056
|
/**
|
|
8817
|
-
*
|
|
10057
|
+
* Computes the number of elements in an iterable that satisfy a predicate.
|
|
10058
|
+
*
|
|
10059
|
+
* **When to use**
|
|
10060
|
+
*
|
|
10061
|
+
* Use to count how many elements satisfy a predicate when you only need the
|
|
10062
|
+
* number of matches instead of the matching elements.
|
|
8818
10063
|
*
|
|
8819
10064
|
* **Details**
|
|
8820
10065
|
*
|