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/BigInt.ts
CHANGED
|
@@ -20,10 +20,9 @@ const bigint2 = BigInt(2)
|
|
|
20
20
|
/**
|
|
21
21
|
* Tests if a value is a `bigint`.
|
|
22
22
|
*
|
|
23
|
-
* @param input - The value to test.
|
|
24
|
-
*
|
|
25
23
|
* @example
|
|
26
24
|
* ```ts
|
|
25
|
+
* import * as assert from "node:assert"
|
|
27
26
|
* import { isBigInt } from "effect/BigInt"
|
|
28
27
|
*
|
|
29
28
|
* assert.deepStrictEqual(isBigInt(1n), true)
|
|
@@ -38,11 +37,9 @@ export const isBigInt: (u: unknown) => u is bigint = predicate.isBigInt
|
|
|
38
37
|
/**
|
|
39
38
|
* Provides an addition operation on `bigint`s.
|
|
40
39
|
*
|
|
41
|
-
* @param self - The first operand.
|
|
42
|
-
* @param that - The second operand.
|
|
43
|
-
*
|
|
44
40
|
* @example
|
|
45
41
|
* ```ts
|
|
42
|
+
* import * as assert from "node:assert"
|
|
46
43
|
* import { sum } from "effect/BigInt"
|
|
47
44
|
*
|
|
48
45
|
* assert.deepStrictEqual(sum(2n, 3n), 5n)
|
|
@@ -55,11 +52,9 @@ export const sum: {
|
|
|
55
52
|
/**
|
|
56
53
|
* Provides an addition operation on `bigint`s.
|
|
57
54
|
*
|
|
58
|
-
* @param self - The first operand.
|
|
59
|
-
* @param that - The second operand.
|
|
60
|
-
*
|
|
61
55
|
* @example
|
|
62
56
|
* ```ts
|
|
57
|
+
* import * as assert from "node:assert"
|
|
63
58
|
* import { sum } from "effect/BigInt"
|
|
64
59
|
*
|
|
65
60
|
* assert.deepStrictEqual(sum(2n, 3n), 5n)
|
|
@@ -72,11 +67,9 @@ export const sum: {
|
|
|
72
67
|
/**
|
|
73
68
|
* Provides an addition operation on `bigint`s.
|
|
74
69
|
*
|
|
75
|
-
* @param self - The first operand.
|
|
76
|
-
* @param that - The second operand.
|
|
77
|
-
*
|
|
78
70
|
* @example
|
|
79
71
|
* ```ts
|
|
72
|
+
* import * as assert from "node:assert"
|
|
80
73
|
* import { sum } from "effect/BigInt"
|
|
81
74
|
*
|
|
82
75
|
* assert.deepStrictEqual(sum(2n, 3n), 5n)
|
|
@@ -91,11 +84,9 @@ export const sum: {
|
|
|
91
84
|
/**
|
|
92
85
|
* Provides a multiplication operation on `bigint`s.
|
|
93
86
|
*
|
|
94
|
-
* @param self - The first operand.
|
|
95
|
-
* @param that - The second operand.
|
|
96
|
-
*
|
|
97
87
|
* @example
|
|
98
88
|
* ```ts
|
|
89
|
+
* import * as assert from "node:assert"
|
|
99
90
|
* import { multiply } from "effect/BigInt"
|
|
100
91
|
*
|
|
101
92
|
* assert.deepStrictEqual(multiply(2n, 3n), 6n)
|
|
@@ -108,11 +99,9 @@ export const multiply: {
|
|
|
108
99
|
/**
|
|
109
100
|
* Provides a multiplication operation on `bigint`s.
|
|
110
101
|
*
|
|
111
|
-
* @param self - The first operand.
|
|
112
|
-
* @param that - The second operand.
|
|
113
|
-
*
|
|
114
102
|
* @example
|
|
115
103
|
* ```ts
|
|
104
|
+
* import * as assert from "node:assert"
|
|
116
105
|
* import { multiply } from "effect/BigInt"
|
|
117
106
|
*
|
|
118
107
|
* assert.deepStrictEqual(multiply(2n, 3n), 6n)
|
|
@@ -125,11 +114,9 @@ export const multiply: {
|
|
|
125
114
|
/**
|
|
126
115
|
* Provides a multiplication operation on `bigint`s.
|
|
127
116
|
*
|
|
128
|
-
* @param self - The first operand.
|
|
129
|
-
* @param that - The second operand.
|
|
130
|
-
*
|
|
131
117
|
* @example
|
|
132
118
|
* ```ts
|
|
119
|
+
* import * as assert from "node:assert"
|
|
133
120
|
* import { multiply } from "effect/BigInt"
|
|
134
121
|
*
|
|
135
122
|
* assert.deepStrictEqual(multiply(2n, 3n), 6n)
|
|
@@ -144,11 +131,9 @@ export const multiply: {
|
|
|
144
131
|
/**
|
|
145
132
|
* Provides a subtraction operation on `bigint`s.
|
|
146
133
|
*
|
|
147
|
-
* @param self - The first operand.
|
|
148
|
-
* @param that - The second operand.
|
|
149
|
-
*
|
|
150
134
|
* @example
|
|
151
135
|
* ```ts
|
|
136
|
+
* import * as assert from "node:assert"
|
|
152
137
|
* import { subtract } from "effect/BigInt"
|
|
153
138
|
*
|
|
154
139
|
* assert.deepStrictEqual(subtract(2n, 3n), -1n)
|
|
@@ -161,11 +146,9 @@ export const subtract: {
|
|
|
161
146
|
/**
|
|
162
147
|
* Provides a subtraction operation on `bigint`s.
|
|
163
148
|
*
|
|
164
|
-
* @param self - The first operand.
|
|
165
|
-
* @param that - The second operand.
|
|
166
|
-
*
|
|
167
149
|
* @example
|
|
168
150
|
* ```ts
|
|
151
|
+
* import * as assert from "node:assert"
|
|
169
152
|
* import { subtract } from "effect/BigInt"
|
|
170
153
|
*
|
|
171
154
|
* assert.deepStrictEqual(subtract(2n, 3n), -1n)
|
|
@@ -178,11 +161,9 @@ export const subtract: {
|
|
|
178
161
|
/**
|
|
179
162
|
* Provides a subtraction operation on `bigint`s.
|
|
180
163
|
*
|
|
181
|
-
* @param self - The first operand.
|
|
182
|
-
* @param that - The second operand.
|
|
183
|
-
*
|
|
184
164
|
* @example
|
|
185
165
|
* ```ts
|
|
166
|
+
* import * as assert from "node:assert"
|
|
186
167
|
* import { subtract } from "effect/BigInt"
|
|
187
168
|
*
|
|
188
169
|
* assert.deepStrictEqual(subtract(2n, 3n), -1n)
|
|
@@ -202,11 +183,9 @@ export const subtract: {
|
|
|
202
183
|
*
|
|
203
184
|
* Returns `None` if the divisor is `0n`.
|
|
204
185
|
*
|
|
205
|
-
* @param self - The dividend operand.
|
|
206
|
-
* @param that - The divisor operand.
|
|
207
|
-
*
|
|
208
186
|
* @example
|
|
209
187
|
* ```ts
|
|
188
|
+
* import * as assert from "node:assert"
|
|
210
189
|
* import { BigInt, Option } from "effect"
|
|
211
190
|
*
|
|
212
191
|
* assert.deepStrictEqual(BigInt.divide(6n, 3n), Option.some(2n))
|
|
@@ -225,11 +204,9 @@ export const divide: {
|
|
|
225
204
|
*
|
|
226
205
|
* Returns `None` if the divisor is `0n`.
|
|
227
206
|
*
|
|
228
|
-
* @param self - The dividend operand.
|
|
229
|
-
* @param that - The divisor operand.
|
|
230
|
-
*
|
|
231
207
|
* @example
|
|
232
208
|
* ```ts
|
|
209
|
+
* import * as assert from "node:assert"
|
|
233
210
|
* import { BigInt, Option } from "effect"
|
|
234
211
|
*
|
|
235
212
|
* assert.deepStrictEqual(BigInt.divide(6n, 3n), Option.some(2n))
|
|
@@ -248,11 +225,9 @@ export const divide: {
|
|
|
248
225
|
*
|
|
249
226
|
* Returns `None` if the divisor is `0n`.
|
|
250
227
|
*
|
|
251
|
-
* @param self - The dividend operand.
|
|
252
|
-
* @param that - The divisor operand.
|
|
253
|
-
*
|
|
254
228
|
* @example
|
|
255
229
|
* ```ts
|
|
230
|
+
* import * as assert from "node:assert"
|
|
256
231
|
* import { BigInt, Option } from "effect"
|
|
257
232
|
*
|
|
258
233
|
* assert.deepStrictEqual(BigInt.divide(6n, 3n), Option.some(2n))
|
|
@@ -276,11 +251,9 @@ export const divide: {
|
|
|
276
251
|
*
|
|
277
252
|
* Throws a `RangeError` if the divisor is `0n`.
|
|
278
253
|
*
|
|
279
|
-
* @param self - The dividend operand.
|
|
280
|
-
* @param that - The divisor operand.
|
|
281
|
-
*
|
|
282
254
|
* @example
|
|
283
255
|
* ```ts
|
|
256
|
+
* import * as assert from "node:assert"
|
|
284
257
|
* import { unsafeDivide } from "effect/BigInt"
|
|
285
258
|
*
|
|
286
259
|
* assert.deepStrictEqual(unsafeDivide(6n, 3n), 2n)
|
|
@@ -299,11 +272,9 @@ export const unsafeDivide: {
|
|
|
299
272
|
*
|
|
300
273
|
* Throws a `RangeError` if the divisor is `0n`.
|
|
301
274
|
*
|
|
302
|
-
* @param self - The dividend operand.
|
|
303
|
-
* @param that - The divisor operand.
|
|
304
|
-
*
|
|
305
275
|
* @example
|
|
306
276
|
* ```ts
|
|
277
|
+
* import * as assert from "node:assert"
|
|
307
278
|
* import { unsafeDivide } from "effect/BigInt"
|
|
308
279
|
*
|
|
309
280
|
* assert.deepStrictEqual(unsafeDivide(6n, 3n), 2n)
|
|
@@ -322,11 +293,9 @@ export const unsafeDivide: {
|
|
|
322
293
|
*
|
|
323
294
|
* Throws a `RangeError` if the divisor is `0n`.
|
|
324
295
|
*
|
|
325
|
-
* @param self - The dividend operand.
|
|
326
|
-
* @param that - The divisor operand.
|
|
327
|
-
*
|
|
328
296
|
* @example
|
|
329
297
|
* ```ts
|
|
298
|
+
* import * as assert from "node:assert"
|
|
330
299
|
* import { unsafeDivide } from "effect/BigInt"
|
|
331
300
|
*
|
|
332
301
|
* assert.deepStrictEqual(unsafeDivide(6n, 3n), 2n)
|
|
@@ -342,10 +311,9 @@ export const unsafeDivide: {
|
|
|
342
311
|
/**
|
|
343
312
|
* Returns the result of adding `1n` to a given number.
|
|
344
313
|
*
|
|
345
|
-
* @param n - A `bigint` to be incremented.
|
|
346
|
-
*
|
|
347
314
|
* @example
|
|
348
315
|
* ```ts
|
|
316
|
+
* import * as assert from "node:assert"
|
|
349
317
|
* import { increment } from "effect/BigInt"
|
|
350
318
|
*
|
|
351
319
|
* assert.deepStrictEqual(increment(2n), 3n)
|
|
@@ -359,10 +327,9 @@ export const increment = (n: bigint): bigint => n + bigint1
|
|
|
359
327
|
/**
|
|
360
328
|
* Decrements a number by `1n`.
|
|
361
329
|
*
|
|
362
|
-
* @param n - A `bigint` to be decremented.
|
|
363
|
-
*
|
|
364
330
|
* @example
|
|
365
331
|
* ```ts
|
|
332
|
+
* import * as assert from "node:assert"
|
|
366
333
|
* import { decrement } from "effect/BigInt"
|
|
367
334
|
*
|
|
368
335
|
* assert.deepStrictEqual(decrement(3n), 2n)
|
|
@@ -388,11 +355,9 @@ export const Order: order.Order<bigint> = order.bigint
|
|
|
388
355
|
/**
|
|
389
356
|
* Returns `true` if the first argument is less than the second, otherwise `false`.
|
|
390
357
|
*
|
|
391
|
-
* @param self - The first argument.
|
|
392
|
-
* @param that - The second argument.
|
|
393
|
-
*
|
|
394
358
|
* @example
|
|
395
359
|
* ```ts
|
|
360
|
+
* import * as assert from "node:assert"
|
|
396
361
|
* import { lessThan } from "effect/BigInt"
|
|
397
362
|
*
|
|
398
363
|
* assert.deepStrictEqual(lessThan(2n, 3n), true)
|
|
@@ -407,11 +372,9 @@ export const lessThan: {
|
|
|
407
372
|
/**
|
|
408
373
|
* Returns `true` if the first argument is less than the second, otherwise `false`.
|
|
409
374
|
*
|
|
410
|
-
* @param self - The first argument.
|
|
411
|
-
* @param that - The second argument.
|
|
412
|
-
*
|
|
413
375
|
* @example
|
|
414
376
|
* ```ts
|
|
377
|
+
* import * as assert from "node:assert"
|
|
415
378
|
* import { lessThan } from "effect/BigInt"
|
|
416
379
|
*
|
|
417
380
|
* assert.deepStrictEqual(lessThan(2n, 3n), true)
|
|
@@ -426,11 +389,9 @@ export const lessThan: {
|
|
|
426
389
|
/**
|
|
427
390
|
* Returns `true` if the first argument is less than the second, otherwise `false`.
|
|
428
391
|
*
|
|
429
|
-
* @param self - The first argument.
|
|
430
|
-
* @param that - The second argument.
|
|
431
|
-
*
|
|
432
392
|
* @example
|
|
433
393
|
* ```ts
|
|
394
|
+
* import * as assert from "node:assert"
|
|
434
395
|
* import { lessThan } from "effect/BigInt"
|
|
435
396
|
*
|
|
436
397
|
* assert.deepStrictEqual(lessThan(2n, 3n), true)
|
|
@@ -447,11 +408,9 @@ export const lessThan: {
|
|
|
447
408
|
/**
|
|
448
409
|
* Returns a function that checks if a given `bigint` is less than or equal to the provided one.
|
|
449
410
|
*
|
|
450
|
-
* @param self - The first `bigint` to compare with.
|
|
451
|
-
* @param that - The second `bigint` to compare with.
|
|
452
|
-
*
|
|
453
411
|
* @example
|
|
454
412
|
* ```ts
|
|
413
|
+
* import * as assert from "node:assert"
|
|
455
414
|
* import { lessThanOrEqualTo } from "effect/BigInt"
|
|
456
415
|
*
|
|
457
416
|
* assert.deepStrictEqual(lessThanOrEqualTo(2n, 3n), true)
|
|
@@ -466,11 +425,9 @@ export const lessThanOrEqualTo: {
|
|
|
466
425
|
/**
|
|
467
426
|
* Returns a function that checks if a given `bigint` is less than or equal to the provided one.
|
|
468
427
|
*
|
|
469
|
-
* @param self - The first `bigint` to compare with.
|
|
470
|
-
* @param that - The second `bigint` to compare with.
|
|
471
|
-
*
|
|
472
428
|
* @example
|
|
473
429
|
* ```ts
|
|
430
|
+
* import * as assert from "node:assert"
|
|
474
431
|
* import { lessThanOrEqualTo } from "effect/BigInt"
|
|
475
432
|
*
|
|
476
433
|
* assert.deepStrictEqual(lessThanOrEqualTo(2n, 3n), true)
|
|
@@ -485,11 +442,9 @@ export const lessThanOrEqualTo: {
|
|
|
485
442
|
/**
|
|
486
443
|
* Returns a function that checks if a given `bigint` is less than or equal to the provided one.
|
|
487
444
|
*
|
|
488
|
-
* @param self - The first `bigint` to compare with.
|
|
489
|
-
* @param that - The second `bigint` to compare with.
|
|
490
|
-
*
|
|
491
445
|
* @example
|
|
492
446
|
* ```ts
|
|
447
|
+
* import * as assert from "node:assert"
|
|
493
448
|
* import { lessThanOrEqualTo } from "effect/BigInt"
|
|
494
449
|
*
|
|
495
450
|
* assert.deepStrictEqual(lessThanOrEqualTo(2n, 3n), true)
|
|
@@ -506,11 +461,9 @@ export const lessThanOrEqualTo: {
|
|
|
506
461
|
/**
|
|
507
462
|
* Returns `true` if the first argument is greater than the second, otherwise `false`.
|
|
508
463
|
*
|
|
509
|
-
* @param self - The first argument.
|
|
510
|
-
* @param that - The second argument.
|
|
511
|
-
*
|
|
512
464
|
* @example
|
|
513
465
|
* ```ts
|
|
466
|
+
* import * as assert from "node:assert"
|
|
514
467
|
* import { greaterThan } from "effect/BigInt"
|
|
515
468
|
*
|
|
516
469
|
* assert.deepStrictEqual(greaterThan(2n, 3n), false)
|
|
@@ -525,11 +478,9 @@ export const greaterThan: {
|
|
|
525
478
|
/**
|
|
526
479
|
* Returns `true` if the first argument is greater than the second, otherwise `false`.
|
|
527
480
|
*
|
|
528
|
-
* @param self - The first argument.
|
|
529
|
-
* @param that - The second argument.
|
|
530
|
-
*
|
|
531
481
|
* @example
|
|
532
482
|
* ```ts
|
|
483
|
+
* import * as assert from "node:assert"
|
|
533
484
|
* import { greaterThan } from "effect/BigInt"
|
|
534
485
|
*
|
|
535
486
|
* assert.deepStrictEqual(greaterThan(2n, 3n), false)
|
|
@@ -544,11 +495,9 @@ export const greaterThan: {
|
|
|
544
495
|
/**
|
|
545
496
|
* Returns `true` if the first argument is greater than the second, otherwise `false`.
|
|
546
497
|
*
|
|
547
|
-
* @param self - The first argument.
|
|
548
|
-
* @param that - The second argument.
|
|
549
|
-
*
|
|
550
498
|
* @example
|
|
551
499
|
* ```ts
|
|
500
|
+
* import * as assert from "node:assert"
|
|
552
501
|
* import { greaterThan } from "effect/BigInt"
|
|
553
502
|
*
|
|
554
503
|
* assert.deepStrictEqual(greaterThan(2n, 3n), false)
|
|
@@ -565,11 +514,9 @@ export const greaterThan: {
|
|
|
565
514
|
/**
|
|
566
515
|
* Returns a function that checks if a given `bigint` is greater than or equal to the provided one.
|
|
567
516
|
*
|
|
568
|
-
* @param self - The first `bigint` to compare with.
|
|
569
|
-
* @param that - The second `bigint` to compare with.
|
|
570
|
-
*
|
|
571
517
|
* @example
|
|
572
518
|
* ```ts
|
|
519
|
+
* import * as assert from "node:assert"
|
|
573
520
|
* import { greaterThanOrEqualTo } from "effect/BigInt"
|
|
574
521
|
*
|
|
575
522
|
* assert.deepStrictEqual(greaterThanOrEqualTo(2n, 3n), false)
|
|
@@ -584,11 +531,9 @@ export const greaterThanOrEqualTo: {
|
|
|
584
531
|
/**
|
|
585
532
|
* Returns a function that checks if a given `bigint` is greater than or equal to the provided one.
|
|
586
533
|
*
|
|
587
|
-
* @param self - The first `bigint` to compare with.
|
|
588
|
-
* @param that - The second `bigint` to compare with.
|
|
589
|
-
*
|
|
590
534
|
* @example
|
|
591
535
|
* ```ts
|
|
536
|
+
* import * as assert from "node:assert"
|
|
592
537
|
* import { greaterThanOrEqualTo } from "effect/BigInt"
|
|
593
538
|
*
|
|
594
539
|
* assert.deepStrictEqual(greaterThanOrEqualTo(2n, 3n), false)
|
|
@@ -603,11 +548,9 @@ export const greaterThanOrEqualTo: {
|
|
|
603
548
|
/**
|
|
604
549
|
* Returns a function that checks if a given `bigint` is greater than or equal to the provided one.
|
|
605
550
|
*
|
|
606
|
-
* @param self - The first `bigint` to compare with.
|
|
607
|
-
* @param that - The second `bigint` to compare with.
|
|
608
|
-
*
|
|
609
551
|
* @example
|
|
610
552
|
* ```ts
|
|
553
|
+
* import * as assert from "node:assert"
|
|
611
554
|
* import { greaterThanOrEqualTo } from "effect/BigInt"
|
|
612
555
|
*
|
|
613
556
|
* assert.deepStrictEqual(greaterThanOrEqualTo(2n, 3n), false)
|
|
@@ -624,12 +567,9 @@ export const greaterThanOrEqualTo: {
|
|
|
624
567
|
/**
|
|
625
568
|
* Checks if a `bigint` is between a `minimum` and `maximum` value (inclusive).
|
|
626
569
|
*
|
|
627
|
-
* @param self - The `number` to check.
|
|
628
|
-
* @param minimum - The `minimum` value to check.
|
|
629
|
-
* @param maximum - The `maximum` value to check.
|
|
630
|
-
*
|
|
631
570
|
* @example
|
|
632
571
|
* ```ts
|
|
572
|
+
* import * as assert from "node:assert"
|
|
633
573
|
* import { BigInt } from "effect"
|
|
634
574
|
*
|
|
635
575
|
* const between = BigInt.between({ minimum: 0n, maximum: 5n })
|
|
@@ -646,12 +586,9 @@ export const between: {
|
|
|
646
586
|
/**
|
|
647
587
|
* Checks if a `bigint` is between a `minimum` and `maximum` value (inclusive).
|
|
648
588
|
*
|
|
649
|
-
* @param self - The `number` to check.
|
|
650
|
-
* @param minimum - The `minimum` value to check.
|
|
651
|
-
* @param maximum - The `maximum` value to check.
|
|
652
|
-
*
|
|
653
589
|
* @example
|
|
654
590
|
* ```ts
|
|
591
|
+
* import * as assert from "node:assert"
|
|
655
592
|
* import { BigInt } from "effect"
|
|
656
593
|
*
|
|
657
594
|
* const between = BigInt.between({ minimum: 0n, maximum: 5n })
|
|
@@ -673,12 +610,9 @@ export const between: {
|
|
|
673
610
|
/**
|
|
674
611
|
* Checks if a `bigint` is between a `minimum` and `maximum` value (inclusive).
|
|
675
612
|
*
|
|
676
|
-
* @param self - The `number` to check.
|
|
677
|
-
* @param minimum - The `minimum` value to check.
|
|
678
|
-
* @param maximum - The `maximum` value to check.
|
|
679
|
-
*
|
|
680
613
|
* @example
|
|
681
614
|
* ```ts
|
|
615
|
+
* import * as assert from "node:assert"
|
|
682
616
|
* import { BigInt } from "effect"
|
|
683
617
|
*
|
|
684
618
|
* const between = BigInt.between({ minimum: 0n, maximum: 5n })
|
|
@@ -707,12 +641,9 @@ export const between: {
|
|
|
707
641
|
* - If the `bigint` is greater than the `maximum` value, the function returns the `maximum` value.
|
|
708
642
|
* - Otherwise, it returns the original `bigint`.
|
|
709
643
|
*
|
|
710
|
-
* @param self - The `bigint` to be clamped.
|
|
711
|
-
* @param minimum - The lower end of the range.
|
|
712
|
-
* @param maximum - The upper end of the range.
|
|
713
|
-
*
|
|
714
644
|
* @example
|
|
715
645
|
* ```ts
|
|
646
|
+
* import * as assert from "node:assert"
|
|
716
647
|
* import { BigInt } from "effect"
|
|
717
648
|
*
|
|
718
649
|
* const clamp = BigInt.clamp({ minimum: 1n, maximum: 5n })
|
|
@@ -732,12 +663,9 @@ export const clamp: {
|
|
|
732
663
|
* - If the `bigint` is greater than the `maximum` value, the function returns the `maximum` value.
|
|
733
664
|
* - Otherwise, it returns the original `bigint`.
|
|
734
665
|
*
|
|
735
|
-
* @param self - The `bigint` to be clamped.
|
|
736
|
-
* @param minimum - The lower end of the range.
|
|
737
|
-
* @param maximum - The upper end of the range.
|
|
738
|
-
*
|
|
739
666
|
* @example
|
|
740
667
|
* ```ts
|
|
668
|
+
* import * as assert from "node:assert"
|
|
741
669
|
* import { BigInt } from "effect"
|
|
742
670
|
*
|
|
743
671
|
* const clamp = BigInt.clamp({ minimum: 1n, maximum: 5n })
|
|
@@ -762,12 +690,9 @@ export const clamp: {
|
|
|
762
690
|
* - If the `bigint` is greater than the `maximum` value, the function returns the `maximum` value.
|
|
763
691
|
* - Otherwise, it returns the original `bigint`.
|
|
764
692
|
*
|
|
765
|
-
* @param self - The `bigint` to be clamped.
|
|
766
|
-
* @param minimum - The lower end of the range.
|
|
767
|
-
* @param maximum - The upper end of the range.
|
|
768
|
-
*
|
|
769
693
|
* @example
|
|
770
694
|
* ```ts
|
|
695
|
+
* import * as assert from "node:assert"
|
|
771
696
|
* import { BigInt } from "effect"
|
|
772
697
|
*
|
|
773
698
|
* const clamp = BigInt.clamp({ minimum: 1n, maximum: 5n })
|
|
@@ -791,11 +716,9 @@ export const clamp: {
|
|
|
791
716
|
/**
|
|
792
717
|
* Returns the minimum between two `bigint`s.
|
|
793
718
|
*
|
|
794
|
-
* @param self - The first `bigint`.
|
|
795
|
-
* @param that - The second `bigint`.
|
|
796
|
-
*
|
|
797
719
|
* @example
|
|
798
720
|
* ```ts
|
|
721
|
+
* import * as assert from "node:assert"
|
|
799
722
|
* import { min } from "effect/BigInt"
|
|
800
723
|
*
|
|
801
724
|
* assert.deepStrictEqual(min(2n, 3n), 2n)
|
|
@@ -807,11 +730,9 @@ export const min: {
|
|
|
807
730
|
/**
|
|
808
731
|
* Returns the minimum between two `bigint`s.
|
|
809
732
|
*
|
|
810
|
-
* @param self - The first `bigint`.
|
|
811
|
-
* @param that - The second `bigint`.
|
|
812
|
-
*
|
|
813
733
|
* @example
|
|
814
734
|
* ```ts
|
|
735
|
+
* import * as assert from "node:assert"
|
|
815
736
|
* import { min } from "effect/BigInt"
|
|
816
737
|
*
|
|
817
738
|
* assert.deepStrictEqual(min(2n, 3n), 2n)
|
|
@@ -823,11 +744,9 @@ export const min: {
|
|
|
823
744
|
/**
|
|
824
745
|
* Returns the minimum between two `bigint`s.
|
|
825
746
|
*
|
|
826
|
-
* @param self - The first `bigint`.
|
|
827
|
-
* @param that - The second `bigint`.
|
|
828
|
-
*
|
|
829
747
|
* @example
|
|
830
748
|
* ```ts
|
|
749
|
+
* import * as assert from "node:assert"
|
|
831
750
|
* import { min } from "effect/BigInt"
|
|
832
751
|
*
|
|
833
752
|
* assert.deepStrictEqual(min(2n, 3n), 2n)
|
|
@@ -841,11 +760,9 @@ export const min: {
|
|
|
841
760
|
/**
|
|
842
761
|
* Returns the maximum between two `bigint`s.
|
|
843
762
|
*
|
|
844
|
-
* @param self - The first `bigint`.
|
|
845
|
-
* @param that - The second `bigint`.
|
|
846
|
-
*
|
|
847
763
|
* @example
|
|
848
764
|
* ```ts
|
|
765
|
+
* import * as assert from "node:assert"
|
|
849
766
|
* import { max } from "effect/BigInt"
|
|
850
767
|
*
|
|
851
768
|
* assert.deepStrictEqual(max(2n, 3n), 3n)
|
|
@@ -857,11 +774,9 @@ export const max: {
|
|
|
857
774
|
/**
|
|
858
775
|
* Returns the maximum between two `bigint`s.
|
|
859
776
|
*
|
|
860
|
-
* @param self - The first `bigint`.
|
|
861
|
-
* @param that - The second `bigint`.
|
|
862
|
-
*
|
|
863
777
|
* @example
|
|
864
778
|
* ```ts
|
|
779
|
+
* import * as assert from "node:assert"
|
|
865
780
|
* import { max } from "effect/BigInt"
|
|
866
781
|
*
|
|
867
782
|
* assert.deepStrictEqual(max(2n, 3n), 3n)
|
|
@@ -873,11 +788,9 @@ export const max: {
|
|
|
873
788
|
/**
|
|
874
789
|
* Returns the maximum between two `bigint`s.
|
|
875
790
|
*
|
|
876
|
-
* @param self - The first `bigint`.
|
|
877
|
-
* @param that - The second `bigint`.
|
|
878
|
-
*
|
|
879
791
|
* @example
|
|
880
792
|
* ```ts
|
|
793
|
+
* import * as assert from "node:assert"
|
|
881
794
|
* import { max } from "effect/BigInt"
|
|
882
795
|
*
|
|
883
796
|
* assert.deepStrictEqual(max(2n, 3n), 3n)
|
|
@@ -891,10 +804,9 @@ export const max: {
|
|
|
891
804
|
/**
|
|
892
805
|
* Determines the sign of a given `bigint`.
|
|
893
806
|
*
|
|
894
|
-
* @param n - The `bigint` to determine the sign of.
|
|
895
|
-
*
|
|
896
807
|
* @example
|
|
897
808
|
* ```ts
|
|
809
|
+
* import * as assert from "node:assert"
|
|
898
810
|
* import { sign } from "effect/BigInt"
|
|
899
811
|
*
|
|
900
812
|
* assert.deepStrictEqual(sign(-5n), -1)
|
|
@@ -910,10 +822,9 @@ export const sign = (n: bigint): Ordering => Order(n, bigint0)
|
|
|
910
822
|
/**
|
|
911
823
|
* Determines the absolute value of a given `bigint`.
|
|
912
824
|
*
|
|
913
|
-
* @param n - The `bigint` to determine the absolute value of.
|
|
914
|
-
*
|
|
915
825
|
* @example
|
|
916
826
|
* ```ts
|
|
827
|
+
* import * as assert from "node:assert"
|
|
917
828
|
* import { abs } from "effect/BigInt"
|
|
918
829
|
*
|
|
919
830
|
* assert.deepStrictEqual(abs(-5n), 5n)
|
|
@@ -929,11 +840,9 @@ export const abs = (n: bigint): bigint => (n < bigint0 ? -n : n)
|
|
|
929
840
|
/**
|
|
930
841
|
* Determines the greatest common divisor of two `bigint`s.
|
|
931
842
|
*
|
|
932
|
-
* @param a - The first `bigint`.
|
|
933
|
-
* @param b - The second `bigint`.
|
|
934
|
-
*
|
|
935
843
|
* @example
|
|
936
844
|
* ```ts
|
|
845
|
+
* import * as assert from "node:assert"
|
|
937
846
|
* import { gcd } from "effect/BigInt"
|
|
938
847
|
*
|
|
939
848
|
* assert.deepStrictEqual(gcd(2n, 3n), 1n)
|
|
@@ -948,11 +857,9 @@ export const gcd: {
|
|
|
948
857
|
/**
|
|
949
858
|
* Determines the greatest common divisor of two `bigint`s.
|
|
950
859
|
*
|
|
951
|
-
* @param a - The first `bigint`.
|
|
952
|
-
* @param b - The second `bigint`.
|
|
953
|
-
*
|
|
954
860
|
* @example
|
|
955
861
|
* ```ts
|
|
862
|
+
* import * as assert from "node:assert"
|
|
956
863
|
* import { gcd } from "effect/BigInt"
|
|
957
864
|
*
|
|
958
865
|
* assert.deepStrictEqual(gcd(2n, 3n), 1n)
|
|
@@ -967,11 +874,9 @@ export const gcd: {
|
|
|
967
874
|
/**
|
|
968
875
|
* Determines the greatest common divisor of two `bigint`s.
|
|
969
876
|
*
|
|
970
|
-
* @param a - The first `bigint`.
|
|
971
|
-
* @param b - The second `bigint`.
|
|
972
|
-
*
|
|
973
877
|
* @example
|
|
974
878
|
* ```ts
|
|
879
|
+
* import * as assert from "node:assert"
|
|
975
880
|
* import { gcd } from "effect/BigInt"
|
|
976
881
|
*
|
|
977
882
|
* assert.deepStrictEqual(gcd(2n, 3n), 1n)
|
|
@@ -995,11 +900,9 @@ export const gcd: {
|
|
|
995
900
|
/**
|
|
996
901
|
* Determines the least common multiple of two `bigint`s.
|
|
997
902
|
*
|
|
998
|
-
* @param a - The first `bigint`.
|
|
999
|
-
* @param b - The second `bigint`.
|
|
1000
|
-
*
|
|
1001
903
|
* @example
|
|
1002
904
|
* ```ts
|
|
905
|
+
* import * as assert from "node:assert"
|
|
1003
906
|
* import { lcm } from "effect/BigInt"
|
|
1004
907
|
*
|
|
1005
908
|
* assert.deepStrictEqual(lcm(2n, 3n), 6n)
|
|
@@ -1014,11 +917,9 @@ export const lcm: {
|
|
|
1014
917
|
/**
|
|
1015
918
|
* Determines the least common multiple of two `bigint`s.
|
|
1016
919
|
*
|
|
1017
|
-
* @param a - The first `bigint`.
|
|
1018
|
-
* @param b - The second `bigint`.
|
|
1019
|
-
*
|
|
1020
920
|
* @example
|
|
1021
921
|
* ```ts
|
|
922
|
+
* import * as assert from "node:assert"
|
|
1022
923
|
* import { lcm } from "effect/BigInt"
|
|
1023
924
|
*
|
|
1024
925
|
* assert.deepStrictEqual(lcm(2n, 3n), 6n)
|
|
@@ -1033,11 +934,9 @@ export const lcm: {
|
|
|
1033
934
|
/**
|
|
1034
935
|
* Determines the least common multiple of two `bigint`s.
|
|
1035
936
|
*
|
|
1036
|
-
* @param a - The first `bigint`.
|
|
1037
|
-
* @param b - The second `bigint`.
|
|
1038
|
-
*
|
|
1039
937
|
* @example
|
|
1040
938
|
* ```ts
|
|
939
|
+
* import * as assert from "node:assert"
|
|
1041
940
|
* import { lcm } from "effect/BigInt"
|
|
1042
941
|
*
|
|
1043
942
|
* assert.deepStrictEqual(lcm(2n, 3n), 6n)
|
|
@@ -1054,10 +953,9 @@ export const lcm: {
|
|
|
1054
953
|
/**
|
|
1055
954
|
* Determines the square root of a given `bigint` unsafely. Throws if the given `bigint` is negative.
|
|
1056
955
|
*
|
|
1057
|
-
* @param n - The `bigint` to determine the square root of.
|
|
1058
|
-
*
|
|
1059
956
|
* @example
|
|
1060
957
|
* ```ts
|
|
958
|
+
* import * as assert from "node:assert"
|
|
1061
959
|
* import { unsafeSqrt } from "effect/BigInt"
|
|
1062
960
|
*
|
|
1063
961
|
* assert.deepStrictEqual(unsafeSqrt(4n), 2n)
|
|
@@ -1085,10 +983,9 @@ export const unsafeSqrt = (n: bigint): bigint => {
|
|
|
1085
983
|
/**
|
|
1086
984
|
* Determines the square root of a given `bigint` safely. Returns `none` if the given `bigint` is negative.
|
|
1087
985
|
*
|
|
1088
|
-
* @param n - The `bigint` to determine the square root of.
|
|
1089
|
-
*
|
|
1090
986
|
* @example
|
|
1091
987
|
* ```ts
|
|
988
|
+
* import * as assert from "node:assert"
|
|
1092
989
|
* import { BigInt, Option } from "effect"
|
|
1093
990
|
*
|
|
1094
991
|
* assert.deepStrictEqual(BigInt.sqrt(4n), Option.some(2n))
|
|
@@ -1106,10 +1003,9 @@ export const sqrt = (n: bigint): Option.Option<bigint> =>
|
|
|
1106
1003
|
/**
|
|
1107
1004
|
* Takes an `Iterable` of `bigint`s and returns their sum as a single `bigint
|
|
1108
1005
|
*
|
|
1109
|
-
* @param collection - The collection of `bigint`s to sum.
|
|
1110
|
-
*
|
|
1111
1006
|
* @example
|
|
1112
1007
|
* ```ts
|
|
1008
|
+
* import * as assert from "node:assert"
|
|
1113
1009
|
* import { sumAll } from "effect/BigInt"
|
|
1114
1010
|
*
|
|
1115
1011
|
* assert.deepStrictEqual(sumAll([2n, 3n, 4n]), 9n)
|
|
@@ -1129,10 +1025,9 @@ export const sumAll = (collection: Iterable<bigint>): bigint => {
|
|
|
1129
1025
|
/**
|
|
1130
1026
|
* Takes an `Iterable` of `bigint`s and returns their multiplication as a single `number`.
|
|
1131
1027
|
*
|
|
1132
|
-
* @param collection - The collection of `bigint`s to multiply.
|
|
1133
|
-
*
|
|
1134
1028
|
* @example
|
|
1135
1029
|
* ```ts
|
|
1030
|
+
* import * as assert from "node:assert"
|
|
1136
1031
|
* import { multiplyAll } from "effect/BigInt"
|
|
1137
1032
|
*
|
|
1138
1033
|
* assert.deepStrictEqual(multiplyAll([2n, 3n, 4n]), 24n)
|
|
@@ -1159,10 +1054,9 @@ export const multiplyAll = (collection: Iterable<bigint>): bigint => {
|
|
|
1159
1054
|
* and `Number.MIN_SAFE_INTEGER`), it returns `Option.none()`. Otherwise, it converts the `bigint`
|
|
1160
1055
|
* to a number and returns `Option.some(number)`.
|
|
1161
1056
|
*
|
|
1162
|
-
* @param b - The `bigint` to be converted to a `number`.
|
|
1163
|
-
*
|
|
1164
1057
|
* @example
|
|
1165
1058
|
* ```ts
|
|
1059
|
+
* import * as assert from "node:assert"
|
|
1166
1060
|
* import { BigInt as BI, Option } from "effect"
|
|
1167
1061
|
*
|
|
1168
1062
|
* assert.deepStrictEqual(BI.toNumber(BigInt(42)), Option.some(42))
|
|
@@ -1186,10 +1080,9 @@ export const toNumber = (b: bigint): Option.Option<number> => {
|
|
|
1186
1080
|
* If the string is empty or contains characters that cannot be converted into a `bigint`,
|
|
1187
1081
|
* it returns `Option.none()`, otherwise, it returns `Option.some(bigint)`.
|
|
1188
1082
|
*
|
|
1189
|
-
* @param s - The string to be converted to a `bigint`.
|
|
1190
|
-
*
|
|
1191
1083
|
* @example
|
|
1192
1084
|
* ```ts
|
|
1085
|
+
* import * as assert from "node:assert"
|
|
1193
1086
|
* import { BigInt as BI, Option } from "effect"
|
|
1194
1087
|
*
|
|
1195
1088
|
* assert.deepStrictEqual(BI.fromString("42"), Option.some(BigInt(42)))
|
|
@@ -1217,10 +1110,9 @@ export const fromString = (s: string): Option.Option<bigint> => {
|
|
|
1217
1110
|
* and `Number.MIN_SAFE_INTEGER`), it returns `Option.none()`. Otherwise, it attempts to
|
|
1218
1111
|
* convert the number to a `bigint` and returns `Option.some(bigint)`.
|
|
1219
1112
|
*
|
|
1220
|
-
* @param n - The number to be converted to a `bigint`.
|
|
1221
|
-
*
|
|
1222
1113
|
* @example
|
|
1223
1114
|
* ```ts
|
|
1115
|
+
* import * as assert from "node:assert"
|
|
1224
1116
|
* import { BigInt as BI, Option } from "effect"
|
|
1225
1117
|
*
|
|
1226
1118
|
* assert.deepStrictEqual(BI.fromNumber(42), Option.some(BigInt(42)))
|