effect 3.10.18 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/Array.js +206 -0
- package/dist/cjs/Array.js.map +1 -1
- package/dist/cjs/BigDecimal.js +181 -24
- package/dist/cjs/BigDecimal.js.map +1 -1
- package/dist/cjs/BigInt.js +54 -0
- package/dist/cjs/BigInt.js.map +1 -1
- package/dist/cjs/Boolean.js +24 -0
- package/dist/cjs/Boolean.js.map +1 -1
- package/dist/cjs/Brand.js +4 -0
- package/dist/cjs/Brand.js.map +1 -1
- package/dist/cjs/Channel.js +44 -4
- package/dist/cjs/Channel.js.map +1 -1
- package/dist/cjs/Chunk.js +8 -0
- package/dist/cjs/Chunk.js.map +1 -1
- package/dist/cjs/Config.js +10 -1
- package/dist/cjs/Config.js.map +1 -1
- package/dist/cjs/Context.js +50 -1
- package/dist/cjs/Context.js.map +1 -1
- package/dist/cjs/Cron.js +81 -67
- package/dist/cjs/Cron.js.map +1 -1
- package/dist/cjs/Data.js +14 -0
- package/dist/cjs/Data.js.map +1 -1
- package/dist/cjs/DateTime.js +178 -664
- package/dist/cjs/DateTime.js.map +1 -1
- package/dist/cjs/Duration.js +2 -0
- package/dist/cjs/Duration.js.map +1 -1
- package/dist/cjs/Effect.js +296 -4
- package/dist/cjs/Effect.js.map +1 -1
- package/dist/cjs/Either.js +38 -2
- package/dist/cjs/Either.js.map +1 -1
- package/dist/cjs/FiberHandle.js +6 -0
- package/dist/cjs/FiberHandle.js.map +1 -1
- package/dist/cjs/FiberMap.js +6 -0
- package/dist/cjs/FiberMap.js.map +1 -1
- package/dist/cjs/FiberSet.js +6 -0
- package/dist/cjs/FiberSet.js.map +1 -1
- package/dist/cjs/Function.js +34 -0
- package/dist/cjs/Function.js.map +1 -1
- package/dist/cjs/GlobalValue.js +2 -0
- package/dist/cjs/GlobalValue.js.map +1 -1
- package/dist/cjs/HashMap.js.map +1 -1
- package/dist/cjs/Inspectable.js +8 -4
- package/dist/cjs/Inspectable.js.map +1 -1
- package/dist/cjs/Iterable.js +18 -0
- package/dist/cjs/Iterable.js.map +1 -1
- package/dist/cjs/JSONSchema.js.map +1 -1
- package/dist/cjs/List.js +4 -0
- package/dist/cjs/List.js.map +1 -1
- package/dist/cjs/Logger.js +26 -0
- package/dist/cjs/Logger.js.map +1 -1
- package/dist/cjs/Mailbox.js +2 -0
- package/dist/cjs/Mailbox.js.map +1 -1
- package/dist/cjs/ManagedRuntime.js +2 -0
- package/dist/cjs/ManagedRuntime.js.map +1 -1
- package/dist/cjs/Metric.js +10 -0
- package/dist/cjs/Metric.js.map +1 -1
- package/dist/cjs/Micro.js +1104 -1069
- package/dist/cjs/Micro.js.map +1 -1
- package/dist/cjs/Number.js +44 -0
- package/dist/cjs/Number.js.map +1 -1
- package/dist/cjs/Option.js +70 -0
- package/dist/cjs/Option.js.map +1 -1
- package/dist/cjs/Order.js +2 -0
- package/dist/cjs/Order.js.map +1 -1
- package/dist/cjs/Ordering.js +4 -0
- package/dist/cjs/Ordering.js.map +1 -1
- package/dist/cjs/Predicate.js +68 -0
- package/dist/cjs/Predicate.js.map +1 -1
- package/dist/cjs/Random.js +4 -0
- package/dist/cjs/Random.js.map +1 -1
- package/dist/cjs/RateLimiter.js +4 -0
- package/dist/cjs/RateLimiter.js.map +1 -1
- package/dist/cjs/RcMap.js +2 -0
- package/dist/cjs/RcMap.js.map +1 -1
- package/dist/cjs/RcRef.js +2 -0
- package/dist/cjs/RcRef.js.map +1 -1
- package/dist/cjs/Record.js +56 -0
- package/dist/cjs/Record.js.map +1 -1
- package/dist/cjs/Redacted.js +8 -0
- package/dist/cjs/Redacted.js.map +1 -1
- package/dist/cjs/RegExp.js +4 -0
- package/dist/cjs/RegExp.js.map +1 -1
- package/dist/cjs/Request.js +4 -0
- package/dist/cjs/Request.js.map +1 -1
- package/dist/cjs/RequestResolver.js +2 -0
- package/dist/cjs/RequestResolver.js.map +1 -1
- package/dist/cjs/Runtime.js +6 -0
- package/dist/cjs/Runtime.js.map +1 -1
- package/dist/cjs/STM.js.map +1 -1
- package/dist/cjs/Schema.js +91 -8
- package/dist/cjs/Schema.js.map +1 -1
- package/dist/cjs/Sink.js +9 -1
- package/dist/cjs/Sink.js.map +1 -1
- package/dist/cjs/Stream.js +179 -7
- package/dist/cjs/Stream.js.map +1 -1
- package/dist/cjs/String.js +62 -0
- package/dist/cjs/String.js.map +1 -1
- package/dist/cjs/Struct.js +12 -0
- package/dist/cjs/Struct.js.map +1 -1
- package/dist/cjs/Symbol.js +2 -0
- package/dist/cjs/Symbol.js.map +1 -1
- package/dist/cjs/Trie.js +56 -0
- package/dist/cjs/Trie.js.map +1 -1
- package/dist/cjs/Tuple.js +18 -0
- package/dist/cjs/Tuple.js.map +1 -1
- package/dist/cjs/Utils.js +7 -1
- package/dist/cjs/Utils.js.map +1 -1
- package/dist/cjs/internal/channel/channelExecutor.js +5 -9
- package/dist/cjs/internal/channel/channelExecutor.js.map +1 -1
- package/dist/cjs/internal/channel.js +156 -130
- package/dist/cjs/internal/channel.js.map +1 -1
- package/dist/cjs/internal/config.js +13 -4
- package/dist/cjs/internal/config.js.map +1 -1
- package/dist/cjs/internal/context.js +46 -3
- package/dist/cjs/internal/context.js.map +1 -1
- package/dist/cjs/internal/dateTime.js +747 -0
- package/dist/cjs/internal/dateTime.js.map +1 -0
- package/dist/cjs/internal/fiberRuntime.js +34 -11
- package/dist/cjs/internal/fiberRuntime.js.map +1 -1
- package/dist/cjs/internal/groupBy.js +9 -3
- package/dist/cjs/internal/groupBy.js.map +1 -1
- package/dist/cjs/internal/layer.js +1 -1
- package/dist/cjs/internal/layer.js.map +1 -1
- package/dist/cjs/internal/mailbox.js +1 -1
- package/dist/cjs/internal/mailbox.js.map +1 -1
- package/dist/cjs/internal/sink.js +25 -21
- package/dist/cjs/internal/sink.js.map +1 -1
- package/dist/cjs/internal/stream.js +70 -71
- package/dist/cjs/internal/stream.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/cjs/internal/version.js.map +1 -1
- package/dist/dts/Array.d.ts +534 -0
- package/dist/dts/Array.d.ts.map +1 -1
- package/dist/dts/BigDecimal.d.ts +172 -1
- package/dist/dts/BigDecimal.d.ts.map +1 -1
- package/dist/dts/BigInt.d.ts +114 -0
- package/dist/dts/BigInt.d.ts.map +1 -1
- package/dist/dts/Boolean.d.ts +56 -0
- package/dist/dts/Boolean.d.ts.map +1 -1
- package/dist/dts/Brand.d.ts +6 -0
- package/dist/dts/Brand.d.ts.map +1 -1
- package/dist/dts/Channel.d.ts +66 -5
- package/dist/dts/Channel.d.ts.map +1 -1
- package/dist/dts/Chunk.d.ts +30 -0
- package/dist/dts/Chunk.d.ts.map +1 -1
- package/dist/dts/Config.d.ts +25 -1
- package/dist/dts/Config.d.ts.map +1 -1
- package/dist/dts/Context.d.ts +155 -0
- package/dist/dts/Context.d.ts.map +1 -1
- package/dist/dts/Cron.d.ts +21 -6
- package/dist/dts/Cron.d.ts.map +1 -1
- package/dist/dts/Data.d.ts +26 -0
- package/dist/dts/Data.d.ts.map +1 -1
- package/dist/dts/DateTime.d.ts +192 -49
- package/dist/dts/DateTime.d.ts.map +1 -1
- package/dist/dts/Duration.d.ts +2 -0
- package/dist/dts/Duration.d.ts.map +1 -1
- package/dist/dts/Effect.d.ts +658 -1
- package/dist/dts/Effect.d.ts.map +1 -1
- package/dist/dts/Either.d.ts +84 -2
- package/dist/dts/Either.d.ts.map +1 -1
- package/dist/dts/FiberHandle.d.ts +6 -0
- package/dist/dts/FiberHandle.d.ts.map +1 -1
- package/dist/dts/FiberMap.d.ts +6 -0
- package/dist/dts/FiberMap.d.ts.map +1 -1
- package/dist/dts/FiberSet.d.ts +6 -0
- package/dist/dts/FiberSet.d.ts.map +1 -1
- package/dist/dts/Function.d.ts +50 -0
- package/dist/dts/Function.d.ts.map +1 -1
- package/dist/dts/GlobalValue.d.ts +2 -0
- package/dist/dts/GlobalValue.d.ts.map +1 -1
- package/dist/dts/HashMap.d.ts +6 -0
- package/dist/dts/HashMap.d.ts.map +1 -1
- package/dist/dts/Inspectable.d.ts.map +1 -1
- package/dist/dts/Iterable.d.ts +26 -0
- package/dist/dts/Iterable.d.ts.map +1 -1
- package/dist/dts/JSONSchema.d.ts +1 -0
- package/dist/dts/JSONSchema.d.ts.map +1 -1
- package/dist/dts/List.d.ts +20 -0
- package/dist/dts/List.d.ts.map +1 -1
- package/dist/dts/Logger.d.ts +34 -0
- package/dist/dts/Logger.d.ts.map +1 -1
- package/dist/dts/Mailbox.d.ts +2 -0
- package/dist/dts/Mailbox.d.ts.map +1 -1
- package/dist/dts/ManagedRuntime.d.ts +2 -0
- package/dist/dts/ManagedRuntime.d.ts.map +1 -1
- package/dist/dts/Metric.d.ts +18 -0
- package/dist/dts/Metric.d.ts.map +1 -1
- package/dist/dts/Micro.d.ts +880 -863
- package/dist/dts/Micro.d.ts.map +1 -1
- package/dist/dts/Number.d.ts +104 -0
- package/dist/dts/Number.d.ts.map +1 -1
- package/dist/dts/Option.d.ts +142 -0
- package/dist/dts/Option.d.ts.map +1 -1
- package/dist/dts/Order.d.ts +2 -0
- package/dist/dts/Order.d.ts.map +1 -1
- package/dist/dts/Ordering.d.ts +8 -0
- package/dist/dts/Ordering.d.ts.map +1 -1
- package/dist/dts/Predicate.d.ts +104 -0
- package/dist/dts/Predicate.d.ts.map +1 -1
- package/dist/dts/Random.d.ts +4 -0
- package/dist/dts/Random.d.ts.map +1 -1
- package/dist/dts/RateLimiter.d.ts +4 -0
- package/dist/dts/RateLimiter.d.ts.map +1 -1
- package/dist/dts/RcMap.d.ts +6 -0
- package/dist/dts/RcMap.d.ts.map +1 -1
- package/dist/dts/RcRef.d.ts +2 -0
- package/dist/dts/RcRef.d.ts.map +1 -1
- package/dist/dts/Record.d.ts +136 -0
- package/dist/dts/Record.d.ts.map +1 -1
- package/dist/dts/Redacted.d.ts +8 -0
- package/dist/dts/Redacted.d.ts.map +1 -1
- package/dist/dts/RegExp.d.ts +4 -0
- package/dist/dts/RegExp.d.ts.map +1 -1
- package/dist/dts/Request.d.ts +4 -0
- package/dist/dts/Request.d.ts.map +1 -1
- package/dist/dts/RequestResolver.d.ts +6 -0
- package/dist/dts/RequestResolver.d.ts.map +1 -1
- package/dist/dts/Runtime.d.ts +18 -0
- package/dist/dts/Runtime.d.ts.map +1 -1
- package/dist/dts/STM.d.ts +2 -0
- package/dist/dts/STM.d.ts.map +1 -1
- package/dist/dts/Schema.d.ts +90 -0
- package/dist/dts/Schema.d.ts.map +1 -1
- package/dist/dts/Sink.d.ts +8 -0
- package/dist/dts/Sink.d.ts.map +1 -1
- package/dist/dts/Stream.d.ts +394 -32
- package/dist/dts/Stream.d.ts.map +1 -1
- package/dist/dts/String.d.ts +94 -0
- package/dist/dts/String.d.ts.map +1 -1
- package/dist/dts/Struct.d.ts +24 -0
- package/dist/dts/Struct.d.ts.map +1 -1
- package/dist/dts/Symbol.d.ts +2 -0
- package/dist/dts/Symbol.d.ts.map +1 -1
- package/dist/dts/Trie.d.ts +132 -0
- package/dist/dts/Trie.d.ts.map +1 -1
- package/dist/dts/Tuple.d.ts +42 -0
- package/dist/dts/Tuple.d.ts.map +1 -1
- package/dist/dts/Types.d.ts +24 -0
- package/dist/dts/Types.d.ts.map +1 -1
- package/dist/dts/Utils.d.ts +4 -0
- package/dist/dts/Utils.d.ts.map +1 -1
- package/dist/dts/internal/context.d.ts +1 -1
- package/dist/dts/internal/context.d.ts.map +1 -1
- package/dist/dts/internal/dateTime.d.ts +2 -0
- package/dist/dts/internal/dateTime.d.ts.map +1 -0
- package/dist/dts/internal/fiberRuntime.d.ts.map +1 -1
- package/dist/dts/internal/stream.d.ts.map +1 -1
- package/dist/esm/Array.js +208 -0
- package/dist/esm/Array.js.map +1 -1
- package/dist/esm/BigDecimal.js +175 -20
- package/dist/esm/BigDecimal.js.map +1 -1
- package/dist/esm/BigInt.js +54 -0
- package/dist/esm/BigInt.js.map +1 -1
- package/dist/esm/Boolean.js +24 -0
- package/dist/esm/Boolean.js.map +1 -1
- package/dist/esm/Brand.js +4 -0
- package/dist/esm/Brand.js.map +1 -1
- package/dist/esm/Channel.js +42 -2
- package/dist/esm/Channel.js.map +1 -1
- package/dist/esm/Chunk.js +8 -0
- package/dist/esm/Chunk.js.map +1 -1
- package/dist/esm/Config.js +9 -0
- package/dist/esm/Config.js.map +1 -1
- package/dist/esm/Context.js +49 -0
- package/dist/esm/Context.js.map +1 -1
- package/dist/esm/Cron.js +81 -67
- package/dist/esm/Cron.js.map +1 -1
- package/dist/esm/Data.js +16 -0
- package/dist/esm/Data.js.map +1 -1
- package/dist/esm/DateTime.js +176 -627
- package/dist/esm/DateTime.js.map +1 -1
- package/dist/esm/Duration.js +2 -0
- package/dist/esm/Duration.js.map +1 -1
- package/dist/esm/Effect.js +297 -0
- package/dist/esm/Effect.js.map +1 -1
- package/dist/esm/Either.js +40 -2
- package/dist/esm/Either.js.map +1 -1
- package/dist/esm/FiberHandle.js +6 -0
- package/dist/esm/FiberHandle.js.map +1 -1
- package/dist/esm/FiberMap.js +6 -0
- package/dist/esm/FiberMap.js.map +1 -1
- package/dist/esm/FiberSet.js +6 -0
- package/dist/esm/FiberSet.js.map +1 -1
- package/dist/esm/Function.js +34 -0
- package/dist/esm/Function.js.map +1 -1
- package/dist/esm/GlobalValue.js +2 -0
- package/dist/esm/GlobalValue.js.map +1 -1
- package/dist/esm/HashMap.js.map +1 -1
- package/dist/esm/Inspectable.js +8 -4
- package/dist/esm/Inspectable.js.map +1 -1
- package/dist/esm/Iterable.js +18 -0
- package/dist/esm/Iterable.js.map +1 -1
- package/dist/esm/JSONSchema.js.map +1 -1
- package/dist/esm/List.js +4 -0
- package/dist/esm/List.js.map +1 -1
- package/dist/esm/Logger.js +26 -0
- package/dist/esm/Logger.js.map +1 -1
- package/dist/esm/Mailbox.js +2 -0
- package/dist/esm/Mailbox.js.map +1 -1
- package/dist/esm/ManagedRuntime.js +2 -0
- package/dist/esm/ManagedRuntime.js.map +1 -1
- package/dist/esm/Metric.js +10 -0
- package/dist/esm/Metric.js.map +1 -1
- package/dist/esm/Micro.js +1077 -1037
- package/dist/esm/Micro.js.map +1 -1
- package/dist/esm/Number.js +44 -0
- package/dist/esm/Number.js.map +1 -1
- package/dist/esm/Option.js +72 -0
- package/dist/esm/Option.js.map +1 -1
- package/dist/esm/Order.js +2 -0
- package/dist/esm/Order.js.map +1 -1
- package/dist/esm/Ordering.js +4 -0
- package/dist/esm/Ordering.js.map +1 -1
- package/dist/esm/Predicate.js +68 -0
- package/dist/esm/Predicate.js.map +1 -1
- package/dist/esm/Random.js +4 -0
- package/dist/esm/Random.js.map +1 -1
- package/dist/esm/RateLimiter.js +4 -0
- package/dist/esm/RateLimiter.js.map +1 -1
- package/dist/esm/RcMap.js +2 -0
- package/dist/esm/RcMap.js.map +1 -1
- package/dist/esm/RcRef.js +2 -0
- package/dist/esm/RcRef.js.map +1 -1
- package/dist/esm/Record.js +56 -0
- package/dist/esm/Record.js.map +1 -1
- package/dist/esm/Redacted.js +8 -0
- package/dist/esm/Redacted.js.map +1 -1
- package/dist/esm/RegExp.js +4 -0
- package/dist/esm/RegExp.js.map +1 -1
- package/dist/esm/Request.js +4 -0
- package/dist/esm/Request.js.map +1 -1
- package/dist/esm/RequestResolver.js +2 -0
- package/dist/esm/RequestResolver.js.map +1 -1
- package/dist/esm/Runtime.js +6 -0
- package/dist/esm/Runtime.js.map +1 -1
- package/dist/esm/STM.js.map +1 -1
- package/dist/esm/Schema.js +88 -0
- package/dist/esm/Schema.js.map +1 -1
- package/dist/esm/Sink.js +8 -0
- package/dist/esm/Sink.js.map +1 -1
- package/dist/esm/Stream.js +183 -5
- package/dist/esm/Stream.js.map +1 -1
- package/dist/esm/String.js +62 -0
- package/dist/esm/String.js.map +1 -1
- package/dist/esm/Struct.js +12 -0
- package/dist/esm/Struct.js.map +1 -1
- package/dist/esm/Symbol.js +2 -0
- package/dist/esm/Symbol.js.map +1 -1
- package/dist/esm/Trie.js +56 -0
- package/dist/esm/Trie.js.map +1 -1
- package/dist/esm/Tuple.js +22 -0
- package/dist/esm/Tuple.js.map +1 -1
- package/dist/esm/Utils.js +5 -0
- package/dist/esm/Utils.js.map +1 -1
- package/dist/esm/internal/channel/channelExecutor.js +5 -7
- package/dist/esm/internal/channel/channelExecutor.js.map +1 -1
- package/dist/esm/internal/channel.js +152 -129
- package/dist/esm/internal/channel.js.map +1 -1
- package/dist/esm/internal/config.js +11 -3
- package/dist/esm/internal/config.js.map +1 -1
- package/dist/esm/internal/context.js +42 -2
- package/dist/esm/internal/context.js.map +1 -1
- package/dist/esm/internal/dateTime.js +704 -0
- package/dist/esm/internal/dateTime.js.map +1 -0
- package/dist/esm/internal/fiberRuntime.js +31 -9
- package/dist/esm/internal/fiberRuntime.js.map +1 -1
- package/dist/esm/internal/groupBy.js +9 -3
- package/dist/esm/internal/groupBy.js.map +1 -1
- package/dist/esm/internal/layer.js +1 -1
- package/dist/esm/internal/layer.js.map +1 -1
- package/dist/esm/internal/mailbox.js +1 -1
- package/dist/esm/internal/mailbox.js.map +1 -1
- package/dist/esm/internal/sink.js +23 -20
- package/dist/esm/internal/sink.js.map +1 -1
- package/dist/esm/internal/stream.js +66 -69
- package/dist/esm/internal/stream.js.map +1 -1
- package/dist/esm/internal/version.js +1 -1
- package/dist/esm/internal/version.js.map +1 -1
- package/package.json +1 -1
- package/src/Array.ts +534 -0
- package/src/BigDecimal.ts +247 -21
- package/src/BigInt.ts +114 -0
- package/src/Boolean.ts +56 -0
- package/src/Brand.ts +6 -0
- package/src/Channel.ts +81 -5
- package/src/Chunk.ts +32 -0
- package/src/Config.ts +26 -1
- package/src/Context.ts +163 -0
- package/src/Cron.ts +91 -68
- package/src/Data.ts +26 -0
- package/src/DateTime.ts +307 -757
- package/src/Duration.ts +2 -0
- package/src/Effect.ts +910 -1
- package/src/Either.ts +84 -2
- package/src/FiberHandle.ts +6 -0
- package/src/FiberMap.ts +6 -0
- package/src/FiberSet.ts +6 -0
- package/src/Function.ts +50 -0
- package/src/GlobalValue.ts +2 -0
- package/src/HashMap.ts +6 -0
- package/src/Inspectable.ts +11 -7
- package/src/Iterable.ts +26 -0
- package/src/JSONSchema.ts +1 -0
- package/src/List.ts +24 -0
- package/src/Logger.ts +34 -0
- package/src/Mailbox.ts +2 -0
- package/src/ManagedRuntime.ts +2 -0
- package/src/Metric.ts +18 -0
- package/src/Micro.ts +2007 -1745
- package/src/Number.ts +104 -0
- package/src/Option.ts +142 -0
- package/src/Order.ts +2 -0
- package/src/Ordering.ts +8 -0
- package/src/Predicate.ts +104 -0
- package/src/Random.ts +4 -0
- package/src/RateLimiter.ts +4 -0
- package/src/RcMap.ts +6 -0
- package/src/RcRef.ts +2 -0
- package/src/Record.ts +136 -0
- package/src/Redacted.ts +8 -0
- package/src/RegExp.ts +4 -0
- package/src/Request.ts +4 -0
- package/src/RequestResolver.ts +6 -0
- package/src/Runtime.ts +18 -0
- package/src/STM.ts +2 -0
- package/src/Schema.ts +124 -0
- package/src/Sink.ts +11 -0
- package/src/Stream.ts +399 -44
- package/src/String.ts +94 -0
- package/src/Struct.ts +24 -0
- package/src/Symbol.ts +2 -0
- package/src/Trie.ts +132 -0
- package/src/Tuple.ts +42 -0
- package/src/Types.ts +24 -0
- package/src/Utils.ts +8 -0
- package/src/internal/channel/channelExecutor.ts +37 -33
- package/src/internal/channel.ts +504 -467
- package/src/internal/config.ts +18 -6
- package/src/internal/context.ts +56 -4
- package/src/internal/dateTime.ts +1126 -0
- package/src/internal/fiberRuntime.ts +35 -16
- package/src/internal/groupBy.ts +13 -22
- package/src/internal/layer.ts +5 -8
- package/src/internal/mailbox.ts +6 -4
- package/src/internal/sink.ts +55 -35
- package/src/internal/stream.ts +299 -299
- package/src/internal/version.ts +1 -1
package/dist/dts/Array.d.ts
CHANGED
|
@@ -33,10 +33,12 @@ export type NonEmptyArray<A> = [A, ...Array<A>];
|
|
|
33
33
|
* Builds a `NonEmptyArray` from an non-empty collection of elements.
|
|
34
34
|
*
|
|
35
35
|
* @example
|
|
36
|
+
* ```ts
|
|
36
37
|
* import { Array } from "effect"
|
|
37
38
|
*
|
|
38
39
|
* const result = Array.make(1, 2, 3)
|
|
39
40
|
* assert.deepStrictEqual(result, [1, 2, 3])
|
|
41
|
+
* ```
|
|
40
42
|
*
|
|
41
43
|
* @category constructors
|
|
42
44
|
* @since 2.0.0
|
|
@@ -46,10 +48,12 @@ export declare const make: <Elements extends NonEmptyArray<any>>(...elements: El
|
|
|
46
48
|
* Creates a new `Array` of the specified length.
|
|
47
49
|
*
|
|
48
50
|
* @example
|
|
51
|
+
* ```ts
|
|
49
52
|
* import { Array } from "effect"
|
|
50
53
|
*
|
|
51
54
|
* const result = Array.allocate<number>(3)
|
|
52
55
|
* assert.deepStrictEqual(result.length, 3)
|
|
56
|
+
* ```
|
|
53
57
|
*
|
|
54
58
|
* @category constructors
|
|
55
59
|
* @since 2.0.0
|
|
@@ -61,9 +65,11 @@ export declare const allocate: <A = never>(n: number) => Array<A | undefined>;
|
|
|
61
65
|
* **Note**. `n` is normalized to an integer >= 1.
|
|
62
66
|
*
|
|
63
67
|
* @example
|
|
68
|
+
* ```ts
|
|
64
69
|
* import { makeBy } from "effect/Array"
|
|
65
70
|
*
|
|
66
71
|
* assert.deepStrictEqual(makeBy(5, n => n * 2), [0, 2, 4, 6, 8])
|
|
72
|
+
* ```
|
|
67
73
|
*
|
|
68
74
|
* @category constructors
|
|
69
75
|
* @since 2.0.0
|
|
@@ -73,9 +79,11 @@ export declare const makeBy: <A>(n: number, f: (i: number) => A) => NonEmptyArra
|
|
|
73
79
|
* Return a `NonEmptyArray` containing a range of integers, including both endpoints.
|
|
74
80
|
*
|
|
75
81
|
* @example
|
|
82
|
+
* ```ts
|
|
76
83
|
* import { range } from "effect/Array"
|
|
77
84
|
*
|
|
78
85
|
* assert.deepStrictEqual(range(1, 3), [1, 2, 3])
|
|
86
|
+
* ```
|
|
79
87
|
*
|
|
80
88
|
* @category constructors
|
|
81
89
|
* @since 2.0.0
|
|
@@ -87,9 +95,11 @@ export declare const range: (start: number, end: number) => NonEmptyArray<number
|
|
|
87
95
|
* **Note**. `n` is normalized to an integer >= 1.
|
|
88
96
|
*
|
|
89
97
|
* @example
|
|
98
|
+
* ```ts
|
|
90
99
|
* import { Array } from "effect"
|
|
91
100
|
*
|
|
92
101
|
* assert.deepStrictEqual(Array.replicate("a", 3), ["a", "a", "a"])
|
|
102
|
+
* ```
|
|
93
103
|
*
|
|
94
104
|
* @category constructors
|
|
95
105
|
* @since 2.0.0
|
|
@@ -101,9 +111,11 @@ export declare const replicate: {
|
|
|
101
111
|
* **Note**. `n` is normalized to an integer >= 1.
|
|
102
112
|
*
|
|
103
113
|
* @example
|
|
114
|
+
* ```ts
|
|
104
115
|
* import { Array } from "effect"
|
|
105
116
|
*
|
|
106
117
|
* assert.deepStrictEqual(Array.replicate("a", 3), ["a", "a", "a"])
|
|
118
|
+
* ```
|
|
107
119
|
*
|
|
108
120
|
* @category constructors
|
|
109
121
|
* @since 2.0.0
|
|
@@ -115,9 +127,11 @@ export declare const replicate: {
|
|
|
115
127
|
* **Note**. `n` is normalized to an integer >= 1.
|
|
116
128
|
*
|
|
117
129
|
* @example
|
|
130
|
+
* ```ts
|
|
118
131
|
* import { Array } from "effect"
|
|
119
132
|
*
|
|
120
133
|
* assert.deepStrictEqual(Array.replicate("a", 3), ["a", "a", "a"])
|
|
134
|
+
* ```
|
|
121
135
|
*
|
|
122
136
|
* @category constructors
|
|
123
137
|
* @since 2.0.0
|
|
@@ -130,11 +144,13 @@ export declare const replicate: {
|
|
|
130
144
|
* Otherwise, it converts the iterable collection to an array.
|
|
131
145
|
*
|
|
132
146
|
* @example
|
|
147
|
+
* ```ts
|
|
133
148
|
* import { Array } from "effect"
|
|
134
149
|
*
|
|
135
150
|
* const set = new Set([1, 2, 3])
|
|
136
151
|
* const result = Array.fromIterable(set)
|
|
137
152
|
* assert.deepStrictEqual(result, [1, 2, 3])
|
|
153
|
+
* ```
|
|
138
154
|
*
|
|
139
155
|
* @category constructors
|
|
140
156
|
* @since 2.0.0
|
|
@@ -144,11 +160,13 @@ export declare const fromIterable: <A>(collection: Iterable<A>) => Array<A>;
|
|
|
144
160
|
* Creates a new `Array` from a value that might not be an iterable.
|
|
145
161
|
*
|
|
146
162
|
* @example
|
|
163
|
+
* ```ts
|
|
147
164
|
* import { Array } from "effect"
|
|
148
165
|
*
|
|
149
166
|
* assert.deepStrictEqual(Array.ensure("a"), ["a"])
|
|
150
167
|
* assert.deepStrictEqual(Array.ensure(["a"]), ["a"])
|
|
151
168
|
* assert.deepStrictEqual(Array.ensure(["a", "b", "c"]), ["a", "b", "c"])
|
|
169
|
+
* ```
|
|
152
170
|
*
|
|
153
171
|
* @category constructors
|
|
154
172
|
* @since 3.3.0
|
|
@@ -160,10 +178,12 @@ export declare const ensure: <A>(self: ReadonlyArray<A> | A) => Array<A>;
|
|
|
160
178
|
* @param self - The record to transform.
|
|
161
179
|
*
|
|
162
180
|
* @example
|
|
181
|
+
* ```ts
|
|
163
182
|
* import { Array } from "effect"
|
|
164
183
|
*
|
|
165
184
|
* const x = { a: 1, b: 2, c: 3 }
|
|
166
185
|
* assert.deepStrictEqual(Array.fromRecord(x), [["a", 1], ["b", 2], ["c", 3]])
|
|
186
|
+
* ```
|
|
167
187
|
*
|
|
168
188
|
* @category conversions
|
|
169
189
|
* @since 2.0.0
|
|
@@ -173,10 +193,12 @@ export declare const fromRecord: <K extends string, A>(self: Readonly<Record<K,
|
|
|
173
193
|
* Converts an `Option` to an array.
|
|
174
194
|
*
|
|
175
195
|
* @example
|
|
196
|
+
* ```ts
|
|
176
197
|
* import { Array, Option } from "effect"
|
|
177
198
|
*
|
|
178
199
|
* assert.deepStrictEqual(Array.fromOption(Option.some(1)), [1])
|
|
179
200
|
* assert.deepStrictEqual(Array.fromOption(Option.none()), [])
|
|
201
|
+
* ```
|
|
180
202
|
*
|
|
181
203
|
* @category conversions
|
|
182
204
|
* @since 2.0.0
|
|
@@ -186,6 +208,7 @@ export declare const fromOption: <A>(self: Option<A>) => Array<A>;
|
|
|
186
208
|
* Matches the elements of an array, applying functions to cases of empty and non-empty arrays.
|
|
187
209
|
*
|
|
188
210
|
* @example
|
|
211
|
+
* ```ts
|
|
189
212
|
* import { Array } from "effect"
|
|
190
213
|
*
|
|
191
214
|
* const match = Array.match({
|
|
@@ -194,6 +217,7 @@ export declare const fromOption: <A>(self: Option<A>) => Array<A>;
|
|
|
194
217
|
* })
|
|
195
218
|
* assert.deepStrictEqual(match([]), "empty")
|
|
196
219
|
* assert.deepStrictEqual(match([1, 2, 3]), "head: 1, tail: 2")
|
|
220
|
+
* ```
|
|
197
221
|
*
|
|
198
222
|
* @category pattern matching
|
|
199
223
|
* @since 2.0.0
|
|
@@ -203,6 +227,7 @@ export declare const match: {
|
|
|
203
227
|
* Matches the elements of an array, applying functions to cases of empty and non-empty arrays.
|
|
204
228
|
*
|
|
205
229
|
* @example
|
|
230
|
+
* ```ts
|
|
206
231
|
* import { Array } from "effect"
|
|
207
232
|
*
|
|
208
233
|
* const match = Array.match({
|
|
@@ -211,6 +236,7 @@ export declare const match: {
|
|
|
211
236
|
* })
|
|
212
237
|
* assert.deepStrictEqual(match([]), "empty")
|
|
213
238
|
* assert.deepStrictEqual(match([1, 2, 3]), "head: 1, tail: 2")
|
|
239
|
+
* ```
|
|
214
240
|
*
|
|
215
241
|
* @category pattern matching
|
|
216
242
|
* @since 2.0.0
|
|
@@ -223,6 +249,7 @@ export declare const match: {
|
|
|
223
249
|
* Matches the elements of an array, applying functions to cases of empty and non-empty arrays.
|
|
224
250
|
*
|
|
225
251
|
* @example
|
|
252
|
+
* ```ts
|
|
226
253
|
* import { Array } from "effect"
|
|
227
254
|
*
|
|
228
255
|
* const match = Array.match({
|
|
@@ -231,6 +258,7 @@ export declare const match: {
|
|
|
231
258
|
* })
|
|
232
259
|
* assert.deepStrictEqual(match([]), "empty")
|
|
233
260
|
* assert.deepStrictEqual(match([1, 2, 3]), "head: 1, tail: 2")
|
|
261
|
+
* ```
|
|
234
262
|
*
|
|
235
263
|
* @category pattern matching
|
|
236
264
|
* @since 2.0.0
|
|
@@ -244,6 +272,7 @@ export declare const match: {
|
|
|
244
272
|
* Matches the elements of an array from the left, applying functions to cases of empty and non-empty arrays.
|
|
245
273
|
*
|
|
246
274
|
* @example
|
|
275
|
+
* ```ts
|
|
247
276
|
* import { Array } from "effect"
|
|
248
277
|
*
|
|
249
278
|
* const matchLeft = Array.matchLeft({
|
|
@@ -252,6 +281,7 @@ export declare const match: {
|
|
|
252
281
|
* })
|
|
253
282
|
* assert.deepStrictEqual(matchLeft([]), "empty")
|
|
254
283
|
* assert.deepStrictEqual(matchLeft([1, 2, 3]), "head: 1, tail: 2")
|
|
284
|
+
* ```
|
|
255
285
|
*
|
|
256
286
|
* @category pattern matching
|
|
257
287
|
* @since 2.0.0
|
|
@@ -261,6 +291,7 @@ export declare const matchLeft: {
|
|
|
261
291
|
* Matches the elements of an array from the left, applying functions to cases of empty and non-empty arrays.
|
|
262
292
|
*
|
|
263
293
|
* @example
|
|
294
|
+
* ```ts
|
|
264
295
|
* import { Array } from "effect"
|
|
265
296
|
*
|
|
266
297
|
* const matchLeft = Array.matchLeft({
|
|
@@ -269,6 +300,7 @@ export declare const matchLeft: {
|
|
|
269
300
|
* })
|
|
270
301
|
* assert.deepStrictEqual(matchLeft([]), "empty")
|
|
271
302
|
* assert.deepStrictEqual(matchLeft([1, 2, 3]), "head: 1, tail: 2")
|
|
303
|
+
* ```
|
|
272
304
|
*
|
|
273
305
|
* @category pattern matching
|
|
274
306
|
* @since 2.0.0
|
|
@@ -281,6 +313,7 @@ export declare const matchLeft: {
|
|
|
281
313
|
* Matches the elements of an array from the left, applying functions to cases of empty and non-empty arrays.
|
|
282
314
|
*
|
|
283
315
|
* @example
|
|
316
|
+
* ```ts
|
|
284
317
|
* import { Array } from "effect"
|
|
285
318
|
*
|
|
286
319
|
* const matchLeft = Array.matchLeft({
|
|
@@ -289,6 +322,7 @@ export declare const matchLeft: {
|
|
|
289
322
|
* })
|
|
290
323
|
* assert.deepStrictEqual(matchLeft([]), "empty")
|
|
291
324
|
* assert.deepStrictEqual(matchLeft([1, 2, 3]), "head: 1, tail: 2")
|
|
325
|
+
* ```
|
|
292
326
|
*
|
|
293
327
|
* @category pattern matching
|
|
294
328
|
* @since 2.0.0
|
|
@@ -302,6 +336,7 @@ export declare const matchLeft: {
|
|
|
302
336
|
* Matches the elements of an array from the right, applying functions to cases of empty and non-empty arrays.
|
|
303
337
|
*
|
|
304
338
|
* @example
|
|
339
|
+
* ```ts
|
|
305
340
|
* import { Array } from "effect"
|
|
306
341
|
*
|
|
307
342
|
* const matchRight = Array.matchRight({
|
|
@@ -310,6 +345,7 @@ export declare const matchLeft: {
|
|
|
310
345
|
* })
|
|
311
346
|
* assert.deepStrictEqual(matchRight([]), "empty")
|
|
312
347
|
* assert.deepStrictEqual(matchRight([1, 2, 3]), "init: 2, last: 3")
|
|
348
|
+
* ```
|
|
313
349
|
*
|
|
314
350
|
* @category pattern matching
|
|
315
351
|
* @since 2.0.0
|
|
@@ -319,6 +355,7 @@ export declare const matchRight: {
|
|
|
319
355
|
* Matches the elements of an array from the right, applying functions to cases of empty and non-empty arrays.
|
|
320
356
|
*
|
|
321
357
|
* @example
|
|
358
|
+
* ```ts
|
|
322
359
|
* import { Array } from "effect"
|
|
323
360
|
*
|
|
324
361
|
* const matchRight = Array.matchRight({
|
|
@@ -327,6 +364,7 @@ export declare const matchRight: {
|
|
|
327
364
|
* })
|
|
328
365
|
* assert.deepStrictEqual(matchRight([]), "empty")
|
|
329
366
|
* assert.deepStrictEqual(matchRight([1, 2, 3]), "init: 2, last: 3")
|
|
367
|
+
* ```
|
|
330
368
|
*
|
|
331
369
|
* @category pattern matching
|
|
332
370
|
* @since 2.0.0
|
|
@@ -339,6 +377,7 @@ export declare const matchRight: {
|
|
|
339
377
|
* Matches the elements of an array from the right, applying functions to cases of empty and non-empty arrays.
|
|
340
378
|
*
|
|
341
379
|
* @example
|
|
380
|
+
* ```ts
|
|
342
381
|
* import { Array } from "effect"
|
|
343
382
|
*
|
|
344
383
|
* const matchRight = Array.matchRight({
|
|
@@ -347,6 +386,7 @@ export declare const matchRight: {
|
|
|
347
386
|
* })
|
|
348
387
|
* assert.deepStrictEqual(matchRight([]), "empty")
|
|
349
388
|
* assert.deepStrictEqual(matchRight([1, 2, 3]), "init: 2, last: 3")
|
|
389
|
+
* ```
|
|
350
390
|
*
|
|
351
391
|
* @category pattern matching
|
|
352
392
|
* @since 2.0.0
|
|
@@ -360,11 +400,13 @@ export declare const matchRight: {
|
|
|
360
400
|
* Prepend an element to the front of an `Iterable`, creating a new `NonEmptyArray`.
|
|
361
401
|
*
|
|
362
402
|
* @example
|
|
403
|
+
* ```ts
|
|
363
404
|
* import { Array } from "effect"
|
|
364
405
|
*
|
|
365
406
|
* const original = [2, 3, 4];
|
|
366
407
|
* const result = Array.prepend(original, 1);
|
|
367
408
|
* assert.deepStrictEqual(result, [1, 2, 3, 4]);
|
|
409
|
+
* ```
|
|
368
410
|
*
|
|
369
411
|
* @category concatenating
|
|
370
412
|
* @since 2.0.0
|
|
@@ -374,11 +416,13 @@ export declare const prepend: {
|
|
|
374
416
|
* Prepend an element to the front of an `Iterable`, creating a new `NonEmptyArray`.
|
|
375
417
|
*
|
|
376
418
|
* @example
|
|
419
|
+
* ```ts
|
|
377
420
|
* import { Array } from "effect"
|
|
378
421
|
*
|
|
379
422
|
* const original = [2, 3, 4];
|
|
380
423
|
* const result = Array.prepend(original, 1);
|
|
381
424
|
* assert.deepStrictEqual(result, [1, 2, 3, 4]);
|
|
425
|
+
* ```
|
|
382
426
|
*
|
|
383
427
|
* @category concatenating
|
|
384
428
|
* @since 2.0.0
|
|
@@ -388,11 +432,13 @@ export declare const prepend: {
|
|
|
388
432
|
* Prepend an element to the front of an `Iterable`, creating a new `NonEmptyArray`.
|
|
389
433
|
*
|
|
390
434
|
* @example
|
|
435
|
+
* ```ts
|
|
391
436
|
* import { Array } from "effect"
|
|
392
437
|
*
|
|
393
438
|
* const original = [2, 3, 4];
|
|
394
439
|
* const result = Array.prepend(original, 1);
|
|
395
440
|
* assert.deepStrictEqual(result, [1, 2, 3, 4]);
|
|
441
|
+
* ```
|
|
396
442
|
*
|
|
397
443
|
* @category concatenating
|
|
398
444
|
* @since 2.0.0
|
|
@@ -404,12 +450,14 @@ export declare const prepend: {
|
|
|
404
450
|
* If either array is non-empty, the result is also a non-empty array.
|
|
405
451
|
*
|
|
406
452
|
* @example
|
|
453
|
+
* ```ts
|
|
407
454
|
* import { Array } from "effect"
|
|
408
455
|
*
|
|
409
456
|
* const prefix = [0, 1];
|
|
410
457
|
* const array = [2, 3];
|
|
411
458
|
* const result = Array.prependAll(array, prefix);
|
|
412
459
|
* assert.deepStrictEqual(result, [0, 1, 2, 3]);
|
|
460
|
+
* ```
|
|
413
461
|
*
|
|
414
462
|
* @category concatenating
|
|
415
463
|
* @since 2.0.0
|
|
@@ -420,12 +468,14 @@ export declare const prependAll: {
|
|
|
420
468
|
* If either array is non-empty, the result is also a non-empty array.
|
|
421
469
|
*
|
|
422
470
|
* @example
|
|
471
|
+
* ```ts
|
|
423
472
|
* import { Array } from "effect"
|
|
424
473
|
*
|
|
425
474
|
* const prefix = [0, 1];
|
|
426
475
|
* const array = [2, 3];
|
|
427
476
|
* const result = Array.prependAll(array, prefix);
|
|
428
477
|
* assert.deepStrictEqual(result, [0, 1, 2, 3]);
|
|
478
|
+
* ```
|
|
429
479
|
*
|
|
430
480
|
* @category concatenating
|
|
431
481
|
* @since 2.0.0
|
|
@@ -436,12 +486,14 @@ export declare const prependAll: {
|
|
|
436
486
|
* If either array is non-empty, the result is also a non-empty array.
|
|
437
487
|
*
|
|
438
488
|
* @example
|
|
489
|
+
* ```ts
|
|
439
490
|
* import { Array } from "effect"
|
|
440
491
|
*
|
|
441
492
|
* const prefix = [0, 1];
|
|
442
493
|
* const array = [2, 3];
|
|
443
494
|
* const result = Array.prependAll(array, prefix);
|
|
444
495
|
* assert.deepStrictEqual(result, [0, 1, 2, 3]);
|
|
496
|
+
* ```
|
|
445
497
|
*
|
|
446
498
|
* @category concatenating
|
|
447
499
|
* @since 2.0.0
|
|
@@ -452,12 +504,14 @@ export declare const prependAll: {
|
|
|
452
504
|
* If either array is non-empty, the result is also a non-empty array.
|
|
453
505
|
*
|
|
454
506
|
* @example
|
|
507
|
+
* ```ts
|
|
455
508
|
* import { Array } from "effect"
|
|
456
509
|
*
|
|
457
510
|
* const prefix = [0, 1];
|
|
458
511
|
* const array = [2, 3];
|
|
459
512
|
* const result = Array.prependAll(array, prefix);
|
|
460
513
|
* assert.deepStrictEqual(result, [0, 1, 2, 3]);
|
|
514
|
+
* ```
|
|
461
515
|
*
|
|
462
516
|
* @category concatenating
|
|
463
517
|
* @since 2.0.0
|
|
@@ -468,12 +522,14 @@ export declare const prependAll: {
|
|
|
468
522
|
* If either array is non-empty, the result is also a non-empty array.
|
|
469
523
|
*
|
|
470
524
|
* @example
|
|
525
|
+
* ```ts
|
|
471
526
|
* import { Array } from "effect"
|
|
472
527
|
*
|
|
473
528
|
* const prefix = [0, 1];
|
|
474
529
|
* const array = [2, 3];
|
|
475
530
|
* const result = Array.prependAll(array, prefix);
|
|
476
531
|
* assert.deepStrictEqual(result, [0, 1, 2, 3]);
|
|
532
|
+
* ```
|
|
477
533
|
*
|
|
478
534
|
* @category concatenating
|
|
479
535
|
* @since 2.0.0
|
|
@@ -484,11 +540,13 @@ export declare const prependAll: {
|
|
|
484
540
|
* Append an element to the end of an `Iterable`, creating a new `NonEmptyArray`.
|
|
485
541
|
*
|
|
486
542
|
* @example
|
|
543
|
+
* ```ts
|
|
487
544
|
* import { Array } from "effect"
|
|
488
545
|
*
|
|
489
546
|
* const original = [1, 2, 3];
|
|
490
547
|
* const result = Array.append(original, 4);
|
|
491
548
|
* assert.deepStrictEqual(result, [1, 2, 3, 4]);
|
|
549
|
+
* ```
|
|
492
550
|
*
|
|
493
551
|
* @category concatenating
|
|
494
552
|
* @since 2.0.0
|
|
@@ -498,11 +556,13 @@ export declare const append: {
|
|
|
498
556
|
* Append an element to the end of an `Iterable`, creating a new `NonEmptyArray`.
|
|
499
557
|
*
|
|
500
558
|
* @example
|
|
559
|
+
* ```ts
|
|
501
560
|
* import { Array } from "effect"
|
|
502
561
|
*
|
|
503
562
|
* const original = [1, 2, 3];
|
|
504
563
|
* const result = Array.append(original, 4);
|
|
505
564
|
* assert.deepStrictEqual(result, [1, 2, 3, 4]);
|
|
565
|
+
* ```
|
|
506
566
|
*
|
|
507
567
|
* @category concatenating
|
|
508
568
|
* @since 2.0.0
|
|
@@ -512,11 +572,13 @@ export declare const append: {
|
|
|
512
572
|
* Append an element to the end of an `Iterable`, creating a new `NonEmptyArray`.
|
|
513
573
|
*
|
|
514
574
|
* @example
|
|
575
|
+
* ```ts
|
|
515
576
|
* import { Array } from "effect"
|
|
516
577
|
*
|
|
517
578
|
* const original = [1, 2, 3];
|
|
518
579
|
* const result = Array.append(original, 4);
|
|
519
580
|
* assert.deepStrictEqual(result, [1, 2, 3, 4]);
|
|
581
|
+
* ```
|
|
520
582
|
*
|
|
521
583
|
* @category concatenating
|
|
522
584
|
* @since 2.0.0
|
|
@@ -570,6 +632,7 @@ export declare const appendAll: {
|
|
|
570
632
|
* a value through a series of transformations.
|
|
571
633
|
*
|
|
572
634
|
* @example
|
|
635
|
+
* ```ts
|
|
573
636
|
* import { Array } from "effect";
|
|
574
637
|
*
|
|
575
638
|
* const numbers = [1, 2, 3, 4]
|
|
@@ -581,6 +644,7 @@ export declare const appendAll: {
|
|
|
581
644
|
* // and adds each element of the array to this accumulator one by one,
|
|
582
645
|
* // keeping track of the cumulative sum after each addition.
|
|
583
646
|
* // Each of these sums is captured in the resulting array.
|
|
647
|
+
* ```
|
|
584
648
|
*
|
|
585
649
|
* @category folding
|
|
586
650
|
* @since 2.0.0
|
|
@@ -592,6 +656,7 @@ export declare const scan: {
|
|
|
592
656
|
* a value through a series of transformations.
|
|
593
657
|
*
|
|
594
658
|
* @example
|
|
659
|
+
* ```ts
|
|
595
660
|
* import { Array } from "effect";
|
|
596
661
|
*
|
|
597
662
|
* const numbers = [1, 2, 3, 4]
|
|
@@ -603,6 +668,7 @@ export declare const scan: {
|
|
|
603
668
|
* // and adds each element of the array to this accumulator one by one,
|
|
604
669
|
* // keeping track of the cumulative sum after each addition.
|
|
605
670
|
* // Each of these sums is captured in the resulting array.
|
|
671
|
+
* ```
|
|
606
672
|
*
|
|
607
673
|
* @category folding
|
|
608
674
|
* @since 2.0.0
|
|
@@ -614,6 +680,7 @@ export declare const scan: {
|
|
|
614
680
|
* a value through a series of transformations.
|
|
615
681
|
*
|
|
616
682
|
* @example
|
|
683
|
+
* ```ts
|
|
617
684
|
* import { Array } from "effect";
|
|
618
685
|
*
|
|
619
686
|
* const numbers = [1, 2, 3, 4]
|
|
@@ -625,6 +692,7 @@ export declare const scan: {
|
|
|
625
692
|
* // and adds each element of the array to this accumulator one by one,
|
|
626
693
|
* // keeping track of the cumulative sum after each addition.
|
|
627
694
|
* // Each of these sums is captured in the resulting array.
|
|
695
|
+
* ```
|
|
628
696
|
*
|
|
629
697
|
* @category folding
|
|
630
698
|
* @since 2.0.0
|
|
@@ -637,11 +705,13 @@ export declare const scan: {
|
|
|
637
705
|
* a value through a series of transformations.
|
|
638
706
|
*
|
|
639
707
|
* @example
|
|
708
|
+
* ```ts
|
|
640
709
|
* import { Array } from "effect";
|
|
641
710
|
*
|
|
642
711
|
* const numbers = [1, 2, 3, 4]
|
|
643
712
|
* const result = Array.scanRight(numbers, 0, (acc, value) => acc + value)
|
|
644
713
|
* assert.deepStrictEqual(result, [10, 9, 7, 4, 0])
|
|
714
|
+
* ```
|
|
645
715
|
*
|
|
646
716
|
* @category folding
|
|
647
717
|
* @since 2.0.0
|
|
@@ -653,11 +723,13 @@ export declare const scanRight: {
|
|
|
653
723
|
* a value through a series of transformations.
|
|
654
724
|
*
|
|
655
725
|
* @example
|
|
726
|
+
* ```ts
|
|
656
727
|
* import { Array } from "effect";
|
|
657
728
|
*
|
|
658
729
|
* const numbers = [1, 2, 3, 4]
|
|
659
730
|
* const result = Array.scanRight(numbers, 0, (acc, value) => acc + value)
|
|
660
731
|
* assert.deepStrictEqual(result, [10, 9, 7, 4, 0])
|
|
732
|
+
* ```
|
|
661
733
|
*
|
|
662
734
|
* @category folding
|
|
663
735
|
* @since 2.0.0
|
|
@@ -669,11 +741,13 @@ export declare const scanRight: {
|
|
|
669
741
|
* a value through a series of transformations.
|
|
670
742
|
*
|
|
671
743
|
* @example
|
|
744
|
+
* ```ts
|
|
672
745
|
* import { Array } from "effect";
|
|
673
746
|
*
|
|
674
747
|
* const numbers = [1, 2, 3, 4]
|
|
675
748
|
* const result = Array.scanRight(numbers, 0, (acc, value) => acc + value)
|
|
676
749
|
* assert.deepStrictEqual(result, [10, 9, 7, 4, 0])
|
|
750
|
+
* ```
|
|
677
751
|
*
|
|
678
752
|
* @category folding
|
|
679
753
|
* @since 2.0.0
|
|
@@ -686,10 +760,12 @@ export declare const scanRight: {
|
|
|
686
760
|
* @param self - The value to check.
|
|
687
761
|
*
|
|
688
762
|
* @example
|
|
763
|
+
* ```ts
|
|
689
764
|
* import { isArray } from "effect/Array"
|
|
690
765
|
*
|
|
691
766
|
* assert.deepStrictEqual(isArray(null), false);
|
|
692
767
|
* assert.deepStrictEqual(isArray([1, 2, 3]), true);
|
|
768
|
+
* ```
|
|
693
769
|
*
|
|
694
770
|
* @category guards
|
|
695
771
|
* @since 2.0.0
|
|
@@ -701,10 +777,12 @@ export declare const isArray: {
|
|
|
701
777
|
* @param self - The value to check.
|
|
702
778
|
*
|
|
703
779
|
* @example
|
|
780
|
+
* ```ts
|
|
704
781
|
* import { isArray } from "effect/Array"
|
|
705
782
|
*
|
|
706
783
|
* assert.deepStrictEqual(isArray(null), false);
|
|
707
784
|
* assert.deepStrictEqual(isArray([1, 2, 3]), true);
|
|
785
|
+
* ```
|
|
708
786
|
*
|
|
709
787
|
* @category guards
|
|
710
788
|
* @since 2.0.0
|
|
@@ -716,10 +794,12 @@ export declare const isArray: {
|
|
|
716
794
|
* @param self - The value to check.
|
|
717
795
|
*
|
|
718
796
|
* @example
|
|
797
|
+
* ```ts
|
|
719
798
|
* import { isArray } from "effect/Array"
|
|
720
799
|
*
|
|
721
800
|
* assert.deepStrictEqual(isArray(null), false);
|
|
722
801
|
* assert.deepStrictEqual(isArray([1, 2, 3]), true);
|
|
802
|
+
* ```
|
|
723
803
|
*
|
|
724
804
|
* @category guards
|
|
725
805
|
* @since 2.0.0
|
|
@@ -732,10 +812,12 @@ export declare const isArray: {
|
|
|
732
812
|
* @param self - The `Array` to check.
|
|
733
813
|
*
|
|
734
814
|
* @example
|
|
815
|
+
* ```ts
|
|
735
816
|
* import { isEmptyArray } from "effect/Array"
|
|
736
817
|
*
|
|
737
818
|
* assert.deepStrictEqual(isEmptyArray([]), true);
|
|
738
819
|
* assert.deepStrictEqual(isEmptyArray([1, 2, 3]), false);
|
|
820
|
+
* ```
|
|
739
821
|
*
|
|
740
822
|
* @category guards
|
|
741
823
|
* @since 2.0.0
|
|
@@ -747,10 +829,12 @@ export declare const isEmptyArray: <A>(self: Array<A>) => self is [];
|
|
|
747
829
|
* @param self - The `ReadonlyArray` to check.
|
|
748
830
|
*
|
|
749
831
|
* @example
|
|
832
|
+
* ```ts
|
|
750
833
|
* import { isEmptyReadonlyArray } from "effect/Array"
|
|
751
834
|
*
|
|
752
835
|
* assert.deepStrictEqual(isEmptyReadonlyArray([]), true);
|
|
753
836
|
* assert.deepStrictEqual(isEmptyReadonlyArray([1, 2, 3]), false);
|
|
837
|
+
* ```
|
|
754
838
|
*
|
|
755
839
|
* @category guards
|
|
756
840
|
* @since 2.0.0
|
|
@@ -764,10 +848,12 @@ export declare const isEmptyReadonlyArray: <A>(self: ReadonlyArray<A>) => self i
|
|
|
764
848
|
* @param self - The `Array` to check.
|
|
765
849
|
*
|
|
766
850
|
* @example
|
|
851
|
+
* ```ts
|
|
767
852
|
* import { isNonEmptyArray } from "effect/Array"
|
|
768
853
|
*
|
|
769
854
|
* assert.deepStrictEqual(isNonEmptyArray([]), false);
|
|
770
855
|
* assert.deepStrictEqual(isNonEmptyArray([1, 2, 3]), true);
|
|
856
|
+
* ```
|
|
771
857
|
*
|
|
772
858
|
* @category guards
|
|
773
859
|
* @since 2.0.0
|
|
@@ -781,10 +867,12 @@ export declare const isNonEmptyArray: <A>(self: Array<A>) => self is NonEmptyArr
|
|
|
781
867
|
* @param self - The `ReadonlyArray` to check.
|
|
782
868
|
*
|
|
783
869
|
* @example
|
|
870
|
+
* ```ts
|
|
784
871
|
* import { isNonEmptyReadonlyArray } from "effect/Array"
|
|
785
872
|
*
|
|
786
873
|
* assert.deepStrictEqual(isNonEmptyReadonlyArray([]), false);
|
|
787
874
|
* assert.deepStrictEqual(isNonEmptyReadonlyArray([1, 2, 3]), true);
|
|
875
|
+
* ```
|
|
788
876
|
*
|
|
789
877
|
* @category guards
|
|
790
878
|
* @since 2.0.0
|
|
@@ -845,10 +933,12 @@ export declare const unsafeGet: {
|
|
|
845
933
|
* Return a tuple containing the first element, and a new `Array` of the remaining elements, if any.
|
|
846
934
|
*
|
|
847
935
|
* @example
|
|
936
|
+
* ```ts
|
|
848
937
|
* import { Array } from "effect";
|
|
849
938
|
*
|
|
850
939
|
* const result = Array.unprepend([1, 2, 3, 4])
|
|
851
940
|
* assert.deepStrictEqual(result, [1, [2, 3, 4]])
|
|
941
|
+
* ```
|
|
852
942
|
*
|
|
853
943
|
* @category splitting
|
|
854
944
|
* @since 2.0.0
|
|
@@ -858,10 +948,12 @@ export declare const unprepend: <A>(self: NonEmptyReadonlyArray<A>) => [firstEle
|
|
|
858
948
|
* Return a tuple containing a copy of the `NonEmptyReadonlyArray` without its last element, and that last element.
|
|
859
949
|
*
|
|
860
950
|
* @example
|
|
951
|
+
* ```ts
|
|
861
952
|
* import { Array } from "effect";
|
|
862
953
|
*
|
|
863
954
|
* const result = Array.unappend([1, 2, 3, 4])
|
|
864
955
|
* assert.deepStrictEqual(result, [[1, 2, 3], 4])
|
|
956
|
+
* ```
|
|
865
957
|
*
|
|
866
958
|
* @category splitting
|
|
867
959
|
* @since 2.0.0
|
|
@@ -878,10 +970,12 @@ export declare const head: <A>(self: ReadonlyArray<A>) => Option<A>;
|
|
|
878
970
|
* Get the first element of a non empty array.
|
|
879
971
|
*
|
|
880
972
|
* @example
|
|
973
|
+
* ```ts
|
|
881
974
|
* import { Array } from "effect"
|
|
882
975
|
*
|
|
883
976
|
* const result = Array.headNonEmpty([1, 2, 3, 4])
|
|
884
977
|
* assert.deepStrictEqual(result, 1)
|
|
978
|
+
* ```
|
|
885
979
|
*
|
|
886
980
|
* @category getters
|
|
887
981
|
* @since 2.0.0
|
|
@@ -898,10 +992,12 @@ export declare const last: <A>(self: ReadonlyArray<A>) => Option<A>;
|
|
|
898
992
|
* Get the last element of a non empty array.
|
|
899
993
|
*
|
|
900
994
|
* @example
|
|
995
|
+
* ```ts
|
|
901
996
|
* import { Array } from "effect"
|
|
902
997
|
*
|
|
903
998
|
* const result = Array.lastNonEmpty([1, 2, 3, 4])
|
|
904
999
|
* assert.deepStrictEqual(result, 4)
|
|
1000
|
+
* ```
|
|
905
1001
|
*
|
|
906
1002
|
* @category getters
|
|
907
1003
|
* @since 2.0.0
|
|
@@ -918,10 +1014,12 @@ export declare const tail: <A>(self: Iterable<A>) => Option<Array<A>>;
|
|
|
918
1014
|
* Get all but the first element of a `NonEmptyReadonlyArray`.
|
|
919
1015
|
*
|
|
920
1016
|
* @example
|
|
1017
|
+
* ```ts
|
|
921
1018
|
* import { Array } from "effect"
|
|
922
1019
|
*
|
|
923
1020
|
* const result = Array.tailNonEmpty([1, 2, 3, 4])
|
|
924
1021
|
* assert.deepStrictEqual(result, [2, 3, 4])
|
|
1022
|
+
* ```
|
|
925
1023
|
*
|
|
926
1024
|
* @category getters
|
|
927
1025
|
* @since 2.0.0
|
|
@@ -938,10 +1036,12 @@ export declare const init: <A>(self: Iterable<A>) => Option<Array<A>>;
|
|
|
938
1036
|
* Get all but the last element of a non empty array, creating a new array.
|
|
939
1037
|
*
|
|
940
1038
|
* @example
|
|
1039
|
+
* ```ts
|
|
941
1040
|
* import { Array } from "effect"
|
|
942
1041
|
*
|
|
943
1042
|
* const result = Array.initNonEmpty([1, 2, 3, 4])
|
|
944
1043
|
* assert.deepStrictEqual(result, [1, 2, 3])
|
|
1044
|
+
* ```
|
|
945
1045
|
*
|
|
946
1046
|
* @category getters
|
|
947
1047
|
* @since 2.0.0
|
|
@@ -953,11 +1053,13 @@ export declare const initNonEmpty: <A>(self: NonEmptyReadonlyArray<A>) => Array<
|
|
|
953
1053
|
* **Note**. `n` is normalized to a non negative integer.
|
|
954
1054
|
*
|
|
955
1055
|
* @example
|
|
1056
|
+
* ```ts
|
|
956
1057
|
* import { Array } from "effect"
|
|
957
1058
|
*
|
|
958
1059
|
* const numbers = [1, 2, 3, 4, 5]
|
|
959
1060
|
* const result = Array.take(numbers, 3)
|
|
960
1061
|
* assert.deepStrictEqual(result, [1, 2, 3])
|
|
1062
|
+
* ```
|
|
961
1063
|
*
|
|
962
1064
|
* @category getters
|
|
963
1065
|
* @since 2.0.0
|
|
@@ -969,11 +1071,13 @@ export declare const take: {
|
|
|
969
1071
|
* **Note**. `n` is normalized to a non negative integer.
|
|
970
1072
|
*
|
|
971
1073
|
* @example
|
|
1074
|
+
* ```ts
|
|
972
1075
|
* import { Array } from "effect"
|
|
973
1076
|
*
|
|
974
1077
|
* const numbers = [1, 2, 3, 4, 5]
|
|
975
1078
|
* const result = Array.take(numbers, 3)
|
|
976
1079
|
* assert.deepStrictEqual(result, [1, 2, 3])
|
|
1080
|
+
* ```
|
|
977
1081
|
*
|
|
978
1082
|
* @category getters
|
|
979
1083
|
* @since 2.0.0
|
|
@@ -985,11 +1089,13 @@ export declare const take: {
|
|
|
985
1089
|
* **Note**. `n` is normalized to a non negative integer.
|
|
986
1090
|
*
|
|
987
1091
|
* @example
|
|
1092
|
+
* ```ts
|
|
988
1093
|
* import { Array } from "effect"
|
|
989
1094
|
*
|
|
990
1095
|
* const numbers = [1, 2, 3, 4, 5]
|
|
991
1096
|
* const result = Array.take(numbers, 3)
|
|
992
1097
|
* assert.deepStrictEqual(result, [1, 2, 3])
|
|
1098
|
+
* ```
|
|
993
1099
|
*
|
|
994
1100
|
* @category getters
|
|
995
1101
|
* @since 2.0.0
|
|
@@ -1002,11 +1108,13 @@ export declare const take: {
|
|
|
1002
1108
|
* **Note**. `n` is normalized to a non negative integer.
|
|
1003
1109
|
*
|
|
1004
1110
|
* @example
|
|
1111
|
+
* ```ts
|
|
1005
1112
|
* import { Array } from "effect"
|
|
1006
1113
|
*
|
|
1007
1114
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1008
1115
|
* const result = Array.takeRight(numbers, 3)
|
|
1009
1116
|
* assert.deepStrictEqual(result, [3, 4, 5])
|
|
1117
|
+
* ```
|
|
1010
1118
|
*
|
|
1011
1119
|
* @category getters
|
|
1012
1120
|
* @since 2.0.0
|
|
@@ -1018,11 +1126,13 @@ export declare const takeRight: {
|
|
|
1018
1126
|
* **Note**. `n` is normalized to a non negative integer.
|
|
1019
1127
|
*
|
|
1020
1128
|
* @example
|
|
1129
|
+
* ```ts
|
|
1021
1130
|
* import { Array } from "effect"
|
|
1022
1131
|
*
|
|
1023
1132
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1024
1133
|
* const result = Array.takeRight(numbers, 3)
|
|
1025
1134
|
* assert.deepStrictEqual(result, [3, 4, 5])
|
|
1135
|
+
* ```
|
|
1026
1136
|
*
|
|
1027
1137
|
* @category getters
|
|
1028
1138
|
* @since 2.0.0
|
|
@@ -1034,11 +1144,13 @@ export declare const takeRight: {
|
|
|
1034
1144
|
* **Note**. `n` is normalized to a non negative integer.
|
|
1035
1145
|
*
|
|
1036
1146
|
* @example
|
|
1147
|
+
* ```ts
|
|
1037
1148
|
* import { Array } from "effect"
|
|
1038
1149
|
*
|
|
1039
1150
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1040
1151
|
* const result = Array.takeRight(numbers, 3)
|
|
1041
1152
|
* assert.deepStrictEqual(result, [3, 4, 5])
|
|
1153
|
+
* ```
|
|
1042
1154
|
*
|
|
1043
1155
|
* @category getters
|
|
1044
1156
|
* @since 2.0.0
|
|
@@ -1049,6 +1161,7 @@ export declare const takeRight: {
|
|
|
1049
1161
|
* Calculate the longest initial subarray for which all element satisfy the specified predicate, creating a new `Array`.
|
|
1050
1162
|
*
|
|
1051
1163
|
* @example
|
|
1164
|
+
* ```ts
|
|
1052
1165
|
* import { Array } from "effect"
|
|
1053
1166
|
*
|
|
1054
1167
|
* const numbers = [1, 3, 2, 4, 1, 2]
|
|
@@ -1060,6 +1173,7 @@ export declare const takeRight: {
|
|
|
1060
1173
|
* // - The next element (`3`) is also less than `4`, so it adds `3`.
|
|
1061
1174
|
* // - The next element (`2`) is again less than `4`, so it adds `2`.
|
|
1062
1175
|
* // - The function then encounters `4`, which is not less than `4`. At this point, it stops checking further elements and finalizes the result.
|
|
1176
|
+
* ```
|
|
1063
1177
|
*
|
|
1064
1178
|
* @category getters
|
|
1065
1179
|
* @since 2.0.0
|
|
@@ -1069,6 +1183,7 @@ export declare const takeWhile: {
|
|
|
1069
1183
|
* Calculate the longest initial subarray for which all element satisfy the specified predicate, creating a new `Array`.
|
|
1070
1184
|
*
|
|
1071
1185
|
* @example
|
|
1186
|
+
* ```ts
|
|
1072
1187
|
* import { Array } from "effect"
|
|
1073
1188
|
*
|
|
1074
1189
|
* const numbers = [1, 3, 2, 4, 1, 2]
|
|
@@ -1080,6 +1195,7 @@ export declare const takeWhile: {
|
|
|
1080
1195
|
* // - The next element (`3`) is also less than `4`, so it adds `3`.
|
|
1081
1196
|
* // - The next element (`2`) is again less than `4`, so it adds `2`.
|
|
1082
1197
|
* // - The function then encounters `4`, which is not less than `4`. At this point, it stops checking further elements and finalizes the result.
|
|
1198
|
+
* ```
|
|
1083
1199
|
*
|
|
1084
1200
|
* @category getters
|
|
1085
1201
|
* @since 2.0.0
|
|
@@ -1089,6 +1205,7 @@ export declare const takeWhile: {
|
|
|
1089
1205
|
* Calculate the longest initial subarray for which all element satisfy the specified predicate, creating a new `Array`.
|
|
1090
1206
|
*
|
|
1091
1207
|
* @example
|
|
1208
|
+
* ```ts
|
|
1092
1209
|
* import { Array } from "effect"
|
|
1093
1210
|
*
|
|
1094
1211
|
* const numbers = [1, 3, 2, 4, 1, 2]
|
|
@@ -1100,6 +1217,7 @@ export declare const takeWhile: {
|
|
|
1100
1217
|
* // - The next element (`3`) is also less than `4`, so it adds `3`.
|
|
1101
1218
|
* // - The next element (`2`) is again less than `4`, so it adds `2`.
|
|
1102
1219
|
* // - The function then encounters `4`, which is not less than `4`. At this point, it stops checking further elements and finalizes the result.
|
|
1220
|
+
* ```
|
|
1103
1221
|
*
|
|
1104
1222
|
* @category getters
|
|
1105
1223
|
* @since 2.0.0
|
|
@@ -1109,6 +1227,7 @@ export declare const takeWhile: {
|
|
|
1109
1227
|
* Calculate the longest initial subarray for which all element satisfy the specified predicate, creating a new `Array`.
|
|
1110
1228
|
*
|
|
1111
1229
|
* @example
|
|
1230
|
+
* ```ts
|
|
1112
1231
|
* import { Array } from "effect"
|
|
1113
1232
|
*
|
|
1114
1233
|
* const numbers = [1, 3, 2, 4, 1, 2]
|
|
@@ -1120,6 +1239,7 @@ export declare const takeWhile: {
|
|
|
1120
1239
|
* // - The next element (`3`) is also less than `4`, so it adds `3`.
|
|
1121
1240
|
* // - The next element (`2`) is again less than `4`, so it adds `2`.
|
|
1122
1241
|
* // - The function then encounters `4`, which is not less than `4`. At this point, it stops checking further elements and finalizes the result.
|
|
1242
|
+
* ```
|
|
1123
1243
|
*
|
|
1124
1244
|
* @category getters
|
|
1125
1245
|
* @since 2.0.0
|
|
@@ -1129,6 +1249,7 @@ export declare const takeWhile: {
|
|
|
1129
1249
|
* Calculate the longest initial subarray for which all element satisfy the specified predicate, creating a new `Array`.
|
|
1130
1250
|
*
|
|
1131
1251
|
* @example
|
|
1252
|
+
* ```ts
|
|
1132
1253
|
* import { Array } from "effect"
|
|
1133
1254
|
*
|
|
1134
1255
|
* const numbers = [1, 3, 2, 4, 1, 2]
|
|
@@ -1140,6 +1261,7 @@ export declare const takeWhile: {
|
|
|
1140
1261
|
* // - The next element (`3`) is also less than `4`, so it adds `3`.
|
|
1141
1262
|
* // - The next element (`2`) is again less than `4`, so it adds `2`.
|
|
1142
1263
|
* // - The function then encounters `4`, which is not less than `4`. At this point, it stops checking further elements and finalizes the result.
|
|
1264
|
+
* ```
|
|
1143
1265
|
*
|
|
1144
1266
|
* @category getters
|
|
1145
1267
|
* @since 2.0.0
|
|
@@ -1203,11 +1325,13 @@ export declare const span: {
|
|
|
1203
1325
|
* **Note**. `n` is normalized to a non negative integer.
|
|
1204
1326
|
*
|
|
1205
1327
|
* @example
|
|
1328
|
+
* ```ts
|
|
1206
1329
|
* import { Array } from "effect"
|
|
1207
1330
|
*
|
|
1208
1331
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1209
1332
|
* const result = Array.drop(numbers, 2)
|
|
1210
1333
|
* assert.deepStrictEqual(result, [3, 4, 5])
|
|
1334
|
+
* ```
|
|
1211
1335
|
*
|
|
1212
1336
|
* @category getters
|
|
1213
1337
|
* @since 2.0.0
|
|
@@ -1219,11 +1343,13 @@ export declare const drop: {
|
|
|
1219
1343
|
* **Note**. `n` is normalized to a non negative integer.
|
|
1220
1344
|
*
|
|
1221
1345
|
* @example
|
|
1346
|
+
* ```ts
|
|
1222
1347
|
* import { Array } from "effect"
|
|
1223
1348
|
*
|
|
1224
1349
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1225
1350
|
* const result = Array.drop(numbers, 2)
|
|
1226
1351
|
* assert.deepStrictEqual(result, [3, 4, 5])
|
|
1352
|
+
* ```
|
|
1227
1353
|
*
|
|
1228
1354
|
* @category getters
|
|
1229
1355
|
* @since 2.0.0
|
|
@@ -1235,11 +1361,13 @@ export declare const drop: {
|
|
|
1235
1361
|
* **Note**. `n` is normalized to a non negative integer.
|
|
1236
1362
|
*
|
|
1237
1363
|
* @example
|
|
1364
|
+
* ```ts
|
|
1238
1365
|
* import { Array } from "effect"
|
|
1239
1366
|
*
|
|
1240
1367
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1241
1368
|
* const result = Array.drop(numbers, 2)
|
|
1242
1369
|
* assert.deepStrictEqual(result, [3, 4, 5])
|
|
1370
|
+
* ```
|
|
1243
1371
|
*
|
|
1244
1372
|
* @category getters
|
|
1245
1373
|
* @since 2.0.0
|
|
@@ -1252,11 +1380,13 @@ export declare const drop: {
|
|
|
1252
1380
|
* **Note**. `n` is normalized to a non negative integer.
|
|
1253
1381
|
*
|
|
1254
1382
|
* @example
|
|
1383
|
+
* ```ts
|
|
1255
1384
|
* import { Array } from "effect"
|
|
1256
1385
|
*
|
|
1257
1386
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1258
1387
|
* const result = Array.dropRight(numbers, 2)
|
|
1259
1388
|
* assert.deepStrictEqual(result, [1, 2, 3])
|
|
1389
|
+
* ```
|
|
1260
1390
|
*
|
|
1261
1391
|
* @category getters
|
|
1262
1392
|
* @since 2.0.0
|
|
@@ -1268,11 +1398,13 @@ export declare const dropRight: {
|
|
|
1268
1398
|
* **Note**. `n` is normalized to a non negative integer.
|
|
1269
1399
|
*
|
|
1270
1400
|
* @example
|
|
1401
|
+
* ```ts
|
|
1271
1402
|
* import { Array } from "effect"
|
|
1272
1403
|
*
|
|
1273
1404
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1274
1405
|
* const result = Array.dropRight(numbers, 2)
|
|
1275
1406
|
* assert.deepStrictEqual(result, [1, 2, 3])
|
|
1407
|
+
* ```
|
|
1276
1408
|
*
|
|
1277
1409
|
* @category getters
|
|
1278
1410
|
* @since 2.0.0
|
|
@@ -1284,11 +1416,13 @@ export declare const dropRight: {
|
|
|
1284
1416
|
* **Note**. `n` is normalized to a non negative integer.
|
|
1285
1417
|
*
|
|
1286
1418
|
* @example
|
|
1419
|
+
* ```ts
|
|
1287
1420
|
* import { Array } from "effect"
|
|
1288
1421
|
*
|
|
1289
1422
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1290
1423
|
* const result = Array.dropRight(numbers, 2)
|
|
1291
1424
|
* assert.deepStrictEqual(result, [1, 2, 3])
|
|
1425
|
+
* ```
|
|
1292
1426
|
*
|
|
1293
1427
|
* @category getters
|
|
1294
1428
|
* @since 2.0.0
|
|
@@ -1299,11 +1433,13 @@ export declare const dropRight: {
|
|
|
1299
1433
|
* Remove the longest initial subarray for which all element satisfy the specified predicate, creating a new `Array`.
|
|
1300
1434
|
*
|
|
1301
1435
|
* @example
|
|
1436
|
+
* ```ts
|
|
1302
1437
|
* import { Array } from "effect"
|
|
1303
1438
|
*
|
|
1304
1439
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1305
1440
|
* const result = Array.dropWhile(numbers, x => x < 4)
|
|
1306
1441
|
* assert.deepStrictEqual(result, [4, 5])
|
|
1442
|
+
* ```
|
|
1307
1443
|
*
|
|
1308
1444
|
* @category getters
|
|
1309
1445
|
* @since 2.0.0
|
|
@@ -1313,11 +1449,13 @@ export declare const dropWhile: {
|
|
|
1313
1449
|
* Remove the longest initial subarray for which all element satisfy the specified predicate, creating a new `Array`.
|
|
1314
1450
|
*
|
|
1315
1451
|
* @example
|
|
1452
|
+
* ```ts
|
|
1316
1453
|
* import { Array } from "effect"
|
|
1317
1454
|
*
|
|
1318
1455
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1319
1456
|
* const result = Array.dropWhile(numbers, x => x < 4)
|
|
1320
1457
|
* assert.deepStrictEqual(result, [4, 5])
|
|
1458
|
+
* ```
|
|
1321
1459
|
*
|
|
1322
1460
|
* @category getters
|
|
1323
1461
|
* @since 2.0.0
|
|
@@ -1327,11 +1465,13 @@ export declare const dropWhile: {
|
|
|
1327
1465
|
* Remove the longest initial subarray for which all element satisfy the specified predicate, creating a new `Array`.
|
|
1328
1466
|
*
|
|
1329
1467
|
* @example
|
|
1468
|
+
* ```ts
|
|
1330
1469
|
* import { Array } from "effect"
|
|
1331
1470
|
*
|
|
1332
1471
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1333
1472
|
* const result = Array.dropWhile(numbers, x => x < 4)
|
|
1334
1473
|
* assert.deepStrictEqual(result, [4, 5])
|
|
1474
|
+
* ```
|
|
1335
1475
|
*
|
|
1336
1476
|
* @category getters
|
|
1337
1477
|
* @since 2.0.0
|
|
@@ -1342,11 +1482,13 @@ export declare const dropWhile: {
|
|
|
1342
1482
|
* Return the first index for which a predicate holds.
|
|
1343
1483
|
*
|
|
1344
1484
|
* @example
|
|
1485
|
+
* ```ts
|
|
1345
1486
|
* import { Array, Option } from "effect"
|
|
1346
1487
|
*
|
|
1347
1488
|
* const numbers = [5, 3, 8, 9]
|
|
1348
1489
|
* const result = Array.findFirstIndex(numbers, x => x > 5)
|
|
1349
1490
|
* assert.deepStrictEqual(result, Option.some(2))
|
|
1491
|
+
* ```
|
|
1350
1492
|
*
|
|
1351
1493
|
* @category elements
|
|
1352
1494
|
* @since 2.0.0
|
|
@@ -1356,11 +1498,13 @@ export declare const findFirstIndex: {
|
|
|
1356
1498
|
* Return the first index for which a predicate holds.
|
|
1357
1499
|
*
|
|
1358
1500
|
* @example
|
|
1501
|
+
* ```ts
|
|
1359
1502
|
* import { Array, Option } from "effect"
|
|
1360
1503
|
*
|
|
1361
1504
|
* const numbers = [5, 3, 8, 9]
|
|
1362
1505
|
* const result = Array.findFirstIndex(numbers, x => x > 5)
|
|
1363
1506
|
* assert.deepStrictEqual(result, Option.some(2))
|
|
1507
|
+
* ```
|
|
1364
1508
|
*
|
|
1365
1509
|
* @category elements
|
|
1366
1510
|
* @since 2.0.0
|
|
@@ -1370,11 +1514,13 @@ export declare const findFirstIndex: {
|
|
|
1370
1514
|
* Return the first index for which a predicate holds.
|
|
1371
1515
|
*
|
|
1372
1516
|
* @example
|
|
1517
|
+
* ```ts
|
|
1373
1518
|
* import { Array, Option } from "effect"
|
|
1374
1519
|
*
|
|
1375
1520
|
* const numbers = [5, 3, 8, 9]
|
|
1376
1521
|
* const result = Array.findFirstIndex(numbers, x => x > 5)
|
|
1377
1522
|
* assert.deepStrictEqual(result, Option.some(2))
|
|
1523
|
+
* ```
|
|
1378
1524
|
*
|
|
1379
1525
|
* @category elements
|
|
1380
1526
|
* @since 2.0.0
|
|
@@ -1385,11 +1531,13 @@ export declare const findFirstIndex: {
|
|
|
1385
1531
|
* Return the last index for which a predicate holds.
|
|
1386
1532
|
*
|
|
1387
1533
|
* @example
|
|
1534
|
+
* ```ts
|
|
1388
1535
|
* import { Array, Option } from "effect"
|
|
1389
1536
|
*
|
|
1390
1537
|
* const numbers = [1, 3, 8, 9]
|
|
1391
1538
|
* const result = Array.findLastIndex(numbers, x => x < 5)
|
|
1392
1539
|
* assert.deepStrictEqual(result, Option.some(1))
|
|
1540
|
+
* ```
|
|
1393
1541
|
*
|
|
1394
1542
|
* @category elements
|
|
1395
1543
|
* @since 2.0.0
|
|
@@ -1399,11 +1547,13 @@ export declare const findLastIndex: {
|
|
|
1399
1547
|
* Return the last index for which a predicate holds.
|
|
1400
1548
|
*
|
|
1401
1549
|
* @example
|
|
1550
|
+
* ```ts
|
|
1402
1551
|
* import { Array, Option } from "effect"
|
|
1403
1552
|
*
|
|
1404
1553
|
* const numbers = [1, 3, 8, 9]
|
|
1405
1554
|
* const result = Array.findLastIndex(numbers, x => x < 5)
|
|
1406
1555
|
* assert.deepStrictEqual(result, Option.some(1))
|
|
1556
|
+
* ```
|
|
1407
1557
|
*
|
|
1408
1558
|
* @category elements
|
|
1409
1559
|
* @since 2.0.0
|
|
@@ -1413,11 +1563,13 @@ export declare const findLastIndex: {
|
|
|
1413
1563
|
* Return the last index for which a predicate holds.
|
|
1414
1564
|
*
|
|
1415
1565
|
* @example
|
|
1566
|
+
* ```ts
|
|
1416
1567
|
* import { Array, Option } from "effect"
|
|
1417
1568
|
*
|
|
1418
1569
|
* const numbers = [1, 3, 8, 9]
|
|
1419
1570
|
* const result = Array.findLastIndex(numbers, x => x < 5)
|
|
1420
1571
|
* assert.deepStrictEqual(result, Option.some(1))
|
|
1572
|
+
* ```
|
|
1421
1573
|
*
|
|
1422
1574
|
* @category elements
|
|
1423
1575
|
* @since 2.0.0
|
|
@@ -1429,11 +1581,13 @@ export declare const findLastIndex: {
|
|
|
1429
1581
|
* predicate, or `None` if no such element exists.
|
|
1430
1582
|
*
|
|
1431
1583
|
* @example
|
|
1584
|
+
* ```ts
|
|
1432
1585
|
* import { Array, Option } from "effect"
|
|
1433
1586
|
*
|
|
1434
1587
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1435
1588
|
* const result = Array.findFirst(numbers, x => x > 3)
|
|
1436
1589
|
* assert.deepStrictEqual(result, Option.some(4))
|
|
1590
|
+
* ```
|
|
1437
1591
|
*
|
|
1438
1592
|
* @category elements
|
|
1439
1593
|
* @since 2.0.0
|
|
@@ -1444,11 +1598,13 @@ export declare const findFirst: {
|
|
|
1444
1598
|
* predicate, or `None` if no such element exists.
|
|
1445
1599
|
*
|
|
1446
1600
|
* @example
|
|
1601
|
+
* ```ts
|
|
1447
1602
|
* import { Array, Option } from "effect"
|
|
1448
1603
|
*
|
|
1449
1604
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1450
1605
|
* const result = Array.findFirst(numbers, x => x > 3)
|
|
1451
1606
|
* assert.deepStrictEqual(result, Option.some(4))
|
|
1607
|
+
* ```
|
|
1452
1608
|
*
|
|
1453
1609
|
* @category elements
|
|
1454
1610
|
* @since 2.0.0
|
|
@@ -1459,11 +1615,13 @@ export declare const findFirst: {
|
|
|
1459
1615
|
* predicate, or `None` if no such element exists.
|
|
1460
1616
|
*
|
|
1461
1617
|
* @example
|
|
1618
|
+
* ```ts
|
|
1462
1619
|
* import { Array, Option } from "effect"
|
|
1463
1620
|
*
|
|
1464
1621
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1465
1622
|
* const result = Array.findFirst(numbers, x => x > 3)
|
|
1466
1623
|
* assert.deepStrictEqual(result, Option.some(4))
|
|
1624
|
+
* ```
|
|
1467
1625
|
*
|
|
1468
1626
|
* @category elements
|
|
1469
1627
|
* @since 2.0.0
|
|
@@ -1474,11 +1632,13 @@ export declare const findFirst: {
|
|
|
1474
1632
|
* predicate, or `None` if no such element exists.
|
|
1475
1633
|
*
|
|
1476
1634
|
* @example
|
|
1635
|
+
* ```ts
|
|
1477
1636
|
* import { Array, Option } from "effect"
|
|
1478
1637
|
*
|
|
1479
1638
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1480
1639
|
* const result = Array.findFirst(numbers, x => x > 3)
|
|
1481
1640
|
* assert.deepStrictEqual(result, Option.some(4))
|
|
1641
|
+
* ```
|
|
1482
1642
|
*
|
|
1483
1643
|
* @category elements
|
|
1484
1644
|
* @since 2.0.0
|
|
@@ -1489,11 +1649,13 @@ export declare const findFirst: {
|
|
|
1489
1649
|
* predicate, or `None` if no such element exists.
|
|
1490
1650
|
*
|
|
1491
1651
|
* @example
|
|
1652
|
+
* ```ts
|
|
1492
1653
|
* import { Array, Option } from "effect"
|
|
1493
1654
|
*
|
|
1494
1655
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1495
1656
|
* const result = Array.findFirst(numbers, x => x > 3)
|
|
1496
1657
|
* assert.deepStrictEqual(result, Option.some(4))
|
|
1658
|
+
* ```
|
|
1497
1659
|
*
|
|
1498
1660
|
* @category elements
|
|
1499
1661
|
* @since 2.0.0
|
|
@@ -1504,11 +1666,13 @@ export declare const findFirst: {
|
|
|
1504
1666
|
* predicate, or `None` if no such element exists.
|
|
1505
1667
|
*
|
|
1506
1668
|
* @example
|
|
1669
|
+
* ```ts
|
|
1507
1670
|
* import { Array, Option } from "effect"
|
|
1508
1671
|
*
|
|
1509
1672
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1510
1673
|
* const result = Array.findFirst(numbers, x => x > 3)
|
|
1511
1674
|
* assert.deepStrictEqual(result, Option.some(4))
|
|
1675
|
+
* ```
|
|
1512
1676
|
*
|
|
1513
1677
|
* @category elements
|
|
1514
1678
|
* @since 2.0.0
|
|
@@ -1519,11 +1683,13 @@ export declare const findFirst: {
|
|
|
1519
1683
|
* predicate, or `None` if no such element exists.
|
|
1520
1684
|
*
|
|
1521
1685
|
* @example
|
|
1686
|
+
* ```ts
|
|
1522
1687
|
* import { Array, Option } from "effect"
|
|
1523
1688
|
*
|
|
1524
1689
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1525
1690
|
* const result = Array.findFirst(numbers, x => x > 3)
|
|
1526
1691
|
* assert.deepStrictEqual(result, Option.some(4))
|
|
1692
|
+
* ```
|
|
1527
1693
|
*
|
|
1528
1694
|
* @category elements
|
|
1529
1695
|
* @since 2.0.0
|
|
@@ -1535,11 +1701,13 @@ export declare const findFirst: {
|
|
|
1535
1701
|
* Returns an `Option` containing the found element, or `Option.none` if no element matches.
|
|
1536
1702
|
*
|
|
1537
1703
|
* @example
|
|
1704
|
+
* ```ts
|
|
1538
1705
|
* import { Array, Option } from "effect"
|
|
1539
1706
|
*
|
|
1540
1707
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1541
1708
|
* const result = Array.findLast(numbers, n => n % 2 === 0)
|
|
1542
1709
|
* assert.deepStrictEqual(result, Option.some(4))
|
|
1710
|
+
* ```
|
|
1543
1711
|
*
|
|
1544
1712
|
* @category elements
|
|
1545
1713
|
* @since 2.0.0
|
|
@@ -1550,11 +1718,13 @@ export declare const findLast: {
|
|
|
1550
1718
|
* Returns an `Option` containing the found element, or `Option.none` if no element matches.
|
|
1551
1719
|
*
|
|
1552
1720
|
* @example
|
|
1721
|
+
* ```ts
|
|
1553
1722
|
* import { Array, Option } from "effect"
|
|
1554
1723
|
*
|
|
1555
1724
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1556
1725
|
* const result = Array.findLast(numbers, n => n % 2 === 0)
|
|
1557
1726
|
* assert.deepStrictEqual(result, Option.some(4))
|
|
1727
|
+
* ```
|
|
1558
1728
|
*
|
|
1559
1729
|
* @category elements
|
|
1560
1730
|
* @since 2.0.0
|
|
@@ -1565,11 +1735,13 @@ export declare const findLast: {
|
|
|
1565
1735
|
* Returns an `Option` containing the found element, or `Option.none` if no element matches.
|
|
1566
1736
|
*
|
|
1567
1737
|
* @example
|
|
1738
|
+
* ```ts
|
|
1568
1739
|
* import { Array, Option } from "effect"
|
|
1569
1740
|
*
|
|
1570
1741
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1571
1742
|
* const result = Array.findLast(numbers, n => n % 2 === 0)
|
|
1572
1743
|
* assert.deepStrictEqual(result, Option.some(4))
|
|
1744
|
+
* ```
|
|
1573
1745
|
*
|
|
1574
1746
|
* @category elements
|
|
1575
1747
|
* @since 2.0.0
|
|
@@ -1580,11 +1752,13 @@ export declare const findLast: {
|
|
|
1580
1752
|
* Returns an `Option` containing the found element, or `Option.none` if no element matches.
|
|
1581
1753
|
*
|
|
1582
1754
|
* @example
|
|
1755
|
+
* ```ts
|
|
1583
1756
|
* import { Array, Option } from "effect"
|
|
1584
1757
|
*
|
|
1585
1758
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1586
1759
|
* const result = Array.findLast(numbers, n => n % 2 === 0)
|
|
1587
1760
|
* assert.deepStrictEqual(result, Option.some(4))
|
|
1761
|
+
* ```
|
|
1588
1762
|
*
|
|
1589
1763
|
* @category elements
|
|
1590
1764
|
* @since 2.0.0
|
|
@@ -1595,11 +1769,13 @@ export declare const findLast: {
|
|
|
1595
1769
|
* Returns an `Option` containing the found element, or `Option.none` if no element matches.
|
|
1596
1770
|
*
|
|
1597
1771
|
* @example
|
|
1772
|
+
* ```ts
|
|
1598
1773
|
* import { Array, Option } from "effect"
|
|
1599
1774
|
*
|
|
1600
1775
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1601
1776
|
* const result = Array.findLast(numbers, n => n % 2 === 0)
|
|
1602
1777
|
* assert.deepStrictEqual(result, Option.some(4))
|
|
1778
|
+
* ```
|
|
1603
1779
|
*
|
|
1604
1780
|
* @category elements
|
|
1605
1781
|
* @since 2.0.0
|
|
@@ -1610,11 +1786,13 @@ export declare const findLast: {
|
|
|
1610
1786
|
* Returns an `Option` containing the found element, or `Option.none` if no element matches.
|
|
1611
1787
|
*
|
|
1612
1788
|
* @example
|
|
1789
|
+
* ```ts
|
|
1613
1790
|
* import { Array, Option } from "effect"
|
|
1614
1791
|
*
|
|
1615
1792
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1616
1793
|
* const result = Array.findLast(numbers, n => n % 2 === 0)
|
|
1617
1794
|
* assert.deepStrictEqual(result, Option.some(4))
|
|
1795
|
+
* ```
|
|
1618
1796
|
*
|
|
1619
1797
|
* @category elements
|
|
1620
1798
|
* @since 2.0.0
|
|
@@ -1625,11 +1803,13 @@ export declare const findLast: {
|
|
|
1625
1803
|
* Returns an `Option` containing the found element, or `Option.none` if no element matches.
|
|
1626
1804
|
*
|
|
1627
1805
|
* @example
|
|
1806
|
+
* ```ts
|
|
1628
1807
|
* import { Array, Option } from "effect"
|
|
1629
1808
|
*
|
|
1630
1809
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1631
1810
|
* const result = Array.findLast(numbers, n => n % 2 === 0)
|
|
1632
1811
|
* assert.deepStrictEqual(result, Option.some(4))
|
|
1812
|
+
* ```
|
|
1633
1813
|
*
|
|
1634
1814
|
* @category elements
|
|
1635
1815
|
* @since 2.0.0
|
|
@@ -1641,11 +1821,13 @@ export declare const findLast: {
|
|
|
1641
1821
|
* or return `None` if the index is out of bounds.
|
|
1642
1822
|
*
|
|
1643
1823
|
* @example
|
|
1824
|
+
* ```ts
|
|
1644
1825
|
* import { Array, Option } from "effect"
|
|
1645
1826
|
*
|
|
1646
1827
|
* const letters = ['a', 'b', 'c', 'e']
|
|
1647
1828
|
* const result = Array.insertAt(letters, 3, 'd')
|
|
1648
1829
|
* assert.deepStrictEqual(result, Option.some(['a', 'b', 'c', 'd', 'e']))
|
|
1830
|
+
* ```
|
|
1649
1831
|
*
|
|
1650
1832
|
* @since 2.0.0
|
|
1651
1833
|
*/
|
|
@@ -1655,11 +1837,13 @@ export declare const insertAt: {
|
|
|
1655
1837
|
* or return `None` if the index is out of bounds.
|
|
1656
1838
|
*
|
|
1657
1839
|
* @example
|
|
1840
|
+
* ```ts
|
|
1658
1841
|
* import { Array, Option } from "effect"
|
|
1659
1842
|
*
|
|
1660
1843
|
* const letters = ['a', 'b', 'c', 'e']
|
|
1661
1844
|
* const result = Array.insertAt(letters, 3, 'd')
|
|
1662
1845
|
* assert.deepStrictEqual(result, Option.some(['a', 'b', 'c', 'd', 'e']))
|
|
1846
|
+
* ```
|
|
1663
1847
|
*
|
|
1664
1848
|
* @since 2.0.0
|
|
1665
1849
|
*/
|
|
@@ -1669,11 +1853,13 @@ export declare const insertAt: {
|
|
|
1669
1853
|
* or return `None` if the index is out of bounds.
|
|
1670
1854
|
*
|
|
1671
1855
|
* @example
|
|
1856
|
+
* ```ts
|
|
1672
1857
|
* import { Array, Option } from "effect"
|
|
1673
1858
|
*
|
|
1674
1859
|
* const letters = ['a', 'b', 'c', 'e']
|
|
1675
1860
|
* const result = Array.insertAt(letters, 3, 'd')
|
|
1676
1861
|
* assert.deepStrictEqual(result, Option.some(['a', 'b', 'c', 'd', 'e']))
|
|
1862
|
+
* ```
|
|
1677
1863
|
*
|
|
1678
1864
|
* @since 2.0.0
|
|
1679
1865
|
*/
|
|
@@ -1684,11 +1870,13 @@ export declare const insertAt: {
|
|
|
1684
1870
|
* or return a copy of the input if the index is out of bounds.
|
|
1685
1871
|
*
|
|
1686
1872
|
* @example
|
|
1873
|
+
* ```ts
|
|
1687
1874
|
* import { Array } from "effect"
|
|
1688
1875
|
*
|
|
1689
1876
|
* const letters = ['a', 'b', 'c', 'd']
|
|
1690
1877
|
* const result = Array.replace(letters, 1, 'z')
|
|
1691
1878
|
* assert.deepStrictEqual(result, ['a', 'z', 'c', 'd'])
|
|
1879
|
+
* ```
|
|
1692
1880
|
*
|
|
1693
1881
|
* @since 2.0.0
|
|
1694
1882
|
*/
|
|
@@ -1698,11 +1886,13 @@ export declare const replace: {
|
|
|
1698
1886
|
* or return a copy of the input if the index is out of bounds.
|
|
1699
1887
|
*
|
|
1700
1888
|
* @example
|
|
1889
|
+
* ```ts
|
|
1701
1890
|
* import { Array } from "effect"
|
|
1702
1891
|
*
|
|
1703
1892
|
* const letters = ['a', 'b', 'c', 'd']
|
|
1704
1893
|
* const result = Array.replace(letters, 1, 'z')
|
|
1705
1894
|
* assert.deepStrictEqual(result, ['a', 'z', 'c', 'd'])
|
|
1895
|
+
* ```
|
|
1706
1896
|
*
|
|
1707
1897
|
* @since 2.0.0
|
|
1708
1898
|
*/
|
|
@@ -1712,11 +1902,13 @@ export declare const replace: {
|
|
|
1712
1902
|
* or return a copy of the input if the index is out of bounds.
|
|
1713
1903
|
*
|
|
1714
1904
|
* @example
|
|
1905
|
+
* ```ts
|
|
1715
1906
|
* import { Array } from "effect"
|
|
1716
1907
|
*
|
|
1717
1908
|
* const letters = ['a', 'b', 'c', 'd']
|
|
1718
1909
|
* const result = Array.replace(letters, 1, 'z')
|
|
1719
1910
|
* assert.deepStrictEqual(result, ['a', 'z', 'c', 'd'])
|
|
1911
|
+
* ```
|
|
1720
1912
|
*
|
|
1721
1913
|
* @since 2.0.0
|
|
1722
1914
|
*/
|
|
@@ -1726,11 +1918,13 @@ export declare const replace: {
|
|
|
1726
1918
|
* Replaces an element in an array with the given value, returning an option of the updated array.
|
|
1727
1919
|
*
|
|
1728
1920
|
* @example
|
|
1921
|
+
* ```ts
|
|
1729
1922
|
* import { Array, Option } from "effect"
|
|
1730
1923
|
*
|
|
1731
1924
|
* const numbers = [1, 2, 3]
|
|
1732
1925
|
* const result = Array.replaceOption(numbers, 1, 4)
|
|
1733
1926
|
* assert.deepStrictEqual(result, Option.some([1, 4, 3]))
|
|
1927
|
+
* ```
|
|
1734
1928
|
*
|
|
1735
1929
|
* @since 2.0.0
|
|
1736
1930
|
*/
|
|
@@ -1739,11 +1933,13 @@ export declare const replaceOption: {
|
|
|
1739
1933
|
* Replaces an element in an array with the given value, returning an option of the updated array.
|
|
1740
1934
|
*
|
|
1741
1935
|
* @example
|
|
1936
|
+
* ```ts
|
|
1742
1937
|
* import { Array, Option } from "effect"
|
|
1743
1938
|
*
|
|
1744
1939
|
* const numbers = [1, 2, 3]
|
|
1745
1940
|
* const result = Array.replaceOption(numbers, 1, 4)
|
|
1746
1941
|
* assert.deepStrictEqual(result, Option.some([1, 4, 3]))
|
|
1942
|
+
* ```
|
|
1747
1943
|
*
|
|
1748
1944
|
* @since 2.0.0
|
|
1749
1945
|
*/
|
|
@@ -1752,11 +1948,13 @@ export declare const replaceOption: {
|
|
|
1752
1948
|
* Replaces an element in an array with the given value, returning an option of the updated array.
|
|
1753
1949
|
*
|
|
1754
1950
|
* @example
|
|
1951
|
+
* ```ts
|
|
1755
1952
|
* import { Array, Option } from "effect"
|
|
1756
1953
|
*
|
|
1757
1954
|
* const numbers = [1, 2, 3]
|
|
1758
1955
|
* const result = Array.replaceOption(numbers, 1, 4)
|
|
1759
1956
|
* assert.deepStrictEqual(result, Option.some([1, 4, 3]))
|
|
1957
|
+
* ```
|
|
1760
1958
|
*
|
|
1761
1959
|
* @since 2.0.0
|
|
1762
1960
|
*/
|
|
@@ -1767,11 +1965,13 @@ export declare const replaceOption: {
|
|
|
1767
1965
|
* or return a copy of the input if the index is out of bounds.
|
|
1768
1966
|
*
|
|
1769
1967
|
* @example
|
|
1968
|
+
* ```ts
|
|
1770
1969
|
* import { Array } from "effect"
|
|
1771
1970
|
*
|
|
1772
1971
|
* const numbers = [1, 2, 3, 4]
|
|
1773
1972
|
* const result = Array.modify(numbers, 2, (n) => n * 2)
|
|
1774
1973
|
* assert.deepStrictEqual(result, [1, 2, 6, 4])
|
|
1974
|
+
* ```
|
|
1775
1975
|
*
|
|
1776
1976
|
* @since 2.0.0
|
|
1777
1977
|
*/
|
|
@@ -1781,11 +1981,13 @@ export declare const modify: {
|
|
|
1781
1981
|
* or return a copy of the input if the index is out of bounds.
|
|
1782
1982
|
*
|
|
1783
1983
|
* @example
|
|
1984
|
+
* ```ts
|
|
1784
1985
|
* import { Array } from "effect"
|
|
1785
1986
|
*
|
|
1786
1987
|
* const numbers = [1, 2, 3, 4]
|
|
1787
1988
|
* const result = Array.modify(numbers, 2, (n) => n * 2)
|
|
1788
1989
|
* assert.deepStrictEqual(result, [1, 2, 6, 4])
|
|
1990
|
+
* ```
|
|
1789
1991
|
*
|
|
1790
1992
|
* @since 2.0.0
|
|
1791
1993
|
*/
|
|
@@ -1795,11 +1997,13 @@ export declare const modify: {
|
|
|
1795
1997
|
* or return a copy of the input if the index is out of bounds.
|
|
1796
1998
|
*
|
|
1797
1999
|
* @example
|
|
2000
|
+
* ```ts
|
|
1798
2001
|
* import { Array } from "effect"
|
|
1799
2002
|
*
|
|
1800
2003
|
* const numbers = [1, 2, 3, 4]
|
|
1801
2004
|
* const result = Array.modify(numbers, 2, (n) => n * 2)
|
|
1802
2005
|
* assert.deepStrictEqual(result, [1, 2, 6, 4])
|
|
2006
|
+
* ```
|
|
1803
2007
|
*
|
|
1804
2008
|
* @since 2.0.0
|
|
1805
2009
|
*/
|
|
@@ -1810,6 +2014,7 @@ export declare const modify: {
|
|
|
1810
2014
|
* or return `None` if the index is out of bounds.
|
|
1811
2015
|
*
|
|
1812
2016
|
* @example
|
|
2017
|
+
* ```ts
|
|
1813
2018
|
* import { Array, Option } from "effect"
|
|
1814
2019
|
*
|
|
1815
2020
|
* const numbers = [1, 2, 3, 4]
|
|
@@ -1818,6 +2023,7 @@ export declare const modify: {
|
|
|
1818
2023
|
*
|
|
1819
2024
|
* const outOfBoundsResult = Array.modifyOption(numbers, 5, (n) => n * 2)
|
|
1820
2025
|
* assert.deepStrictEqual(outOfBoundsResult, Option.none())
|
|
2026
|
+
* ```
|
|
1821
2027
|
*
|
|
1822
2028
|
* @since 2.0.0
|
|
1823
2029
|
*/
|
|
@@ -1827,6 +2033,7 @@ export declare const modifyOption: {
|
|
|
1827
2033
|
* or return `None` if the index is out of bounds.
|
|
1828
2034
|
*
|
|
1829
2035
|
* @example
|
|
2036
|
+
* ```ts
|
|
1830
2037
|
* import { Array, Option } from "effect"
|
|
1831
2038
|
*
|
|
1832
2039
|
* const numbers = [1, 2, 3, 4]
|
|
@@ -1835,6 +2042,7 @@ export declare const modifyOption: {
|
|
|
1835
2042
|
*
|
|
1836
2043
|
* const outOfBoundsResult = Array.modifyOption(numbers, 5, (n) => n * 2)
|
|
1837
2044
|
* assert.deepStrictEqual(outOfBoundsResult, Option.none())
|
|
2045
|
+
* ```
|
|
1838
2046
|
*
|
|
1839
2047
|
* @since 2.0.0
|
|
1840
2048
|
*/
|
|
@@ -1844,6 +2052,7 @@ export declare const modifyOption: {
|
|
|
1844
2052
|
* or return `None` if the index is out of bounds.
|
|
1845
2053
|
*
|
|
1846
2054
|
* @example
|
|
2055
|
+
* ```ts
|
|
1847
2056
|
* import { Array, Option } from "effect"
|
|
1848
2057
|
*
|
|
1849
2058
|
* const numbers = [1, 2, 3, 4]
|
|
@@ -1852,6 +2061,7 @@ export declare const modifyOption: {
|
|
|
1852
2061
|
*
|
|
1853
2062
|
* const outOfBoundsResult = Array.modifyOption(numbers, 5, (n) => n * 2)
|
|
1854
2063
|
* assert.deepStrictEqual(outOfBoundsResult, Option.none())
|
|
2064
|
+
* ```
|
|
1855
2065
|
*
|
|
1856
2066
|
* @since 2.0.0
|
|
1857
2067
|
*/
|
|
@@ -1862,6 +2072,7 @@ export declare const modifyOption: {
|
|
|
1862
2072
|
* or return a copy of the input if the index is out of bounds.
|
|
1863
2073
|
*
|
|
1864
2074
|
* @example
|
|
2075
|
+
* ```ts
|
|
1865
2076
|
* import { Array } from "effect"
|
|
1866
2077
|
*
|
|
1867
2078
|
* const numbers = [1, 2, 3, 4]
|
|
@@ -1870,6 +2081,7 @@ export declare const modifyOption: {
|
|
|
1870
2081
|
*
|
|
1871
2082
|
* const outOfBoundsResult = Array.remove(numbers, 5)
|
|
1872
2083
|
* assert.deepStrictEqual(outOfBoundsResult, [1, 2, 3, 4])
|
|
2084
|
+
* ```
|
|
1873
2085
|
*
|
|
1874
2086
|
* @since 2.0.0
|
|
1875
2087
|
*/
|
|
@@ -1879,6 +2091,7 @@ export declare const remove: {
|
|
|
1879
2091
|
* or return a copy of the input if the index is out of bounds.
|
|
1880
2092
|
*
|
|
1881
2093
|
* @example
|
|
2094
|
+
* ```ts
|
|
1882
2095
|
* import { Array } from "effect"
|
|
1883
2096
|
*
|
|
1884
2097
|
* const numbers = [1, 2, 3, 4]
|
|
@@ -1887,6 +2100,7 @@ export declare const remove: {
|
|
|
1887
2100
|
*
|
|
1888
2101
|
* const outOfBoundsResult = Array.remove(numbers, 5)
|
|
1889
2102
|
* assert.deepStrictEqual(outOfBoundsResult, [1, 2, 3, 4])
|
|
2103
|
+
* ```
|
|
1890
2104
|
*
|
|
1891
2105
|
* @since 2.0.0
|
|
1892
2106
|
*/
|
|
@@ -1896,6 +2110,7 @@ export declare const remove: {
|
|
|
1896
2110
|
* or return a copy of the input if the index is out of bounds.
|
|
1897
2111
|
*
|
|
1898
2112
|
* @example
|
|
2113
|
+
* ```ts
|
|
1899
2114
|
* import { Array } from "effect"
|
|
1900
2115
|
*
|
|
1901
2116
|
* const numbers = [1, 2, 3, 4]
|
|
@@ -1904,6 +2119,7 @@ export declare const remove: {
|
|
|
1904
2119
|
*
|
|
1905
2120
|
* const outOfBoundsResult = Array.remove(numbers, 5)
|
|
1906
2121
|
* assert.deepStrictEqual(outOfBoundsResult, [1, 2, 3, 4])
|
|
2122
|
+
* ```
|
|
1907
2123
|
*
|
|
1908
2124
|
* @since 2.0.0
|
|
1909
2125
|
*/
|
|
@@ -1913,11 +2129,13 @@ export declare const remove: {
|
|
|
1913
2129
|
* Reverse an `Iterable`, creating a new `Array`.
|
|
1914
2130
|
*
|
|
1915
2131
|
* @example
|
|
2132
|
+
* ```ts
|
|
1916
2133
|
* import { Array } from "effect"
|
|
1917
2134
|
*
|
|
1918
2135
|
* const numbers = [1, 2, 3, 4]
|
|
1919
2136
|
* const result = Array.reverse(numbers)
|
|
1920
2137
|
* assert.deepStrictEqual(result, [4, 3, 2, 1])
|
|
2138
|
+
* ```
|
|
1921
2139
|
*
|
|
1922
2140
|
* @category elements
|
|
1923
2141
|
* @since 2.0.0
|
|
@@ -1962,6 +2180,7 @@ export declare const sort: {
|
|
|
1962
2180
|
* order defines how those values should be sorted.
|
|
1963
2181
|
*
|
|
1964
2182
|
* @example
|
|
2183
|
+
* ```ts
|
|
1965
2184
|
* import { Array, Order } from "effect"
|
|
1966
2185
|
*
|
|
1967
2186
|
* const strings = ["aaa", "b", "cc"]
|
|
@@ -1972,6 +2191,7 @@ export declare const sort: {
|
|
|
1972
2191
|
* // The array of strings is sorted based on their lengths. The mapping function `(s) => s.length`
|
|
1973
2192
|
* // converts each string into its length, and the `Order.number` specifies that the lengths should
|
|
1974
2193
|
* // be sorted in ascending order.
|
|
2194
|
+
* ```
|
|
1975
2195
|
*
|
|
1976
2196
|
* @since 2.0.0
|
|
1977
2197
|
* @category elements
|
|
@@ -1983,6 +2203,7 @@ export declare const sortWith: {
|
|
|
1983
2203
|
* order defines how those values should be sorted.
|
|
1984
2204
|
*
|
|
1985
2205
|
* @example
|
|
2206
|
+
* ```ts
|
|
1986
2207
|
* import { Array, Order } from "effect"
|
|
1987
2208
|
*
|
|
1988
2209
|
* const strings = ["aaa", "b", "cc"]
|
|
@@ -1993,6 +2214,7 @@ export declare const sortWith: {
|
|
|
1993
2214
|
* // The array of strings is sorted based on their lengths. The mapping function `(s) => s.length`
|
|
1994
2215
|
* // converts each string into its length, and the `Order.number` specifies that the lengths should
|
|
1995
2216
|
* // be sorted in ascending order.
|
|
2217
|
+
* ```
|
|
1996
2218
|
*
|
|
1997
2219
|
* @since 2.0.0
|
|
1998
2220
|
* @category elements
|
|
@@ -2004,6 +2226,7 @@ export declare const sortWith: {
|
|
|
2004
2226
|
* order defines how those values should be sorted.
|
|
2005
2227
|
*
|
|
2006
2228
|
* @example
|
|
2229
|
+
* ```ts
|
|
2007
2230
|
* import { Array, Order } from "effect"
|
|
2008
2231
|
*
|
|
2009
2232
|
* const strings = ["aaa", "b", "cc"]
|
|
@@ -2014,6 +2237,7 @@ export declare const sortWith: {
|
|
|
2014
2237
|
* // The array of strings is sorted based on their lengths. The mapping function `(s) => s.length`
|
|
2015
2238
|
* // converts each string into its length, and the `Order.number` specifies that the lengths should
|
|
2016
2239
|
* // be sorted in ascending order.
|
|
2240
|
+
* ```
|
|
2017
2241
|
*
|
|
2018
2242
|
* @since 2.0.0
|
|
2019
2243
|
* @category elements
|
|
@@ -2025,6 +2249,7 @@ export declare const sortWith: {
|
|
|
2025
2249
|
* order defines how those values should be sorted.
|
|
2026
2250
|
*
|
|
2027
2251
|
* @example
|
|
2252
|
+
* ```ts
|
|
2028
2253
|
* import { Array, Order } from "effect"
|
|
2029
2254
|
*
|
|
2030
2255
|
* const strings = ["aaa", "b", "cc"]
|
|
@@ -2035,6 +2260,7 @@ export declare const sortWith: {
|
|
|
2035
2260
|
* // The array of strings is sorted based on their lengths. The mapping function `(s) => s.length`
|
|
2036
2261
|
* // converts each string into its length, and the `Order.number` specifies that the lengths should
|
|
2037
2262
|
* // be sorted in ascending order.
|
|
2263
|
+
* ```
|
|
2038
2264
|
*
|
|
2039
2265
|
* @since 2.0.0
|
|
2040
2266
|
* @category elements
|
|
@@ -2047,6 +2273,7 @@ export declare const sortWith: {
|
|
|
2047
2273
|
* second order if the first comparison is equal, and so on.
|
|
2048
2274
|
*
|
|
2049
2275
|
* @example
|
|
2276
|
+
* ```ts
|
|
2050
2277
|
* import { Array, Order } from "effect"
|
|
2051
2278
|
*
|
|
2052
2279
|
* const users = [
|
|
@@ -2069,6 +2296,7 @@ export declare const sortWith: {
|
|
|
2069
2296
|
* // Explanation:
|
|
2070
2297
|
* // The array of users is sorted first by age in ascending order. When ages are equal,
|
|
2071
2298
|
* // the users are further sorted by name in ascending order.
|
|
2299
|
+
* ```
|
|
2072
2300
|
*
|
|
2073
2301
|
* @category sorting
|
|
2074
2302
|
* @since 2.0.0
|
|
@@ -2080,12 +2308,14 @@ export declare const sortBy: <S extends Iterable<any> | NonEmptyReadonlyArray<an
|
|
|
2080
2308
|
* longer `Iterable` are discarded.
|
|
2081
2309
|
*
|
|
2082
2310
|
* @example
|
|
2311
|
+
* ```ts
|
|
2083
2312
|
* import { Array } from "effect"
|
|
2084
2313
|
*
|
|
2085
2314
|
* const array1 = [1, 2, 3]
|
|
2086
2315
|
* const array2 = ['a', 'b']
|
|
2087
2316
|
* const result = Array.zip(array1, array2)
|
|
2088
2317
|
* assert.deepStrictEqual(result, [[1, 'a'], [2, 'b']])
|
|
2318
|
+
* ```
|
|
2089
2319
|
*
|
|
2090
2320
|
* @category zipping
|
|
2091
2321
|
* @since 2.0.0
|
|
@@ -2097,12 +2327,14 @@ export declare const zip: {
|
|
|
2097
2327
|
* longer `Iterable` are discarded.
|
|
2098
2328
|
*
|
|
2099
2329
|
* @example
|
|
2330
|
+
* ```ts
|
|
2100
2331
|
* import { Array } from "effect"
|
|
2101
2332
|
*
|
|
2102
2333
|
* const array1 = [1, 2, 3]
|
|
2103
2334
|
* const array2 = ['a', 'b']
|
|
2104
2335
|
* const result = Array.zip(array1, array2)
|
|
2105
2336
|
* assert.deepStrictEqual(result, [[1, 'a'], [2, 'b']])
|
|
2337
|
+
* ```
|
|
2106
2338
|
*
|
|
2107
2339
|
* @category zipping
|
|
2108
2340
|
* @since 2.0.0
|
|
@@ -2114,12 +2346,14 @@ export declare const zip: {
|
|
|
2114
2346
|
* longer `Iterable` are discarded.
|
|
2115
2347
|
*
|
|
2116
2348
|
* @example
|
|
2349
|
+
* ```ts
|
|
2117
2350
|
* import { Array } from "effect"
|
|
2118
2351
|
*
|
|
2119
2352
|
* const array1 = [1, 2, 3]
|
|
2120
2353
|
* const array2 = ['a', 'b']
|
|
2121
2354
|
* const result = Array.zip(array1, array2)
|
|
2122
2355
|
* assert.deepStrictEqual(result, [[1, 'a'], [2, 'b']])
|
|
2356
|
+
* ```
|
|
2123
2357
|
*
|
|
2124
2358
|
* @category zipping
|
|
2125
2359
|
* @since 2.0.0
|
|
@@ -2131,12 +2365,14 @@ export declare const zip: {
|
|
|
2131
2365
|
* longer `Iterable` are discarded.
|
|
2132
2366
|
*
|
|
2133
2367
|
* @example
|
|
2368
|
+
* ```ts
|
|
2134
2369
|
* import { Array } from "effect"
|
|
2135
2370
|
*
|
|
2136
2371
|
* const array1 = [1, 2, 3]
|
|
2137
2372
|
* const array2 = ['a', 'b']
|
|
2138
2373
|
* const result = Array.zip(array1, array2)
|
|
2139
2374
|
* assert.deepStrictEqual(result, [[1, 'a'], [2, 'b']])
|
|
2375
|
+
* ```
|
|
2140
2376
|
*
|
|
2141
2377
|
* @category zipping
|
|
2142
2378
|
* @since 2.0.0
|
|
@@ -2148,12 +2384,14 @@ export declare const zip: {
|
|
|
2148
2384
|
* longer `Iterable` are discarded.
|
|
2149
2385
|
*
|
|
2150
2386
|
* @example
|
|
2387
|
+
* ```ts
|
|
2151
2388
|
* import { Array } from "effect"
|
|
2152
2389
|
*
|
|
2153
2390
|
* const array1 = [1, 2, 3]
|
|
2154
2391
|
* const array2 = ['a', 'b']
|
|
2155
2392
|
* const result = Array.zip(array1, array2)
|
|
2156
2393
|
* assert.deepStrictEqual(result, [[1, 'a'], [2, 'b']])
|
|
2394
|
+
* ```
|
|
2157
2395
|
*
|
|
2158
2396
|
* @category zipping
|
|
2159
2397
|
* @since 2.0.0
|
|
@@ -2165,12 +2403,14 @@ export declare const zip: {
|
|
|
2165
2403
|
* input `Iterable` is short, excess elements of the longer `Iterable` are discarded.
|
|
2166
2404
|
*
|
|
2167
2405
|
* @example
|
|
2406
|
+
* ```ts
|
|
2168
2407
|
* import { Array } from "effect"
|
|
2169
2408
|
*
|
|
2170
2409
|
* const array1 = [1, 2, 3]
|
|
2171
2410
|
* const array2 = [4, 5, 6]
|
|
2172
2411
|
* const result = Array.zipWith(array1, array2, (a, b) => a + b)
|
|
2173
2412
|
* assert.deepStrictEqual(result, [5, 7, 9])
|
|
2413
|
+
* ```
|
|
2174
2414
|
*
|
|
2175
2415
|
* @category zipping
|
|
2176
2416
|
* @since 2.0.0
|
|
@@ -2181,12 +2421,14 @@ export declare const zipWith: {
|
|
|
2181
2421
|
* input `Iterable` is short, excess elements of the longer `Iterable` are discarded.
|
|
2182
2422
|
*
|
|
2183
2423
|
* @example
|
|
2424
|
+
* ```ts
|
|
2184
2425
|
* import { Array } from "effect"
|
|
2185
2426
|
*
|
|
2186
2427
|
* const array1 = [1, 2, 3]
|
|
2187
2428
|
* const array2 = [4, 5, 6]
|
|
2188
2429
|
* const result = Array.zipWith(array1, array2, (a, b) => a + b)
|
|
2189
2430
|
* assert.deepStrictEqual(result, [5, 7, 9])
|
|
2431
|
+
* ```
|
|
2190
2432
|
*
|
|
2191
2433
|
* @category zipping
|
|
2192
2434
|
* @since 2.0.0
|
|
@@ -2197,12 +2439,14 @@ export declare const zipWith: {
|
|
|
2197
2439
|
* input `Iterable` is short, excess elements of the longer `Iterable` are discarded.
|
|
2198
2440
|
*
|
|
2199
2441
|
* @example
|
|
2442
|
+
* ```ts
|
|
2200
2443
|
* import { Array } from "effect"
|
|
2201
2444
|
*
|
|
2202
2445
|
* const array1 = [1, 2, 3]
|
|
2203
2446
|
* const array2 = [4, 5, 6]
|
|
2204
2447
|
* const result = Array.zipWith(array1, array2, (a, b) => a + b)
|
|
2205
2448
|
* assert.deepStrictEqual(result, [5, 7, 9])
|
|
2449
|
+
* ```
|
|
2206
2450
|
*
|
|
2207
2451
|
* @category zipping
|
|
2208
2452
|
* @since 2.0.0
|
|
@@ -2213,12 +2457,14 @@ export declare const zipWith: {
|
|
|
2213
2457
|
* input `Iterable` is short, excess elements of the longer `Iterable` are discarded.
|
|
2214
2458
|
*
|
|
2215
2459
|
* @example
|
|
2460
|
+
* ```ts
|
|
2216
2461
|
* import { Array } from "effect"
|
|
2217
2462
|
*
|
|
2218
2463
|
* const array1 = [1, 2, 3]
|
|
2219
2464
|
* const array2 = [4, 5, 6]
|
|
2220
2465
|
* const result = Array.zipWith(array1, array2, (a, b) => a + b)
|
|
2221
2466
|
* assert.deepStrictEqual(result, [5, 7, 9])
|
|
2467
|
+
* ```
|
|
2222
2468
|
*
|
|
2223
2469
|
* @category zipping
|
|
2224
2470
|
* @since 2.0.0
|
|
@@ -2229,12 +2475,14 @@ export declare const zipWith: {
|
|
|
2229
2475
|
* input `Iterable` is short, excess elements of the longer `Iterable` are discarded.
|
|
2230
2476
|
*
|
|
2231
2477
|
* @example
|
|
2478
|
+
* ```ts
|
|
2232
2479
|
* import { Array } from "effect"
|
|
2233
2480
|
*
|
|
2234
2481
|
* const array1 = [1, 2, 3]
|
|
2235
2482
|
* const array2 = [4, 5, 6]
|
|
2236
2483
|
* const result = Array.zipWith(array1, array2, (a, b) => a + b)
|
|
2237
2484
|
* assert.deepStrictEqual(result, [5, 7, 9])
|
|
2485
|
+
* ```
|
|
2238
2486
|
*
|
|
2239
2487
|
* @category zipping
|
|
2240
2488
|
* @since 2.0.0
|
|
@@ -2245,10 +2493,12 @@ export declare const zipWith: {
|
|
|
2245
2493
|
* This function is the inverse of `zip`. Takes an `Iterable` of pairs and return two corresponding `Array`s.
|
|
2246
2494
|
*
|
|
2247
2495
|
* @example
|
|
2496
|
+
* ```ts
|
|
2248
2497
|
* import { Array } from "effect"
|
|
2249
2498
|
*
|
|
2250
2499
|
* const result = Array.unzip([[1, "a"], [2, "b"], [3, "c"]])
|
|
2251
2500
|
* assert.deepStrictEqual(result, [[1, 2, 3], ['a', 'b', 'c']])
|
|
2501
|
+
* ```
|
|
2252
2502
|
*
|
|
2253
2503
|
* @since 2.0.0
|
|
2254
2504
|
*/
|
|
@@ -2258,11 +2508,13 @@ export declare const unzip: <S extends Iterable<readonly [any, any]> | NonEmptyR
|
|
|
2258
2508
|
* If the input is a non-empty array, the result is also a non-empty array.
|
|
2259
2509
|
*
|
|
2260
2510
|
* @example
|
|
2511
|
+
* ```ts
|
|
2261
2512
|
* import { Array } from "effect"
|
|
2262
2513
|
*
|
|
2263
2514
|
* const numbers = [1, 2, 3]
|
|
2264
2515
|
* const result = Array.intersperse(numbers, 0)
|
|
2265
2516
|
* assert.deepStrictEqual(result, [1, 0, 2, 0, 3])
|
|
2517
|
+
* ```
|
|
2266
2518
|
*
|
|
2267
2519
|
* @since 2.0.0
|
|
2268
2520
|
*/
|
|
@@ -2272,11 +2524,13 @@ export declare const intersperse: {
|
|
|
2272
2524
|
* If the input is a non-empty array, the result is also a non-empty array.
|
|
2273
2525
|
*
|
|
2274
2526
|
* @example
|
|
2527
|
+
* ```ts
|
|
2275
2528
|
* import { Array } from "effect"
|
|
2276
2529
|
*
|
|
2277
2530
|
* const numbers = [1, 2, 3]
|
|
2278
2531
|
* const result = Array.intersperse(numbers, 0)
|
|
2279
2532
|
* assert.deepStrictEqual(result, [1, 0, 2, 0, 3])
|
|
2533
|
+
* ```
|
|
2280
2534
|
*
|
|
2281
2535
|
* @since 2.0.0
|
|
2282
2536
|
*/
|
|
@@ -2286,11 +2540,13 @@ export declare const intersperse: {
|
|
|
2286
2540
|
* If the input is a non-empty array, the result is also a non-empty array.
|
|
2287
2541
|
*
|
|
2288
2542
|
* @example
|
|
2543
|
+
* ```ts
|
|
2289
2544
|
* import { Array } from "effect"
|
|
2290
2545
|
*
|
|
2291
2546
|
* const numbers = [1, 2, 3]
|
|
2292
2547
|
* const result = Array.intersperse(numbers, 0)
|
|
2293
2548
|
* assert.deepStrictEqual(result, [1, 0, 2, 0, 3])
|
|
2549
|
+
* ```
|
|
2294
2550
|
*
|
|
2295
2551
|
* @since 2.0.0
|
|
2296
2552
|
*/
|
|
@@ -2300,11 +2556,13 @@ export declare const intersperse: {
|
|
|
2300
2556
|
* If the input is a non-empty array, the result is also a non-empty array.
|
|
2301
2557
|
*
|
|
2302
2558
|
* @example
|
|
2559
|
+
* ```ts
|
|
2303
2560
|
* import { Array } from "effect"
|
|
2304
2561
|
*
|
|
2305
2562
|
* const numbers = [1, 2, 3]
|
|
2306
2563
|
* const result = Array.intersperse(numbers, 0)
|
|
2307
2564
|
* assert.deepStrictEqual(result, [1, 0, 2, 0, 3])
|
|
2565
|
+
* ```
|
|
2308
2566
|
*
|
|
2309
2567
|
* @since 2.0.0
|
|
2310
2568
|
*/
|
|
@@ -2314,10 +2572,12 @@ export declare const intersperse: {
|
|
|
2314
2572
|
* Apply a function to the head, creating a new `NonEmptyReadonlyArray`.
|
|
2315
2573
|
*
|
|
2316
2574
|
* @example
|
|
2575
|
+
* ```ts
|
|
2317
2576
|
* import { Array } from "effect"
|
|
2318
2577
|
*
|
|
2319
2578
|
* const result = Array.modifyNonEmptyHead([1, 2, 3], n => n * 10)
|
|
2320
2579
|
* assert.deepStrictEqual(result, [10, 2, 3])
|
|
2580
|
+
* ```
|
|
2321
2581
|
*
|
|
2322
2582
|
* @since 2.0.0
|
|
2323
2583
|
*/
|
|
@@ -2326,10 +2586,12 @@ export declare const modifyNonEmptyHead: {
|
|
|
2326
2586
|
* Apply a function to the head, creating a new `NonEmptyReadonlyArray`.
|
|
2327
2587
|
*
|
|
2328
2588
|
* @example
|
|
2589
|
+
* ```ts
|
|
2329
2590
|
* import { Array } from "effect"
|
|
2330
2591
|
*
|
|
2331
2592
|
* const result = Array.modifyNonEmptyHead([1, 2, 3], n => n * 10)
|
|
2332
2593
|
* assert.deepStrictEqual(result, [10, 2, 3])
|
|
2594
|
+
* ```
|
|
2333
2595
|
*
|
|
2334
2596
|
* @since 2.0.0
|
|
2335
2597
|
*/
|
|
@@ -2338,10 +2600,12 @@ export declare const modifyNonEmptyHead: {
|
|
|
2338
2600
|
* Apply a function to the head, creating a new `NonEmptyReadonlyArray`.
|
|
2339
2601
|
*
|
|
2340
2602
|
* @example
|
|
2603
|
+
* ```ts
|
|
2341
2604
|
* import { Array } from "effect"
|
|
2342
2605
|
*
|
|
2343
2606
|
* const result = Array.modifyNonEmptyHead([1, 2, 3], n => n * 10)
|
|
2344
2607
|
* assert.deepStrictEqual(result, [10, 2, 3])
|
|
2608
|
+
* ```
|
|
2345
2609
|
*
|
|
2346
2610
|
* @since 2.0.0
|
|
2347
2611
|
*/
|
|
@@ -2351,10 +2615,12 @@ export declare const modifyNonEmptyHead: {
|
|
|
2351
2615
|
* Change the head, creating a new `NonEmptyReadonlyArray`.
|
|
2352
2616
|
*
|
|
2353
2617
|
* @example
|
|
2618
|
+
* ```ts
|
|
2354
2619
|
* import { Array } from "effect"
|
|
2355
2620
|
*
|
|
2356
2621
|
* const result = Array.setNonEmptyHead([1, 2, 3], 10)
|
|
2357
2622
|
* assert.deepStrictEqual(result, [10, 2, 3])
|
|
2623
|
+
* ```
|
|
2358
2624
|
*
|
|
2359
2625
|
* @since 2.0.0
|
|
2360
2626
|
*/
|
|
@@ -2363,10 +2629,12 @@ export declare const setNonEmptyHead: {
|
|
|
2363
2629
|
* Change the head, creating a new `NonEmptyReadonlyArray`.
|
|
2364
2630
|
*
|
|
2365
2631
|
* @example
|
|
2632
|
+
* ```ts
|
|
2366
2633
|
* import { Array } from "effect"
|
|
2367
2634
|
*
|
|
2368
2635
|
* const result = Array.setNonEmptyHead([1, 2, 3], 10)
|
|
2369
2636
|
* assert.deepStrictEqual(result, [10, 2, 3])
|
|
2637
|
+
* ```
|
|
2370
2638
|
*
|
|
2371
2639
|
* @since 2.0.0
|
|
2372
2640
|
*/
|
|
@@ -2375,10 +2643,12 @@ export declare const setNonEmptyHead: {
|
|
|
2375
2643
|
* Change the head, creating a new `NonEmptyReadonlyArray`.
|
|
2376
2644
|
*
|
|
2377
2645
|
* @example
|
|
2646
|
+
* ```ts
|
|
2378
2647
|
* import { Array } from "effect"
|
|
2379
2648
|
*
|
|
2380
2649
|
* const result = Array.setNonEmptyHead([1, 2, 3], 10)
|
|
2381
2650
|
* assert.deepStrictEqual(result, [10, 2, 3])
|
|
2651
|
+
* ```
|
|
2382
2652
|
*
|
|
2383
2653
|
* @since 2.0.0
|
|
2384
2654
|
*/
|
|
@@ -2388,10 +2658,12 @@ export declare const setNonEmptyHead: {
|
|
|
2388
2658
|
* Apply a function to the last element, creating a new `NonEmptyReadonlyArray`.
|
|
2389
2659
|
*
|
|
2390
2660
|
* @example
|
|
2661
|
+
* ```ts
|
|
2391
2662
|
* import { Array } from "effect"
|
|
2392
2663
|
*
|
|
2393
2664
|
* const result = Array.modifyNonEmptyLast([1, 2, 3], n => n * 2)
|
|
2394
2665
|
* assert.deepStrictEqual(result, [1, 2, 6])
|
|
2666
|
+
* ```
|
|
2395
2667
|
*
|
|
2396
2668
|
* @since 2.0.0
|
|
2397
2669
|
*/
|
|
@@ -2400,10 +2672,12 @@ export declare const modifyNonEmptyLast: {
|
|
|
2400
2672
|
* Apply a function to the last element, creating a new `NonEmptyReadonlyArray`.
|
|
2401
2673
|
*
|
|
2402
2674
|
* @example
|
|
2675
|
+
* ```ts
|
|
2403
2676
|
* import { Array } from "effect"
|
|
2404
2677
|
*
|
|
2405
2678
|
* const result = Array.modifyNonEmptyLast([1, 2, 3], n => n * 2)
|
|
2406
2679
|
* assert.deepStrictEqual(result, [1, 2, 6])
|
|
2680
|
+
* ```
|
|
2407
2681
|
*
|
|
2408
2682
|
* @since 2.0.0
|
|
2409
2683
|
*/
|
|
@@ -2412,10 +2686,12 @@ export declare const modifyNonEmptyLast: {
|
|
|
2412
2686
|
* Apply a function to the last element, creating a new `NonEmptyReadonlyArray`.
|
|
2413
2687
|
*
|
|
2414
2688
|
* @example
|
|
2689
|
+
* ```ts
|
|
2415
2690
|
* import { Array } from "effect"
|
|
2416
2691
|
*
|
|
2417
2692
|
* const result = Array.modifyNonEmptyLast([1, 2, 3], n => n * 2)
|
|
2418
2693
|
* assert.deepStrictEqual(result, [1, 2, 6])
|
|
2694
|
+
* ```
|
|
2419
2695
|
*
|
|
2420
2696
|
* @since 2.0.0
|
|
2421
2697
|
*/
|
|
@@ -2425,10 +2701,12 @@ export declare const modifyNonEmptyLast: {
|
|
|
2425
2701
|
* Change the last element, creating a new `NonEmptyReadonlyArray`.
|
|
2426
2702
|
*
|
|
2427
2703
|
* @example
|
|
2704
|
+
* ```ts
|
|
2428
2705
|
* import { Array } from "effect"
|
|
2429
2706
|
*
|
|
2430
2707
|
* const result = Array.setNonEmptyLast([1, 2, 3], 4)
|
|
2431
2708
|
* assert.deepStrictEqual(result, [1, 2, 4])
|
|
2709
|
+
* ```
|
|
2432
2710
|
*
|
|
2433
2711
|
* @since 2.0.0
|
|
2434
2712
|
*/
|
|
@@ -2437,10 +2715,12 @@ export declare const setNonEmptyLast: {
|
|
|
2437
2715
|
* Change the last element, creating a new `NonEmptyReadonlyArray`.
|
|
2438
2716
|
*
|
|
2439
2717
|
* @example
|
|
2718
|
+
* ```ts
|
|
2440
2719
|
* import { Array } from "effect"
|
|
2441
2720
|
*
|
|
2442
2721
|
* const result = Array.setNonEmptyLast([1, 2, 3], 4)
|
|
2443
2722
|
* assert.deepStrictEqual(result, [1, 2, 4])
|
|
2723
|
+
* ```
|
|
2444
2724
|
*
|
|
2445
2725
|
* @since 2.0.0
|
|
2446
2726
|
*/
|
|
@@ -2449,10 +2729,12 @@ export declare const setNonEmptyLast: {
|
|
|
2449
2729
|
* Change the last element, creating a new `NonEmptyReadonlyArray`.
|
|
2450
2730
|
*
|
|
2451
2731
|
* @example
|
|
2732
|
+
* ```ts
|
|
2452
2733
|
* import { Array } from "effect"
|
|
2453
2734
|
*
|
|
2454
2735
|
* const result = Array.setNonEmptyLast([1, 2, 3], 4)
|
|
2455
2736
|
* assert.deepStrictEqual(result, [1, 2, 4])
|
|
2737
|
+
* ```
|
|
2456
2738
|
*
|
|
2457
2739
|
* @since 2.0.0
|
|
2458
2740
|
*/
|
|
@@ -2463,11 +2745,13 @@ export declare const setNonEmptyLast: {
|
|
|
2463
2745
|
* If the input is a non-empty array, the result is also a non-empty array.
|
|
2464
2746
|
*
|
|
2465
2747
|
* @example
|
|
2748
|
+
* ```ts
|
|
2466
2749
|
* import { Array } from "effect"
|
|
2467
2750
|
*
|
|
2468
2751
|
* const letters = ['a', 'b', 'c', 'd']
|
|
2469
2752
|
* const result = Array.rotate(letters, 2)
|
|
2470
2753
|
* assert.deepStrictEqual(result, ['c', 'd', 'a', 'b'])
|
|
2754
|
+
* ```
|
|
2471
2755
|
*
|
|
2472
2756
|
* @since 2.0.0
|
|
2473
2757
|
*/
|
|
@@ -2477,11 +2761,13 @@ export declare const rotate: {
|
|
|
2477
2761
|
* If the input is a non-empty array, the result is also a non-empty array.
|
|
2478
2762
|
*
|
|
2479
2763
|
* @example
|
|
2764
|
+
* ```ts
|
|
2480
2765
|
* import { Array } from "effect"
|
|
2481
2766
|
*
|
|
2482
2767
|
* const letters = ['a', 'b', 'c', 'd']
|
|
2483
2768
|
* const result = Array.rotate(letters, 2)
|
|
2484
2769
|
* assert.deepStrictEqual(result, ['c', 'd', 'a', 'b'])
|
|
2770
|
+
* ```
|
|
2485
2771
|
*
|
|
2486
2772
|
* @since 2.0.0
|
|
2487
2773
|
*/
|
|
@@ -2491,11 +2777,13 @@ export declare const rotate: {
|
|
|
2491
2777
|
* If the input is a non-empty array, the result is also a non-empty array.
|
|
2492
2778
|
*
|
|
2493
2779
|
* @example
|
|
2780
|
+
* ```ts
|
|
2494
2781
|
* import { Array } from "effect"
|
|
2495
2782
|
*
|
|
2496
2783
|
* const letters = ['a', 'b', 'c', 'd']
|
|
2497
2784
|
* const result = Array.rotate(letters, 2)
|
|
2498
2785
|
* assert.deepStrictEqual(result, ['c', 'd', 'a', 'b'])
|
|
2786
|
+
* ```
|
|
2499
2787
|
*
|
|
2500
2788
|
* @since 2.0.0
|
|
2501
2789
|
*/
|
|
@@ -2505,11 +2793,13 @@ export declare const rotate: {
|
|
|
2505
2793
|
* If the input is a non-empty array, the result is also a non-empty array.
|
|
2506
2794
|
*
|
|
2507
2795
|
* @example
|
|
2796
|
+
* ```ts
|
|
2508
2797
|
* import { Array } from "effect"
|
|
2509
2798
|
*
|
|
2510
2799
|
* const letters = ['a', 'b', 'c', 'd']
|
|
2511
2800
|
* const result = Array.rotate(letters, 2)
|
|
2512
2801
|
* assert.deepStrictEqual(result, ['c', 'd', 'a', 'b'])
|
|
2802
|
+
* ```
|
|
2513
2803
|
*
|
|
2514
2804
|
* @since 2.0.0
|
|
2515
2805
|
*/
|
|
@@ -2519,6 +2809,7 @@ export declare const rotate: {
|
|
|
2519
2809
|
* Returns a function that checks if a `ReadonlyArray` contains a given value using a provided `isEquivalent` function.
|
|
2520
2810
|
*
|
|
2521
2811
|
* @example
|
|
2812
|
+
* ```ts
|
|
2522
2813
|
* import { Array } from "effect"
|
|
2523
2814
|
*
|
|
2524
2815
|
* const numbers = [1, 2, 3, 4]
|
|
@@ -2526,6 +2817,7 @@ export declare const rotate: {
|
|
|
2526
2817
|
* const containsNumber = Array.containsWith(isEquivalent)
|
|
2527
2818
|
* const result = containsNumber(3)(numbers)
|
|
2528
2819
|
* assert.deepStrictEqual(result, true)
|
|
2820
|
+
* ```
|
|
2529
2821
|
*
|
|
2530
2822
|
* @category elements
|
|
2531
2823
|
* @since 2.0.0
|
|
@@ -2538,11 +2830,13 @@ export declare const containsWith: <A>(isEquivalent: (self: A, that: A) => boole
|
|
|
2538
2830
|
* Returns a function that checks if a `ReadonlyArray` contains a given value using the default `Equivalence`.
|
|
2539
2831
|
*
|
|
2540
2832
|
* @example
|
|
2833
|
+
* ```ts
|
|
2541
2834
|
* import { Array } from "effect"
|
|
2542
2835
|
*
|
|
2543
2836
|
* const letters = ['a', 'b', 'c', 'd']
|
|
2544
2837
|
* const result = Array.contains('c')(letters)
|
|
2545
2838
|
* assert.deepStrictEqual(result, true)
|
|
2839
|
+
* ```
|
|
2546
2840
|
*
|
|
2547
2841
|
* @category elements
|
|
2548
2842
|
* @since 2.0.0
|
|
@@ -2552,11 +2846,13 @@ export declare const contains: {
|
|
|
2552
2846
|
* Returns a function that checks if a `ReadonlyArray` contains a given value using the default `Equivalence`.
|
|
2553
2847
|
*
|
|
2554
2848
|
* @example
|
|
2849
|
+
* ```ts
|
|
2555
2850
|
* import { Array } from "effect"
|
|
2556
2851
|
*
|
|
2557
2852
|
* const letters = ['a', 'b', 'c', 'd']
|
|
2558
2853
|
* const result = Array.contains('c')(letters)
|
|
2559
2854
|
* assert.deepStrictEqual(result, true)
|
|
2855
|
+
* ```
|
|
2560
2856
|
*
|
|
2561
2857
|
* @category elements
|
|
2562
2858
|
* @since 2.0.0
|
|
@@ -2566,11 +2862,13 @@ export declare const contains: {
|
|
|
2566
2862
|
* Returns a function that checks if a `ReadonlyArray` contains a given value using the default `Equivalence`.
|
|
2567
2863
|
*
|
|
2568
2864
|
* @example
|
|
2865
|
+
* ```ts
|
|
2569
2866
|
* import { Array } from "effect"
|
|
2570
2867
|
*
|
|
2571
2868
|
* const letters = ['a', 'b', 'c', 'd']
|
|
2572
2869
|
* const result = Array.contains('c')(letters)
|
|
2573
2870
|
* assert.deepStrictEqual(result, true)
|
|
2871
|
+
* ```
|
|
2574
2872
|
*
|
|
2575
2873
|
* @category elements
|
|
2576
2874
|
* @since 2.0.0
|
|
@@ -2583,6 +2881,7 @@ export declare const contains: {
|
|
|
2583
2881
|
* value and the rest of the `Array`.
|
|
2584
2882
|
*
|
|
2585
2883
|
* @example
|
|
2884
|
+
* ```ts
|
|
2586
2885
|
* import { Array } from "effect"
|
|
2587
2886
|
*
|
|
2588
2887
|
* const numbers = [1, 2, 3, 4, 5]
|
|
@@ -2593,6 +2892,7 @@ export declare const contains: {
|
|
|
2593
2892
|
* // The `chopFunction` takes the first element of the array, doubles it, and then returns it along with the rest of the array.
|
|
2594
2893
|
* // The `chop` function applies this `chopFunction` recursively to the input array `[1, 2, 3, 4, 5]`,
|
|
2595
2894
|
* // resulting in a new array `[2, 4, 6, 8, 10]`.
|
|
2895
|
+
* ```
|
|
2596
2896
|
*
|
|
2597
2897
|
* @since 2.0.0
|
|
2598
2898
|
*/
|
|
@@ -2603,6 +2903,7 @@ export declare const chop: {
|
|
|
2603
2903
|
* value and the rest of the `Array`.
|
|
2604
2904
|
*
|
|
2605
2905
|
* @example
|
|
2906
|
+
* ```ts
|
|
2606
2907
|
* import { Array } from "effect"
|
|
2607
2908
|
*
|
|
2608
2909
|
* const numbers = [1, 2, 3, 4, 5]
|
|
@@ -2613,6 +2914,7 @@ export declare const chop: {
|
|
|
2613
2914
|
* // The `chopFunction` takes the first element of the array, doubles it, and then returns it along with the rest of the array.
|
|
2614
2915
|
* // The `chop` function applies this `chopFunction` recursively to the input array `[1, 2, 3, 4, 5]`,
|
|
2615
2916
|
* // resulting in a new array `[2, 4, 6, 8, 10]`.
|
|
2917
|
+
* ```
|
|
2616
2918
|
*
|
|
2617
2919
|
* @since 2.0.0
|
|
2618
2920
|
*/
|
|
@@ -2623,6 +2925,7 @@ export declare const chop: {
|
|
|
2623
2925
|
* value and the rest of the `Array`.
|
|
2624
2926
|
*
|
|
2625
2927
|
* @example
|
|
2928
|
+
* ```ts
|
|
2626
2929
|
* import { Array } from "effect"
|
|
2627
2930
|
*
|
|
2628
2931
|
* const numbers = [1, 2, 3, 4, 5]
|
|
@@ -2633,6 +2936,7 @@ export declare const chop: {
|
|
|
2633
2936
|
* // The `chopFunction` takes the first element of the array, doubles it, and then returns it along with the rest of the array.
|
|
2634
2937
|
* // The `chop` function applies this `chopFunction` recursively to the input array `[1, 2, 3, 4, 5]`,
|
|
2635
2938
|
* // resulting in a new array `[2, 4, 6, 8, 10]`.
|
|
2939
|
+
* ```
|
|
2636
2940
|
*
|
|
2637
2941
|
* @since 2.0.0
|
|
2638
2942
|
*/
|
|
@@ -2643,6 +2947,7 @@ export declare const chop: {
|
|
|
2643
2947
|
* value and the rest of the `Array`.
|
|
2644
2948
|
*
|
|
2645
2949
|
* @example
|
|
2950
|
+
* ```ts
|
|
2646
2951
|
* import { Array } from "effect"
|
|
2647
2952
|
*
|
|
2648
2953
|
* const numbers = [1, 2, 3, 4, 5]
|
|
@@ -2653,6 +2958,7 @@ export declare const chop: {
|
|
|
2653
2958
|
* // The `chopFunction` takes the first element of the array, doubles it, and then returns it along with the rest of the array.
|
|
2654
2959
|
* // The `chop` function applies this `chopFunction` recursively to the input array `[1, 2, 3, 4, 5]`,
|
|
2655
2960
|
* // resulting in a new array `[2, 4, 6, 8, 10]`.
|
|
2961
|
+
* ```
|
|
2656
2962
|
*
|
|
2657
2963
|
* @since 2.0.0
|
|
2658
2964
|
*/
|
|
@@ -2663,11 +2969,13 @@ export declare const chop: {
|
|
|
2663
2969
|
* The value of `n` can be `0`.
|
|
2664
2970
|
*
|
|
2665
2971
|
* @example
|
|
2972
|
+
* ```ts
|
|
2666
2973
|
* import { Array } from "effect"
|
|
2667
2974
|
*
|
|
2668
2975
|
* const numbers = [1, 2, 3, 4, 5]
|
|
2669
2976
|
* const result = Array.splitAt(numbers, 3)
|
|
2670
2977
|
* assert.deepStrictEqual(result, [[1, 2, 3], [4, 5]])
|
|
2978
|
+
* ```
|
|
2671
2979
|
*
|
|
2672
2980
|
* @category splitting
|
|
2673
2981
|
* @since 2.0.0
|
|
@@ -2678,11 +2986,13 @@ export declare const splitAt: {
|
|
|
2678
2986
|
* The value of `n` can be `0`.
|
|
2679
2987
|
*
|
|
2680
2988
|
* @example
|
|
2989
|
+
* ```ts
|
|
2681
2990
|
* import { Array } from "effect"
|
|
2682
2991
|
*
|
|
2683
2992
|
* const numbers = [1, 2, 3, 4, 5]
|
|
2684
2993
|
* const result = Array.splitAt(numbers, 3)
|
|
2685
2994
|
* assert.deepStrictEqual(result, [[1, 2, 3], [4, 5]])
|
|
2995
|
+
* ```
|
|
2686
2996
|
*
|
|
2687
2997
|
* @category splitting
|
|
2688
2998
|
* @since 2.0.0
|
|
@@ -2693,11 +3003,13 @@ export declare const splitAt: {
|
|
|
2693
3003
|
* The value of `n` can be `0`.
|
|
2694
3004
|
*
|
|
2695
3005
|
* @example
|
|
3006
|
+
* ```ts
|
|
2696
3007
|
* import { Array } from "effect"
|
|
2697
3008
|
*
|
|
2698
3009
|
* const numbers = [1, 2, 3, 4, 5]
|
|
2699
3010
|
* const result = Array.splitAt(numbers, 3)
|
|
2700
3011
|
* assert.deepStrictEqual(result, [[1, 2, 3], [4, 5]])
|
|
3012
|
+
* ```
|
|
2701
3013
|
*
|
|
2702
3014
|
* @category splitting
|
|
2703
3015
|
* @since 2.0.0
|
|
@@ -2709,10 +3021,12 @@ export declare const splitAt: {
|
|
|
2709
3021
|
* The value of `n` must be `>= 1`.
|
|
2710
3022
|
*
|
|
2711
3023
|
* @example
|
|
3024
|
+
* ```ts
|
|
2712
3025
|
* import { Array } from "effect"
|
|
2713
3026
|
*
|
|
2714
3027
|
* const result = Array.splitNonEmptyAt(["a", "b", "c", "d", "e"], 3)
|
|
2715
3028
|
* assert.deepStrictEqual(result, [["a", "b", "c"], ["d", "e"]])
|
|
3029
|
+
* ```
|
|
2716
3030
|
*
|
|
2717
3031
|
* @category splitting
|
|
2718
3032
|
* @since 2.0.0
|
|
@@ -2723,10 +3037,12 @@ export declare const splitNonEmptyAt: {
|
|
|
2723
3037
|
* The value of `n` must be `>= 1`.
|
|
2724
3038
|
*
|
|
2725
3039
|
* @example
|
|
3040
|
+
* ```ts
|
|
2726
3041
|
* import { Array } from "effect"
|
|
2727
3042
|
*
|
|
2728
3043
|
* const result = Array.splitNonEmptyAt(["a", "b", "c", "d", "e"], 3)
|
|
2729
3044
|
* assert.deepStrictEqual(result, [["a", "b", "c"], ["d", "e"]])
|
|
3045
|
+
* ```
|
|
2730
3046
|
*
|
|
2731
3047
|
* @category splitting
|
|
2732
3048
|
* @since 2.0.0
|
|
@@ -2737,10 +3053,12 @@ export declare const splitNonEmptyAt: {
|
|
|
2737
3053
|
* The value of `n` must be `>= 1`.
|
|
2738
3054
|
*
|
|
2739
3055
|
* @example
|
|
3056
|
+
* ```ts
|
|
2740
3057
|
* import { Array } from "effect"
|
|
2741
3058
|
*
|
|
2742
3059
|
* const result = Array.splitNonEmptyAt(["a", "b", "c", "d", "e"], 3)
|
|
2743
3060
|
* assert.deepStrictEqual(result, [["a", "b", "c"], ["d", "e"]])
|
|
3061
|
+
* ```
|
|
2744
3062
|
*
|
|
2745
3063
|
* @category splitting
|
|
2746
3064
|
* @since 2.0.0
|
|
@@ -2751,11 +3069,13 @@ export declare const splitNonEmptyAt: {
|
|
|
2751
3069
|
* Splits this iterable into `n` equally sized arrays.
|
|
2752
3070
|
*
|
|
2753
3071
|
* @example
|
|
3072
|
+
* ```ts
|
|
2754
3073
|
* import { Array } from "effect"
|
|
2755
3074
|
*
|
|
2756
3075
|
* const numbers = [1, 2, 3, 4, 5, 6, 7, 8]
|
|
2757
3076
|
* const result = Array.split(numbers, 3)
|
|
2758
3077
|
* assert.deepStrictEqual(result, [[1, 2, 3], [4, 5, 6], [7, 8]])
|
|
3078
|
+
* ```
|
|
2759
3079
|
*
|
|
2760
3080
|
* @since 2.0.0
|
|
2761
3081
|
* @category splitting
|
|
@@ -2765,11 +3085,13 @@ export declare const split: {
|
|
|
2765
3085
|
* Splits this iterable into `n` equally sized arrays.
|
|
2766
3086
|
*
|
|
2767
3087
|
* @example
|
|
3088
|
+
* ```ts
|
|
2768
3089
|
* import { Array } from "effect"
|
|
2769
3090
|
*
|
|
2770
3091
|
* const numbers = [1, 2, 3, 4, 5, 6, 7, 8]
|
|
2771
3092
|
* const result = Array.split(numbers, 3)
|
|
2772
3093
|
* assert.deepStrictEqual(result, [[1, 2, 3], [4, 5, 6], [7, 8]])
|
|
3094
|
+
* ```
|
|
2773
3095
|
*
|
|
2774
3096
|
* @since 2.0.0
|
|
2775
3097
|
* @category splitting
|
|
@@ -2779,11 +3101,13 @@ export declare const split: {
|
|
|
2779
3101
|
* Splits this iterable into `n` equally sized arrays.
|
|
2780
3102
|
*
|
|
2781
3103
|
* @example
|
|
3104
|
+
* ```ts
|
|
2782
3105
|
* import { Array } from "effect"
|
|
2783
3106
|
*
|
|
2784
3107
|
* const numbers = [1, 2, 3, 4, 5, 6, 7, 8]
|
|
2785
3108
|
* const result = Array.split(numbers, 3)
|
|
2786
3109
|
* assert.deepStrictEqual(result, [[1, 2, 3], [4, 5, 6], [7, 8]])
|
|
3110
|
+
* ```
|
|
2787
3111
|
*
|
|
2788
3112
|
* @since 2.0.0
|
|
2789
3113
|
* @category splitting
|
|
@@ -2795,11 +3119,13 @@ export declare const split: {
|
|
|
2795
3119
|
* Returns a tuple containing two arrays: the first one is before the match, and the second one is from the match onward.
|
|
2796
3120
|
*
|
|
2797
3121
|
* @example
|
|
3122
|
+
* ```ts
|
|
2798
3123
|
* import { Array } from "effect"
|
|
2799
3124
|
*
|
|
2800
3125
|
* const numbers = [1, 2, 3, 4, 5]
|
|
2801
3126
|
* const result = Array.splitWhere(numbers, n => n > 3)
|
|
2802
3127
|
* assert.deepStrictEqual(result, [[1, 2, 3], [4, 5]])
|
|
3128
|
+
* ```
|
|
2803
3129
|
*
|
|
2804
3130
|
* @category splitting
|
|
2805
3131
|
* @since 2.0.0
|
|
@@ -2810,11 +3136,13 @@ export declare const splitWhere: {
|
|
|
2810
3136
|
* Returns a tuple containing two arrays: the first one is before the match, and the second one is from the match onward.
|
|
2811
3137
|
*
|
|
2812
3138
|
* @example
|
|
3139
|
+
* ```ts
|
|
2813
3140
|
* import { Array } from "effect"
|
|
2814
3141
|
*
|
|
2815
3142
|
* const numbers = [1, 2, 3, 4, 5]
|
|
2816
3143
|
* const result = Array.splitWhere(numbers, n => n > 3)
|
|
2817
3144
|
* assert.deepStrictEqual(result, [[1, 2, 3], [4, 5]])
|
|
3145
|
+
* ```
|
|
2818
3146
|
*
|
|
2819
3147
|
* @category splitting
|
|
2820
3148
|
* @since 2.0.0
|
|
@@ -2825,11 +3153,13 @@ export declare const splitWhere: {
|
|
|
2825
3153
|
* Returns a tuple containing two arrays: the first one is before the match, and the second one is from the match onward.
|
|
2826
3154
|
*
|
|
2827
3155
|
* @example
|
|
3156
|
+
* ```ts
|
|
2828
3157
|
* import { Array } from "effect"
|
|
2829
3158
|
*
|
|
2830
3159
|
* const numbers = [1, 2, 3, 4, 5]
|
|
2831
3160
|
* const result = Array.splitWhere(numbers, n => n > 3)
|
|
2832
3161
|
* assert.deepStrictEqual(result, [[1, 2, 3], [4, 5]])
|
|
3162
|
+
* ```
|
|
2833
3163
|
*
|
|
2834
3164
|
* @category splitting
|
|
2835
3165
|
* @since 2.0.0
|
|
@@ -2840,11 +3170,13 @@ export declare const splitWhere: {
|
|
|
2840
3170
|
* Copies an array.
|
|
2841
3171
|
*
|
|
2842
3172
|
* @example
|
|
3173
|
+
* ```ts
|
|
2843
3174
|
* import { Array } from "effect"
|
|
2844
3175
|
*
|
|
2845
3176
|
* const numbers = [1, 2, 3]
|
|
2846
3177
|
* const copy = Array.copy(numbers)
|
|
2847
3178
|
* assert.deepStrictEqual(copy, [1, 2, 3])
|
|
3179
|
+
* ```
|
|
2848
3180
|
*
|
|
2849
3181
|
* @since 2.0.0
|
|
2850
3182
|
*/
|
|
@@ -2853,11 +3185,13 @@ export declare const copy: {
|
|
|
2853
3185
|
* Copies an array.
|
|
2854
3186
|
*
|
|
2855
3187
|
* @example
|
|
3188
|
+
* ```ts
|
|
2856
3189
|
* import { Array } from "effect"
|
|
2857
3190
|
*
|
|
2858
3191
|
* const numbers = [1, 2, 3]
|
|
2859
3192
|
* const copy = Array.copy(numbers)
|
|
2860
3193
|
* assert.deepStrictEqual(copy, [1, 2, 3])
|
|
3194
|
+
* ```
|
|
2861
3195
|
*
|
|
2862
3196
|
* @since 2.0.0
|
|
2863
3197
|
*/
|
|
@@ -2866,11 +3200,13 @@ export declare const copy: {
|
|
|
2866
3200
|
* Copies an array.
|
|
2867
3201
|
*
|
|
2868
3202
|
* @example
|
|
3203
|
+
* ```ts
|
|
2869
3204
|
* import { Array } from "effect"
|
|
2870
3205
|
*
|
|
2871
3206
|
* const numbers = [1, 2, 3]
|
|
2872
3207
|
* const copy = Array.copy(numbers)
|
|
2873
3208
|
* assert.deepStrictEqual(copy, [1, 2, 3])
|
|
3209
|
+
* ```
|
|
2874
3210
|
*
|
|
2875
3211
|
* @since 2.0.0
|
|
2876
3212
|
*/
|
|
@@ -2883,11 +3219,13 @@ export declare const copy: {
|
|
|
2883
3219
|
* If `n` is less than or equal to 0, the returned array will be an empty array.
|
|
2884
3220
|
*
|
|
2885
3221
|
* @example
|
|
3222
|
+
* ```ts
|
|
2886
3223
|
* import { Array } from "effect"
|
|
2887
3224
|
*
|
|
2888
3225
|
* const arr = [1, 2, 3]
|
|
2889
3226
|
* const result = Array.pad(arr, 6, 0)
|
|
2890
3227
|
* assert.deepStrictEqual(result, [1, 2, 3, 0, 0, 0])
|
|
3228
|
+
* ```
|
|
2891
3229
|
*
|
|
2892
3230
|
* @since 3.8.4
|
|
2893
3231
|
*/
|
|
@@ -2899,11 +3237,13 @@ export declare const pad: {
|
|
|
2899
3237
|
* If `n` is less than or equal to 0, the returned array will be an empty array.
|
|
2900
3238
|
*
|
|
2901
3239
|
* @example
|
|
3240
|
+
* ```ts
|
|
2902
3241
|
* import { Array } from "effect"
|
|
2903
3242
|
*
|
|
2904
3243
|
* const arr = [1, 2, 3]
|
|
2905
3244
|
* const result = Array.pad(arr, 6, 0)
|
|
2906
3245
|
* assert.deepStrictEqual(result, [1, 2, 3, 0, 0, 0])
|
|
3246
|
+
* ```
|
|
2907
3247
|
*
|
|
2908
3248
|
* @since 3.8.4
|
|
2909
3249
|
*/
|
|
@@ -2915,11 +3255,13 @@ export declare const pad: {
|
|
|
2915
3255
|
* If `n` is less than or equal to 0, the returned array will be an empty array.
|
|
2916
3256
|
*
|
|
2917
3257
|
* @example
|
|
3258
|
+
* ```ts
|
|
2918
3259
|
* import { Array } from "effect"
|
|
2919
3260
|
*
|
|
2920
3261
|
* const arr = [1, 2, 3]
|
|
2921
3262
|
* const result = Array.pad(arr, 6, 0)
|
|
2922
3263
|
* assert.deepStrictEqual(result, [1, 2, 3, 0, 0, 0])
|
|
3264
|
+
* ```
|
|
2923
3265
|
*
|
|
2924
3266
|
* @since 3.8.4
|
|
2925
3267
|
*/
|
|
@@ -2937,6 +3279,7 @@ export declare const pad: {
|
|
|
2937
3279
|
* whenever `n` evenly divides the length of `self`.
|
|
2938
3280
|
*
|
|
2939
3281
|
* @example
|
|
3282
|
+
* ```ts
|
|
2940
3283
|
* import { Array } from "effect"
|
|
2941
3284
|
*
|
|
2942
3285
|
* const numbers = [1, 2, 3, 4, 5]
|
|
@@ -2948,6 +3291,7 @@ export declare const pad: {
|
|
|
2948
3291
|
* // It splits the array into chunks of length 2. Since the array length is not evenly divisible by 2,
|
|
2949
3292
|
* // the last chunk contains the remaining elements.
|
|
2950
3293
|
* // The result is `[[1, 2], [3, 4], [5]]`.
|
|
3294
|
+
* ```
|
|
2951
3295
|
*
|
|
2952
3296
|
* @category splitting
|
|
2953
3297
|
* @since 2.0.0
|
|
@@ -2965,6 +3309,7 @@ export declare const chunksOf: {
|
|
|
2965
3309
|
* whenever `n` evenly divides the length of `self`.
|
|
2966
3310
|
*
|
|
2967
3311
|
* @example
|
|
3312
|
+
* ```ts
|
|
2968
3313
|
* import { Array } from "effect"
|
|
2969
3314
|
*
|
|
2970
3315
|
* const numbers = [1, 2, 3, 4, 5]
|
|
@@ -2976,6 +3321,7 @@ export declare const chunksOf: {
|
|
|
2976
3321
|
* // It splits the array into chunks of length 2. Since the array length is not evenly divisible by 2,
|
|
2977
3322
|
* // the last chunk contains the remaining elements.
|
|
2978
3323
|
* // The result is `[[1, 2], [3, 4], [5]]`.
|
|
3324
|
+
* ```
|
|
2979
3325
|
*
|
|
2980
3326
|
* @category splitting
|
|
2981
3327
|
* @since 2.0.0
|
|
@@ -2993,6 +3339,7 @@ export declare const chunksOf: {
|
|
|
2993
3339
|
* whenever `n` evenly divides the length of `self`.
|
|
2994
3340
|
*
|
|
2995
3341
|
* @example
|
|
3342
|
+
* ```ts
|
|
2996
3343
|
* import { Array } from "effect"
|
|
2997
3344
|
*
|
|
2998
3345
|
* const numbers = [1, 2, 3, 4, 5]
|
|
@@ -3004,6 +3351,7 @@ export declare const chunksOf: {
|
|
|
3004
3351
|
* // It splits the array into chunks of length 2. Since the array length is not evenly divisible by 2,
|
|
3005
3352
|
* // the last chunk contains the remaining elements.
|
|
3006
3353
|
* // The result is `[[1, 2], [3, 4], [5]]`.
|
|
3354
|
+
* ```
|
|
3007
3355
|
*
|
|
3008
3356
|
* @category splitting
|
|
3009
3357
|
* @since 2.0.0
|
|
@@ -3021,6 +3369,7 @@ export declare const chunksOf: {
|
|
|
3021
3369
|
* whenever `n` evenly divides the length of `self`.
|
|
3022
3370
|
*
|
|
3023
3371
|
* @example
|
|
3372
|
+
* ```ts
|
|
3024
3373
|
* import { Array } from "effect"
|
|
3025
3374
|
*
|
|
3026
3375
|
* const numbers = [1, 2, 3, 4, 5]
|
|
@@ -3032,6 +3381,7 @@ export declare const chunksOf: {
|
|
|
3032
3381
|
* // It splits the array into chunks of length 2. Since the array length is not evenly divisible by 2,
|
|
3033
3382
|
* // the last chunk contains the remaining elements.
|
|
3034
3383
|
* // The result is `[[1, 2], [3, 4], [5]]`.
|
|
3384
|
+
* ```
|
|
3035
3385
|
*
|
|
3036
3386
|
* @category splitting
|
|
3037
3387
|
* @since 2.0.0
|
|
@@ -3042,10 +3392,12 @@ export declare const chunksOf: {
|
|
|
3042
3392
|
* Group equal, consecutive elements of a `NonEmptyReadonlyArray` into `NonEmptyArray`s using the provided `isEquivalent` function.
|
|
3043
3393
|
*
|
|
3044
3394
|
* @example
|
|
3395
|
+
* ```ts
|
|
3045
3396
|
* import { Array } from "effect"
|
|
3046
3397
|
*
|
|
3047
3398
|
* const result = Array.groupWith(["a", "a", "b", "b", "b", "c", "a"], (x, y) => x === y)
|
|
3048
3399
|
* assert.deepStrictEqual(result, [["a", "a"], ["b", "b", "b"], ["c"], ["a"]])
|
|
3400
|
+
* ```
|
|
3049
3401
|
*
|
|
3050
3402
|
* @category grouping
|
|
3051
3403
|
* @since 2.0.0
|
|
@@ -3055,10 +3407,12 @@ export declare const groupWith: {
|
|
|
3055
3407
|
* Group equal, consecutive elements of a `NonEmptyReadonlyArray` into `NonEmptyArray`s using the provided `isEquivalent` function.
|
|
3056
3408
|
*
|
|
3057
3409
|
* @example
|
|
3410
|
+
* ```ts
|
|
3058
3411
|
* import { Array } from "effect"
|
|
3059
3412
|
*
|
|
3060
3413
|
* const result = Array.groupWith(["a", "a", "b", "b", "b", "c", "a"], (x, y) => x === y)
|
|
3061
3414
|
* assert.deepStrictEqual(result, [["a", "a"], ["b", "b", "b"], ["c"], ["a"]])
|
|
3415
|
+
* ```
|
|
3062
3416
|
*
|
|
3063
3417
|
* @category grouping
|
|
3064
3418
|
* @since 2.0.0
|
|
@@ -3068,10 +3422,12 @@ export declare const groupWith: {
|
|
|
3068
3422
|
* Group equal, consecutive elements of a `NonEmptyReadonlyArray` into `NonEmptyArray`s using the provided `isEquivalent` function.
|
|
3069
3423
|
*
|
|
3070
3424
|
* @example
|
|
3425
|
+
* ```ts
|
|
3071
3426
|
* import { Array } from "effect"
|
|
3072
3427
|
*
|
|
3073
3428
|
* const result = Array.groupWith(["a", "a", "b", "b", "b", "c", "a"], (x, y) => x === y)
|
|
3074
3429
|
* assert.deepStrictEqual(result, [["a", "a"], ["b", "b", "b"], ["c"], ["a"]])
|
|
3430
|
+
* ```
|
|
3075
3431
|
*
|
|
3076
3432
|
* @category grouping
|
|
3077
3433
|
* @since 2.0.0
|
|
@@ -3082,10 +3438,12 @@ export declare const groupWith: {
|
|
|
3082
3438
|
* Group equal, consecutive elements of a `NonEmptyReadonlyArray` into `NonEmptyArray`s.
|
|
3083
3439
|
*
|
|
3084
3440
|
* @example
|
|
3441
|
+
* ```ts
|
|
3085
3442
|
* import { Array } from "effect"
|
|
3086
3443
|
*
|
|
3087
3444
|
* const result = Array.group([1, 1, 2, 2, 2, 3, 1])
|
|
3088
3445
|
* assert.deepStrictEqual(result, [[1, 1], [2, 2, 2], [3], [1]])
|
|
3446
|
+
* ```
|
|
3089
3447
|
*
|
|
3090
3448
|
* @category grouping
|
|
3091
3449
|
* @since 2.0.0
|
|
@@ -3096,6 +3454,7 @@ export declare const group: <A>(self: NonEmptyReadonlyArray<A>) => NonEmptyArray
|
|
|
3096
3454
|
* function on each element, and grouping the results according to values returned
|
|
3097
3455
|
*
|
|
3098
3456
|
* @example
|
|
3457
|
+
* ```ts
|
|
3099
3458
|
* import { Array } from "effect"
|
|
3100
3459
|
*
|
|
3101
3460
|
* const people = [
|
|
@@ -3108,6 +3467,7 @@ export declare const group: <A>(self: NonEmptyReadonlyArray<A>) => NonEmptyArray
|
|
|
3108
3467
|
* A: [{ name: "Alice", group: "A" }, { name: "Charlie", group: "A" }],
|
|
3109
3468
|
* B: [{ name: "Bob", group: "B" }]
|
|
3110
3469
|
* })
|
|
3470
|
+
* ```
|
|
3111
3471
|
*
|
|
3112
3472
|
* @category grouping
|
|
3113
3473
|
* @since 2.0.0
|
|
@@ -3118,6 +3478,7 @@ export declare const groupBy: {
|
|
|
3118
3478
|
* function on each element, and grouping the results according to values returned
|
|
3119
3479
|
*
|
|
3120
3480
|
* @example
|
|
3481
|
+
* ```ts
|
|
3121
3482
|
* import { Array } from "effect"
|
|
3122
3483
|
*
|
|
3123
3484
|
* const people = [
|
|
@@ -3130,6 +3491,7 @@ export declare const groupBy: {
|
|
|
3130
3491
|
* A: [{ name: "Alice", group: "A" }, { name: "Charlie", group: "A" }],
|
|
3131
3492
|
* B: [{ name: "Bob", group: "B" }]
|
|
3132
3493
|
* })
|
|
3494
|
+
* ```
|
|
3133
3495
|
*
|
|
3134
3496
|
* @category grouping
|
|
3135
3497
|
* @since 2.0.0
|
|
@@ -3140,6 +3502,7 @@ export declare const groupBy: {
|
|
|
3140
3502
|
* function on each element, and grouping the results according to values returned
|
|
3141
3503
|
*
|
|
3142
3504
|
* @example
|
|
3505
|
+
* ```ts
|
|
3143
3506
|
* import { Array } from "effect"
|
|
3144
3507
|
*
|
|
3145
3508
|
* const people = [
|
|
@@ -3152,6 +3515,7 @@ export declare const groupBy: {
|
|
|
3152
3515
|
* A: [{ name: "Alice", group: "A" }, { name: "Charlie", group: "A" }],
|
|
3153
3516
|
* B: [{ name: "Bob", group: "B" }]
|
|
3154
3517
|
* })
|
|
3518
|
+
* ```
|
|
3155
3519
|
*
|
|
3156
3520
|
* @category grouping
|
|
3157
3521
|
* @since 2.0.0
|
|
@@ -3162,12 +3526,14 @@ export declare const groupBy: {
|
|
|
3162
3526
|
* Calculates the union of two arrays using the provided equivalence relation.
|
|
3163
3527
|
*
|
|
3164
3528
|
* @example
|
|
3529
|
+
* ```ts
|
|
3165
3530
|
* import { Array } from "effect"
|
|
3166
3531
|
*
|
|
3167
3532
|
* const array1 = [1, 2]
|
|
3168
3533
|
* const array2 = [2, 3]
|
|
3169
3534
|
* const union = Array.unionWith(array1, array2, (a, b) => a === b)
|
|
3170
3535
|
* assert.deepStrictEqual(union, [1, 2, 3])
|
|
3536
|
+
* ```
|
|
3171
3537
|
*
|
|
3172
3538
|
* @since 2.0.0
|
|
3173
3539
|
*/
|
|
@@ -3176,12 +3542,14 @@ export declare const unionWith: {
|
|
|
3176
3542
|
* Calculates the union of two arrays using the provided equivalence relation.
|
|
3177
3543
|
*
|
|
3178
3544
|
* @example
|
|
3545
|
+
* ```ts
|
|
3179
3546
|
* import { Array } from "effect"
|
|
3180
3547
|
*
|
|
3181
3548
|
* const array1 = [1, 2]
|
|
3182
3549
|
* const array2 = [2, 3]
|
|
3183
3550
|
* const union = Array.unionWith(array1, array2, (a, b) => a === b)
|
|
3184
3551
|
* assert.deepStrictEqual(union, [1, 2, 3])
|
|
3552
|
+
* ```
|
|
3185
3553
|
*
|
|
3186
3554
|
* @since 2.0.0
|
|
3187
3555
|
*/
|
|
@@ -3190,12 +3558,14 @@ export declare const unionWith: {
|
|
|
3190
3558
|
* Calculates the union of two arrays using the provided equivalence relation.
|
|
3191
3559
|
*
|
|
3192
3560
|
* @example
|
|
3561
|
+
* ```ts
|
|
3193
3562
|
* import { Array } from "effect"
|
|
3194
3563
|
*
|
|
3195
3564
|
* const array1 = [1, 2]
|
|
3196
3565
|
* const array2 = [2, 3]
|
|
3197
3566
|
* const union = Array.unionWith(array1, array2, (a, b) => a === b)
|
|
3198
3567
|
* assert.deepStrictEqual(union, [1, 2, 3])
|
|
3568
|
+
* ```
|
|
3199
3569
|
*
|
|
3200
3570
|
* @since 2.0.0
|
|
3201
3571
|
*/
|
|
@@ -3204,12 +3574,14 @@ export declare const unionWith: {
|
|
|
3204
3574
|
* Calculates the union of two arrays using the provided equivalence relation.
|
|
3205
3575
|
*
|
|
3206
3576
|
* @example
|
|
3577
|
+
* ```ts
|
|
3207
3578
|
* import { Array } from "effect"
|
|
3208
3579
|
*
|
|
3209
3580
|
* const array1 = [1, 2]
|
|
3210
3581
|
* const array2 = [2, 3]
|
|
3211
3582
|
* const union = Array.unionWith(array1, array2, (a, b) => a === b)
|
|
3212
3583
|
* assert.deepStrictEqual(union, [1, 2, 3])
|
|
3584
|
+
* ```
|
|
3213
3585
|
*
|
|
3214
3586
|
* @since 2.0.0
|
|
3215
3587
|
*/
|
|
@@ -3218,12 +3590,14 @@ export declare const unionWith: {
|
|
|
3218
3590
|
* Calculates the union of two arrays using the provided equivalence relation.
|
|
3219
3591
|
*
|
|
3220
3592
|
* @example
|
|
3593
|
+
* ```ts
|
|
3221
3594
|
* import { Array } from "effect"
|
|
3222
3595
|
*
|
|
3223
3596
|
* const array1 = [1, 2]
|
|
3224
3597
|
* const array2 = [2, 3]
|
|
3225
3598
|
* const union = Array.unionWith(array1, array2, (a, b) => a === b)
|
|
3226
3599
|
* assert.deepStrictEqual(union, [1, 2, 3])
|
|
3600
|
+
* ```
|
|
3227
3601
|
*
|
|
3228
3602
|
* @since 2.0.0
|
|
3229
3603
|
*/
|
|
@@ -3233,12 +3607,14 @@ export declare const unionWith: {
|
|
|
3233
3607
|
* Creates a union of two arrays, removing duplicates.
|
|
3234
3608
|
*
|
|
3235
3609
|
* @example
|
|
3610
|
+
* ```ts
|
|
3236
3611
|
* import { Array } from "effect"
|
|
3237
3612
|
*
|
|
3238
3613
|
* const array1 = [1, 2]
|
|
3239
3614
|
* const array2 = [2, 3]
|
|
3240
3615
|
* const result = Array.union(array1, array2)
|
|
3241
3616
|
* assert.deepStrictEqual(result, [1, 2, 3])
|
|
3617
|
+
* ```
|
|
3242
3618
|
*
|
|
3243
3619
|
* @since 2.0.0
|
|
3244
3620
|
*/
|
|
@@ -3247,12 +3623,14 @@ export declare const union: {
|
|
|
3247
3623
|
* Creates a union of two arrays, removing duplicates.
|
|
3248
3624
|
*
|
|
3249
3625
|
* @example
|
|
3626
|
+
* ```ts
|
|
3250
3627
|
* import { Array } from "effect"
|
|
3251
3628
|
*
|
|
3252
3629
|
* const array1 = [1, 2]
|
|
3253
3630
|
* const array2 = [2, 3]
|
|
3254
3631
|
* const result = Array.union(array1, array2)
|
|
3255
3632
|
* assert.deepStrictEqual(result, [1, 2, 3])
|
|
3633
|
+
* ```
|
|
3256
3634
|
*
|
|
3257
3635
|
* @since 2.0.0
|
|
3258
3636
|
*/
|
|
@@ -3261,12 +3639,14 @@ export declare const union: {
|
|
|
3261
3639
|
* Creates a union of two arrays, removing duplicates.
|
|
3262
3640
|
*
|
|
3263
3641
|
* @example
|
|
3642
|
+
* ```ts
|
|
3264
3643
|
* import { Array } from "effect"
|
|
3265
3644
|
*
|
|
3266
3645
|
* const array1 = [1, 2]
|
|
3267
3646
|
* const array2 = [2, 3]
|
|
3268
3647
|
* const result = Array.union(array1, array2)
|
|
3269
3648
|
* assert.deepStrictEqual(result, [1, 2, 3])
|
|
3649
|
+
* ```
|
|
3270
3650
|
*
|
|
3271
3651
|
* @since 2.0.0
|
|
3272
3652
|
*/
|
|
@@ -3275,12 +3655,14 @@ export declare const union: {
|
|
|
3275
3655
|
* Creates a union of two arrays, removing duplicates.
|
|
3276
3656
|
*
|
|
3277
3657
|
* @example
|
|
3658
|
+
* ```ts
|
|
3278
3659
|
* import { Array } from "effect"
|
|
3279
3660
|
*
|
|
3280
3661
|
* const array1 = [1, 2]
|
|
3281
3662
|
* const array2 = [2, 3]
|
|
3282
3663
|
* const result = Array.union(array1, array2)
|
|
3283
3664
|
* assert.deepStrictEqual(result, [1, 2, 3])
|
|
3665
|
+
* ```
|
|
3284
3666
|
*
|
|
3285
3667
|
* @since 2.0.0
|
|
3286
3668
|
*/
|
|
@@ -3289,12 +3671,14 @@ export declare const union: {
|
|
|
3289
3671
|
* Creates a union of two arrays, removing duplicates.
|
|
3290
3672
|
*
|
|
3291
3673
|
* @example
|
|
3674
|
+
* ```ts
|
|
3292
3675
|
* import { Array } from "effect"
|
|
3293
3676
|
*
|
|
3294
3677
|
* const array1 = [1, 2]
|
|
3295
3678
|
* const array2 = [2, 3]
|
|
3296
3679
|
* const result = Array.union(array1, array2)
|
|
3297
3680
|
* assert.deepStrictEqual(result, [1, 2, 3])
|
|
3681
|
+
* ```
|
|
3298
3682
|
*
|
|
3299
3683
|
* @since 2.0.0
|
|
3300
3684
|
*/
|
|
@@ -3305,6 +3689,7 @@ export declare const union: {
|
|
|
3305
3689
|
* The order and references of result values are determined by the first `Iterable`.
|
|
3306
3690
|
*
|
|
3307
3691
|
* @example
|
|
3692
|
+
* ```ts
|
|
3308
3693
|
* import { Array } from "effect"
|
|
3309
3694
|
*
|
|
3310
3695
|
* const array1 = [{ id: 1 }, { id: 2 }, { id: 3 }]
|
|
@@ -3312,6 +3697,7 @@ export declare const union: {
|
|
|
3312
3697
|
* const isEquivalent = (a: { id: number }, b: { id: number }) => a.id === b.id
|
|
3313
3698
|
* const result = Array.intersectionWith(isEquivalent)(array2)(array1)
|
|
3314
3699
|
* assert.deepStrictEqual(result, [{ id: 1 }, { id: 3 }])
|
|
3700
|
+
* ```
|
|
3315
3701
|
*
|
|
3316
3702
|
* @since 2.0.0
|
|
3317
3703
|
*/
|
|
@@ -3324,12 +3710,14 @@ export declare const intersectionWith: <A>(isEquivalent: (self: A, that: A) => b
|
|
|
3324
3710
|
* The order and references of result values are determined by the first `Iterable`.
|
|
3325
3711
|
*
|
|
3326
3712
|
* @example
|
|
3713
|
+
* ```ts
|
|
3327
3714
|
* import { Array } from "effect"
|
|
3328
3715
|
*
|
|
3329
3716
|
* const array1 = [1, 2, 3]
|
|
3330
3717
|
* const array2 = [3, 4, 1]
|
|
3331
3718
|
* const result = Array.intersection(array1, array2)
|
|
3332
3719
|
* assert.deepStrictEqual(result, [1, 3])
|
|
3720
|
+
* ```
|
|
3333
3721
|
*
|
|
3334
3722
|
* @since 2.0.0
|
|
3335
3723
|
*/
|
|
@@ -3339,12 +3727,14 @@ export declare const intersection: {
|
|
|
3339
3727
|
* The order and references of result values are determined by the first `Iterable`.
|
|
3340
3728
|
*
|
|
3341
3729
|
* @example
|
|
3730
|
+
* ```ts
|
|
3342
3731
|
* import { Array } from "effect"
|
|
3343
3732
|
*
|
|
3344
3733
|
* const array1 = [1, 2, 3]
|
|
3345
3734
|
* const array2 = [3, 4, 1]
|
|
3346
3735
|
* const result = Array.intersection(array1, array2)
|
|
3347
3736
|
* assert.deepStrictEqual(result, [1, 3])
|
|
3737
|
+
* ```
|
|
3348
3738
|
*
|
|
3349
3739
|
* @since 2.0.0
|
|
3350
3740
|
*/
|
|
@@ -3354,12 +3744,14 @@ export declare const intersection: {
|
|
|
3354
3744
|
* The order and references of result values are determined by the first `Iterable`.
|
|
3355
3745
|
*
|
|
3356
3746
|
* @example
|
|
3747
|
+
* ```ts
|
|
3357
3748
|
* import { Array } from "effect"
|
|
3358
3749
|
*
|
|
3359
3750
|
* const array1 = [1, 2, 3]
|
|
3360
3751
|
* const array2 = [3, 4, 1]
|
|
3361
3752
|
* const result = Array.intersection(array1, array2)
|
|
3362
3753
|
* assert.deepStrictEqual(result, [1, 3])
|
|
3754
|
+
* ```
|
|
3363
3755
|
*
|
|
3364
3756
|
* @since 2.0.0
|
|
3365
3757
|
*/
|
|
@@ -3370,12 +3762,14 @@ export declare const intersection: {
|
|
|
3370
3762
|
* The order and references of result values are determined by the first `Iterable`.
|
|
3371
3763
|
*
|
|
3372
3764
|
* @example
|
|
3765
|
+
* ```ts
|
|
3373
3766
|
* import { Array } from "effect"
|
|
3374
3767
|
*
|
|
3375
3768
|
* const array1 = [1, 2, 3]
|
|
3376
3769
|
* const array2 = [2, 3, 4]
|
|
3377
3770
|
* const difference = Array.differenceWith<number>((a, b) => a === b)(array1, array2)
|
|
3378
3771
|
* assert.deepStrictEqual(difference, [1])
|
|
3772
|
+
* ```
|
|
3379
3773
|
*
|
|
3380
3774
|
* @since 2.0.0
|
|
3381
3775
|
*/
|
|
@@ -3388,12 +3782,14 @@ export declare const differenceWith: <A>(isEquivalent: (self: A, that: A) => boo
|
|
|
3388
3782
|
* The order and references of result values are determined by the first `Iterable`.
|
|
3389
3783
|
*
|
|
3390
3784
|
* @example
|
|
3785
|
+
* ```ts
|
|
3391
3786
|
* import { Array } from "effect"
|
|
3392
3787
|
*
|
|
3393
3788
|
* const array1 = [1, 2, 3]
|
|
3394
3789
|
* const array2 = [2, 3, 4]
|
|
3395
3790
|
* const difference = Array.difference(array1, array2)
|
|
3396
3791
|
* assert.deepStrictEqual(difference, [1])
|
|
3792
|
+
* ```
|
|
3397
3793
|
*
|
|
3398
3794
|
* @since 2.0.0
|
|
3399
3795
|
*/
|
|
@@ -3403,12 +3799,14 @@ export declare const difference: {
|
|
|
3403
3799
|
* The order and references of result values are determined by the first `Iterable`.
|
|
3404
3800
|
*
|
|
3405
3801
|
* @example
|
|
3802
|
+
* ```ts
|
|
3406
3803
|
* import { Array } from "effect"
|
|
3407
3804
|
*
|
|
3408
3805
|
* const array1 = [1, 2, 3]
|
|
3409
3806
|
* const array2 = [2, 3, 4]
|
|
3410
3807
|
* const difference = Array.difference(array1, array2)
|
|
3411
3808
|
* assert.deepStrictEqual(difference, [1])
|
|
3809
|
+
* ```
|
|
3412
3810
|
*
|
|
3413
3811
|
* @since 2.0.0
|
|
3414
3812
|
*/
|
|
@@ -3418,12 +3816,14 @@ export declare const difference: {
|
|
|
3418
3816
|
* The order and references of result values are determined by the first `Iterable`.
|
|
3419
3817
|
*
|
|
3420
3818
|
* @example
|
|
3819
|
+
* ```ts
|
|
3421
3820
|
* import { Array } from "effect"
|
|
3422
3821
|
*
|
|
3423
3822
|
* const array1 = [1, 2, 3]
|
|
3424
3823
|
* const array2 = [2, 3, 4]
|
|
3425
3824
|
* const difference = Array.difference(array1, array2)
|
|
3426
3825
|
* assert.deepStrictEqual(difference, [1])
|
|
3826
|
+
* ```
|
|
3427
3827
|
*
|
|
3428
3828
|
* @since 2.0.0
|
|
3429
3829
|
*/
|
|
@@ -3517,12 +3917,14 @@ export declare const flatMap: {
|
|
|
3517
3917
|
* arrays is collapsed into a single, flat array.
|
|
3518
3918
|
*
|
|
3519
3919
|
* @example
|
|
3920
|
+
* ```ts
|
|
3520
3921
|
* import { Array } from "effect";
|
|
3521
3922
|
*
|
|
3522
3923
|
* const nestedArrays = [[1, 2], [], [3, 4], [], [5, 6]]
|
|
3523
3924
|
* const result = Array.flatten(nestedArrays)
|
|
3524
3925
|
*
|
|
3525
3926
|
* assert.deepStrictEqual(result, [1, 2, 3, 4, 5, 6]);
|
|
3927
|
+
* ```
|
|
3526
3928
|
*
|
|
3527
3929
|
* @category sequencing
|
|
3528
3930
|
* @since 2.0.0
|
|
@@ -3533,6 +3935,7 @@ export declare const flatten: <S extends ReadonlyArray<ReadonlyArray<any>>>(self
|
|
|
3533
3935
|
* This method combines filtering and mapping functionalities, allowing transformations and filtering of elements based on a single function pass.
|
|
3534
3936
|
*
|
|
3535
3937
|
* @example
|
|
3938
|
+
* ```ts
|
|
3536
3939
|
* import { Array, Option } from "effect";
|
|
3537
3940
|
*
|
|
3538
3941
|
* const data = [1, 2, 3, 4, 5];
|
|
@@ -3540,6 +3943,7 @@ export declare const flatten: <S extends ReadonlyArray<ReadonlyArray<any>>>(self
|
|
|
3540
3943
|
* const result = Array.filterMap(data, evenSquares);
|
|
3541
3944
|
*
|
|
3542
3945
|
* assert.deepStrictEqual(result, [4, 16]);
|
|
3946
|
+
* ```
|
|
3543
3947
|
*
|
|
3544
3948
|
* @category filtering
|
|
3545
3949
|
* @since 2.0.0
|
|
@@ -3550,6 +3954,7 @@ export declare const filterMap: {
|
|
|
3550
3954
|
* This method combines filtering and mapping functionalities, allowing transformations and filtering of elements based on a single function pass.
|
|
3551
3955
|
*
|
|
3552
3956
|
* @example
|
|
3957
|
+
* ```ts
|
|
3553
3958
|
* import { Array, Option } from "effect";
|
|
3554
3959
|
*
|
|
3555
3960
|
* const data = [1, 2, 3, 4, 5];
|
|
@@ -3557,6 +3962,7 @@ export declare const filterMap: {
|
|
|
3557
3962
|
* const result = Array.filterMap(data, evenSquares);
|
|
3558
3963
|
*
|
|
3559
3964
|
* assert.deepStrictEqual(result, [4, 16]);
|
|
3965
|
+
* ```
|
|
3560
3966
|
*
|
|
3561
3967
|
* @category filtering
|
|
3562
3968
|
* @since 2.0.0
|
|
@@ -3567,6 +3973,7 @@ export declare const filterMap: {
|
|
|
3567
3973
|
* This method combines filtering and mapping functionalities, allowing transformations and filtering of elements based on a single function pass.
|
|
3568
3974
|
*
|
|
3569
3975
|
* @example
|
|
3976
|
+
* ```ts
|
|
3570
3977
|
* import { Array, Option } from "effect";
|
|
3571
3978
|
*
|
|
3572
3979
|
* const data = [1, 2, 3, 4, 5];
|
|
@@ -3574,6 +3981,7 @@ export declare const filterMap: {
|
|
|
3574
3981
|
* const result = Array.filterMap(data, evenSquares);
|
|
3575
3982
|
*
|
|
3576
3983
|
* assert.deepStrictEqual(result, [4, 16]);
|
|
3984
|
+
* ```
|
|
3577
3985
|
*
|
|
3578
3986
|
* @category filtering
|
|
3579
3987
|
* @since 2.0.0
|
|
@@ -3586,6 +3994,7 @@ export declare const filterMap: {
|
|
|
3586
3994
|
* This is useful when you need to transform an array but only up to the point where a certain condition holds true.
|
|
3587
3995
|
*
|
|
3588
3996
|
* @example
|
|
3997
|
+
* ```ts
|
|
3589
3998
|
* import { Array, Option } from "effect";
|
|
3590
3999
|
*
|
|
3591
4000
|
* const data = [2, 4, 5];
|
|
@@ -3593,6 +4002,7 @@ export declare const filterMap: {
|
|
|
3593
4002
|
* const result = Array.filterMapWhile(data, toSquareTillOdd);
|
|
3594
4003
|
*
|
|
3595
4004
|
* assert.deepStrictEqual(result, [4, 16]);
|
|
4005
|
+
* ```
|
|
3596
4006
|
*
|
|
3597
4007
|
* @category filtering
|
|
3598
4008
|
* @since 2.0.0
|
|
@@ -3604,6 +4014,7 @@ export declare const filterMapWhile: {
|
|
|
3604
4014
|
* This is useful when you need to transform an array but only up to the point where a certain condition holds true.
|
|
3605
4015
|
*
|
|
3606
4016
|
* @example
|
|
4017
|
+
* ```ts
|
|
3607
4018
|
* import { Array, Option } from "effect";
|
|
3608
4019
|
*
|
|
3609
4020
|
* const data = [2, 4, 5];
|
|
@@ -3611,6 +4022,7 @@ export declare const filterMapWhile: {
|
|
|
3611
4022
|
* const result = Array.filterMapWhile(data, toSquareTillOdd);
|
|
3612
4023
|
*
|
|
3613
4024
|
* assert.deepStrictEqual(result, [4, 16]);
|
|
4025
|
+
* ```
|
|
3614
4026
|
*
|
|
3615
4027
|
* @category filtering
|
|
3616
4028
|
* @since 2.0.0
|
|
@@ -3622,6 +4034,7 @@ export declare const filterMapWhile: {
|
|
|
3622
4034
|
* This is useful when you need to transform an array but only up to the point where a certain condition holds true.
|
|
3623
4035
|
*
|
|
3624
4036
|
* @example
|
|
4037
|
+
* ```ts
|
|
3625
4038
|
* import { Array, Option } from "effect";
|
|
3626
4039
|
*
|
|
3627
4040
|
* const data = [2, 4, 5];
|
|
@@ -3629,6 +4042,7 @@ export declare const filterMapWhile: {
|
|
|
3629
4042
|
* const result = Array.filterMapWhile(data, toSquareTillOdd);
|
|
3630
4043
|
*
|
|
3631
4044
|
* assert.deepStrictEqual(result, [4, 16]);
|
|
4045
|
+
* ```
|
|
3632
4046
|
*
|
|
3633
4047
|
* @category filtering
|
|
3634
4048
|
* @since 2.0.0
|
|
@@ -3642,6 +4056,7 @@ export declare const filterMapWhile: {
|
|
|
3642
4056
|
* into successes and failures.
|
|
3643
4057
|
*
|
|
3644
4058
|
* @example
|
|
4059
|
+
* ```ts
|
|
3645
4060
|
* import { Array, Either } from "effect";
|
|
3646
4061
|
*
|
|
3647
4062
|
* const data = [1, 2, 3, 4, 5]
|
|
@@ -3654,6 +4069,7 @@ export declare const filterMapWhile: {
|
|
|
3654
4069
|
* [1, 3, 5],
|
|
3655
4070
|
* [2, 4]
|
|
3656
4071
|
* ])
|
|
4072
|
+
* ```
|
|
3657
4073
|
*
|
|
3658
4074
|
* @category filtering
|
|
3659
4075
|
* @since 2.0.0
|
|
@@ -3666,6 +4082,7 @@ export declare const partitionMap: {
|
|
|
3666
4082
|
* into successes and failures.
|
|
3667
4083
|
*
|
|
3668
4084
|
* @example
|
|
4085
|
+
* ```ts
|
|
3669
4086
|
* import { Array, Either } from "effect";
|
|
3670
4087
|
*
|
|
3671
4088
|
* const data = [1, 2, 3, 4, 5]
|
|
@@ -3678,6 +4095,7 @@ export declare const partitionMap: {
|
|
|
3678
4095
|
* [1, 3, 5],
|
|
3679
4096
|
* [2, 4]
|
|
3680
4097
|
* ])
|
|
4098
|
+
* ```
|
|
3681
4099
|
*
|
|
3682
4100
|
* @category filtering
|
|
3683
4101
|
* @since 2.0.0
|
|
@@ -3690,6 +4108,7 @@ export declare const partitionMap: {
|
|
|
3690
4108
|
* into successes and failures.
|
|
3691
4109
|
*
|
|
3692
4110
|
* @example
|
|
4111
|
+
* ```ts
|
|
3693
4112
|
* import { Array, Either } from "effect";
|
|
3694
4113
|
*
|
|
3695
4114
|
* const data = [1, 2, 3, 4, 5]
|
|
@@ -3702,6 +4121,7 @@ export declare const partitionMap: {
|
|
|
3702
4121
|
* [1, 3, 5],
|
|
3703
4122
|
* [2, 4]
|
|
3704
4123
|
* ])
|
|
4124
|
+
* ```
|
|
3705
4125
|
*
|
|
3706
4126
|
* @category filtering
|
|
3707
4127
|
* @since 2.0.0
|
|
@@ -3712,12 +4132,14 @@ export declare const partitionMap: {
|
|
|
3712
4132
|
* Retrieves the `Some` values from an `Iterable` of `Option`s, collecting them into an array.
|
|
3713
4133
|
*
|
|
3714
4134
|
* @example
|
|
4135
|
+
* ```ts
|
|
3715
4136
|
* import { Array, Option } from "effect"
|
|
3716
4137
|
*
|
|
3717
4138
|
* assert.deepStrictEqual(
|
|
3718
4139
|
* Array.getSomes([Option.some(1), Option.none(), Option.some(2)]),
|
|
3719
4140
|
* [1, 2]
|
|
3720
4141
|
* )
|
|
4142
|
+
* ```
|
|
3721
4143
|
*
|
|
3722
4144
|
* @category filtering
|
|
3723
4145
|
* @since 2.0.0
|
|
@@ -3727,12 +4149,14 @@ export declare const getSomes: <T extends Iterable<Option<X>>, X = any>(self: T)
|
|
|
3727
4149
|
* Retrieves the `Left` values from an `Iterable` of `Either`s, collecting them into an array.
|
|
3728
4150
|
*
|
|
3729
4151
|
* @example
|
|
4152
|
+
* ```ts
|
|
3730
4153
|
* import { Array, Either } from "effect"
|
|
3731
4154
|
*
|
|
3732
4155
|
* assert.deepStrictEqual(
|
|
3733
4156
|
* Array.getLefts([Either.right(1), Either.left("err"), Either.right(2)]),
|
|
3734
4157
|
* ["err"]
|
|
3735
4158
|
* )
|
|
4159
|
+
* ```
|
|
3736
4160
|
*
|
|
3737
4161
|
* @category filtering
|
|
3738
4162
|
* @since 2.0.0
|
|
@@ -3742,12 +4166,14 @@ export declare const getLefts: <T extends Iterable<array_<any, any>>>(self: T) =
|
|
|
3742
4166
|
* Retrieves the `Right` values from an `Iterable` of `Either`s, collecting them into an array.
|
|
3743
4167
|
*
|
|
3744
4168
|
* @example
|
|
4169
|
+
* ```ts
|
|
3745
4170
|
* import { Array, Either } from "effect"
|
|
3746
4171
|
*
|
|
3747
4172
|
* assert.deepStrictEqual(
|
|
3748
4173
|
* Array.getRights([Either.right(1), Either.left("err"), Either.right(2)]),
|
|
3749
4174
|
* [1, 2]
|
|
3750
4175
|
* )
|
|
4176
|
+
* ```
|
|
3751
4177
|
*
|
|
3752
4178
|
* @category filtering
|
|
3753
4179
|
* @since 2.0.0
|
|
@@ -3819,11 +4245,13 @@ export declare const partition: {
|
|
|
3819
4245
|
* Separates an `Iterable` into two arrays based on a predicate.
|
|
3820
4246
|
*
|
|
3821
4247
|
* @example
|
|
4248
|
+
* ```ts
|
|
3822
4249
|
* import { Array } from "effect"
|
|
3823
4250
|
*
|
|
3824
4251
|
* const numbers = [1, 2, 3, 4]
|
|
3825
4252
|
* const result = Array.partition(numbers, n => n % 2 === 0)
|
|
3826
4253
|
* assert.deepStrictEqual(result, [[1, 3], [2, 4]])
|
|
4254
|
+
* ```
|
|
3827
4255
|
*
|
|
3828
4256
|
* @category filtering
|
|
3829
4257
|
* @since 2.0.0
|
|
@@ -3833,11 +4261,13 @@ export declare const separate: <T extends Iterable<array_<any, any>>>(self: T) =
|
|
|
3833
4261
|
* Reduces an array from the left.
|
|
3834
4262
|
*
|
|
3835
4263
|
* @example
|
|
4264
|
+
* ```ts
|
|
3836
4265
|
* import { Array } from "effect"
|
|
3837
4266
|
*
|
|
3838
4267
|
* const numbers = [1, 2, 3]
|
|
3839
4268
|
* const result = Array.reduce(numbers, 0, (acc, n) => acc + n)
|
|
3840
4269
|
* assert.deepStrictEqual(result, 6)
|
|
4270
|
+
* ```
|
|
3841
4271
|
*
|
|
3842
4272
|
* @category folding
|
|
3843
4273
|
* @since 2.0.0
|
|
@@ -3847,11 +4277,13 @@ export declare const reduce: {
|
|
|
3847
4277
|
* Reduces an array from the left.
|
|
3848
4278
|
*
|
|
3849
4279
|
* @example
|
|
4280
|
+
* ```ts
|
|
3850
4281
|
* import { Array } from "effect"
|
|
3851
4282
|
*
|
|
3852
4283
|
* const numbers = [1, 2, 3]
|
|
3853
4284
|
* const result = Array.reduce(numbers, 0, (acc, n) => acc + n)
|
|
3854
4285
|
* assert.deepStrictEqual(result, 6)
|
|
4286
|
+
* ```
|
|
3855
4287
|
*
|
|
3856
4288
|
* @category folding
|
|
3857
4289
|
* @since 2.0.0
|
|
@@ -3861,11 +4293,13 @@ export declare const reduce: {
|
|
|
3861
4293
|
* Reduces an array from the left.
|
|
3862
4294
|
*
|
|
3863
4295
|
* @example
|
|
4296
|
+
* ```ts
|
|
3864
4297
|
* import { Array } from "effect"
|
|
3865
4298
|
*
|
|
3866
4299
|
* const numbers = [1, 2, 3]
|
|
3867
4300
|
* const result = Array.reduce(numbers, 0, (acc, n) => acc + n)
|
|
3868
4301
|
* assert.deepStrictEqual(result, 6)
|
|
4302
|
+
* ```
|
|
3869
4303
|
*
|
|
3870
4304
|
* @category folding
|
|
3871
4305
|
* @since 2.0.0
|
|
@@ -3876,11 +4310,13 @@ export declare const reduce: {
|
|
|
3876
4310
|
* Reduces an array from the right.
|
|
3877
4311
|
*
|
|
3878
4312
|
* @example
|
|
4313
|
+
* ```ts
|
|
3879
4314
|
* import { Array } from "effect"
|
|
3880
4315
|
*
|
|
3881
4316
|
* const numbers = [1, 2, 3]
|
|
3882
4317
|
* const result = Array.reduceRight(numbers, 0, (acc, n) => acc + n)
|
|
3883
4318
|
* assert.deepStrictEqual(result, 6)
|
|
4319
|
+
* ```
|
|
3884
4320
|
*
|
|
3885
4321
|
* @category folding
|
|
3886
4322
|
* @since 2.0.0
|
|
@@ -3890,11 +4326,13 @@ export declare const reduceRight: {
|
|
|
3890
4326
|
* Reduces an array from the right.
|
|
3891
4327
|
*
|
|
3892
4328
|
* @example
|
|
4329
|
+
* ```ts
|
|
3893
4330
|
* import { Array } from "effect"
|
|
3894
4331
|
*
|
|
3895
4332
|
* const numbers = [1, 2, 3]
|
|
3896
4333
|
* const result = Array.reduceRight(numbers, 0, (acc, n) => acc + n)
|
|
3897
4334
|
* assert.deepStrictEqual(result, 6)
|
|
4335
|
+
* ```
|
|
3898
4336
|
*
|
|
3899
4337
|
* @category folding
|
|
3900
4338
|
* @since 2.0.0
|
|
@@ -3904,11 +4342,13 @@ export declare const reduceRight: {
|
|
|
3904
4342
|
* Reduces an array from the right.
|
|
3905
4343
|
*
|
|
3906
4344
|
* @example
|
|
4345
|
+
* ```ts
|
|
3907
4346
|
* import { Array } from "effect"
|
|
3908
4347
|
*
|
|
3909
4348
|
* const numbers = [1, 2, 3]
|
|
3910
4349
|
* const result = Array.reduceRight(numbers, 0, (acc, n) => acc + n)
|
|
3911
4350
|
* assert.deepStrictEqual(result, 6)
|
|
4351
|
+
* ```
|
|
3912
4352
|
*
|
|
3913
4353
|
* @category folding
|
|
3914
4354
|
* @since 2.0.0
|
|
@@ -3919,12 +4359,14 @@ export declare const reduceRight: {
|
|
|
3919
4359
|
* Lifts a predicate into an array.
|
|
3920
4360
|
*
|
|
3921
4361
|
* @example
|
|
4362
|
+
* ```ts
|
|
3922
4363
|
* import { Array } from "effect"
|
|
3923
4364
|
*
|
|
3924
4365
|
* const isEven = (n: number) => n % 2 === 0
|
|
3925
4366
|
* const to = Array.liftPredicate(isEven)
|
|
3926
4367
|
* assert.deepStrictEqual(to(1), [])
|
|
3927
4368
|
* assert.deepStrictEqual(to(2), [2])
|
|
4369
|
+
* ```
|
|
3928
4370
|
*
|
|
3929
4371
|
* @category lifting
|
|
3930
4372
|
* @since 2.0.0
|
|
@@ -3935,12 +4377,14 @@ export declare const liftPredicate: {
|
|
|
3935
4377
|
* Lifts a predicate into an array.
|
|
3936
4378
|
*
|
|
3937
4379
|
* @example
|
|
4380
|
+
* ```ts
|
|
3938
4381
|
* import { Array } from "effect"
|
|
3939
4382
|
*
|
|
3940
4383
|
* const isEven = (n: number) => n % 2 === 0
|
|
3941
4384
|
* const to = Array.liftPredicate(isEven)
|
|
3942
4385
|
* assert.deepStrictEqual(to(1), [])
|
|
3943
4386
|
* assert.deepStrictEqual(to(2), [2])
|
|
4387
|
+
* ```
|
|
3944
4388
|
*
|
|
3945
4389
|
* @category lifting
|
|
3946
4390
|
* @since 2.0.0
|
|
@@ -3966,6 +4410,7 @@ export declare const liftNullable: <A extends Array<unknown>, B>(f: (...a: A) =>
|
|
|
3966
4410
|
* Maps over an array and flattens the result, removing null and undefined values.
|
|
3967
4411
|
*
|
|
3968
4412
|
* @example
|
|
4413
|
+
* ```ts
|
|
3969
4414
|
* import { Array } from "effect"
|
|
3970
4415
|
*
|
|
3971
4416
|
* const numbers = [1, 2, 3]
|
|
@@ -3976,6 +4421,7 @@ export declare const liftNullable: <A extends Array<unknown>, B>(f: (...a: A) =>
|
|
|
3976
4421
|
* // The array of numbers [1, 2, 3] is mapped with a function that returns null for even numbers
|
|
3977
4422
|
* // and the number itself for odd numbers. The resulting array [1, null, 3] is then flattened
|
|
3978
4423
|
* // to remove null values, resulting in [1, 3].
|
|
4424
|
+
* ```
|
|
3979
4425
|
*
|
|
3980
4426
|
* @category sequencing
|
|
3981
4427
|
* @since 2.0.0
|
|
@@ -3985,6 +4431,7 @@ export declare const flatMapNullable: {
|
|
|
3985
4431
|
* Maps over an array and flattens the result, removing null and undefined values.
|
|
3986
4432
|
*
|
|
3987
4433
|
* @example
|
|
4434
|
+
* ```ts
|
|
3988
4435
|
* import { Array } from "effect"
|
|
3989
4436
|
*
|
|
3990
4437
|
* const numbers = [1, 2, 3]
|
|
@@ -3995,6 +4442,7 @@ export declare const flatMapNullable: {
|
|
|
3995
4442
|
* // The array of numbers [1, 2, 3] is mapped with a function that returns null for even numbers
|
|
3996
4443
|
* // and the number itself for odd numbers. The resulting array [1, null, 3] is then flattened
|
|
3997
4444
|
* // to remove null values, resulting in [1, 3].
|
|
4445
|
+
* ```
|
|
3998
4446
|
*
|
|
3999
4447
|
* @category sequencing
|
|
4000
4448
|
* @since 2.0.0
|
|
@@ -4004,6 +4452,7 @@ export declare const flatMapNullable: {
|
|
|
4004
4452
|
* Maps over an array and flattens the result, removing null and undefined values.
|
|
4005
4453
|
*
|
|
4006
4454
|
* @example
|
|
4455
|
+
* ```ts
|
|
4007
4456
|
* import { Array } from "effect"
|
|
4008
4457
|
*
|
|
4009
4458
|
* const numbers = [1, 2, 3]
|
|
@@ -4014,6 +4463,7 @@ export declare const flatMapNullable: {
|
|
|
4014
4463
|
* // The array of numbers [1, 2, 3] is mapped with a function that returns null for even numbers
|
|
4015
4464
|
* // and the number itself for odd numbers. The resulting array [1, null, 3] is then flattened
|
|
4016
4465
|
* // to remove null values, resulting in [1, 3].
|
|
4466
|
+
* ```
|
|
4017
4467
|
*
|
|
4018
4468
|
* @category sequencing
|
|
4019
4469
|
* @since 2.0.0
|
|
@@ -4026,6 +4476,7 @@ export declare const flatMapNullable: {
|
|
|
4026
4476
|
* If the `Either` is a right, it returns an array with the right value.
|
|
4027
4477
|
*
|
|
4028
4478
|
* @example
|
|
4479
|
+
* ```ts
|
|
4029
4480
|
* import { Array, Either } from "effect"
|
|
4030
4481
|
*
|
|
4031
4482
|
* const parseNumber = (s: string): Either.Either<number, Error> =>
|
|
@@ -4043,6 +4494,7 @@ export declare const flatMapNullable: {
|
|
|
4043
4494
|
* // The function parseNumber is lifted to return an array.
|
|
4044
4495
|
* // When parsing "42", it returns an Either.left with the number 42, resulting in [42].
|
|
4045
4496
|
* // When parsing "not a number", it returns an Either.right with an error, resulting in an empty array [].
|
|
4497
|
+
* ```
|
|
4046
4498
|
*
|
|
4047
4499
|
* @category lifting
|
|
4048
4500
|
* @since 2.0.0
|
|
@@ -4110,6 +4562,7 @@ export declare const some: {
|
|
|
4110
4562
|
* Extends an array with a function that maps each subarray to a value.
|
|
4111
4563
|
*
|
|
4112
4564
|
* @example
|
|
4565
|
+
* ```ts
|
|
4113
4566
|
* import { Array } from "effect"
|
|
4114
4567
|
*
|
|
4115
4568
|
* const numbers = [1, 2, 3]
|
|
@@ -4121,6 +4574,7 @@ export declare const some: {
|
|
|
4121
4574
|
* // The subarrays are: [1, 2, 3], [2, 3], [3].
|
|
4122
4575
|
* // The lengths are: 3, 2, 1.
|
|
4123
4576
|
* // Therefore, the result is [3, 2, 1].
|
|
4577
|
+
* ```
|
|
4124
4578
|
*
|
|
4125
4579
|
* @since 2.0.0
|
|
4126
4580
|
*/
|
|
@@ -4129,6 +4583,7 @@ export declare const extend: {
|
|
|
4129
4583
|
* Extends an array with a function that maps each subarray to a value.
|
|
4130
4584
|
*
|
|
4131
4585
|
* @example
|
|
4586
|
+
* ```ts
|
|
4132
4587
|
* import { Array } from "effect"
|
|
4133
4588
|
*
|
|
4134
4589
|
* const numbers = [1, 2, 3]
|
|
@@ -4140,6 +4595,7 @@ export declare const extend: {
|
|
|
4140
4595
|
* // The subarrays are: [1, 2, 3], [2, 3], [3].
|
|
4141
4596
|
* // The lengths are: 3, 2, 1.
|
|
4142
4597
|
* // Therefore, the result is [3, 2, 1].
|
|
4598
|
+
* ```
|
|
4143
4599
|
*
|
|
4144
4600
|
* @since 2.0.0
|
|
4145
4601
|
*/
|
|
@@ -4148,6 +4604,7 @@ export declare const extend: {
|
|
|
4148
4604
|
* Extends an array with a function that maps each subarray to a value.
|
|
4149
4605
|
*
|
|
4150
4606
|
* @example
|
|
4607
|
+
* ```ts
|
|
4151
4608
|
* import { Array } from "effect"
|
|
4152
4609
|
*
|
|
4153
4610
|
* const numbers = [1, 2, 3]
|
|
@@ -4159,6 +4616,7 @@ export declare const extend: {
|
|
|
4159
4616
|
* // The subarrays are: [1, 2, 3], [2, 3], [3].
|
|
4160
4617
|
* // The lengths are: 3, 2, 1.
|
|
4161
4618
|
* // Therefore, the result is [3, 2, 1].
|
|
4619
|
+
* ```
|
|
4162
4620
|
*
|
|
4163
4621
|
* @since 2.0.0
|
|
4164
4622
|
*/
|
|
@@ -4168,10 +4626,12 @@ export declare const extend: {
|
|
|
4168
4626
|
* Finds the minimum element in an array based on a comparator.
|
|
4169
4627
|
*
|
|
4170
4628
|
* @example
|
|
4629
|
+
* ```ts
|
|
4171
4630
|
* import { Array, Order } from "effect"
|
|
4172
4631
|
*
|
|
4173
4632
|
* const min = Array.min([3, 1, 2], Order.number)
|
|
4174
4633
|
* assert.deepStrictEqual(min, 1)
|
|
4634
|
+
* ```
|
|
4175
4635
|
*
|
|
4176
4636
|
* @since 2.0.0
|
|
4177
4637
|
*/
|
|
@@ -4180,10 +4640,12 @@ export declare const min: {
|
|
|
4180
4640
|
* Finds the minimum element in an array based on a comparator.
|
|
4181
4641
|
*
|
|
4182
4642
|
* @example
|
|
4643
|
+
* ```ts
|
|
4183
4644
|
* import { Array, Order } from "effect"
|
|
4184
4645
|
*
|
|
4185
4646
|
* const min = Array.min([3, 1, 2], Order.number)
|
|
4186
4647
|
* assert.deepStrictEqual(min, 1)
|
|
4648
|
+
* ```
|
|
4187
4649
|
*
|
|
4188
4650
|
* @since 2.0.0
|
|
4189
4651
|
*/
|
|
@@ -4192,10 +4654,12 @@ export declare const min: {
|
|
|
4192
4654
|
* Finds the minimum element in an array based on a comparator.
|
|
4193
4655
|
*
|
|
4194
4656
|
* @example
|
|
4657
|
+
* ```ts
|
|
4195
4658
|
* import { Array, Order } from "effect"
|
|
4196
4659
|
*
|
|
4197
4660
|
* const min = Array.min([3, 1, 2], Order.number)
|
|
4198
4661
|
* assert.deepStrictEqual(min, 1)
|
|
4662
|
+
* ```
|
|
4199
4663
|
*
|
|
4200
4664
|
* @since 2.0.0
|
|
4201
4665
|
*/
|
|
@@ -4205,10 +4669,12 @@ export declare const min: {
|
|
|
4205
4669
|
* Finds the maximum element in an array based on a comparator.
|
|
4206
4670
|
*
|
|
4207
4671
|
* @example
|
|
4672
|
+
* ```ts
|
|
4208
4673
|
* import { Array, Order } from "effect"
|
|
4209
4674
|
*
|
|
4210
4675
|
* const max = Array.max([3, 1, 2], Order.number)
|
|
4211
4676
|
* assert.deepStrictEqual(max, 3)
|
|
4677
|
+
* ```
|
|
4212
4678
|
*
|
|
4213
4679
|
* @since 2.0.0
|
|
4214
4680
|
*/
|
|
@@ -4217,10 +4683,12 @@ export declare const max: {
|
|
|
4217
4683
|
* Finds the maximum element in an array based on a comparator.
|
|
4218
4684
|
*
|
|
4219
4685
|
* @example
|
|
4686
|
+
* ```ts
|
|
4220
4687
|
* import { Array, Order } from "effect"
|
|
4221
4688
|
*
|
|
4222
4689
|
* const max = Array.max([3, 1, 2], Order.number)
|
|
4223
4690
|
* assert.deepStrictEqual(max, 3)
|
|
4691
|
+
* ```
|
|
4224
4692
|
*
|
|
4225
4693
|
* @since 2.0.0
|
|
4226
4694
|
*/
|
|
@@ -4229,10 +4697,12 @@ export declare const max: {
|
|
|
4229
4697
|
* Finds the maximum element in an array based on a comparator.
|
|
4230
4698
|
*
|
|
4231
4699
|
* @example
|
|
4700
|
+
* ```ts
|
|
4232
4701
|
* import { Array, Order } from "effect"
|
|
4233
4702
|
*
|
|
4234
4703
|
* const max = Array.max([3, 1, 2], Order.number)
|
|
4235
4704
|
* assert.deepStrictEqual(max, 3)
|
|
4705
|
+
* ```
|
|
4236
4706
|
*
|
|
4237
4707
|
* @since 2.0.0
|
|
4238
4708
|
*/
|
|
@@ -4257,12 +4727,14 @@ export declare const getOrder: <A>(O: Order.Order<A>) => Order.Order<ReadonlyArr
|
|
|
4257
4727
|
* Creates an equivalence relation for arrays.
|
|
4258
4728
|
*
|
|
4259
4729
|
* @example
|
|
4730
|
+
* ```ts
|
|
4260
4731
|
* import { Array } from "effect"
|
|
4261
4732
|
*
|
|
4262
4733
|
* const numbers1 = [1, 2, 3]
|
|
4263
4734
|
* const numbers2 = [1, 2, 3]
|
|
4264
4735
|
* const eq = Array.getEquivalence<number>((a, b) => a === b)
|
|
4265
4736
|
* assert.deepStrictEqual(eq(numbers1, numbers2), true)
|
|
4737
|
+
* ```
|
|
4266
4738
|
*
|
|
4267
4739
|
* @category instances
|
|
4268
4740
|
* @since 2.0.0
|
|
@@ -4272,10 +4744,12 @@ export declare const getEquivalence: <A>(isEquivalent: Equivalence.Equivalence<A
|
|
|
4272
4744
|
* Performs a side-effect for each element of the `Iterable`.
|
|
4273
4745
|
*
|
|
4274
4746
|
* @example
|
|
4747
|
+
* ```ts
|
|
4275
4748
|
* import { Array } from "effect"
|
|
4276
4749
|
*
|
|
4277
4750
|
* const numbers = [1, 2, 3]
|
|
4278
4751
|
* Array.forEach(numbers, n => console.log(n)) // 1, 2, 3
|
|
4752
|
+
* ```
|
|
4279
4753
|
*
|
|
4280
4754
|
* @since 2.0.0
|
|
4281
4755
|
*/
|
|
@@ -4284,10 +4758,12 @@ export declare const forEach: {
|
|
|
4284
4758
|
* Performs a side-effect for each element of the `Iterable`.
|
|
4285
4759
|
*
|
|
4286
4760
|
* @example
|
|
4761
|
+
* ```ts
|
|
4287
4762
|
* import { Array } from "effect"
|
|
4288
4763
|
*
|
|
4289
4764
|
* const numbers = [1, 2, 3]
|
|
4290
4765
|
* Array.forEach(numbers, n => console.log(n)) // 1, 2, 3
|
|
4766
|
+
* ```
|
|
4291
4767
|
*
|
|
4292
4768
|
* @since 2.0.0
|
|
4293
4769
|
*/
|
|
@@ -4296,10 +4772,12 @@ export declare const forEach: {
|
|
|
4296
4772
|
* Performs a side-effect for each element of the `Iterable`.
|
|
4297
4773
|
*
|
|
4298
4774
|
* @example
|
|
4775
|
+
* ```ts
|
|
4299
4776
|
* import { Array } from "effect"
|
|
4300
4777
|
*
|
|
4301
4778
|
* const numbers = [1, 2, 3]
|
|
4302
4779
|
* Array.forEach(numbers, n => console.log(n)) // 1, 2, 3
|
|
4780
|
+
* ```
|
|
4303
4781
|
*
|
|
4304
4782
|
* @since 2.0.0
|
|
4305
4783
|
*/
|
|
@@ -4310,11 +4788,13 @@ export declare const forEach: {
|
|
|
4310
4788
|
* preserving the order of the first occurrence of each element.
|
|
4311
4789
|
*
|
|
4312
4790
|
* @example
|
|
4791
|
+
* ```ts
|
|
4313
4792
|
* import { Array } from "effect"
|
|
4314
4793
|
*
|
|
4315
4794
|
* const numbers = [1, 2, 2, 3, 3, 3]
|
|
4316
4795
|
* const unique = Array.dedupeWith(numbers, (a, b) => a === b)
|
|
4317
4796
|
* assert.deepStrictEqual(unique, [1, 2, 3])
|
|
4797
|
+
* ```
|
|
4318
4798
|
*
|
|
4319
4799
|
* @since 2.0.0
|
|
4320
4800
|
*/
|
|
@@ -4324,11 +4804,13 @@ export declare const dedupeWith: {
|
|
|
4324
4804
|
* preserving the order of the first occurrence of each element.
|
|
4325
4805
|
*
|
|
4326
4806
|
* @example
|
|
4807
|
+
* ```ts
|
|
4327
4808
|
* import { Array } from "effect"
|
|
4328
4809
|
*
|
|
4329
4810
|
* const numbers = [1, 2, 2, 3, 3, 3]
|
|
4330
4811
|
* const unique = Array.dedupeWith(numbers, (a, b) => a === b)
|
|
4331
4812
|
* assert.deepStrictEqual(unique, [1, 2, 3])
|
|
4813
|
+
* ```
|
|
4332
4814
|
*
|
|
4333
4815
|
* @since 2.0.0
|
|
4334
4816
|
*/
|
|
@@ -4338,11 +4820,13 @@ export declare const dedupeWith: {
|
|
|
4338
4820
|
* preserving the order of the first occurrence of each element.
|
|
4339
4821
|
*
|
|
4340
4822
|
* @example
|
|
4823
|
+
* ```ts
|
|
4341
4824
|
* import { Array } from "effect"
|
|
4342
4825
|
*
|
|
4343
4826
|
* const numbers = [1, 2, 2, 3, 3, 3]
|
|
4344
4827
|
* const unique = Array.dedupeWith(numbers, (a, b) => a === b)
|
|
4345
4828
|
* assert.deepStrictEqual(unique, [1, 2, 3])
|
|
4829
|
+
* ```
|
|
4346
4830
|
*
|
|
4347
4831
|
* @since 2.0.0
|
|
4348
4832
|
*/
|
|
@@ -4352,11 +4836,13 @@ export declare const dedupeWith: {
|
|
|
4352
4836
|
* preserving the order of the first occurrence of each element.
|
|
4353
4837
|
*
|
|
4354
4838
|
* @example
|
|
4839
|
+
* ```ts
|
|
4355
4840
|
* import { Array } from "effect"
|
|
4356
4841
|
*
|
|
4357
4842
|
* const numbers = [1, 2, 2, 3, 3, 3]
|
|
4358
4843
|
* const unique = Array.dedupeWith(numbers, (a, b) => a === b)
|
|
4359
4844
|
* assert.deepStrictEqual(unique, [1, 2, 3])
|
|
4845
|
+
* ```
|
|
4360
4846
|
*
|
|
4361
4847
|
* @since 2.0.0
|
|
4362
4848
|
*/
|
|
@@ -4373,11 +4859,13 @@ export declare const dedupe: <S extends Iterable<any> | NonEmptyReadonlyArray<an
|
|
|
4373
4859
|
* Deduplicates adjacent elements that are identical using the provided `isEquivalent` function.
|
|
4374
4860
|
*
|
|
4375
4861
|
* @example
|
|
4862
|
+
* ```ts
|
|
4376
4863
|
* import { Array } from "effect"
|
|
4377
4864
|
*
|
|
4378
4865
|
* const numbers = [1, 1, 2, 2, 3, 3]
|
|
4379
4866
|
* const unique = Array.dedupeAdjacentWith(numbers, (a, b) => a === b)
|
|
4380
4867
|
* assert.deepStrictEqual(unique, [1, 2, 3])
|
|
4868
|
+
* ```
|
|
4381
4869
|
*
|
|
4382
4870
|
* @since 2.0.0
|
|
4383
4871
|
*/
|
|
@@ -4386,11 +4874,13 @@ export declare const dedupeAdjacentWith: {
|
|
|
4386
4874
|
* Deduplicates adjacent elements that are identical using the provided `isEquivalent` function.
|
|
4387
4875
|
*
|
|
4388
4876
|
* @example
|
|
4877
|
+
* ```ts
|
|
4389
4878
|
* import { Array } from "effect"
|
|
4390
4879
|
*
|
|
4391
4880
|
* const numbers = [1, 1, 2, 2, 3, 3]
|
|
4392
4881
|
* const unique = Array.dedupeAdjacentWith(numbers, (a, b) => a === b)
|
|
4393
4882
|
* assert.deepStrictEqual(unique, [1, 2, 3])
|
|
4883
|
+
* ```
|
|
4394
4884
|
*
|
|
4395
4885
|
* @since 2.0.0
|
|
4396
4886
|
*/
|
|
@@ -4399,11 +4889,13 @@ export declare const dedupeAdjacentWith: {
|
|
|
4399
4889
|
* Deduplicates adjacent elements that are identical using the provided `isEquivalent` function.
|
|
4400
4890
|
*
|
|
4401
4891
|
* @example
|
|
4892
|
+
* ```ts
|
|
4402
4893
|
* import { Array } from "effect"
|
|
4403
4894
|
*
|
|
4404
4895
|
* const numbers = [1, 1, 2, 2, 3, 3]
|
|
4405
4896
|
* const unique = Array.dedupeAdjacentWith(numbers, (a, b) => a === b)
|
|
4406
4897
|
* assert.deepStrictEqual(unique, [1, 2, 3])
|
|
4898
|
+
* ```
|
|
4407
4899
|
*
|
|
4408
4900
|
* @since 2.0.0
|
|
4409
4901
|
*/
|
|
@@ -4413,11 +4905,13 @@ export declare const dedupeAdjacentWith: {
|
|
|
4413
4905
|
* Deduplicates adjacent elements that are identical.
|
|
4414
4906
|
*
|
|
4415
4907
|
* @example
|
|
4908
|
+
* ```ts
|
|
4416
4909
|
* import { Array } from "effect"
|
|
4417
4910
|
*
|
|
4418
4911
|
* const numbers = [1, 1, 2, 2, 3, 3]
|
|
4419
4912
|
* const unique = Array.dedupeAdjacent(numbers)
|
|
4420
4913
|
* assert.deepStrictEqual(unique, [1, 2, 3])
|
|
4914
|
+
* ```
|
|
4421
4915
|
*
|
|
4422
4916
|
* @since 2.0.0
|
|
4423
4917
|
*/
|
|
@@ -4426,11 +4920,13 @@ export declare const dedupeAdjacent: <A>(self: Iterable<A>) => Array<A>;
|
|
|
4426
4920
|
* Joins the elements together with "sep" in the middle.
|
|
4427
4921
|
*
|
|
4428
4922
|
* @example
|
|
4923
|
+
* ```ts
|
|
4429
4924
|
* import { Array } from "effect"
|
|
4430
4925
|
*
|
|
4431
4926
|
* const strings = ["a", "b", "c"]
|
|
4432
4927
|
* const joined = Array.join(strings, "-")
|
|
4433
4928
|
* assert.deepStrictEqual(joined, "a-b-c")
|
|
4929
|
+
* ```
|
|
4434
4930
|
*
|
|
4435
4931
|
* @since 2.0.0
|
|
4436
4932
|
* @category folding
|
|
@@ -4440,11 +4936,13 @@ export declare const join: {
|
|
|
4440
4936
|
* Joins the elements together with "sep" in the middle.
|
|
4441
4937
|
*
|
|
4442
4938
|
* @example
|
|
4939
|
+
* ```ts
|
|
4443
4940
|
* import { Array } from "effect"
|
|
4444
4941
|
*
|
|
4445
4942
|
* const strings = ["a", "b", "c"]
|
|
4446
4943
|
* const joined = Array.join(strings, "-")
|
|
4447
4944
|
* assert.deepStrictEqual(joined, "a-b-c")
|
|
4945
|
+
* ```
|
|
4448
4946
|
*
|
|
4449
4947
|
* @since 2.0.0
|
|
4450
4948
|
* @category folding
|
|
@@ -4454,11 +4952,13 @@ export declare const join: {
|
|
|
4454
4952
|
* Joins the elements together with "sep" in the middle.
|
|
4455
4953
|
*
|
|
4456
4954
|
* @example
|
|
4955
|
+
* ```ts
|
|
4457
4956
|
* import { Array } from "effect"
|
|
4458
4957
|
*
|
|
4459
4958
|
* const strings = ["a", "b", "c"]
|
|
4460
4959
|
* const joined = Array.join(strings, "-")
|
|
4461
4960
|
* assert.deepStrictEqual(joined, "a-b-c")
|
|
4961
|
+
* ```
|
|
4462
4962
|
*
|
|
4463
4963
|
* @since 2.0.0
|
|
4464
4964
|
* @category folding
|
|
@@ -4469,11 +4969,13 @@ export declare const join: {
|
|
|
4469
4969
|
* Statefully maps over the chunk, producing new elements of type `B`.
|
|
4470
4970
|
*
|
|
4471
4971
|
* @example
|
|
4972
|
+
* ```ts
|
|
4472
4973
|
* import { Array } from "effect"
|
|
4473
4974
|
*
|
|
4474
4975
|
* const numbers = [1, 2, 3]
|
|
4475
4976
|
* const result = Array.mapAccum(numbers, 0, (acc, n) => [acc + n, acc + n])
|
|
4476
4977
|
* assert.deepStrictEqual(result, [6, [1, 3, 6]])
|
|
4978
|
+
* ```
|
|
4477
4979
|
*
|
|
4478
4980
|
* @since 2.0.0
|
|
4479
4981
|
* @category folding
|
|
@@ -4483,11 +4985,13 @@ export declare const mapAccum: {
|
|
|
4483
4985
|
* Statefully maps over the chunk, producing new elements of type `B`.
|
|
4484
4986
|
*
|
|
4485
4987
|
* @example
|
|
4988
|
+
* ```ts
|
|
4486
4989
|
* import { Array } from "effect"
|
|
4487
4990
|
*
|
|
4488
4991
|
* const numbers = [1, 2, 3]
|
|
4489
4992
|
* const result = Array.mapAccum(numbers, 0, (acc, n) => [acc + n, acc + n])
|
|
4490
4993
|
* assert.deepStrictEqual(result, [6, [1, 3, 6]])
|
|
4994
|
+
* ```
|
|
4491
4995
|
*
|
|
4492
4996
|
* @since 2.0.0
|
|
4493
4997
|
* @category folding
|
|
@@ -4497,11 +5001,13 @@ export declare const mapAccum: {
|
|
|
4497
5001
|
* Statefully maps over the chunk, producing new elements of type `B`.
|
|
4498
5002
|
*
|
|
4499
5003
|
* @example
|
|
5004
|
+
* ```ts
|
|
4500
5005
|
* import { Array } from "effect"
|
|
4501
5006
|
*
|
|
4502
5007
|
* const numbers = [1, 2, 3]
|
|
4503
5008
|
* const result = Array.mapAccum(numbers, 0, (acc, n) => [acc + n, acc + n])
|
|
4504
5009
|
* assert.deepStrictEqual(result, [6, [1, 3, 6]])
|
|
5010
|
+
* ```
|
|
4505
5011
|
*
|
|
4506
5012
|
* @since 2.0.0
|
|
4507
5013
|
* @category folding
|
|
@@ -4512,12 +5018,14 @@ export declare const mapAccum: {
|
|
|
4512
5018
|
* Zips this chunk crosswise with the specified chunk using the specified combiner.
|
|
4513
5019
|
*
|
|
4514
5020
|
* @example
|
|
5021
|
+
* ```ts
|
|
4515
5022
|
* import { Array } from "effect"
|
|
4516
5023
|
*
|
|
4517
5024
|
* const array1 = [1, 2]
|
|
4518
5025
|
* const array2 = ["a", "b"]
|
|
4519
5026
|
* const product = Array.cartesianWith(array1, array2, (a, b) => `${a}-${b}`)
|
|
4520
5027
|
* assert.deepStrictEqual(product, ["1-a", "1-b", "2-a", "2-b"])
|
|
5028
|
+
* ```
|
|
4521
5029
|
*
|
|
4522
5030
|
* @since 2.0.0
|
|
4523
5031
|
* @category elements
|
|
@@ -4527,12 +5035,14 @@ export declare const cartesianWith: {
|
|
|
4527
5035
|
* Zips this chunk crosswise with the specified chunk using the specified combiner.
|
|
4528
5036
|
*
|
|
4529
5037
|
* @example
|
|
5038
|
+
* ```ts
|
|
4530
5039
|
* import { Array } from "effect"
|
|
4531
5040
|
*
|
|
4532
5041
|
* const array1 = [1, 2]
|
|
4533
5042
|
* const array2 = ["a", "b"]
|
|
4534
5043
|
* const product = Array.cartesianWith(array1, array2, (a, b) => `${a}-${b}`)
|
|
4535
5044
|
* assert.deepStrictEqual(product, ["1-a", "1-b", "2-a", "2-b"])
|
|
5045
|
+
* ```
|
|
4536
5046
|
*
|
|
4537
5047
|
* @since 2.0.0
|
|
4538
5048
|
* @category elements
|
|
@@ -4542,12 +5052,14 @@ export declare const cartesianWith: {
|
|
|
4542
5052
|
* Zips this chunk crosswise with the specified chunk using the specified combiner.
|
|
4543
5053
|
*
|
|
4544
5054
|
* @example
|
|
5055
|
+
* ```ts
|
|
4545
5056
|
* import { Array } from "effect"
|
|
4546
5057
|
*
|
|
4547
5058
|
* const array1 = [1, 2]
|
|
4548
5059
|
* const array2 = ["a", "b"]
|
|
4549
5060
|
* const product = Array.cartesianWith(array1, array2, (a, b) => `${a}-${b}`)
|
|
4550
5061
|
* assert.deepStrictEqual(product, ["1-a", "1-b", "2-a", "2-b"])
|
|
5062
|
+
* ```
|
|
4551
5063
|
*
|
|
4552
5064
|
* @since 2.0.0
|
|
4553
5065
|
* @category elements
|
|
@@ -4558,12 +5070,14 @@ export declare const cartesianWith: {
|
|
|
4558
5070
|
* Zips this chunk crosswise with the specified chunk.
|
|
4559
5071
|
*
|
|
4560
5072
|
* @example
|
|
5073
|
+
* ```ts
|
|
4561
5074
|
* import { Array } from "effect"
|
|
4562
5075
|
*
|
|
4563
5076
|
* const array1 = [1, 2]
|
|
4564
5077
|
* const array2 = ["a", "b"]
|
|
4565
5078
|
* const product = Array.cartesian(array1, array2)
|
|
4566
5079
|
* assert.deepStrictEqual(product, [[1, "a"], [1, "b"], [2, "a"], [2, "b"]])
|
|
5080
|
+
* ```
|
|
4567
5081
|
*
|
|
4568
5082
|
* @since 2.0.0
|
|
4569
5083
|
* @category elements
|
|
@@ -4573,12 +5087,14 @@ export declare const cartesian: {
|
|
|
4573
5087
|
* Zips this chunk crosswise with the specified chunk.
|
|
4574
5088
|
*
|
|
4575
5089
|
* @example
|
|
5090
|
+
* ```ts
|
|
4576
5091
|
* import { Array } from "effect"
|
|
4577
5092
|
*
|
|
4578
5093
|
* const array1 = [1, 2]
|
|
4579
5094
|
* const array2 = ["a", "b"]
|
|
4580
5095
|
* const product = Array.cartesian(array1, array2)
|
|
4581
5096
|
* assert.deepStrictEqual(product, [[1, "a"], [1, "b"], [2, "a"], [2, "b"]])
|
|
5097
|
+
* ```
|
|
4582
5098
|
*
|
|
4583
5099
|
* @since 2.0.0
|
|
4584
5100
|
* @category elements
|
|
@@ -4588,12 +5104,14 @@ export declare const cartesian: {
|
|
|
4588
5104
|
* Zips this chunk crosswise with the specified chunk.
|
|
4589
5105
|
*
|
|
4590
5106
|
* @example
|
|
5107
|
+
* ```ts
|
|
4591
5108
|
* import { Array } from "effect"
|
|
4592
5109
|
*
|
|
4593
5110
|
* const array1 = [1, 2]
|
|
4594
5111
|
* const array2 = ["a", "b"]
|
|
4595
5112
|
* const product = Array.cartesian(array1, array2)
|
|
4596
5113
|
* assert.deepStrictEqual(product, [[1, "a"], [1, "b"], [2, "a"], [2, "b"]])
|
|
5114
|
+
* ```
|
|
4597
5115
|
*
|
|
4598
5116
|
* @since 2.0.0
|
|
4599
5117
|
* @category elements
|
|
@@ -4619,6 +5137,7 @@ export declare const cartesian: {
|
|
|
4619
5137
|
* @see {@link let_ let}
|
|
4620
5138
|
*
|
|
4621
5139
|
* @example
|
|
5140
|
+
* ```ts
|
|
4622
5141
|
* import { Array as Arr, pipe } from "effect"
|
|
4623
5142
|
* const doResult = pipe(
|
|
4624
5143
|
* Arr.Do,
|
|
@@ -4639,6 +5158,7 @@ export declare const cartesian: {
|
|
|
4639
5158
|
* if(_x < _y) result.push([_x, _y] as const)
|
|
4640
5159
|
* }
|
|
4641
5160
|
* }
|
|
5161
|
+
* ```
|
|
4642
5162
|
*
|
|
4643
5163
|
* @category do notation
|
|
4644
5164
|
* @since 3.2.0
|
|
@@ -4663,6 +5183,7 @@ export declare const Do: ReadonlyArray<{}>;
|
|
|
4663
5183
|
* @see {@link let_ let}
|
|
4664
5184
|
*
|
|
4665
5185
|
* @example
|
|
5186
|
+
* ```ts
|
|
4666
5187
|
* import { Array as Arr, pipe } from "effect"
|
|
4667
5188
|
* const doResult = pipe(
|
|
4668
5189
|
* Arr.Do,
|
|
@@ -4683,6 +5204,7 @@ export declare const Do: ReadonlyArray<{}>;
|
|
|
4683
5204
|
* if(_x < _y) result.push([_x, _y] as const)
|
|
4684
5205
|
* }
|
|
4685
5206
|
* }
|
|
5207
|
+
* ```
|
|
4686
5208
|
*
|
|
4687
5209
|
* @category do notation
|
|
4688
5210
|
* @since 3.2.0
|
|
@@ -4707,6 +5229,7 @@ export declare const bind: {
|
|
|
4707
5229
|
* @see {@link let_ let}
|
|
4708
5230
|
*
|
|
4709
5231
|
* @example
|
|
5232
|
+
* ```ts
|
|
4710
5233
|
* import { Array as Arr, pipe } from "effect"
|
|
4711
5234
|
* const doResult = pipe(
|
|
4712
5235
|
* Arr.Do,
|
|
@@ -4727,6 +5250,7 @@ export declare const bind: {
|
|
|
4727
5250
|
* if(_x < _y) result.push([_x, _y] as const)
|
|
4728
5251
|
* }
|
|
4729
5252
|
* }
|
|
5253
|
+
* ```
|
|
4730
5254
|
*
|
|
4731
5255
|
* @category do notation
|
|
4732
5256
|
* @since 3.2.0
|
|
@@ -4753,6 +5277,7 @@ export declare const bind: {
|
|
|
4753
5277
|
* @see {@link let_ let}
|
|
4754
5278
|
*
|
|
4755
5279
|
* @example
|
|
5280
|
+
* ```ts
|
|
4756
5281
|
* import { Array as Arr, pipe } from "effect"
|
|
4757
5282
|
* const doResult = pipe(
|
|
4758
5283
|
* Arr.Do,
|
|
@@ -4773,6 +5298,7 @@ export declare const bind: {
|
|
|
4773
5298
|
* if(_x < _y) result.push([_x, _y] as const)
|
|
4774
5299
|
* }
|
|
4775
5300
|
* }
|
|
5301
|
+
* ```
|
|
4776
5302
|
*
|
|
4777
5303
|
* @category do notation
|
|
4778
5304
|
* @since 3.2.0
|
|
@@ -4800,6 +5326,7 @@ export declare const bind: {
|
|
|
4800
5326
|
* @see {@link let_ let}
|
|
4801
5327
|
*
|
|
4802
5328
|
* @example
|
|
5329
|
+
* ```ts
|
|
4803
5330
|
* import { Array as Arr, pipe } from "effect"
|
|
4804
5331
|
* const doResult = pipe(
|
|
4805
5332
|
* Arr.Do,
|
|
@@ -4820,6 +5347,7 @@ export declare const bind: {
|
|
|
4820
5347
|
* if(_x < _y) result.push([_x, _y] as const)
|
|
4821
5348
|
* }
|
|
4822
5349
|
* }
|
|
5350
|
+
* ```
|
|
4823
5351
|
*
|
|
4824
5352
|
* @category do notation
|
|
4825
5353
|
* @since 3.2.0
|
|
@@ -4844,6 +5372,7 @@ export declare const bindTo: {
|
|
|
4844
5372
|
* @see {@link let_ let}
|
|
4845
5373
|
*
|
|
4846
5374
|
* @example
|
|
5375
|
+
* ```ts
|
|
4847
5376
|
* import { Array as Arr, pipe } from "effect"
|
|
4848
5377
|
* const doResult = pipe(
|
|
4849
5378
|
* Arr.Do,
|
|
@@ -4864,6 +5393,7 @@ export declare const bindTo: {
|
|
|
4864
5393
|
* if(_x < _y) result.push([_x, _y] as const)
|
|
4865
5394
|
* }
|
|
4866
5395
|
* }
|
|
5396
|
+
* ```
|
|
4867
5397
|
*
|
|
4868
5398
|
* @category do notation
|
|
4869
5399
|
* @since 3.2.0
|
|
@@ -4890,6 +5420,7 @@ export declare const bindTo: {
|
|
|
4890
5420
|
* @see {@link let_ let}
|
|
4891
5421
|
*
|
|
4892
5422
|
* @example
|
|
5423
|
+
* ```ts
|
|
4893
5424
|
* import { Array as Arr, pipe } from "effect"
|
|
4894
5425
|
* const doResult = pipe(
|
|
4895
5426
|
* Arr.Do,
|
|
@@ -4910,6 +5441,7 @@ export declare const bindTo: {
|
|
|
4910
5441
|
* if(_x < _y) result.push([_x, _y] as const)
|
|
4911
5442
|
* }
|
|
4912
5443
|
* }
|
|
5444
|
+
* ```
|
|
4913
5445
|
*
|
|
4914
5446
|
* @category do notation
|
|
4915
5447
|
* @since 3.2.0
|
|
@@ -4946,6 +5478,7 @@ export {
|
|
|
4946
5478
|
* @see {@link Do}
|
|
4947
5479
|
*
|
|
4948
5480
|
* @example
|
|
5481
|
+
* ```ts
|
|
4949
5482
|
* import { Array as Arr, pipe } from "effect"
|
|
4950
5483
|
* const doResult = pipe(
|
|
4951
5484
|
* Arr.Do,
|
|
@@ -4967,6 +5500,7 @@ export {
|
|
|
4967
5500
|
* }
|
|
4968
5501
|
* }
|
|
4969
5502
|
*
|
|
5503
|
+
* ```
|
|
4970
5504
|
* @category do notation
|
|
4971
5505
|
* @since 3.2.0
|
|
4972
5506
|
*/
|