effect 3.13.8 → 3.13.9
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 +460 -431
- package/dist/cjs/Array.js.map +1 -1
- package/dist/cjs/BigDecimal.js +31 -89
- package/dist/cjs/BigDecimal.js.map +1 -1
- package/dist/cjs/BigInt.js +27 -71
- package/dist/cjs/BigInt.js.map +1 -1
- package/dist/cjs/Boolean.js +12 -10
- package/dist/cjs/Boolean.js.map +1 -1
- package/dist/cjs/Brand.js +2 -0
- package/dist/cjs/Brand.js.map +1 -1
- package/dist/cjs/Channel.js +0 -2
- package/dist/cjs/Channel.js.map +1 -1
- package/dist/cjs/Chunk.js +4 -0
- package/dist/cjs/Chunk.js.map +1 -1
- package/dist/cjs/Config.js +0 -5
- package/dist/cjs/Config.js.map +1 -1
- package/dist/cjs/Context.js +14 -24
- package/dist/cjs/Context.js.map +1 -1
- package/dist/cjs/Cron.js +11 -25
- package/dist/cjs/Cron.js.map +1 -1
- package/dist/cjs/Data.js +6 -0
- package/dist/cjs/Data.js.map +1 -1
- package/dist/cjs/DateTime.js +2 -0
- package/dist/cjs/DateTime.js.map +1 -1
- package/dist/cjs/Duration.js +2 -2
- package/dist/cjs/Effect.js +122 -53
- package/dist/cjs/Effect.js.map +1 -1
- package/dist/cjs/Either.js +21 -25
- package/dist/cjs/Either.js.map +1 -1
- package/dist/cjs/Encoding.js +1 -1
- package/dist/cjs/Equivalence.js +1 -1
- package/dist/cjs/Function.js +21 -24
- package/dist/cjs/Function.js.map +1 -1
- package/dist/cjs/HashMap.js +0 -3
- package/dist/cjs/HashMap.js.map +1 -1
- package/dist/cjs/Iterable.js +9 -2
- package/dist/cjs/Iterable.js.map +1 -1
- package/dist/cjs/List.js +2 -0
- package/dist/cjs/List.js.map +1 -1
- package/dist/cjs/Logger.js +0 -2
- package/dist/cjs/Logger.js.map +1 -1
- package/dist/cjs/Mailbox.js +1 -0
- package/dist/cjs/Mailbox.js.map +1 -1
- package/dist/cjs/ManagedRuntime.js +0 -2
- package/dist/cjs/ManagedRuntime.js.map +1 -1
- package/dist/cjs/Metric.js +6 -12
- package/dist/cjs/Metric.js.map +1 -1
- package/dist/cjs/Number.js +22 -61
- package/dist/cjs/Number.js.map +1 -1
- package/dist/cjs/Option.js +5 -0
- package/dist/cjs/Option.js.map +1 -1
- package/dist/cjs/Order.js +1 -0
- package/dist/cjs/Order.js.map +1 -1
- package/dist/cjs/Ordering.js +2 -7
- package/dist/cjs/Ordering.js.map +1 -1
- package/dist/cjs/Pool.js +1 -1
- package/dist/cjs/Predicate.js +36 -77
- package/dist/cjs/Predicate.js.map +1 -1
- package/dist/cjs/Random.js +1 -2
- package/dist/cjs/Random.js.map +1 -1
- package/dist/cjs/RcMap.js +5 -2
- package/dist/cjs/RcMap.js.map +1 -1
- package/dist/cjs/Record.js +28 -107
- package/dist/cjs/Record.js.map +1 -1
- package/dist/cjs/Redacted.js +3 -0
- package/dist/cjs/Redacted.js.map +1 -1
- package/dist/cjs/RegExp.js +2 -2
- package/dist/cjs/RegExp.js.map +1 -1
- package/dist/cjs/STM.js +3 -5
- package/dist/cjs/STM.js.map +1 -1
- package/dist/cjs/Schedule.js +2 -2
- package/dist/cjs/Schema.js +14 -13
- package/dist/cjs/Schema.js.map +1 -1
- package/dist/cjs/SchemaAST.js +0 -2
- package/dist/cjs/SchemaAST.js.map +1 -1
- package/dist/cjs/Sink.js +14 -10
- package/dist/cjs/Sink.js.map +1 -1
- package/dist/cjs/Stream.js +24 -25
- package/dist/cjs/Stream.js.map +1 -1
- package/dist/cjs/String.js +31 -2
- package/dist/cjs/String.js.map +1 -1
- package/dist/cjs/Struct.js +6 -0
- package/dist/cjs/Struct.js.map +1 -1
- package/dist/cjs/Symbol.js +1 -2
- package/dist/cjs/Symbol.js.map +1 -1
- package/dist/cjs/TestClock.js.map +1 -1
- package/dist/cjs/Trie.js +28 -0
- package/dist/cjs/Trie.js.map +1 -1
- package/dist/cjs/Tuple.js +9 -24
- package/dist/cjs/Tuple.js.map +1 -1
- package/dist/cjs/internal/matcher.js +1 -1
- package/dist/cjs/internal/matcher.js.map +1 -1
- package/dist/cjs/internal/version.js +1 -1
- package/dist/dts/Array.d.ts +1235 -1188
- package/dist/dts/Array.d.ts.map +1 -1
- package/dist/dts/BigDecimal.d.ts +61 -189
- package/dist/dts/BigDecimal.d.ts.map +1 -1
- package/dist/dts/BigInt.d.ts +57 -165
- package/dist/dts/BigInt.d.ts.map +1 -1
- package/dist/dts/Boolean.d.ts +28 -18
- package/dist/dts/Boolean.d.ts.map +1 -1
- package/dist/dts/Brand.d.ts +3 -3
- package/dist/dts/Brand.d.ts.map +1 -1
- package/dist/dts/Channel.d.ts +0 -6
- package/dist/dts/Channel.d.ts.map +1 -1
- package/dist/dts/Chunk.d.ts +15 -0
- package/dist/dts/Chunk.d.ts.map +1 -1
- package/dist/dts/Config.d.ts +0 -5
- package/dist/dts/Config.d.ts.map +1 -1
- package/dist/dts/Context.d.ts +26 -54
- package/dist/dts/Context.d.ts.map +1 -1
- package/dist/dts/Cron.d.ts +9 -23
- package/dist/dts/Cron.d.ts.map +1 -1
- package/dist/dts/Data.d.ts +8 -0
- package/dist/dts/Data.d.ts.map +1 -1
- package/dist/dts/DateTime.d.ts +6 -0
- package/dist/dts/DateTime.d.ts.map +1 -1
- package/dist/dts/Duration.d.ts +2 -2
- package/dist/dts/Effect.d.ts +153 -71
- package/dist/dts/Effect.d.ts.map +1 -1
- package/dist/dts/Either.d.ts +44 -57
- package/dist/dts/Either.d.ts.map +1 -1
- package/dist/dts/Encoding.d.ts +1 -1
- package/dist/dts/Equivalence.d.ts +1 -1
- package/dist/dts/Function.d.ts +55 -59
- package/dist/dts/Function.d.ts.map +1 -1
- package/dist/dts/HashMap.d.ts +0 -9
- package/dist/dts/HashMap.d.ts.map +1 -1
- package/dist/dts/Iterable.d.ts +13 -2
- package/dist/dts/Iterable.d.ts.map +1 -1
- package/dist/dts/List.d.ts +10 -0
- package/dist/dts/List.d.ts.map +1 -1
- package/dist/dts/Logger.d.ts +0 -6
- package/dist/dts/Logger.d.ts.map +1 -1
- package/dist/dts/Mailbox.d.ts +1 -0
- package/dist/dts/Mailbox.d.ts.map +1 -1
- package/dist/dts/ManagedRuntime.d.ts +0 -2
- package/dist/dts/ManagedRuntime.d.ts.map +1 -1
- package/dist/dts/Metric.d.ts +14 -20
- package/dist/dts/Metric.d.ts.map +1 -1
- package/dist/dts/Micro.d.ts +1 -1
- package/dist/dts/Number.d.ts +52 -155
- package/dist/dts/Number.d.ts.map +1 -1
- package/dist/dts/Option.d.ts +12 -0
- package/dist/dts/Option.d.ts.map +1 -1
- package/dist/dts/Order.d.ts +1 -0
- package/dist/dts/Order.d.ts.map +1 -1
- package/dist/dts/Ordering.d.ts +4 -17
- package/dist/dts/Ordering.d.ts.map +1 -1
- package/dist/dts/Pool.d.ts +1 -1
- package/dist/dts/Predicate.d.ts +56 -133
- package/dist/dts/Predicate.d.ts.map +1 -1
- package/dist/dts/Random.d.ts +1 -2
- package/dist/dts/Random.d.ts.map +1 -1
- package/dist/dts/RcMap.d.ts +15 -6
- package/dist/dts/RcMap.d.ts.map +1 -1
- package/dist/dts/Record.d.ts +68 -279
- package/dist/dts/Record.d.ts.map +1 -1
- package/dist/dts/Redacted.d.ts +3 -0
- package/dist/dts/Redacted.d.ts.map +1 -1
- package/dist/dts/RegExp.d.ts +2 -2
- package/dist/dts/RegExp.d.ts.map +1 -1
- package/dist/dts/STM.d.ts +5 -7
- package/dist/dts/STM.d.ts.map +1 -1
- package/dist/dts/Schedule.d.ts +7 -7
- package/dist/dts/Schema.d.ts +31 -25
- package/dist/dts/Schema.d.ts.map +1 -1
- package/dist/dts/SchemaAST.d.ts +0 -2
- package/dist/dts/SchemaAST.d.ts.map +1 -1
- package/dist/dts/Sink.d.ts +14 -10
- package/dist/dts/Sink.d.ts.map +1 -1
- package/dist/dts/Stream.d.ts +58 -62
- package/dist/dts/Stream.d.ts.map +1 -1
- package/dist/dts/String.d.ts +47 -2
- package/dist/dts/String.d.ts.map +1 -1
- package/dist/dts/Struct.d.ts +12 -0
- package/dist/dts/Struct.d.ts.map +1 -1
- package/dist/dts/Symbol.d.ts +1 -2
- package/dist/dts/Symbol.d.ts.map +1 -1
- package/dist/dts/TestClock.d.ts +2 -1
- package/dist/dts/TestClock.d.ts.map +1 -1
- package/dist/dts/Trie.d.ts +66 -0
- package/dist/dts/Trie.d.ts.map +1 -1
- package/dist/dts/Tuple.d.ts +21 -62
- package/dist/dts/Tuple.d.ts.map +1 -1
- package/dist/dts/Utils.d.ts +8 -8
- package/dist/esm/Array.js +474 -442
- package/dist/esm/Array.js.map +1 -1
- package/dist/esm/BigDecimal.js +31 -89
- package/dist/esm/BigDecimal.js.map +1 -1
- package/dist/esm/BigInt.js +27 -71
- package/dist/esm/BigInt.js.map +1 -1
- package/dist/esm/Boolean.js +12 -10
- package/dist/esm/Boolean.js.map +1 -1
- package/dist/esm/Brand.js +2 -0
- package/dist/esm/Brand.js.map +1 -1
- package/dist/esm/Channel.js +0 -2
- package/dist/esm/Channel.js.map +1 -1
- package/dist/esm/Chunk.js +4 -0
- package/dist/esm/Chunk.js.map +1 -1
- package/dist/esm/Config.js +0 -5
- package/dist/esm/Config.js.map +1 -1
- package/dist/esm/Context.js +14 -24
- package/dist/esm/Context.js.map +1 -1
- package/dist/esm/Cron.js +11 -25
- package/dist/esm/Cron.js.map +1 -1
- package/dist/esm/Data.js +7 -0
- package/dist/esm/Data.js.map +1 -1
- package/dist/esm/DateTime.js +2 -0
- package/dist/esm/DateTime.js.map +1 -1
- package/dist/esm/Duration.js +2 -2
- package/dist/esm/Effect.js +123 -53
- package/dist/esm/Effect.js.map +1 -1
- package/dist/esm/Either.js +22 -25
- package/dist/esm/Either.js.map +1 -1
- package/dist/esm/Encoding.js +1 -1
- package/dist/esm/Equivalence.js +1 -1
- package/dist/esm/Function.js +21 -24
- package/dist/esm/Function.js.map +1 -1
- package/dist/esm/HashMap.js +0 -3
- package/dist/esm/HashMap.js.map +1 -1
- package/dist/esm/Iterable.js +9 -2
- package/dist/esm/Iterable.js.map +1 -1
- package/dist/esm/List.js +2 -0
- package/dist/esm/List.js.map +1 -1
- package/dist/esm/Logger.js +0 -2
- package/dist/esm/Logger.js.map +1 -1
- package/dist/esm/Mailbox.js +1 -0
- package/dist/esm/Mailbox.js.map +1 -1
- package/dist/esm/ManagedRuntime.js +0 -2
- package/dist/esm/ManagedRuntime.js.map +1 -1
- package/dist/esm/Metric.js +6 -12
- package/dist/esm/Metric.js.map +1 -1
- package/dist/esm/Micro.js +1 -1
- package/dist/esm/Number.js +22 -61
- package/dist/esm/Number.js.map +1 -1
- package/dist/esm/Option.js +6 -0
- package/dist/esm/Option.js.map +1 -1
- package/dist/esm/Order.js +1 -0
- package/dist/esm/Order.js.map +1 -1
- package/dist/esm/Ordering.js +2 -7
- package/dist/esm/Ordering.js.map +1 -1
- package/dist/esm/Pool.js +1 -1
- package/dist/esm/Predicate.js +36 -77
- package/dist/esm/Predicate.js.map +1 -1
- package/dist/esm/Random.js +1 -2
- package/dist/esm/Random.js.map +1 -1
- package/dist/esm/RcMap.js +5 -2
- package/dist/esm/RcMap.js.map +1 -1
- package/dist/esm/Record.js +28 -107
- package/dist/esm/Record.js.map +1 -1
- package/dist/esm/Redacted.js +3 -0
- package/dist/esm/Redacted.js.map +1 -1
- package/dist/esm/RegExp.js +2 -2
- package/dist/esm/RegExp.js.map +1 -1
- package/dist/esm/STM.js +3 -5
- package/dist/esm/STM.js.map +1 -1
- package/dist/esm/Schedule.js +2 -2
- package/dist/esm/Schema.js +14 -13
- package/dist/esm/Schema.js.map +1 -1
- package/dist/esm/SchemaAST.js +0 -2
- package/dist/esm/SchemaAST.js.map +1 -1
- package/dist/esm/Sink.js +14 -10
- package/dist/esm/Sink.js.map +1 -1
- package/dist/esm/Stream.js +25 -25
- package/dist/esm/Stream.js.map +1 -1
- package/dist/esm/String.js +31 -2
- package/dist/esm/String.js.map +1 -1
- package/dist/esm/Struct.js +6 -0
- package/dist/esm/Struct.js.map +1 -1
- package/dist/esm/Symbol.js +1 -2
- package/dist/esm/Symbol.js.map +1 -1
- package/dist/esm/TestClock.js.map +1 -1
- package/dist/esm/Trie.js +28 -0
- package/dist/esm/Trie.js.map +1 -1
- package/dist/esm/Tuple.js +11 -30
- package/dist/esm/Tuple.js.map +1 -1
- package/dist/esm/internal/matcher.js +1 -1
- package/dist/esm/internal/matcher.js.map +1 -1
- package/dist/esm/internal/version.js +1 -1
- package/package.json +1 -1
- package/src/Array.ts +1235 -1188
- package/src/BigDecimal.ts +61 -189
- package/src/BigInt.ts +57 -165
- package/src/Boolean.ts +28 -18
- package/src/Brand.ts +3 -3
- package/src/Channel.ts +0 -6
- package/src/Chunk.ts +16 -0
- package/src/Config.ts +0 -5
- package/src/Context.ts +26 -54
- package/src/Cron.ts +11 -25
- package/src/Data.ts +8 -0
- package/src/DateTime.ts +6 -0
- package/src/Duration.ts +2 -2
- package/src/Effect.ts +153 -71
- package/src/Either.ts +45 -58
- package/src/Encoding.ts +1 -1
- package/src/Equivalence.ts +1 -1
- package/src/Function.ts +55 -59
- package/src/HashMap.ts +0 -9
- package/src/Iterable.ts +13 -2
- package/src/List.ts +12 -0
- package/src/Logger.ts +0 -6
- package/src/Mailbox.ts +1 -0
- package/src/ManagedRuntime.ts +0 -2
- package/src/Metric.ts +14 -20
- package/src/Micro.ts +1 -1
- package/src/Number.ts +52 -155
- package/src/Option.ts +12 -0
- package/src/Order.ts +1 -0
- package/src/Ordering.ts +4 -17
- package/src/Pool.ts +1 -1
- package/src/Predicate.ts +56 -133
- package/src/Random.ts +1 -2
- package/src/RcMap.ts +15 -6
- package/src/Record.ts +68 -279
- package/src/Redacted.ts +3 -0
- package/src/RegExp.ts +2 -2
- package/src/STM.ts +5 -7
- package/src/Schedule.ts +7 -7
- package/src/Schema.ts +31 -25
- package/src/SchemaAST.ts +0 -2
- package/src/Sink.ts +14 -10
- package/src/Stream.ts +56 -61
- package/src/String.ts +47 -2
- package/src/Struct.ts +12 -0
- package/src/Symbol.ts +1 -2
- package/src/TestClock.ts +2 -1
- package/src/Trie.ts +66 -0
- package/src/Tuple.ts +21 -62
- package/src/Utils.ts +8 -8
- package/src/internal/matcher.ts +1 -1
- package/src/internal/version.ts +1 -1
package/src/Either.ts
CHANGED
|
@@ -142,6 +142,7 @@ export const left: <L>(left: L) => Either<never, L> = either.left
|
|
|
142
142
|
*
|
|
143
143
|
* @example
|
|
144
144
|
* ```ts
|
|
145
|
+
* import * as assert from "node:assert"
|
|
145
146
|
* import { Either } from "effect"
|
|
146
147
|
*
|
|
147
148
|
* assert.deepStrictEqual(Either.fromNullable(1, () => 'fallback'), Either.right(1))
|
|
@@ -158,6 +159,7 @@ export const fromNullable: {
|
|
|
158
159
|
*
|
|
159
160
|
* @example
|
|
160
161
|
* ```ts
|
|
162
|
+
* import * as assert from "node:assert"
|
|
161
163
|
* import { Either } from "effect"
|
|
162
164
|
*
|
|
163
165
|
* assert.deepStrictEqual(Either.fromNullable(1, () => 'fallback'), Either.right(1))
|
|
@@ -174,6 +176,7 @@ export const fromNullable: {
|
|
|
174
176
|
*
|
|
175
177
|
* @example
|
|
176
178
|
* ```ts
|
|
179
|
+
* import * as assert from "node:assert"
|
|
177
180
|
* import { Either } from "effect"
|
|
178
181
|
*
|
|
179
182
|
* assert.deepStrictEqual(Either.fromNullable(1, () => 'fallback'), Either.right(1))
|
|
@@ -193,6 +196,7 @@ export const fromNullable: {
|
|
|
193
196
|
/**
|
|
194
197
|
* @example
|
|
195
198
|
* ```ts
|
|
199
|
+
* import * as assert from "node:assert"
|
|
196
200
|
* import { Either, Option } from "effect"
|
|
197
201
|
*
|
|
198
202
|
* assert.deepStrictEqual(Either.fromOption(Option.some(1), () => 'error'), Either.right(1))
|
|
@@ -206,6 +210,7 @@ export const fromOption: {
|
|
|
206
210
|
/**
|
|
207
211
|
* @example
|
|
208
212
|
* ```ts
|
|
213
|
+
* import * as assert from "node:assert"
|
|
209
214
|
* import { Either, Option } from "effect"
|
|
210
215
|
*
|
|
211
216
|
* assert.deepStrictEqual(Either.fromOption(Option.some(1), () => 'error'), Either.right(1))
|
|
@@ -219,6 +224,7 @@ export const fromOption: {
|
|
|
219
224
|
/**
|
|
220
225
|
* @example
|
|
221
226
|
* ```ts
|
|
227
|
+
* import * as assert from "node:assert"
|
|
222
228
|
* import { Either, Option } from "effect"
|
|
223
229
|
*
|
|
224
230
|
* assert.deepStrictEqual(Either.fromOption(Option.some(1), () => 'error'), Either.right(1))
|
|
@@ -274,10 +280,9 @@ export {
|
|
|
274
280
|
/**
|
|
275
281
|
* Tests if a value is a `Either`.
|
|
276
282
|
*
|
|
277
|
-
* @param input - The value to test.
|
|
278
|
-
*
|
|
279
283
|
* @example
|
|
280
284
|
* ```ts
|
|
285
|
+
* import * as assert from "node:assert"
|
|
281
286
|
* import { Either } from "effect"
|
|
282
287
|
*
|
|
283
288
|
* assert.deepStrictEqual(Either.isEither(Either.right(1)), true)
|
|
@@ -293,10 +298,9 @@ export const isEither: (input: unknown) => input is Either<unknown, unknown> = e
|
|
|
293
298
|
/**
|
|
294
299
|
* Determine if a `Either` is a `Left`.
|
|
295
300
|
*
|
|
296
|
-
* @param self - The `Either` to check.
|
|
297
|
-
*
|
|
298
301
|
* @example
|
|
299
302
|
* ```ts
|
|
303
|
+
* import * as assert from "node:assert"
|
|
300
304
|
* import { Either } from "effect"
|
|
301
305
|
*
|
|
302
306
|
* assert.deepStrictEqual(Either.isLeft(Either.right(1)), false)
|
|
@@ -311,10 +315,9 @@ export const isLeft: <R, L>(self: Either<R, L>) => self is Left<L, R> = either.i
|
|
|
311
315
|
/**
|
|
312
316
|
* Determine if a `Either` is a `Right`.
|
|
313
317
|
*
|
|
314
|
-
* @param self - The `Either` to check.
|
|
315
|
-
*
|
|
316
318
|
* @example
|
|
317
319
|
* ```ts
|
|
320
|
+
* import * as assert from "node:assert"
|
|
318
321
|
* import { Either } from "effect"
|
|
319
322
|
*
|
|
320
323
|
* assert.deepStrictEqual(Either.isRight(Either.right(1)), true)
|
|
@@ -331,6 +334,7 @@ export const isRight: <R, L>(self: Either<R, L>) => self is Right<L, R> = either
|
|
|
331
334
|
*
|
|
332
335
|
* @example
|
|
333
336
|
* ```ts
|
|
337
|
+
* import * as assert from "node:assert"
|
|
334
338
|
* import { Either, Option } from "effect"
|
|
335
339
|
*
|
|
336
340
|
* assert.deepStrictEqual(Either.getRight(Either.right('ok')), Option.some('ok'))
|
|
@@ -347,6 +351,7 @@ export const getRight: <R, L>(self: Either<R, L>) => Option<R> = either.getRight
|
|
|
347
351
|
*
|
|
348
352
|
* @example
|
|
349
353
|
* ```ts
|
|
354
|
+
* import * as assert from "node:assert"
|
|
350
355
|
* import { Either, Option } from "effect"
|
|
351
356
|
*
|
|
352
357
|
* assert.deepStrictEqual(Either.getLeft(Either.right('ok')), Option.none())
|
|
@@ -409,9 +414,6 @@ export const mapBoth: {
|
|
|
409
414
|
/**
|
|
410
415
|
* Maps the `Left` side of an `Either` value to a new `Either` value.
|
|
411
416
|
*
|
|
412
|
-
* @param self - The input `Either` value to map.
|
|
413
|
-
* @param f - A transformation function to apply to the `Left` value of the input `Either`.
|
|
414
|
-
*
|
|
415
417
|
* @category mapping
|
|
416
418
|
* @since 2.0.0
|
|
417
419
|
*/
|
|
@@ -419,9 +421,6 @@ export const mapLeft: {
|
|
|
419
421
|
/**
|
|
420
422
|
* Maps the `Left` side of an `Either` value to a new `Either` value.
|
|
421
423
|
*
|
|
422
|
-
* @param self - The input `Either` value to map.
|
|
423
|
-
* @param f - A transformation function to apply to the `Left` value of the input `Either`.
|
|
424
|
-
*
|
|
425
424
|
* @category mapping
|
|
426
425
|
* @since 2.0.0
|
|
427
426
|
*/
|
|
@@ -429,9 +428,6 @@ export const mapLeft: {
|
|
|
429
428
|
/**
|
|
430
429
|
* Maps the `Left` side of an `Either` value to a new `Either` value.
|
|
431
430
|
*
|
|
432
|
-
* @param self - The input `Either` value to map.
|
|
433
|
-
* @param f - A transformation function to apply to the `Left` value of the input `Either`.
|
|
434
|
-
*
|
|
435
431
|
* @category mapping
|
|
436
432
|
* @since 2.0.0
|
|
437
433
|
*/
|
|
@@ -445,9 +441,6 @@ export const mapLeft: {
|
|
|
445
441
|
/**
|
|
446
442
|
* Maps the `Right` side of an `Either` value to a new `Either` value.
|
|
447
443
|
*
|
|
448
|
-
* @param self - An `Either` to map
|
|
449
|
-
* @param f - The function to map over the value of the `Either`
|
|
450
|
-
*
|
|
451
444
|
* @category mapping
|
|
452
445
|
* @since 2.0.0
|
|
453
446
|
*/
|
|
@@ -455,9 +448,6 @@ export const map: {
|
|
|
455
448
|
/**
|
|
456
449
|
* Maps the `Right` side of an `Either` value to a new `Either` value.
|
|
457
450
|
*
|
|
458
|
-
* @param self - An `Either` to map
|
|
459
|
-
* @param f - The function to map over the value of the `Either`
|
|
460
|
-
*
|
|
461
451
|
* @category mapping
|
|
462
452
|
* @since 2.0.0
|
|
463
453
|
*/
|
|
@@ -465,9 +455,6 @@ export const map: {
|
|
|
465
455
|
/**
|
|
466
456
|
* Maps the `Right` side of an `Either` value to a new `Either` value.
|
|
467
457
|
*
|
|
468
|
-
* @param self - An `Either` to map
|
|
469
|
-
* @param f - The function to map over the value of the `Either`
|
|
470
|
-
*
|
|
471
458
|
* @category mapping
|
|
472
459
|
* @since 2.0.0
|
|
473
460
|
*/
|
|
@@ -484,6 +471,7 @@ export const map: {
|
|
|
484
471
|
*
|
|
485
472
|
* @example
|
|
486
473
|
* ```ts
|
|
474
|
+
* import * as assert from "node:assert"
|
|
487
475
|
* import { pipe, Either } from "effect"
|
|
488
476
|
*
|
|
489
477
|
* const onLeft = (strings: ReadonlyArray<string>): string => `strings: ${strings.join(', ')}`
|
|
@@ -507,6 +495,7 @@ export const match: {
|
|
|
507
495
|
*
|
|
508
496
|
* @example
|
|
509
497
|
* ```ts
|
|
498
|
+
* import * as assert from "node:assert"
|
|
510
499
|
* import { pipe, Either } from "effect"
|
|
511
500
|
*
|
|
512
501
|
* const onLeft = (strings: ReadonlyArray<string>): string => `strings: ${strings.join(', ')}`
|
|
@@ -535,6 +524,7 @@ export const match: {
|
|
|
535
524
|
*
|
|
536
525
|
* @example
|
|
537
526
|
* ```ts
|
|
527
|
+
* import * as assert from "node:assert"
|
|
538
528
|
* import { pipe, Either } from "effect"
|
|
539
529
|
*
|
|
540
530
|
* const onLeft = (strings: ReadonlyArray<string>): string => `strings: ${strings.join(', ')}`
|
|
@@ -570,10 +560,9 @@ export const match: {
|
|
|
570
560
|
* Transforms a `Predicate` function into a `Right` of the input value if the predicate returns `true`
|
|
571
561
|
* or `Left` of the result of the provided function if the predicate returns false
|
|
572
562
|
*
|
|
573
|
-
* @param predicate - A `Predicate` function that takes in a value of type `A` and returns a boolean.
|
|
574
|
-
*
|
|
575
563
|
* @example
|
|
576
564
|
* ```ts
|
|
565
|
+
* import * as assert from "node:assert"
|
|
577
566
|
* import { pipe, Either } from "effect"
|
|
578
567
|
*
|
|
579
568
|
* const isPositive = (n: number): boolean => n > 0
|
|
@@ -602,10 +591,9 @@ export const liftPredicate: {
|
|
|
602
591
|
* Transforms a `Predicate` function into a `Right` of the input value if the predicate returns `true`
|
|
603
592
|
* or `Left` of the result of the provided function if the predicate returns false
|
|
604
593
|
*
|
|
605
|
-
* @param predicate - A `Predicate` function that takes in a value of type `A` and returns a boolean.
|
|
606
|
-
*
|
|
607
594
|
* @example
|
|
608
595
|
* ```ts
|
|
596
|
+
* import * as assert from "node:assert"
|
|
609
597
|
* import { pipe, Either } from "effect"
|
|
610
598
|
*
|
|
611
599
|
* const isPositive = (n: number): boolean => n > 0
|
|
@@ -634,10 +622,9 @@ export const liftPredicate: {
|
|
|
634
622
|
* Transforms a `Predicate` function into a `Right` of the input value if the predicate returns `true`
|
|
635
623
|
* or `Left` of the result of the provided function if the predicate returns false
|
|
636
624
|
*
|
|
637
|
-
* @param predicate - A `Predicate` function that takes in a value of type `A` and returns a boolean.
|
|
638
|
-
*
|
|
639
625
|
* @example
|
|
640
626
|
* ```ts
|
|
627
|
+
* import * as assert from "node:assert"
|
|
641
628
|
* import { pipe, Either } from "effect"
|
|
642
629
|
*
|
|
643
630
|
* const isPositive = (n: number): boolean => n > 0
|
|
@@ -666,10 +653,9 @@ export const liftPredicate: {
|
|
|
666
653
|
* Transforms a `Predicate` function into a `Right` of the input value if the predicate returns `true`
|
|
667
654
|
* or `Left` of the result of the provided function if the predicate returns false
|
|
668
655
|
*
|
|
669
|
-
* @param predicate - A `Predicate` function that takes in a value of type `A` and returns a boolean.
|
|
670
|
-
*
|
|
671
656
|
* @example
|
|
672
657
|
* ```ts
|
|
658
|
+
* import * as assert from "node:assert"
|
|
673
659
|
* import { pipe, Either } from "effect"
|
|
674
660
|
*
|
|
675
661
|
* const isPositive = (n: number): boolean => n > 0
|
|
@@ -698,10 +684,9 @@ export const liftPredicate: {
|
|
|
698
684
|
* Transforms a `Predicate` function into a `Right` of the input value if the predicate returns `true`
|
|
699
685
|
* or `Left` of the result of the provided function if the predicate returns false
|
|
700
686
|
*
|
|
701
|
-
* @param predicate - A `Predicate` function that takes in a value of type `A` and returns a boolean.
|
|
702
|
-
*
|
|
703
687
|
* @example
|
|
704
688
|
* ```ts
|
|
689
|
+
* import * as assert from "node:assert"
|
|
705
690
|
* import { pipe, Either } from "effect"
|
|
706
691
|
*
|
|
707
692
|
* const isPositive = (n: number): boolean => n > 0
|
|
@@ -742,6 +727,7 @@ export const liftPredicate: {
|
|
|
742
727
|
*
|
|
743
728
|
* @example
|
|
744
729
|
* ```ts
|
|
730
|
+
* import * as assert from "node:assert"
|
|
745
731
|
* import { pipe, Either } from "effect"
|
|
746
732
|
*
|
|
747
733
|
* const isPositive = (n: number): boolean => n > 0
|
|
@@ -772,6 +758,7 @@ export const filterOrLeft: {
|
|
|
772
758
|
*
|
|
773
759
|
* @example
|
|
774
760
|
* ```ts
|
|
761
|
+
* import * as assert from "node:assert"
|
|
775
762
|
* import { pipe, Either } from "effect"
|
|
776
763
|
*
|
|
777
764
|
* const isPositive = (n: number): boolean => n > 0
|
|
@@ -805,6 +792,7 @@ export const filterOrLeft: {
|
|
|
805
792
|
*
|
|
806
793
|
* @example
|
|
807
794
|
* ```ts
|
|
795
|
+
* import * as assert from "node:assert"
|
|
808
796
|
* import { pipe, Either } from "effect"
|
|
809
797
|
*
|
|
810
798
|
* const isPositive = (n: number): boolean => n > 0
|
|
@@ -835,6 +823,7 @@ export const filterOrLeft: {
|
|
|
835
823
|
*
|
|
836
824
|
* @example
|
|
837
825
|
* ```ts
|
|
826
|
+
* import * as assert from "node:assert"
|
|
838
827
|
* import { pipe, Either } from "effect"
|
|
839
828
|
*
|
|
840
829
|
* const isPositive = (n: number): boolean => n > 0
|
|
@@ -869,6 +858,7 @@ export const filterOrLeft: {
|
|
|
869
858
|
*
|
|
870
859
|
* @example
|
|
871
860
|
* ```ts
|
|
861
|
+
* import * as assert from "node:assert"
|
|
872
862
|
* import { pipe, Either } from "effect"
|
|
873
863
|
*
|
|
874
864
|
* const isPositive = (n: number): boolean => n > 0
|
|
@@ -913,6 +903,7 @@ export const merge: <R, L>(self: Either<R, L>) => L | R = match({
|
|
|
913
903
|
*
|
|
914
904
|
* @example
|
|
915
905
|
* ```ts
|
|
906
|
+
* import * as assert from "node:assert"
|
|
916
907
|
* import { Either } from "effect"
|
|
917
908
|
*
|
|
918
909
|
* assert.deepStrictEqual(Either.getOrElse(Either.right(1), (error) => error + "!"), 1)
|
|
@@ -928,6 +919,7 @@ export const getOrElse: {
|
|
|
928
919
|
*
|
|
929
920
|
* @example
|
|
930
921
|
* ```ts
|
|
922
|
+
* import * as assert from "node:assert"
|
|
931
923
|
* import { Either } from "effect"
|
|
932
924
|
*
|
|
933
925
|
* assert.deepStrictEqual(Either.getOrElse(Either.right(1), (error) => error + "!"), 1)
|
|
@@ -943,6 +935,7 @@ export const getOrElse: {
|
|
|
943
935
|
*
|
|
944
936
|
* @example
|
|
945
937
|
* ```ts
|
|
938
|
+
* import * as assert from "node:assert"
|
|
946
939
|
* import { Either } from "effect"
|
|
947
940
|
*
|
|
948
941
|
* assert.deepStrictEqual(Either.getOrElse(Either.right(1), (error) => error + "!"), 1)
|
|
@@ -961,6 +954,7 @@ export const getOrElse: {
|
|
|
961
954
|
/**
|
|
962
955
|
* @example
|
|
963
956
|
* ```ts
|
|
957
|
+
* import * as assert from "node:assert"
|
|
964
958
|
* import { Either } from "effect"
|
|
965
959
|
*
|
|
966
960
|
* assert.deepStrictEqual(Either.getOrNull(Either.right(1)), 1)
|
|
@@ -975,6 +969,7 @@ export const getOrNull: <R, L>(self: Either<R, L>) => R | null = getOrElse(const
|
|
|
975
969
|
/**
|
|
976
970
|
* @example
|
|
977
971
|
* ```ts
|
|
972
|
+
* import * as assert from "node:assert"
|
|
978
973
|
* import { Either } from "effect"
|
|
979
974
|
*
|
|
980
975
|
* assert.deepStrictEqual(Either.getOrUndefined(Either.right(1)), 1)
|
|
@@ -991,11 +986,9 @@ export const getOrUndefined: <R, L>(self: Either<R, L>) => R | undefined = getOr
|
|
|
991
986
|
*
|
|
992
987
|
* If a default error is sufficient for your use case and you don't need to configure the thrown error, see {@link getOrThrow}.
|
|
993
988
|
*
|
|
994
|
-
* @param self - The `Either` to extract the value from.
|
|
995
|
-
* @param onLeft - A function that will be called if the `Either` is `Left`. It returns the error to be thrown.
|
|
996
|
-
*
|
|
997
989
|
* @example
|
|
998
990
|
* ```ts
|
|
991
|
+
* import * as assert from "node:assert"
|
|
999
992
|
* import { Either } from "effect"
|
|
1000
993
|
*
|
|
1001
994
|
* assert.deepStrictEqual(
|
|
@@ -1014,11 +1007,9 @@ export const getOrThrowWith: {
|
|
|
1014
1007
|
*
|
|
1015
1008
|
* If a default error is sufficient for your use case and you don't need to configure the thrown error, see {@link getOrThrow}.
|
|
1016
1009
|
*
|
|
1017
|
-
* @param self - The `Either` to extract the value from.
|
|
1018
|
-
* @param onLeft - A function that will be called if the `Either` is `Left`. It returns the error to be thrown.
|
|
1019
|
-
*
|
|
1020
1010
|
* @example
|
|
1021
1011
|
* ```ts
|
|
1012
|
+
* import * as assert from "node:assert"
|
|
1022
1013
|
* import { Either } from "effect"
|
|
1023
1014
|
*
|
|
1024
1015
|
* assert.deepStrictEqual(
|
|
@@ -1037,11 +1028,9 @@ export const getOrThrowWith: {
|
|
|
1037
1028
|
*
|
|
1038
1029
|
* If a default error is sufficient for your use case and you don't need to configure the thrown error, see {@link getOrThrow}.
|
|
1039
1030
|
*
|
|
1040
|
-
* @param self - The `Either` to extract the value from.
|
|
1041
|
-
* @param onLeft - A function that will be called if the `Either` is `Left`. It returns the error to be thrown.
|
|
1042
|
-
*
|
|
1043
1031
|
* @example
|
|
1044
1032
|
* ```ts
|
|
1033
|
+
* import * as assert from "node:assert"
|
|
1045
1034
|
* import { Either } from "effect"
|
|
1046
1035
|
*
|
|
1047
1036
|
* assert.deepStrictEqual(
|
|
@@ -1068,17 +1057,17 @@ export const getOrThrowWith: {
|
|
|
1068
1057
|
*
|
|
1069
1058
|
* The thrown error is a default error. To configure the error thrown, see {@link getOrThrowWith}.
|
|
1070
1059
|
*
|
|
1071
|
-
* @param self - The `Either` to extract the value from.
|
|
1072
|
-
* @throws `Error("getOrThrow called on a Left")`
|
|
1073
|
-
*
|
|
1074
1060
|
* @example
|
|
1075
1061
|
* ```ts
|
|
1062
|
+
* import * as assert from "node:assert"
|
|
1076
1063
|
* import { Either } from "effect"
|
|
1077
1064
|
*
|
|
1078
1065
|
* assert.deepStrictEqual(Either.getOrThrow(Either.right(1)), 1)
|
|
1079
1066
|
* assert.throws(() => Either.getOrThrow(Either.left("error")))
|
|
1080
1067
|
* ```
|
|
1081
1068
|
*
|
|
1069
|
+
* @throws `Error("getOrThrow called on a Left")`
|
|
1070
|
+
*
|
|
1082
1071
|
* @category getters
|
|
1083
1072
|
* @since 2.0.0
|
|
1084
1073
|
*/
|
|
@@ -1089,9 +1078,6 @@ export const getOrThrow: <R, L>(self: Either<R, L>) => R = getOrThrowWith(() =>
|
|
|
1089
1078
|
/**
|
|
1090
1079
|
* Returns `self` if it is a `Right` or `that` otherwise.
|
|
1091
1080
|
*
|
|
1092
|
-
* @param self - The input `Either` value to check and potentially return.
|
|
1093
|
-
* @param that - A function that takes the error value from `self` (if it's a `Left`) and returns a new `Either` value.
|
|
1094
|
-
*
|
|
1095
1081
|
* @category error handling
|
|
1096
1082
|
* @since 2.0.0
|
|
1097
1083
|
*/
|
|
@@ -1099,9 +1085,6 @@ export const orElse: {
|
|
|
1099
1085
|
/**
|
|
1100
1086
|
* Returns `self` if it is a `Right` or `that` otherwise.
|
|
1101
1087
|
*
|
|
1102
|
-
* @param self - The input `Either` value to check and potentially return.
|
|
1103
|
-
* @param that - A function that takes the error value from `self` (if it's a `Left`) and returns a new `Either` value.
|
|
1104
|
-
*
|
|
1105
1088
|
* @category error handling
|
|
1106
1089
|
* @since 2.0.0
|
|
1107
1090
|
*/
|
|
@@ -1109,9 +1092,6 @@ export const orElse: {
|
|
|
1109
1092
|
/**
|
|
1110
1093
|
* Returns `self` if it is a `Right` or `that` otherwise.
|
|
1111
1094
|
*
|
|
1112
|
-
* @param self - The input `Either` value to check and potentially return.
|
|
1113
|
-
* @param that - A function that takes the error value from `self` (if it's a `Left`) and returns a new `Either` value.
|
|
1114
|
-
*
|
|
1115
1095
|
* @category error handling
|
|
1116
1096
|
* @since 2.0.0
|
|
1117
1097
|
*/
|
|
@@ -1264,10 +1244,9 @@ export const ap: {
|
|
|
1264
1244
|
* - If a struct is supplied, then the returned `Either` will contain a struct with the same keys.
|
|
1265
1245
|
* - If an iterable is supplied, then the returned `Either` will contain an array.
|
|
1266
1246
|
*
|
|
1267
|
-
* @param fields - the struct of `Either`s to be sequenced.
|
|
1268
|
-
*
|
|
1269
1247
|
* @example
|
|
1270
1248
|
* ```ts
|
|
1249
|
+
* import * as assert from "node:assert"
|
|
1271
1250
|
* import { Either } from "effect"
|
|
1272
1251
|
*
|
|
1273
1252
|
* assert.deepStrictEqual(Either.all([Either.right(1), Either.right(2)]), Either.right([1, 2]))
|
|
@@ -1294,7 +1273,7 @@ export const all: <const I extends Iterable<Either<any, any>> | Record<string, E
|
|
|
1294
1273
|
): Either<any, any> => {
|
|
1295
1274
|
if (Symbol.iterator in input) {
|
|
1296
1275
|
const out: Array<Either<any, any>> = []
|
|
1297
|
-
for (const e of
|
|
1276
|
+
for (const e of input) {
|
|
1298
1277
|
if (isLeft(e)) {
|
|
1299
1278
|
return e
|
|
1300
1279
|
}
|
|
@@ -1365,6 +1344,7 @@ export const gen: Gen.Gen<EitherTypeLambda, Gen.Adapter<EitherTypeLambda>> = (..
|
|
|
1365
1344
|
*
|
|
1366
1345
|
* @example
|
|
1367
1346
|
* ```ts
|
|
1347
|
+
* import * as assert from "node:assert"
|
|
1368
1348
|
* import { Either, pipe } from "effect"
|
|
1369
1349
|
*
|
|
1370
1350
|
* const result = pipe(
|
|
@@ -1397,6 +1377,7 @@ export const Do: Either<{}> = right({})
|
|
|
1397
1377
|
*
|
|
1398
1378
|
* @example
|
|
1399
1379
|
* ```ts
|
|
1380
|
+
* import * as assert from "node:assert"
|
|
1400
1381
|
* import { Either, pipe } from "effect"
|
|
1401
1382
|
*
|
|
1402
1383
|
* const result = pipe(
|
|
@@ -1428,6 +1409,7 @@ export const bind: {
|
|
|
1428
1409
|
*
|
|
1429
1410
|
* @example
|
|
1430
1411
|
* ```ts
|
|
1412
|
+
* import * as assert from "node:assert"
|
|
1431
1413
|
* import { Either, pipe } from "effect"
|
|
1432
1414
|
*
|
|
1433
1415
|
* const result = pipe(
|
|
@@ -1459,6 +1441,7 @@ export const bind: {
|
|
|
1459
1441
|
*
|
|
1460
1442
|
* @example
|
|
1461
1443
|
* ```ts
|
|
1444
|
+
* import * as assert from "node:assert"
|
|
1462
1445
|
* import { Either, pipe } from "effect"
|
|
1463
1446
|
*
|
|
1464
1447
|
* const result = pipe(
|
|
@@ -1496,6 +1479,7 @@ export const bind: {
|
|
|
1496
1479
|
*
|
|
1497
1480
|
* @example
|
|
1498
1481
|
* ```ts
|
|
1482
|
+
* import * as assert from "node:assert"
|
|
1499
1483
|
* import { Either, pipe } from "effect"
|
|
1500
1484
|
*
|
|
1501
1485
|
* const result = pipe(
|
|
@@ -1527,6 +1511,7 @@ export const bindTo: {
|
|
|
1527
1511
|
*
|
|
1528
1512
|
* @example
|
|
1529
1513
|
* ```ts
|
|
1514
|
+
* import * as assert from "node:assert"
|
|
1530
1515
|
* import { Either, pipe } from "effect"
|
|
1531
1516
|
*
|
|
1532
1517
|
* const result = pipe(
|
|
@@ -1558,6 +1543,7 @@ export const bindTo: {
|
|
|
1558
1543
|
*
|
|
1559
1544
|
* @example
|
|
1560
1545
|
* ```ts
|
|
1546
|
+
* import * as assert from "node:assert"
|
|
1561
1547
|
* import { Either, pipe } from "effect"
|
|
1562
1548
|
*
|
|
1563
1549
|
* const result = pipe(
|
|
@@ -1604,6 +1590,7 @@ export {
|
|
|
1604
1590
|
*
|
|
1605
1591
|
* @example
|
|
1606
1592
|
* ```ts
|
|
1593
|
+
* import * as assert from "node:assert"
|
|
1607
1594
|
* import { Either, pipe } from "effect"
|
|
1608
1595
|
*
|
|
1609
1596
|
* const result = pipe(
|
package/src/Encoding.ts
CHANGED
|
@@ -187,7 +187,7 @@ export interface EncodeException {
|
|
|
187
187
|
export const EncodeException: (input: string, message?: string) => EncodeException = Common.EncodeException
|
|
188
188
|
|
|
189
189
|
/**
|
|
190
|
-
* Returns `true` if the specified value is an `
|
|
190
|
+
* Returns `true` if the specified value is an `EncodeException`, `false` otherwise.
|
|
191
191
|
*
|
|
192
192
|
* @since 3.12.0
|
|
193
193
|
* @category refinements
|
package/src/Equivalence.ts
CHANGED