effect 3.13.9 → 3.13.11
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/Arbitrary.js +38 -22
- package/dist/cjs/Arbitrary.js.map +1 -1
- package/dist/cjs/Array.js +50 -50
- package/dist/cjs/Array.js.map +1 -1
- package/dist/cjs/Brand.js +9 -4
- package/dist/cjs/Brand.js.map +1 -1
- package/dist/cjs/Cause.js +1 -0
- package/dist/cjs/Cause.js.map +1 -1
- package/dist/cjs/Chunk.js +25 -23
- package/dist/cjs/Chunk.js.map +1 -1
- package/dist/cjs/Config.js +2 -1
- package/dist/cjs/Config.js.map +1 -1
- package/dist/cjs/Context.js +4 -4
- package/dist/cjs/Effect.js +823 -632
- package/dist/cjs/Effect.js.map +1 -1
- package/dist/cjs/Either.js +12 -12
- package/dist/cjs/Either.js.map +1 -1
- package/dist/cjs/LogLevel.js +1 -1
- package/dist/cjs/Logger.js +12 -12
- package/dist/cjs/Match.js +26 -26
- package/dist/cjs/Option.js +43 -43
- package/dist/cjs/Predicate.js +6 -2
- package/dist/cjs/Predicate.js.map +1 -1
- package/dist/cjs/Schema.js +21 -17
- package/dist/cjs/Schema.js.map +1 -1
- package/dist/cjs/SchemaAST.js +49 -25
- package/dist/cjs/SchemaAST.js.map +1 -1
- package/dist/cjs/Scope.js +2 -0
- package/dist/cjs/Scope.js.map +1 -1
- package/dist/cjs/Stream.js +93 -93
- package/dist/cjs/internal/core.js +1 -1
- package/dist/cjs/internal/core.js.map +1 -1
- package/dist/cjs/internal/schema/util.js +23 -14
- package/dist/cjs/internal/schema/util.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 +47 -47
- package/dist/dts/Array.d.ts.map +1 -1
- package/dist/dts/Brand.d.ts +14 -6
- package/dist/dts/Brand.d.ts.map +1 -1
- package/dist/dts/Cause.d.ts +1 -0
- package/dist/dts/Cause.d.ts.map +1 -1
- package/dist/dts/Chunk.d.ts +91 -89
- package/dist/dts/Chunk.d.ts.map +1 -1
- package/dist/dts/Config.d.ts +2 -1
- package/dist/dts/Config.d.ts.map +1 -1
- package/dist/dts/Context.d.ts +4 -4
- package/dist/dts/Effect.d.ts +2107 -1621
- package/dist/dts/Effect.d.ts.map +1 -1
- package/dist/dts/Either.d.ts +33 -33
- package/dist/dts/LogLevel.d.ts +3 -3
- package/dist/dts/Logger.d.ts +16 -16
- package/dist/dts/Match.d.ts +26 -26
- package/dist/dts/Option.d.ts +84 -84
- package/dist/dts/Predicate.d.ts.map +1 -1
- package/dist/dts/Schema.d.ts +53 -21
- package/dist/dts/Schema.d.ts.map +1 -1
- package/dist/dts/SchemaAST.d.ts.map +1 -1
- package/dist/dts/Scope.d.ts +2 -0
- package/dist/dts/Scope.d.ts.map +1 -1
- package/dist/dts/Stream.d.ts +229 -229
- package/dist/esm/Arbitrary.js +38 -22
- package/dist/esm/Arbitrary.js.map +1 -1
- package/dist/esm/Array.js +50 -50
- package/dist/esm/Array.js.map +1 -1
- package/dist/esm/Brand.js +9 -4
- package/dist/esm/Brand.js.map +1 -1
- package/dist/esm/Cause.js +1 -0
- package/dist/esm/Cause.js.map +1 -1
- package/dist/esm/Chunk.js +25 -23
- package/dist/esm/Chunk.js.map +1 -1
- package/dist/esm/Config.js +2 -1
- package/dist/esm/Config.js.map +1 -1
- package/dist/esm/Context.js +4 -4
- package/dist/esm/Effect.js +845 -648
- package/dist/esm/Effect.js.map +1 -1
- package/dist/esm/Either.js +17 -17
- package/dist/esm/Either.js.map +1 -1
- package/dist/esm/LogLevel.js +1 -1
- package/dist/esm/Logger.js +12 -12
- package/dist/esm/Match.js +26 -26
- package/dist/esm/Option.js +48 -48
- package/dist/esm/Predicate.js +3 -0
- package/dist/esm/Predicate.js.map +1 -1
- package/dist/esm/Schema.js +21 -17
- package/dist/esm/Schema.js.map +1 -1
- package/dist/esm/SchemaAST.js +46 -22
- package/dist/esm/SchemaAST.js.map +1 -1
- package/dist/esm/Scope.js +2 -0
- package/dist/esm/Scope.js.map +1 -1
- package/dist/esm/Stream.js +101 -101
- package/dist/esm/internal/core.js +1 -1
- package/dist/esm/internal/core.js.map +1 -1
- package/dist/esm/internal/schema/util.js +23 -14
- package/dist/esm/internal/schema/util.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/Arbitrary.ts +39 -24
- package/src/Array.ts +116 -113
- package/src/Brand.ts +14 -6
- package/src/Cause.ts +1 -0
- package/src/Chunk.ts +97 -95
- package/src/Config.ts +2 -1
- package/src/Context.ts +4 -4
- package/src/Effect.ts +2107 -1621
- package/src/Either.ts +34 -34
- package/src/LogLevel.ts +3 -3
- package/src/Logger.ts +16 -16
- package/src/Match.ts +26 -26
- package/src/Option.ts +84 -84
- package/src/Predicate.ts +4 -0
- package/src/Schema.ts +87 -41
- package/src/SchemaAST.ts +47 -22
- package/src/Scope.ts +2 -0
- package/src/Stream.ts +229 -229
- package/src/internal/core.ts +2 -1
- package/src/internal/schema/util.ts +34 -25
- package/src/internal/version.ts +1 -1
package/src/Option.ts
CHANGED
|
@@ -97,9 +97,9 @@ export declare namespace Option {
|
|
|
97
97
|
/**
|
|
98
98
|
* Extracts the type of the value contained in an `Option`.
|
|
99
99
|
*
|
|
100
|
-
*
|
|
100
|
+
* **Example** (Getting the Value Type of an Option)
|
|
101
|
+
*
|
|
101
102
|
* ```ts
|
|
102
|
-
* // Title: Getting the Value Type of an Option
|
|
103
103
|
* import { Option } from "effect"
|
|
104
104
|
*
|
|
105
105
|
* // Declare an Option holding a string
|
|
@@ -139,11 +139,9 @@ export interface OptionTypeLambda extends TypeLambda {
|
|
|
139
139
|
* This means you can use it in place of any `Option<A>` regardless of the type
|
|
140
140
|
* `A`.
|
|
141
141
|
*
|
|
142
|
-
*
|
|
142
|
+
* **Example** (Creating an Option with No Value)
|
|
143
143
|
*
|
|
144
|
-
* @example
|
|
145
144
|
* ```ts
|
|
146
|
-
* // Title: Creating an Option with No Value
|
|
147
145
|
* import { Option } from "effect"
|
|
148
146
|
*
|
|
149
147
|
* // An Option holding no value
|
|
@@ -156,6 +154,8 @@ export interface OptionTypeLambda extends TypeLambda {
|
|
|
156
154
|
* // Output: { _id: 'Option', _tag: 'None' }
|
|
157
155
|
* ```
|
|
158
156
|
*
|
|
157
|
+
* @see {@link some} for the opposite operation.
|
|
158
|
+
*
|
|
159
159
|
* @category Constructors
|
|
160
160
|
* @since 2.0.0
|
|
161
161
|
*/
|
|
@@ -164,11 +164,9 @@ export const none = <A = never>(): Option<A> => option.none
|
|
|
164
164
|
/**
|
|
165
165
|
* Wraps the given value into an `Option` to represent its presence.
|
|
166
166
|
*
|
|
167
|
-
*
|
|
167
|
+
* **Example** (Creating an Option with a Value)
|
|
168
168
|
*
|
|
169
|
-
* @example
|
|
170
169
|
* ```ts
|
|
171
|
-
* // Title: Creating an Option with a Value
|
|
172
170
|
* import { Option } from "effect"
|
|
173
171
|
*
|
|
174
172
|
* // An Option holding the number 1
|
|
@@ -181,6 +179,8 @@ export const none = <A = never>(): Option<A> => option.none
|
|
|
181
179
|
* // Output: { _id: 'Option', _tag: 'Some', value: 1 }
|
|
182
180
|
* ```
|
|
183
181
|
*
|
|
182
|
+
* @see {@link none} for the opposite operation.
|
|
183
|
+
*
|
|
184
184
|
* @category Constructors
|
|
185
185
|
* @since 2.0.0
|
|
186
186
|
*/
|
|
@@ -218,8 +218,6 @@ export const isOption: (input: unknown) => input is Option<unknown> = option.isO
|
|
|
218
218
|
/**
|
|
219
219
|
* Checks whether an `Option` represents the absence of a value (`None`).
|
|
220
220
|
*
|
|
221
|
-
* @see {@link isSome} for the opposite check.
|
|
222
|
-
*
|
|
223
221
|
* @example
|
|
224
222
|
* ```ts
|
|
225
223
|
* import { Option } from "effect"
|
|
@@ -231,6 +229,8 @@ export const isOption: (input: unknown) => input is Option<unknown> = option.isO
|
|
|
231
229
|
* // Output: true
|
|
232
230
|
* ```
|
|
233
231
|
*
|
|
232
|
+
* @see {@link isSome} for the opposite check.
|
|
233
|
+
*
|
|
234
234
|
* @category Guards
|
|
235
235
|
* @since 2.0.0
|
|
236
236
|
*/
|
|
@@ -239,8 +239,6 @@ export const isNone: <A>(self: Option<A>) => self is None<A> = option.isNone
|
|
|
239
239
|
/**
|
|
240
240
|
* Checks whether an `Option` contains a value (`Some`).
|
|
241
241
|
*
|
|
242
|
-
* @see {@link isNone} for the opposite check.
|
|
243
|
-
*
|
|
244
242
|
* @example
|
|
245
243
|
* ```ts
|
|
246
244
|
* import { Option } from "effect"
|
|
@@ -252,6 +250,8 @@ export const isNone: <A>(self: Option<A>) => self is None<A> = option.isNone
|
|
|
252
250
|
* // Output: false
|
|
253
251
|
* ```
|
|
254
252
|
*
|
|
253
|
+
* @see {@link isNone} for the opposite check.
|
|
254
|
+
*
|
|
255
255
|
* @category Guards
|
|
256
256
|
* @since 2.0.0
|
|
257
257
|
*/
|
|
@@ -277,9 +277,9 @@ export const isSome: <A>(self: Option<A>) => self is Some<A> = option.isSome
|
|
|
277
277
|
* without resorting to `if` or manual checks, making your code more declarative
|
|
278
278
|
* and readable.
|
|
279
279
|
*
|
|
280
|
-
*
|
|
280
|
+
* **Example** (Pattern Matching with Option)
|
|
281
|
+
*
|
|
281
282
|
* ```ts
|
|
282
|
-
* // Title: Pattern Matching with Option
|
|
283
283
|
* import { Option } from "effect"
|
|
284
284
|
*
|
|
285
285
|
* const foo = Option.some(1)
|
|
@@ -317,9 +317,9 @@ export const match: {
|
|
|
317
317
|
* without resorting to `if` or manual checks, making your code more declarative
|
|
318
318
|
* and readable.
|
|
319
319
|
*
|
|
320
|
-
*
|
|
320
|
+
* **Example** (Pattern Matching with Option)
|
|
321
|
+
*
|
|
321
322
|
* ```ts
|
|
322
|
-
* // Title: Pattern Matching with Option
|
|
323
323
|
* import { Option } from "effect"
|
|
324
324
|
*
|
|
325
325
|
* const foo = Option.some(1)
|
|
@@ -362,9 +362,9 @@ export const match: {
|
|
|
362
362
|
* without resorting to `if` or manual checks, making your code more declarative
|
|
363
363
|
* and readable.
|
|
364
364
|
*
|
|
365
|
-
*
|
|
365
|
+
* **Example** (Pattern Matching with Option)
|
|
366
|
+
*
|
|
366
367
|
* ```ts
|
|
367
|
-
* // Title: Pattern Matching with Option
|
|
368
368
|
* import { Option } from "effect"
|
|
369
369
|
*
|
|
370
370
|
* const foo = Option.some(1)
|
|
@@ -495,8 +495,6 @@ export const fromIterable = <A>(collection: Iterable<A>): Option<A> => {
|
|
|
495
495
|
* using this function, you can convert `Either` into a simpler structure for
|
|
496
496
|
* cases where error handling is not required.
|
|
497
497
|
*
|
|
498
|
-
* @see {@link getLeft} for the opposite operation.
|
|
499
|
-
*
|
|
500
498
|
* @example
|
|
501
499
|
* ```ts
|
|
502
500
|
* import { Either, Option } from "effect"
|
|
@@ -508,6 +506,8 @@ export const fromIterable = <A>(collection: Iterable<A>): Option<A> => {
|
|
|
508
506
|
* // Output: { _id: 'Option', _tag: 'None' }
|
|
509
507
|
* ```
|
|
510
508
|
*
|
|
509
|
+
* @see {@link getLeft} for the opposite operation.
|
|
510
|
+
*
|
|
511
511
|
* @category Conversions
|
|
512
512
|
* @since 2.0.0
|
|
513
513
|
*/
|
|
@@ -529,8 +529,6 @@ export const getRight: <R, L>(self: Either<R, L>) => Option<R> = either.getRight
|
|
|
529
529
|
* `Either` and want to handle it as an `Option`. By discarding the right value,
|
|
530
530
|
* it simplifies error-focused workflows.
|
|
531
531
|
*
|
|
532
|
-
* @see {@link getRight} for the opposite operation.
|
|
533
|
-
*
|
|
534
532
|
* @example
|
|
535
533
|
* ```ts
|
|
536
534
|
* import { Either, Option } from "effect"
|
|
@@ -542,6 +540,8 @@ export const getRight: <R, L>(self: Either<R, L>) => Option<R> = either.getRight
|
|
|
542
540
|
* // Output: { _id: 'Option', _tag: 'Some', value: 'err' }
|
|
543
541
|
* ```
|
|
544
542
|
*
|
|
543
|
+
* @see {@link getRight} for the opposite operation.
|
|
544
|
+
*
|
|
545
545
|
* @category Conversions
|
|
546
546
|
* @since 2.0.0
|
|
547
547
|
*/
|
|
@@ -563,9 +563,6 @@ export const getLeft: <R, L>(self: Either<R, L>) => Option<L> = either.getLeft
|
|
|
563
563
|
* value. It is particularly useful for providing default values or alternative
|
|
564
564
|
* logic when working with optional values.
|
|
565
565
|
*
|
|
566
|
-
* @see {@link getOrNull} for a version that returns `null` instead of executing a function.
|
|
567
|
-
* @see {@link getOrUndefined} for a version that returns `undefined` instead of executing a function.
|
|
568
|
-
*
|
|
569
566
|
* @example
|
|
570
567
|
* ```ts
|
|
571
568
|
* import { Option } from "effect"
|
|
@@ -577,6 +574,9 @@ export const getLeft: <R, L>(self: Either<R, L>) => Option<L> = either.getLeft
|
|
|
577
574
|
* // Output: 0
|
|
578
575
|
* ```
|
|
579
576
|
*
|
|
577
|
+
* @see {@link getOrNull} for a version that returns `null` instead of executing a function.
|
|
578
|
+
* @see {@link getOrUndefined} for a version that returns `undefined` instead of executing a function.
|
|
579
|
+
*
|
|
580
580
|
* @category Getters
|
|
581
581
|
* @since 2.0.0
|
|
582
582
|
*/
|
|
@@ -597,9 +597,6 @@ export const getOrElse: {
|
|
|
597
597
|
* value. It is particularly useful for providing default values or alternative
|
|
598
598
|
* logic when working with optional values.
|
|
599
599
|
*
|
|
600
|
-
* @see {@link getOrNull} for a version that returns `null` instead of executing a function.
|
|
601
|
-
* @see {@link getOrUndefined} for a version that returns `undefined` instead of executing a function.
|
|
602
|
-
*
|
|
603
600
|
* @example
|
|
604
601
|
* ```ts
|
|
605
602
|
* import { Option } from "effect"
|
|
@@ -611,6 +608,9 @@ export const getOrElse: {
|
|
|
611
608
|
* // Output: 0
|
|
612
609
|
* ```
|
|
613
610
|
*
|
|
611
|
+
* @see {@link getOrNull} for a version that returns `null` instead of executing a function.
|
|
612
|
+
* @see {@link getOrUndefined} for a version that returns `undefined` instead of executing a function.
|
|
613
|
+
*
|
|
614
614
|
* @category Getters
|
|
615
615
|
* @since 2.0.0
|
|
616
616
|
*/
|
|
@@ -631,9 +631,6 @@ export const getOrElse: {
|
|
|
631
631
|
* value. It is particularly useful for providing default values or alternative
|
|
632
632
|
* logic when working with optional values.
|
|
633
633
|
*
|
|
634
|
-
* @see {@link getOrNull} for a version that returns `null` instead of executing a function.
|
|
635
|
-
* @see {@link getOrUndefined} for a version that returns `undefined` instead of executing a function.
|
|
636
|
-
*
|
|
637
634
|
* @example
|
|
638
635
|
* ```ts
|
|
639
636
|
* import { Option } from "effect"
|
|
@@ -645,6 +642,9 @@ export const getOrElse: {
|
|
|
645
642
|
* // Output: 0
|
|
646
643
|
* ```
|
|
647
644
|
*
|
|
645
|
+
* @see {@link getOrNull} for a version that returns `null` instead of executing a function.
|
|
646
|
+
* @see {@link getOrUndefined} for a version that returns `undefined` instead of executing a function.
|
|
647
|
+
*
|
|
648
648
|
* @category Getters
|
|
649
649
|
* @since 2.0.0
|
|
650
650
|
*/
|
|
@@ -1157,8 +1157,6 @@ export const liftThrowable = <A extends ReadonlyArray<unknown>, B>(
|
|
|
1157
1157
|
* a fail-fast behavior for empty `Option` values and want to provide a custom
|
|
1158
1158
|
* error message or object.
|
|
1159
1159
|
*
|
|
1160
|
-
* @see {@link getOrThrow} for a version that throws a default error.
|
|
1161
|
-
*
|
|
1162
1160
|
* @example
|
|
1163
1161
|
* ```ts
|
|
1164
1162
|
* import * as assert from "node:assert"
|
|
@@ -1171,6 +1169,8 @@ export const liftThrowable = <A extends ReadonlyArray<unknown>, B>(
|
|
|
1171
1169
|
* assert.throws(() => Option.getOrThrowWith(Option.none(), () => new Error('Unexpected None')))
|
|
1172
1170
|
* ```
|
|
1173
1171
|
*
|
|
1172
|
+
* @see {@link getOrThrow} for a version that throws a default error.
|
|
1173
|
+
*
|
|
1174
1174
|
* @category Conversions
|
|
1175
1175
|
* @since 2.0.0
|
|
1176
1176
|
*/
|
|
@@ -1187,8 +1187,6 @@ export const getOrThrowWith: {
|
|
|
1187
1187
|
* a fail-fast behavior for empty `Option` values and want to provide a custom
|
|
1188
1188
|
* error message or object.
|
|
1189
1189
|
*
|
|
1190
|
-
* @see {@link getOrThrow} for a version that throws a default error.
|
|
1191
|
-
*
|
|
1192
1190
|
* @example
|
|
1193
1191
|
* ```ts
|
|
1194
1192
|
* import * as assert from "node:assert"
|
|
@@ -1201,6 +1199,8 @@ export const getOrThrowWith: {
|
|
|
1201
1199
|
* assert.throws(() => Option.getOrThrowWith(Option.none(), () => new Error('Unexpected None')))
|
|
1202
1200
|
* ```
|
|
1203
1201
|
*
|
|
1202
|
+
* @see {@link getOrThrow} for a version that throws a default error.
|
|
1203
|
+
*
|
|
1204
1204
|
* @category Conversions
|
|
1205
1205
|
* @since 2.0.0
|
|
1206
1206
|
*/
|
|
@@ -1217,8 +1217,6 @@ export const getOrThrowWith: {
|
|
|
1217
1217
|
* a fail-fast behavior for empty `Option` values and want to provide a custom
|
|
1218
1218
|
* error message or object.
|
|
1219
1219
|
*
|
|
1220
|
-
* @see {@link getOrThrow} for a version that throws a default error.
|
|
1221
|
-
*
|
|
1222
1220
|
* @example
|
|
1223
1221
|
* ```ts
|
|
1224
1222
|
* import * as assert from "node:assert"
|
|
@@ -1231,6 +1229,8 @@ export const getOrThrowWith: {
|
|
|
1231
1229
|
* assert.throws(() => Option.getOrThrowWith(Option.none(), () => new Error('Unexpected None')))
|
|
1232
1230
|
* ```
|
|
1233
1231
|
*
|
|
1232
|
+
* @see {@link getOrThrow} for a version that throws a default error.
|
|
1233
|
+
*
|
|
1234
1234
|
* @category Conversions
|
|
1235
1235
|
* @since 2.0.0
|
|
1236
1236
|
*/
|
|
@@ -1253,8 +1253,6 @@ export const getOrThrowWith: {
|
|
|
1253
1253
|
* scenarios where the absence of a value is treated as an exceptional case and
|
|
1254
1254
|
* a default error is sufficient.
|
|
1255
1255
|
*
|
|
1256
|
-
* @see {@link getOrThrowWith} for a version that allows you to provide a custom error.
|
|
1257
|
-
*
|
|
1258
1256
|
* @example
|
|
1259
1257
|
* ```ts
|
|
1260
1258
|
* import * as assert from "node:assert"
|
|
@@ -1264,6 +1262,8 @@ export const getOrThrowWith: {
|
|
|
1264
1262
|
* assert.throws(() => Option.getOrThrow(Option.none()))
|
|
1265
1263
|
* ```
|
|
1266
1264
|
*
|
|
1265
|
+
* @see {@link getOrThrowWith} for a version that allows you to provide a custom error.
|
|
1266
|
+
*
|
|
1267
1267
|
* @category Conversions
|
|
1268
1268
|
* @since 2.0.0
|
|
1269
1269
|
*/
|
|
@@ -3102,9 +3102,9 @@ export const filter: {
|
|
|
3102
3102
|
* - Two `Some` values are equivalent if their inner values are equivalent
|
|
3103
3103
|
* according to the provided `Equivalence`.
|
|
3104
3104
|
*
|
|
3105
|
-
*
|
|
3105
|
+
* **Example** (Comparing Optional Numbers for Equivalence)
|
|
3106
|
+
*
|
|
3106
3107
|
* ```ts
|
|
3107
|
-
* // Title: Comparing Optional Numbers for Equivalence
|
|
3108
3108
|
* import { Number, Option } from "effect"
|
|
3109
3109
|
*
|
|
3110
3110
|
* const isEquivalent = Option.getEquivalence(Number.Equivalence)
|
|
@@ -3361,8 +3361,6 @@ export const liftPredicate: { // Note: I intentionally avoid using the NoInfer p
|
|
|
3361
3361
|
* equivalence function returns `true`, the result is `true`. If the `Option` is
|
|
3362
3362
|
* `None` or the values are not equivalent, the result is `false`.
|
|
3363
3363
|
*
|
|
3364
|
-
* @see {@link contains} for a version that uses the default `Equivalence`.
|
|
3365
|
-
*
|
|
3366
3364
|
* @example
|
|
3367
3365
|
* ```ts
|
|
3368
3366
|
* import { Number, Option } from "effect"
|
|
@@ -3379,6 +3377,8 @@ export const liftPredicate: { // Note: I intentionally avoid using the NoInfer p
|
|
|
3379
3377
|
* // Output: false
|
|
3380
3378
|
* ```
|
|
3381
3379
|
*
|
|
3380
|
+
* @see {@link contains} for a version that uses the default `Equivalence`.
|
|
3381
|
+
*
|
|
3382
3382
|
* @category Elements
|
|
3383
3383
|
* @since 2.0.0
|
|
3384
3384
|
*/
|
|
@@ -3401,8 +3401,6 @@ const _equivalence = Equal.equivalence()
|
|
|
3401
3401
|
* result is `true`. If the `Option` is `None` or the values are not equivalent,
|
|
3402
3402
|
* the result is `false`.
|
|
3403
3403
|
*
|
|
3404
|
-
* @see {@link containsWith} for a version that allows you to specify a custom equivalence function.
|
|
3405
|
-
*
|
|
3406
3404
|
* @example
|
|
3407
3405
|
* ```ts
|
|
3408
3406
|
* import { Option } from "effect"
|
|
@@ -3417,6 +3415,8 @@ const _equivalence = Equal.equivalence()
|
|
|
3417
3415
|
* // Output: false
|
|
3418
3416
|
* ```
|
|
3419
3417
|
*
|
|
3418
|
+
* @see {@link containsWith} for a version that allows you to specify a custom equivalence function.
|
|
3419
|
+
*
|
|
3420
3420
|
* @category Elements
|
|
3421
3421
|
* @since 2.0.0
|
|
3422
3422
|
*/
|
|
@@ -3433,8 +3433,6 @@ export const contains: {
|
|
|
3433
3433
|
* result is `true`. If the `Option` is `None` or the values are not equivalent,
|
|
3434
3434
|
* the result is `false`.
|
|
3435
3435
|
*
|
|
3436
|
-
* @see {@link containsWith} for a version that allows you to specify a custom equivalence function.
|
|
3437
|
-
*
|
|
3438
3436
|
* @example
|
|
3439
3437
|
* ```ts
|
|
3440
3438
|
* import { Option } from "effect"
|
|
@@ -3449,6 +3447,8 @@ export const contains: {
|
|
|
3449
3447
|
* // Output: false
|
|
3450
3448
|
* ```
|
|
3451
3449
|
*
|
|
3450
|
+
* @see {@link containsWith} for a version that allows you to specify a custom equivalence function.
|
|
3451
|
+
*
|
|
3452
3452
|
* @category Elements
|
|
3453
3453
|
* @since 2.0.0
|
|
3454
3454
|
*/
|
|
@@ -3465,8 +3465,6 @@ export const contains: {
|
|
|
3465
3465
|
* result is `true`. If the `Option` is `None` or the values are not equivalent,
|
|
3466
3466
|
* the result is `false`.
|
|
3467
3467
|
*
|
|
3468
|
-
* @see {@link containsWith} for a version that allows you to specify a custom equivalence function.
|
|
3469
|
-
*
|
|
3470
3468
|
* @example
|
|
3471
3469
|
* ```ts
|
|
3472
3470
|
* import { Option } from "effect"
|
|
@@ -3481,6 +3479,8 @@ export const contains: {
|
|
|
3481
3479
|
* // Output: false
|
|
3482
3480
|
* ```
|
|
3483
3481
|
*
|
|
3482
|
+
* @see {@link containsWith} for a version that allows you to specify a custom equivalence function.
|
|
3483
|
+
*
|
|
3484
3484
|
* @category Elements
|
|
3485
3485
|
* @since 2.0.0
|
|
3486
3486
|
*/
|
|
@@ -3673,10 +3673,6 @@ export const exists: {
|
|
|
3673
3673
|
* 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
|
|
3674
3674
|
* 5. Regular `Option` functions like `map` and `filter` can still be used within the do simulation. These functions will receive the accumulated variables as arguments within the scope
|
|
3675
3675
|
*
|
|
3676
|
-
* @see {@link Do}
|
|
3677
|
-
* @see {@link bind}
|
|
3678
|
-
* @see {@link let_ let}
|
|
3679
|
-
*
|
|
3680
3676
|
* @example
|
|
3681
3677
|
* ```ts
|
|
3682
3678
|
* import * as assert from "node:assert"
|
|
@@ -3692,6 +3688,10 @@ export const exists: {
|
|
|
3692
3688
|
* assert.deepStrictEqual(result, Option.some({ x: 2, y: 3, sum: 5 }))
|
|
3693
3689
|
* ```
|
|
3694
3690
|
*
|
|
3691
|
+
* @see {@link Do}
|
|
3692
|
+
* @see {@link bind}
|
|
3693
|
+
* @see {@link let_ let}
|
|
3694
|
+
*
|
|
3695
3695
|
* @category Do notation
|
|
3696
3696
|
* @since 2.0.0
|
|
3697
3697
|
*/
|
|
@@ -3711,10 +3711,6 @@ export const bindTo: {
|
|
|
3711
3711
|
* 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
|
|
3712
3712
|
* 5. Regular `Option` functions like `map` and `filter` can still be used within the do simulation. These functions will receive the accumulated variables as arguments within the scope
|
|
3713
3713
|
*
|
|
3714
|
-
* @see {@link Do}
|
|
3715
|
-
* @see {@link bind}
|
|
3716
|
-
* @see {@link let_ let}
|
|
3717
|
-
*
|
|
3718
3714
|
* @example
|
|
3719
3715
|
* ```ts
|
|
3720
3716
|
* import * as assert from "node:assert"
|
|
@@ -3730,6 +3726,10 @@ export const bindTo: {
|
|
|
3730
3726
|
* assert.deepStrictEqual(result, Option.some({ x: 2, y: 3, sum: 5 }))
|
|
3731
3727
|
* ```
|
|
3732
3728
|
*
|
|
3729
|
+
* @see {@link Do}
|
|
3730
|
+
* @see {@link bind}
|
|
3731
|
+
* @see {@link let_ let}
|
|
3732
|
+
*
|
|
3733
3733
|
* @category Do notation
|
|
3734
3734
|
* @since 2.0.0
|
|
3735
3735
|
*/
|
|
@@ -3749,10 +3749,6 @@ export const bindTo: {
|
|
|
3749
3749
|
* 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
|
|
3750
3750
|
* 5. Regular `Option` functions like `map` and `filter` can still be used within the do simulation. These functions will receive the accumulated variables as arguments within the scope
|
|
3751
3751
|
*
|
|
3752
|
-
* @see {@link Do}
|
|
3753
|
-
* @see {@link bind}
|
|
3754
|
-
* @see {@link let_ let}
|
|
3755
|
-
*
|
|
3756
3752
|
* @example
|
|
3757
3753
|
* ```ts
|
|
3758
3754
|
* import * as assert from "node:assert"
|
|
@@ -3768,6 +3764,10 @@ export const bindTo: {
|
|
|
3768
3764
|
* assert.deepStrictEqual(result, Option.some({ x: 2, y: 3, sum: 5 }))
|
|
3769
3765
|
* ```
|
|
3770
3766
|
*
|
|
3767
|
+
* @see {@link Do}
|
|
3768
|
+
* @see {@link bind}
|
|
3769
|
+
* @see {@link let_ let}
|
|
3770
|
+
*
|
|
3771
3771
|
* @category Do notation
|
|
3772
3772
|
* @since 2.0.0
|
|
3773
3773
|
*/
|
|
@@ -3798,10 +3798,6 @@ export {
|
|
|
3798
3798
|
* 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
|
|
3799
3799
|
* 5. Regular `Option` functions like `map` and `filter` can still be used within the do simulation. These functions will receive the accumulated variables as arguments within the scope
|
|
3800
3800
|
*
|
|
3801
|
-
* @see {@link Do}
|
|
3802
|
-
* @see {@link bind}
|
|
3803
|
-
* @see {@link bindTo}
|
|
3804
|
-
*
|
|
3805
3801
|
* @example
|
|
3806
3802
|
* ```ts
|
|
3807
3803
|
* import * as assert from "node:assert"
|
|
@@ -3815,8 +3811,12 @@ export {
|
|
|
3815
3811
|
* Option.filter(({ x, y }) => x * y > 5)
|
|
3816
3812
|
* )
|
|
3817
3813
|
* assert.deepStrictEqual(result, Option.some({ x: 2, y: 3, sum: 5 }))
|
|
3818
|
-
*
|
|
3819
3814
|
* ```
|
|
3815
|
+
*
|
|
3816
|
+
* @see {@link Do}
|
|
3817
|
+
* @see {@link bind}
|
|
3818
|
+
* @see {@link bindTo}
|
|
3819
|
+
*
|
|
3820
3820
|
* @category Do notation
|
|
3821
3821
|
* @since 2.0.0
|
|
3822
3822
|
*/
|
|
@@ -3834,10 +3834,6 @@ export {
|
|
|
3834
3834
|
* 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
|
|
3835
3835
|
* 5. Regular `Option` functions like `map` and `filter` can still be used within the do simulation. These functions will receive the accumulated variables as arguments within the scope
|
|
3836
3836
|
*
|
|
3837
|
-
* @see {@link Do}
|
|
3838
|
-
* @see {@link bindTo}
|
|
3839
|
-
* @see {@link let_ let}
|
|
3840
|
-
*
|
|
3841
3837
|
* @example
|
|
3842
3838
|
* ```ts
|
|
3843
3839
|
* import * as assert from "node:assert"
|
|
@@ -3853,6 +3849,10 @@ export {
|
|
|
3853
3849
|
* assert.deepStrictEqual(result, Option.some({ x: 2, y: 3, sum: 5 }))
|
|
3854
3850
|
* ```
|
|
3855
3851
|
*
|
|
3852
|
+
* @see {@link Do}
|
|
3853
|
+
* @see {@link bindTo}
|
|
3854
|
+
* @see {@link let_ let}
|
|
3855
|
+
*
|
|
3856
3856
|
* @category Do notation
|
|
3857
3857
|
* @since 2.0.0
|
|
3858
3858
|
*/
|
|
@@ -3868,10 +3868,6 @@ export const bind: {
|
|
|
3868
3868
|
* 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
|
|
3869
3869
|
* 5. Regular `Option` functions like `map` and `filter` can still be used within the do simulation. These functions will receive the accumulated variables as arguments within the scope
|
|
3870
3870
|
*
|
|
3871
|
-
* @see {@link Do}
|
|
3872
|
-
* @see {@link bindTo}
|
|
3873
|
-
* @see {@link let_ let}
|
|
3874
|
-
*
|
|
3875
3871
|
* @example
|
|
3876
3872
|
* ```ts
|
|
3877
3873
|
* import * as assert from "node:assert"
|
|
@@ -3887,6 +3883,10 @@ export const bind: {
|
|
|
3887
3883
|
* assert.deepStrictEqual(result, Option.some({ x: 2, y: 3, sum: 5 }))
|
|
3888
3884
|
* ```
|
|
3889
3885
|
*
|
|
3886
|
+
* @see {@link Do}
|
|
3887
|
+
* @see {@link bindTo}
|
|
3888
|
+
* @see {@link let_ let}
|
|
3889
|
+
*
|
|
3890
3890
|
* @category Do notation
|
|
3891
3891
|
* @since 2.0.0
|
|
3892
3892
|
*/
|
|
@@ -3902,10 +3902,6 @@ export const bind: {
|
|
|
3902
3902
|
* 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
|
|
3903
3903
|
* 5. Regular `Option` functions like `map` and `filter` can still be used within the do simulation. These functions will receive the accumulated variables as arguments within the scope
|
|
3904
3904
|
*
|
|
3905
|
-
* @see {@link Do}
|
|
3906
|
-
* @see {@link bindTo}
|
|
3907
|
-
* @see {@link let_ let}
|
|
3908
|
-
*
|
|
3909
3905
|
* @example
|
|
3910
3906
|
* ```ts
|
|
3911
3907
|
* import * as assert from "node:assert"
|
|
@@ -3921,6 +3917,10 @@ export const bind: {
|
|
|
3921
3917
|
* assert.deepStrictEqual(result, Option.some({ x: 2, y: 3, sum: 5 }))
|
|
3922
3918
|
* ```
|
|
3923
3919
|
*
|
|
3920
|
+
* @see {@link Do}
|
|
3921
|
+
* @see {@link bindTo}
|
|
3922
|
+
* @see {@link let_ let}
|
|
3923
|
+
*
|
|
3924
3924
|
* @category Do notation
|
|
3925
3925
|
* @since 2.0.0
|
|
3926
3926
|
*/
|
|
@@ -3942,10 +3942,6 @@ export const bind: {
|
|
|
3942
3942
|
* 4. Inside the do simulation scope, you can also use the `let` function to define variables and bind them to simple values
|
|
3943
3943
|
* 5. Regular `Option` functions like `map` and `filter` can still be used within the do simulation. These functions will receive the accumulated variables as arguments within the scope
|
|
3944
3944
|
*
|
|
3945
|
-
* @see {@link bindTo}
|
|
3946
|
-
* @see {@link bind}
|
|
3947
|
-
* @see {@link let_ let}
|
|
3948
|
-
*
|
|
3949
3945
|
* @example
|
|
3950
3946
|
* ```ts
|
|
3951
3947
|
* import * as assert from "node:assert"
|
|
@@ -3961,6 +3957,10 @@ export const bind: {
|
|
|
3961
3957
|
* assert.deepStrictEqual(result, Option.some({ x: 2, y: 3, sum: 5 }))
|
|
3962
3958
|
* ```
|
|
3963
3959
|
*
|
|
3960
|
+
* @see {@link bindTo}
|
|
3961
|
+
* @see {@link bind}
|
|
3962
|
+
* @see {@link let_ let}
|
|
3963
|
+
*
|
|
3964
3964
|
* @category Do notation
|
|
3965
3965
|
* @since 2.0.0
|
|
3966
3966
|
*/
|
|
@@ -3974,9 +3974,9 @@ const adapter = Gen.adapter<OptionTypeLambda>()
|
|
|
3974
3974
|
* involves `Option` easier to write and understand. This approach is similar to
|
|
3975
3975
|
* using `async/await` but tailored for `Option`.
|
|
3976
3976
|
*
|
|
3977
|
-
*
|
|
3977
|
+
* **Example** (Using `Option.gen` to Create a Combined Value)
|
|
3978
|
+
*
|
|
3978
3979
|
* ```ts
|
|
3979
|
-
* // Title: Using Option.gen to Create a Combined Value
|
|
3980
3980
|
* import { Option } from "effect"
|
|
3981
3981
|
*
|
|
3982
3982
|
* const maybeName: Option.Option<string> = Option.some("John")
|
package/src/Predicate.ts
CHANGED
|
@@ -431,6 +431,10 @@ export const isBigInt = (input: unknown): input is bigint => typeof input === "b
|
|
|
431
431
|
*/
|
|
432
432
|
export const isSymbol = (input: unknown): input is symbol => typeof input === "symbol"
|
|
433
433
|
|
|
434
|
+
// TODO: make public
|
|
435
|
+
/** @internal */
|
|
436
|
+
export const isPropertyKey = (u: unknown): u is PropertyKey => isString(u) || isNumber(u) || isSymbol(u)
|
|
437
|
+
|
|
434
438
|
/**
|
|
435
439
|
* Tests if a value is a `function`.
|
|
436
440
|
*
|