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/BigDecimal.ts
CHANGED
|
@@ -86,8 +86,6 @@ const BigDecimalProto: Omit<BigDecimal, "value" | "scale" | "normalized"> = {
|
|
|
86
86
|
/**
|
|
87
87
|
* Checks if a given value is a `BigDecimal`.
|
|
88
88
|
*
|
|
89
|
-
* @param u - The value to check.
|
|
90
|
-
*
|
|
91
89
|
* @since 2.0.0
|
|
92
90
|
* @category guards
|
|
93
91
|
*/
|
|
@@ -96,9 +94,6 @@ export const isBigDecimal = (u: unknown): u is BigDecimal => hasProperty(u, Type
|
|
|
96
94
|
/**
|
|
97
95
|
* Creates a `BigDecimal` from a `bigint` value and a scale.
|
|
98
96
|
*
|
|
99
|
-
* @param value - The `bigint` value to create a `BigDecimal` from.
|
|
100
|
-
* @param scale - The scale of the `BigDecimal`.
|
|
101
|
-
*
|
|
102
97
|
* @since 2.0.0
|
|
103
98
|
* @category constructors
|
|
104
99
|
*/
|
|
@@ -132,10 +127,10 @@ const zero = unsafeMakeNormalized(bigint0, 0)
|
|
|
132
127
|
/**
|
|
133
128
|
* Normalizes a given `BigDecimal` by removing trailing zeros.
|
|
134
129
|
*
|
|
135
|
-
*
|
|
130
|
+
* **Example**
|
|
136
131
|
*
|
|
137
|
-
* @example
|
|
138
132
|
* ```ts
|
|
133
|
+
* import * as assert from "node:assert"
|
|
139
134
|
* import { normalize, make, unsafeFromString } from "effect/BigDecimal"
|
|
140
135
|
*
|
|
141
136
|
* assert.deepStrictEqual(normalize(unsafeFromString("123.00000")), normalize(make(123n, 0)))
|
|
@@ -180,9 +175,6 @@ export const normalize = (self: BigDecimal): BigDecimal => {
|
|
|
180
175
|
* If the given scale is smaller than the current scale, the value will be rounded down to
|
|
181
176
|
* the nearest integer.
|
|
182
177
|
*
|
|
183
|
-
* @param self - The `BigDecimal` to scale.
|
|
184
|
-
* @param scale - The scale to scale to.
|
|
185
|
-
*
|
|
186
178
|
* @since 2.0.0
|
|
187
179
|
* @category scaling
|
|
188
180
|
*/
|
|
@@ -193,9 +185,6 @@ export const scale: {
|
|
|
193
185
|
* If the given scale is smaller than the current scale, the value will be rounded down to
|
|
194
186
|
* the nearest integer.
|
|
195
187
|
*
|
|
196
|
-
* @param self - The `BigDecimal` to scale.
|
|
197
|
-
* @param scale - The scale to scale to.
|
|
198
|
-
*
|
|
199
188
|
* @since 2.0.0
|
|
200
189
|
* @category scaling
|
|
201
190
|
*/
|
|
@@ -206,9 +195,6 @@ export const scale: {
|
|
|
206
195
|
* If the given scale is smaller than the current scale, the value will be rounded down to
|
|
207
196
|
* the nearest integer.
|
|
208
197
|
*
|
|
209
|
-
* @param self - The `BigDecimal` to scale.
|
|
210
|
-
* @param scale - The scale to scale to.
|
|
211
|
-
*
|
|
212
198
|
* @since 2.0.0
|
|
213
199
|
* @category scaling
|
|
214
200
|
*/
|
|
@@ -228,11 +214,9 @@ export const scale: {
|
|
|
228
214
|
/**
|
|
229
215
|
* Provides an addition operation on `BigDecimal`s.
|
|
230
216
|
*
|
|
231
|
-
* @param self - The first operand.
|
|
232
|
-
* @param that - The second operand.
|
|
233
|
-
*
|
|
234
217
|
* @example
|
|
235
218
|
* ```ts
|
|
219
|
+
* import * as assert from "node:assert"
|
|
236
220
|
* import { sum, unsafeFromString } from "effect/BigDecimal"
|
|
237
221
|
*
|
|
238
222
|
* assert.deepStrictEqual(sum(unsafeFromString("2"), unsafeFromString("3")), unsafeFromString("5"))
|
|
@@ -245,11 +229,9 @@ export const sum: {
|
|
|
245
229
|
/**
|
|
246
230
|
* Provides an addition operation on `BigDecimal`s.
|
|
247
231
|
*
|
|
248
|
-
* @param self - The first operand.
|
|
249
|
-
* @param that - The second operand.
|
|
250
|
-
*
|
|
251
232
|
* @example
|
|
252
233
|
* ```ts
|
|
234
|
+
* import * as assert from "node:assert"
|
|
253
235
|
* import { sum, unsafeFromString } from "effect/BigDecimal"
|
|
254
236
|
*
|
|
255
237
|
* assert.deepStrictEqual(sum(unsafeFromString("2"), unsafeFromString("3")), unsafeFromString("5"))
|
|
@@ -262,11 +244,9 @@ export const sum: {
|
|
|
262
244
|
/**
|
|
263
245
|
* Provides an addition operation on `BigDecimal`s.
|
|
264
246
|
*
|
|
265
|
-
* @param self - The first operand.
|
|
266
|
-
* @param that - The second operand.
|
|
267
|
-
*
|
|
268
247
|
* @example
|
|
269
248
|
* ```ts
|
|
249
|
+
* import * as assert from "node:assert"
|
|
270
250
|
* import { sum, unsafeFromString } from "effect/BigDecimal"
|
|
271
251
|
*
|
|
272
252
|
* assert.deepStrictEqual(sum(unsafeFromString("2"), unsafeFromString("3")), unsafeFromString("5"))
|
|
@@ -299,11 +279,9 @@ export const sum: {
|
|
|
299
279
|
/**
|
|
300
280
|
* Provides a multiplication operation on `BigDecimal`s.
|
|
301
281
|
*
|
|
302
|
-
* @param self - The first operand.
|
|
303
|
-
* @param that - The second operand.
|
|
304
|
-
*
|
|
305
282
|
* @example
|
|
306
283
|
* ```ts
|
|
284
|
+
* import * as assert from "node:assert"
|
|
307
285
|
* import { multiply, unsafeFromString } from "effect/BigDecimal"
|
|
308
286
|
*
|
|
309
287
|
* assert.deepStrictEqual(multiply(unsafeFromString("2"), unsafeFromString("3")), unsafeFromString("6"))
|
|
@@ -316,11 +294,9 @@ export const multiply: {
|
|
|
316
294
|
/**
|
|
317
295
|
* Provides a multiplication operation on `BigDecimal`s.
|
|
318
296
|
*
|
|
319
|
-
* @param self - The first operand.
|
|
320
|
-
* @param that - The second operand.
|
|
321
|
-
*
|
|
322
297
|
* @example
|
|
323
298
|
* ```ts
|
|
299
|
+
* import * as assert from "node:assert"
|
|
324
300
|
* import { multiply, unsafeFromString } from "effect/BigDecimal"
|
|
325
301
|
*
|
|
326
302
|
* assert.deepStrictEqual(multiply(unsafeFromString("2"), unsafeFromString("3")), unsafeFromString("6"))
|
|
@@ -333,11 +309,9 @@ export const multiply: {
|
|
|
333
309
|
/**
|
|
334
310
|
* Provides a multiplication operation on `BigDecimal`s.
|
|
335
311
|
*
|
|
336
|
-
* @param self - The first operand.
|
|
337
|
-
* @param that - The second operand.
|
|
338
|
-
*
|
|
339
312
|
* @example
|
|
340
313
|
* ```ts
|
|
314
|
+
* import * as assert from "node:assert"
|
|
341
315
|
* import { multiply, unsafeFromString } from "effect/BigDecimal"
|
|
342
316
|
*
|
|
343
317
|
* assert.deepStrictEqual(multiply(unsafeFromString("2"), unsafeFromString("3")), unsafeFromString("6"))
|
|
@@ -358,11 +332,9 @@ export const multiply: {
|
|
|
358
332
|
/**
|
|
359
333
|
* Provides a subtraction operation on `BigDecimal`s.
|
|
360
334
|
*
|
|
361
|
-
* @param self - The first operand.
|
|
362
|
-
* @param that - The second operand.
|
|
363
|
-
*
|
|
364
335
|
* @example
|
|
365
336
|
* ```ts
|
|
337
|
+
* import * as assert from "node:assert"
|
|
366
338
|
* import { subtract, unsafeFromString } from "effect/BigDecimal"
|
|
367
339
|
*
|
|
368
340
|
* assert.deepStrictEqual(subtract(unsafeFromString("2"), unsafeFromString("3")), unsafeFromString("-1"))
|
|
@@ -375,11 +347,9 @@ export const subtract: {
|
|
|
375
347
|
/**
|
|
376
348
|
* Provides a subtraction operation on `BigDecimal`s.
|
|
377
349
|
*
|
|
378
|
-
* @param self - The first operand.
|
|
379
|
-
* @param that - The second operand.
|
|
380
|
-
*
|
|
381
350
|
* @example
|
|
382
351
|
* ```ts
|
|
352
|
+
* import * as assert from "node:assert"
|
|
383
353
|
* import { subtract, unsafeFromString } from "effect/BigDecimal"
|
|
384
354
|
*
|
|
385
355
|
* assert.deepStrictEqual(subtract(unsafeFromString("2"), unsafeFromString("3")), unsafeFromString("-1"))
|
|
@@ -392,11 +362,9 @@ export const subtract: {
|
|
|
392
362
|
/**
|
|
393
363
|
* Provides a subtraction operation on `BigDecimal`s.
|
|
394
364
|
*
|
|
395
|
-
* @param self - The first operand.
|
|
396
|
-
* @param that - The second operand.
|
|
397
|
-
*
|
|
398
365
|
* @example
|
|
399
366
|
* ```ts
|
|
367
|
+
* import * as assert from "node:assert"
|
|
400
368
|
* import { subtract, unsafeFromString } from "effect/BigDecimal"
|
|
401
369
|
*
|
|
402
370
|
* assert.deepStrictEqual(subtract(unsafeFromString("2"), unsafeFromString("3")), unsafeFromString("-1"))
|
|
@@ -502,11 +470,9 @@ export const roundTerminal = (n: bigint): bigint => {
|
|
|
502
470
|
*
|
|
503
471
|
* If the divisor is `0`, the result will be `None`.
|
|
504
472
|
*
|
|
505
|
-
* @param self - The dividend operand.
|
|
506
|
-
* @param that - The divisor operand.
|
|
507
|
-
*
|
|
508
473
|
* @example
|
|
509
474
|
* ```ts
|
|
475
|
+
* import * as assert from "node:assert"
|
|
510
476
|
* import { BigDecimal, Option } from "effect"
|
|
511
477
|
*
|
|
512
478
|
* assert.deepStrictEqual(BigDecimal.divide(BigDecimal.unsafeFromString("6"), BigDecimal.unsafeFromString("3")), Option.some(BigDecimal.unsafeFromString("2")))
|
|
@@ -526,11 +492,9 @@ export const divide: {
|
|
|
526
492
|
*
|
|
527
493
|
* If the divisor is `0`, the result will be `None`.
|
|
528
494
|
*
|
|
529
|
-
* @param self - The dividend operand.
|
|
530
|
-
* @param that - The divisor operand.
|
|
531
|
-
*
|
|
532
495
|
* @example
|
|
533
496
|
* ```ts
|
|
497
|
+
* import * as assert from "node:assert"
|
|
534
498
|
* import { BigDecimal, Option } from "effect"
|
|
535
499
|
*
|
|
536
500
|
* assert.deepStrictEqual(BigDecimal.divide(BigDecimal.unsafeFromString("6"), BigDecimal.unsafeFromString("3")), Option.some(BigDecimal.unsafeFromString("2")))
|
|
@@ -550,11 +514,9 @@ export const divide: {
|
|
|
550
514
|
*
|
|
551
515
|
* If the divisor is `0`, the result will be `None`.
|
|
552
516
|
*
|
|
553
|
-
* @param self - The dividend operand.
|
|
554
|
-
* @param that - The divisor operand.
|
|
555
|
-
*
|
|
556
517
|
* @example
|
|
557
518
|
* ```ts
|
|
519
|
+
* import * as assert from "node:assert"
|
|
558
520
|
* import { BigDecimal, Option } from "effect"
|
|
559
521
|
*
|
|
560
522
|
* assert.deepStrictEqual(BigDecimal.divide(BigDecimal.unsafeFromString("6"), BigDecimal.unsafeFromString("3")), Option.some(BigDecimal.unsafeFromString("2")))
|
|
@@ -591,11 +553,9 @@ export const divide: {
|
|
|
591
553
|
*
|
|
592
554
|
* Throws a `RangeError` if the divisor is `0`.
|
|
593
555
|
*
|
|
594
|
-
* @param self - The dividend operand.
|
|
595
|
-
* @param that - The divisor operand.as
|
|
596
|
-
*
|
|
597
556
|
* @example
|
|
598
557
|
* ```ts
|
|
558
|
+
* import * as assert from "node:assert"
|
|
599
559
|
* import { unsafeDivide, unsafeFromString } from "effect/BigDecimal"
|
|
600
560
|
*
|
|
601
561
|
* assert.deepStrictEqual(unsafeDivide(unsafeFromString("6"), unsafeFromString("3")), unsafeFromString("2"))
|
|
@@ -614,11 +574,9 @@ export const unsafeDivide: {
|
|
|
614
574
|
*
|
|
615
575
|
* Throws a `RangeError` if the divisor is `0`.
|
|
616
576
|
*
|
|
617
|
-
* @param self - The dividend operand.
|
|
618
|
-
* @param that - The divisor operand.as
|
|
619
|
-
*
|
|
620
577
|
* @example
|
|
621
578
|
* ```ts
|
|
579
|
+
* import * as assert from "node:assert"
|
|
622
580
|
* import { unsafeDivide, unsafeFromString } from "effect/BigDecimal"
|
|
623
581
|
*
|
|
624
582
|
* assert.deepStrictEqual(unsafeDivide(unsafeFromString("6"), unsafeFromString("3")), unsafeFromString("2"))
|
|
@@ -637,11 +595,9 @@ export const unsafeDivide: {
|
|
|
637
595
|
*
|
|
638
596
|
* Throws a `RangeError` if the divisor is `0`.
|
|
639
597
|
*
|
|
640
|
-
* @param self - The dividend operand.
|
|
641
|
-
* @param that - The divisor operand.as
|
|
642
|
-
*
|
|
643
598
|
* @example
|
|
644
599
|
* ```ts
|
|
600
|
+
* import * as assert from "node:assert"
|
|
645
601
|
* import { unsafeDivide, unsafeFromString } from "effect/BigDecimal"
|
|
646
602
|
*
|
|
647
603
|
* assert.deepStrictEqual(unsafeDivide(unsafeFromString("6"), unsafeFromString("3")), unsafeFromString("2"))
|
|
@@ -692,11 +648,9 @@ export const Order: order.Order<BigDecimal> = order.make((self, that) => {
|
|
|
692
648
|
/**
|
|
693
649
|
* Returns `true` if the first argument is less than the second, otherwise `false`.
|
|
694
650
|
*
|
|
695
|
-
* @param self - The first argument.
|
|
696
|
-
* @param that - The second argument.
|
|
697
|
-
*
|
|
698
651
|
* @example
|
|
699
652
|
* ```ts
|
|
653
|
+
* import * as assert from "node:assert"
|
|
700
654
|
* import { lessThan, unsafeFromString } from "effect/BigDecimal"
|
|
701
655
|
*
|
|
702
656
|
* assert.deepStrictEqual(lessThan(unsafeFromString("2"), unsafeFromString("3")), true)
|
|
@@ -711,11 +665,9 @@ export const lessThan: {
|
|
|
711
665
|
/**
|
|
712
666
|
* Returns `true` if the first argument is less than the second, otherwise `false`.
|
|
713
667
|
*
|
|
714
|
-
* @param self - The first argument.
|
|
715
|
-
* @param that - The second argument.
|
|
716
|
-
*
|
|
717
668
|
* @example
|
|
718
669
|
* ```ts
|
|
670
|
+
* import * as assert from "node:assert"
|
|
719
671
|
* import { lessThan, unsafeFromString } from "effect/BigDecimal"
|
|
720
672
|
*
|
|
721
673
|
* assert.deepStrictEqual(lessThan(unsafeFromString("2"), unsafeFromString("3")), true)
|
|
@@ -730,11 +682,9 @@ export const lessThan: {
|
|
|
730
682
|
/**
|
|
731
683
|
* Returns `true` if the first argument is less than the second, otherwise `false`.
|
|
732
684
|
*
|
|
733
|
-
* @param self - The first argument.
|
|
734
|
-
* @param that - The second argument.
|
|
735
|
-
*
|
|
736
685
|
* @example
|
|
737
686
|
* ```ts
|
|
687
|
+
* import * as assert from "node:assert"
|
|
738
688
|
* import { lessThan, unsafeFromString } from "effect/BigDecimal"
|
|
739
689
|
*
|
|
740
690
|
* assert.deepStrictEqual(lessThan(unsafeFromString("2"), unsafeFromString("3")), true)
|
|
@@ -751,11 +701,9 @@ export const lessThan: {
|
|
|
751
701
|
/**
|
|
752
702
|
* Checks if a given `BigDecimal` is less than or equal to the provided one.
|
|
753
703
|
*
|
|
754
|
-
* @param self - The first `BigDecimal` to compare with.
|
|
755
|
-
* @param that - The second `BigDecimal` to compare with.
|
|
756
|
-
*
|
|
757
704
|
* @example
|
|
758
705
|
* ```ts
|
|
706
|
+
* import * as assert from "node:assert"
|
|
759
707
|
* import { lessThanOrEqualTo, unsafeFromString } from "effect/BigDecimal"
|
|
760
708
|
*
|
|
761
709
|
* assert.deepStrictEqual(lessThanOrEqualTo(unsafeFromString("2"), unsafeFromString("3")), true)
|
|
@@ -770,11 +718,9 @@ export const lessThanOrEqualTo: {
|
|
|
770
718
|
/**
|
|
771
719
|
* Checks if a given `BigDecimal` is less than or equal to the provided one.
|
|
772
720
|
*
|
|
773
|
-
* @param self - The first `BigDecimal` to compare with.
|
|
774
|
-
* @param that - The second `BigDecimal` to compare with.
|
|
775
|
-
*
|
|
776
721
|
* @example
|
|
777
722
|
* ```ts
|
|
723
|
+
* import * as assert from "node:assert"
|
|
778
724
|
* import { lessThanOrEqualTo, unsafeFromString } from "effect/BigDecimal"
|
|
779
725
|
*
|
|
780
726
|
* assert.deepStrictEqual(lessThanOrEqualTo(unsafeFromString("2"), unsafeFromString("3")), true)
|
|
@@ -789,11 +735,9 @@ export const lessThanOrEqualTo: {
|
|
|
789
735
|
/**
|
|
790
736
|
* Checks if a given `BigDecimal` is less than or equal to the provided one.
|
|
791
737
|
*
|
|
792
|
-
* @param self - The first `BigDecimal` to compare with.
|
|
793
|
-
* @param that - The second `BigDecimal` to compare with.
|
|
794
|
-
*
|
|
795
738
|
* @example
|
|
796
739
|
* ```ts
|
|
740
|
+
* import * as assert from "node:assert"
|
|
797
741
|
* import { lessThanOrEqualTo, unsafeFromString } from "effect/BigDecimal"
|
|
798
742
|
*
|
|
799
743
|
* assert.deepStrictEqual(lessThanOrEqualTo(unsafeFromString("2"), unsafeFromString("3")), true)
|
|
@@ -810,11 +754,9 @@ export const lessThanOrEqualTo: {
|
|
|
810
754
|
/**
|
|
811
755
|
* Returns `true` if the first argument is greater than the second, otherwise `false`.
|
|
812
756
|
*
|
|
813
|
-
* @param self - The first argument.
|
|
814
|
-
* @param that - The second argument.
|
|
815
|
-
*
|
|
816
757
|
* @example
|
|
817
758
|
* ```ts
|
|
759
|
+
* import * as assert from "node:assert"
|
|
818
760
|
* import { greaterThan, unsafeFromString } from "effect/BigDecimal"
|
|
819
761
|
*
|
|
820
762
|
* assert.deepStrictEqual(greaterThan(unsafeFromString("2"), unsafeFromString("3")), false)
|
|
@@ -829,11 +771,9 @@ export const greaterThan: {
|
|
|
829
771
|
/**
|
|
830
772
|
* Returns `true` if the first argument is greater than the second, otherwise `false`.
|
|
831
773
|
*
|
|
832
|
-
* @param self - The first argument.
|
|
833
|
-
* @param that - The second argument.
|
|
834
|
-
*
|
|
835
774
|
* @example
|
|
836
775
|
* ```ts
|
|
776
|
+
* import * as assert from "node:assert"
|
|
837
777
|
* import { greaterThan, unsafeFromString } from "effect/BigDecimal"
|
|
838
778
|
*
|
|
839
779
|
* assert.deepStrictEqual(greaterThan(unsafeFromString("2"), unsafeFromString("3")), false)
|
|
@@ -848,11 +788,9 @@ export const greaterThan: {
|
|
|
848
788
|
/**
|
|
849
789
|
* Returns `true` if the first argument is greater than the second, otherwise `false`.
|
|
850
790
|
*
|
|
851
|
-
* @param self - The first argument.
|
|
852
|
-
* @param that - The second argument.
|
|
853
|
-
*
|
|
854
791
|
* @example
|
|
855
792
|
* ```ts
|
|
793
|
+
* import * as assert from "node:assert"
|
|
856
794
|
* import { greaterThan, unsafeFromString } from "effect/BigDecimal"
|
|
857
795
|
*
|
|
858
796
|
* assert.deepStrictEqual(greaterThan(unsafeFromString("2"), unsafeFromString("3")), false)
|
|
@@ -869,11 +807,9 @@ export const greaterThan: {
|
|
|
869
807
|
/**
|
|
870
808
|
* Checks if a given `BigDecimal` is greater than or equal to the provided one.
|
|
871
809
|
*
|
|
872
|
-
* @param self - The first `BigDecimal` to compare with.
|
|
873
|
-
* @param that - The second `BigDecimal` to compare with.
|
|
874
|
-
*
|
|
875
810
|
* @example
|
|
876
811
|
* ```ts
|
|
812
|
+
* import * as assert from "node:assert"
|
|
877
813
|
* import { greaterThanOrEqualTo, unsafeFromString } from "effect/BigDecimal"
|
|
878
814
|
*
|
|
879
815
|
* assert.deepStrictEqual(greaterThanOrEqualTo(unsafeFromString("2"), unsafeFromString("3")), false)
|
|
@@ -888,11 +824,9 @@ export const greaterThanOrEqualTo: {
|
|
|
888
824
|
/**
|
|
889
825
|
* Checks if a given `BigDecimal` is greater than or equal to the provided one.
|
|
890
826
|
*
|
|
891
|
-
* @param self - The first `BigDecimal` to compare with.
|
|
892
|
-
* @param that - The second `BigDecimal` to compare with.
|
|
893
|
-
*
|
|
894
827
|
* @example
|
|
895
828
|
* ```ts
|
|
829
|
+
* import * as assert from "node:assert"
|
|
896
830
|
* import { greaterThanOrEqualTo, unsafeFromString } from "effect/BigDecimal"
|
|
897
831
|
*
|
|
898
832
|
* assert.deepStrictEqual(greaterThanOrEqualTo(unsafeFromString("2"), unsafeFromString("3")), false)
|
|
@@ -907,11 +841,9 @@ export const greaterThanOrEqualTo: {
|
|
|
907
841
|
/**
|
|
908
842
|
* Checks if a given `BigDecimal` is greater than or equal to the provided one.
|
|
909
843
|
*
|
|
910
|
-
* @param self - The first `BigDecimal` to compare with.
|
|
911
|
-
* @param that - The second `BigDecimal` to compare with.
|
|
912
|
-
*
|
|
913
844
|
* @example
|
|
914
845
|
* ```ts
|
|
846
|
+
* import * as assert from "node:assert"
|
|
915
847
|
* import { greaterThanOrEqualTo, unsafeFromString } from "effect/BigDecimal"
|
|
916
848
|
*
|
|
917
849
|
* assert.deepStrictEqual(greaterThanOrEqualTo(unsafeFromString("2"), unsafeFromString("3")), false)
|
|
@@ -928,12 +860,9 @@ export const greaterThanOrEqualTo: {
|
|
|
928
860
|
/**
|
|
929
861
|
* Checks if a `BigDecimal` is between a `minimum` and `maximum` value (inclusive).
|
|
930
862
|
*
|
|
931
|
-
* @param self - The `number` to check.
|
|
932
|
-
* @param minimum - The `minimum` value to check.
|
|
933
|
-
* @param maximum - The `maximum` value to check.
|
|
934
|
-
*
|
|
935
863
|
* @example
|
|
936
864
|
* ```ts
|
|
865
|
+
* import * as assert from "node:assert"
|
|
937
866
|
* import { BigDecimal } from "effect"
|
|
938
867
|
*
|
|
939
868
|
* const between = BigDecimal.between({
|
|
@@ -953,12 +882,9 @@ export const between: {
|
|
|
953
882
|
/**
|
|
954
883
|
* Checks if a `BigDecimal` is between a `minimum` and `maximum` value (inclusive).
|
|
955
884
|
*
|
|
956
|
-
* @param self - The `number` to check.
|
|
957
|
-
* @param minimum - The `minimum` value to check.
|
|
958
|
-
* @param maximum - The `maximum` value to check.
|
|
959
|
-
*
|
|
960
885
|
* @example
|
|
961
886
|
* ```ts
|
|
887
|
+
* import * as assert from "node:assert"
|
|
962
888
|
* import { BigDecimal } from "effect"
|
|
963
889
|
*
|
|
964
890
|
* const between = BigDecimal.between({
|
|
@@ -983,12 +909,9 @@ export const between: {
|
|
|
983
909
|
/**
|
|
984
910
|
* Checks if a `BigDecimal` is between a `minimum` and `maximum` value (inclusive).
|
|
985
911
|
*
|
|
986
|
-
* @param self - The `number` to check.
|
|
987
|
-
* @param minimum - The `minimum` value to check.
|
|
988
|
-
* @param maximum - The `maximum` value to check.
|
|
989
|
-
*
|
|
990
912
|
* @example
|
|
991
913
|
* ```ts
|
|
914
|
+
* import * as assert from "node:assert"
|
|
992
915
|
* import { BigDecimal } from "effect"
|
|
993
916
|
*
|
|
994
917
|
* const between = BigDecimal.between({
|
|
@@ -1020,12 +943,9 @@ export const between: {
|
|
|
1020
943
|
* - If the `BigDecimal` is greater than the `maximum` value, the function returns the `maximum` value.
|
|
1021
944
|
* - Otherwise, it returns the original `BigDecimal`.
|
|
1022
945
|
*
|
|
1023
|
-
* @param self - The `BigDecimal` to be clamped.
|
|
1024
|
-
* @param minimum - The lower end of the range.
|
|
1025
|
-
* @param maximum - The upper end of the range.
|
|
1026
|
-
*
|
|
1027
946
|
* @example
|
|
1028
947
|
* ```ts
|
|
948
|
+
* import * as assert from "node:assert"
|
|
1029
949
|
* import { BigDecimal } from "effect"
|
|
1030
950
|
*
|
|
1031
951
|
* const clamp = BigDecimal.clamp({
|
|
@@ -1049,12 +969,9 @@ export const clamp: {
|
|
|
1049
969
|
* - If the `BigDecimal` is greater than the `maximum` value, the function returns the `maximum` value.
|
|
1050
970
|
* - Otherwise, it returns the original `BigDecimal`.
|
|
1051
971
|
*
|
|
1052
|
-
* @param self - The `BigDecimal` to be clamped.
|
|
1053
|
-
* @param minimum - The lower end of the range.
|
|
1054
|
-
* @param maximum - The upper end of the range.
|
|
1055
|
-
*
|
|
1056
972
|
* @example
|
|
1057
973
|
* ```ts
|
|
974
|
+
* import * as assert from "node:assert"
|
|
1058
975
|
* import { BigDecimal } from "effect"
|
|
1059
976
|
*
|
|
1060
977
|
* const clamp = BigDecimal.clamp({
|
|
@@ -1083,12 +1000,9 @@ export const clamp: {
|
|
|
1083
1000
|
* - If the `BigDecimal` is greater than the `maximum` value, the function returns the `maximum` value.
|
|
1084
1001
|
* - Otherwise, it returns the original `BigDecimal`.
|
|
1085
1002
|
*
|
|
1086
|
-
* @param self - The `BigDecimal` to be clamped.
|
|
1087
|
-
* @param minimum - The lower end of the range.
|
|
1088
|
-
* @param maximum - The upper end of the range.
|
|
1089
|
-
*
|
|
1090
1003
|
* @example
|
|
1091
1004
|
* ```ts
|
|
1005
|
+
* import * as assert from "node:assert"
|
|
1092
1006
|
* import { BigDecimal } from "effect"
|
|
1093
1007
|
*
|
|
1094
1008
|
* const clamp = BigDecimal.clamp({
|
|
@@ -1116,11 +1030,9 @@ export const clamp: {
|
|
|
1116
1030
|
/**
|
|
1117
1031
|
* Returns the minimum between two `BigDecimal`s.
|
|
1118
1032
|
*
|
|
1119
|
-
* @param self - The first `BigDecimal`.
|
|
1120
|
-
* @param that - The second `BigDecimal`.
|
|
1121
|
-
*
|
|
1122
1033
|
* @example
|
|
1123
1034
|
* ```ts
|
|
1035
|
+
* import * as assert from "node:assert"
|
|
1124
1036
|
* import { min, unsafeFromString } from "effect/BigDecimal"
|
|
1125
1037
|
*
|
|
1126
1038
|
* assert.deepStrictEqual(min(unsafeFromString("2"), unsafeFromString("3")), unsafeFromString("2"))
|
|
@@ -1133,11 +1045,9 @@ export const min: {
|
|
|
1133
1045
|
/**
|
|
1134
1046
|
* Returns the minimum between two `BigDecimal`s.
|
|
1135
1047
|
*
|
|
1136
|
-
* @param self - The first `BigDecimal`.
|
|
1137
|
-
* @param that - The second `BigDecimal`.
|
|
1138
|
-
*
|
|
1139
1048
|
* @example
|
|
1140
1049
|
* ```ts
|
|
1050
|
+
* import * as assert from "node:assert"
|
|
1141
1051
|
* import { min, unsafeFromString } from "effect/BigDecimal"
|
|
1142
1052
|
*
|
|
1143
1053
|
* assert.deepStrictEqual(min(unsafeFromString("2"), unsafeFromString("3")), unsafeFromString("2"))
|
|
@@ -1150,11 +1060,9 @@ export const min: {
|
|
|
1150
1060
|
/**
|
|
1151
1061
|
* Returns the minimum between two `BigDecimal`s.
|
|
1152
1062
|
*
|
|
1153
|
-
* @param self - The first `BigDecimal`.
|
|
1154
|
-
* @param that - The second `BigDecimal`.
|
|
1155
|
-
*
|
|
1156
1063
|
* @example
|
|
1157
1064
|
* ```ts
|
|
1065
|
+
* import * as assert from "node:assert"
|
|
1158
1066
|
* import { min, unsafeFromString } from "effect/BigDecimal"
|
|
1159
1067
|
*
|
|
1160
1068
|
* assert.deepStrictEqual(min(unsafeFromString("2"), unsafeFromString("3")), unsafeFromString("2"))
|
|
@@ -1169,11 +1077,9 @@ export const min: {
|
|
|
1169
1077
|
/**
|
|
1170
1078
|
* Returns the maximum between two `BigDecimal`s.
|
|
1171
1079
|
*
|
|
1172
|
-
* @param self - The first `BigDecimal`.
|
|
1173
|
-
* @param that - The second `BigDecimal`.
|
|
1174
|
-
*
|
|
1175
1080
|
* @example
|
|
1176
1081
|
* ```ts
|
|
1082
|
+
* import * as assert from "node:assert"
|
|
1177
1083
|
* import { max, unsafeFromString } from "effect/BigDecimal"
|
|
1178
1084
|
*
|
|
1179
1085
|
* assert.deepStrictEqual(max(unsafeFromString("2"), unsafeFromString("3")), unsafeFromString("3"))
|
|
@@ -1186,11 +1092,9 @@ export const max: {
|
|
|
1186
1092
|
/**
|
|
1187
1093
|
* Returns the maximum between two `BigDecimal`s.
|
|
1188
1094
|
*
|
|
1189
|
-
* @param self - The first `BigDecimal`.
|
|
1190
|
-
* @param that - The second `BigDecimal`.
|
|
1191
|
-
*
|
|
1192
1095
|
* @example
|
|
1193
1096
|
* ```ts
|
|
1097
|
+
* import * as assert from "node:assert"
|
|
1194
1098
|
* import { max, unsafeFromString } from "effect/BigDecimal"
|
|
1195
1099
|
*
|
|
1196
1100
|
* assert.deepStrictEqual(max(unsafeFromString("2"), unsafeFromString("3")), unsafeFromString("3"))
|
|
@@ -1203,11 +1107,9 @@ export const max: {
|
|
|
1203
1107
|
/**
|
|
1204
1108
|
* Returns the maximum between two `BigDecimal`s.
|
|
1205
1109
|
*
|
|
1206
|
-
* @param self - The first `BigDecimal`.
|
|
1207
|
-
* @param that - The second `BigDecimal`.
|
|
1208
|
-
*
|
|
1209
1110
|
* @example
|
|
1210
1111
|
* ```ts
|
|
1112
|
+
* import * as assert from "node:assert"
|
|
1211
1113
|
* import { max, unsafeFromString } from "effect/BigDecimal"
|
|
1212
1114
|
*
|
|
1213
1115
|
* assert.deepStrictEqual(max(unsafeFromString("2"), unsafeFromString("3")), unsafeFromString("3"))
|
|
@@ -1222,10 +1124,9 @@ export const max: {
|
|
|
1222
1124
|
/**
|
|
1223
1125
|
* Determines the sign of a given `BigDecimal`.
|
|
1224
1126
|
*
|
|
1225
|
-
* @param n - The `BigDecimal` to determine the sign of.
|
|
1226
|
-
*
|
|
1227
1127
|
* @example
|
|
1228
1128
|
* ```ts
|
|
1129
|
+
* import * as assert from "node:assert"
|
|
1229
1130
|
* import { sign, unsafeFromString } from "effect/BigDecimal"
|
|
1230
1131
|
*
|
|
1231
1132
|
* assert.deepStrictEqual(sign(unsafeFromString("-5")), -1)
|
|
@@ -1241,10 +1142,9 @@ export const sign = (n: BigDecimal): Ordering => n.value === bigint0 ? 0 : n.val
|
|
|
1241
1142
|
/**
|
|
1242
1143
|
* Determines the absolute value of a given `BigDecimal`.
|
|
1243
1144
|
*
|
|
1244
|
-
* @param n - The `BigDecimal` to determine the absolute value of.
|
|
1245
|
-
*
|
|
1246
1145
|
* @example
|
|
1247
1146
|
* ```ts
|
|
1147
|
+
* import * as assert from "node:assert"
|
|
1248
1148
|
* import { abs, unsafeFromString } from "effect/BigDecimal"
|
|
1249
1149
|
*
|
|
1250
1150
|
* assert.deepStrictEqual(abs(unsafeFromString("-5")), unsafeFromString("5"))
|
|
@@ -1260,10 +1160,9 @@ export const abs = (n: BigDecimal): BigDecimal => n.value < bigint0 ? make(-n.va
|
|
|
1260
1160
|
/**
|
|
1261
1161
|
* Provides a negate operation on `BigDecimal`s.
|
|
1262
1162
|
*
|
|
1263
|
-
* @param n - The `BigDecimal` to negate.
|
|
1264
|
-
*
|
|
1265
1163
|
* @example
|
|
1266
1164
|
* ```ts
|
|
1165
|
+
* import * as assert from "node:assert"
|
|
1267
1166
|
* import { negate, unsafeFromString } from "effect/BigDecimal"
|
|
1268
1167
|
*
|
|
1269
1168
|
* assert.deepStrictEqual(negate(unsafeFromString("3")), unsafeFromString("-3"))
|
|
@@ -1280,11 +1179,9 @@ export const negate = (n: BigDecimal): BigDecimal => make(-n.value, n.scale)
|
|
|
1280
1179
|
*
|
|
1281
1180
|
* If the divisor is `0`, the result will be `None`.
|
|
1282
1181
|
*
|
|
1283
|
-
* @param self - The dividend.
|
|
1284
|
-
* @param divisor - The divisor.
|
|
1285
|
-
*
|
|
1286
1182
|
* @example
|
|
1287
1183
|
* ```ts
|
|
1184
|
+
* import * as assert from "node:assert"
|
|
1288
1185
|
* import { BigDecimal, Option } from "effect"
|
|
1289
1186
|
*
|
|
1290
1187
|
* assert.deepStrictEqual(BigDecimal.remainder(BigDecimal.unsafeFromString("2"), BigDecimal.unsafeFromString("2")), Option.some(BigDecimal.unsafeFromString("0")))
|
|
@@ -1301,11 +1198,9 @@ export const remainder: {
|
|
|
1301
1198
|
*
|
|
1302
1199
|
* If the divisor is `0`, the result will be `None`.
|
|
1303
1200
|
*
|
|
1304
|
-
* @param self - The dividend.
|
|
1305
|
-
* @param divisor - The divisor.
|
|
1306
|
-
*
|
|
1307
1201
|
* @example
|
|
1308
1202
|
* ```ts
|
|
1203
|
+
* import * as assert from "node:assert"
|
|
1309
1204
|
* import { BigDecimal, Option } from "effect"
|
|
1310
1205
|
*
|
|
1311
1206
|
* assert.deepStrictEqual(BigDecimal.remainder(BigDecimal.unsafeFromString("2"), BigDecimal.unsafeFromString("2")), Option.some(BigDecimal.unsafeFromString("0")))
|
|
@@ -1322,11 +1217,9 @@ export const remainder: {
|
|
|
1322
1217
|
*
|
|
1323
1218
|
* If the divisor is `0`, the result will be `None`.
|
|
1324
1219
|
*
|
|
1325
|
-
* @param self - The dividend.
|
|
1326
|
-
* @param divisor - The divisor.
|
|
1327
|
-
*
|
|
1328
1220
|
* @example
|
|
1329
1221
|
* ```ts
|
|
1222
|
+
* import * as assert from "node:assert"
|
|
1330
1223
|
* import { BigDecimal, Option } from "effect"
|
|
1331
1224
|
*
|
|
1332
1225
|
* assert.deepStrictEqual(BigDecimal.remainder(BigDecimal.unsafeFromString("2"), BigDecimal.unsafeFromString("2")), Option.some(BigDecimal.unsafeFromString("0")))
|
|
@@ -1352,11 +1245,9 @@ export const remainder: {
|
|
|
1352
1245
|
*
|
|
1353
1246
|
* Throws a `RangeError` if the divisor is `0`.
|
|
1354
1247
|
*
|
|
1355
|
-
* @param self - The dividend.
|
|
1356
|
-
* @param divisor - The divisor.
|
|
1357
|
-
*
|
|
1358
1248
|
* @example
|
|
1359
1249
|
* ```ts
|
|
1250
|
+
* import * as assert from "node:assert"
|
|
1360
1251
|
* import { unsafeRemainder, unsafeFromString } from "effect/BigDecimal"
|
|
1361
1252
|
*
|
|
1362
1253
|
* assert.deepStrictEqual(unsafeRemainder(unsafeFromString("2"), unsafeFromString("2")), unsafeFromString("0"))
|
|
@@ -1373,11 +1264,9 @@ export const unsafeRemainder: {
|
|
|
1373
1264
|
*
|
|
1374
1265
|
* Throws a `RangeError` if the divisor is `0`.
|
|
1375
1266
|
*
|
|
1376
|
-
* @param self - The dividend.
|
|
1377
|
-
* @param divisor - The divisor.
|
|
1378
|
-
*
|
|
1379
1267
|
* @example
|
|
1380
1268
|
* ```ts
|
|
1269
|
+
* import * as assert from "node:assert"
|
|
1381
1270
|
* import { unsafeRemainder, unsafeFromString } from "effect/BigDecimal"
|
|
1382
1271
|
*
|
|
1383
1272
|
* assert.deepStrictEqual(unsafeRemainder(unsafeFromString("2"), unsafeFromString("2")), unsafeFromString("0"))
|
|
@@ -1394,11 +1283,9 @@ export const unsafeRemainder: {
|
|
|
1394
1283
|
*
|
|
1395
1284
|
* Throws a `RangeError` if the divisor is `0`.
|
|
1396
1285
|
*
|
|
1397
|
-
* @param self - The dividend.
|
|
1398
|
-
* @param divisor - The divisor.
|
|
1399
|
-
*
|
|
1400
1286
|
* @example
|
|
1401
1287
|
* ```ts
|
|
1288
|
+
* import * as assert from "node:assert"
|
|
1402
1289
|
* import { unsafeRemainder, unsafeFromString } from "effect/BigDecimal"
|
|
1403
1290
|
*
|
|
1404
1291
|
* assert.deepStrictEqual(unsafeRemainder(unsafeFromString("2"), unsafeFromString("2")), unsafeFromString("0"))
|
|
@@ -1461,8 +1348,6 @@ export const equals: {
|
|
|
1461
1348
|
/**
|
|
1462
1349
|
* Creates a `BigDecimal` from a `bigint` value.
|
|
1463
1350
|
*
|
|
1464
|
-
* @param value - The `bigint` value to create a `BigDecimal` from.
|
|
1465
|
-
*
|
|
1466
1351
|
* @since 2.0.0
|
|
1467
1352
|
* @category constructors
|
|
1468
1353
|
*/
|
|
@@ -1476,10 +1361,9 @@ export const fromBigInt = (n: bigint): BigDecimal => make(n, 0)
|
|
|
1476
1361
|
*
|
|
1477
1362
|
* Throws a `RangeError` if the number is not finite (`NaN`, `+Infinity` or `-Infinity`).
|
|
1478
1363
|
*
|
|
1479
|
-
* @param value - The `number` value to create a `BigDecimal` from.
|
|
1480
|
-
*
|
|
1481
1364
|
* @example
|
|
1482
1365
|
* ```ts
|
|
1366
|
+
* import * as assert from "node:assert"
|
|
1483
1367
|
* import { unsafeFromNumber, make } from "effect/BigDecimal"
|
|
1484
1368
|
*
|
|
1485
1369
|
* assert.deepStrictEqual(unsafeFromNumber(123), make(123n, 0))
|
|
@@ -1500,8 +1384,6 @@ export const unsafeFromNumber = (n: number): BigDecimal =>
|
|
|
1500
1384
|
*
|
|
1501
1385
|
* Throws a `RangeError` if the number is not finite (`NaN`, `+Infinity` or `-Infinity`).
|
|
1502
1386
|
*
|
|
1503
|
-
* @param value - The `number` value to create a `BigDecimal` from.
|
|
1504
|
-
*
|
|
1505
1387
|
* @since 2.0.0
|
|
1506
1388
|
* @category constructors
|
|
1507
1389
|
* @deprecated Use {@link unsafeFromNumber} instead.
|
|
@@ -1517,10 +1399,9 @@ export const fromNumber: (n: number) => BigDecimal = unsafeFromNumber
|
|
|
1517
1399
|
*
|
|
1518
1400
|
* Returns `None` if the number is not finite (`NaN`, `+Infinity` or `-Infinity`).
|
|
1519
1401
|
*
|
|
1520
|
-
* @param n - The `number` value to create a `BigDecimal` from.
|
|
1521
|
-
*
|
|
1522
1402
|
* @example
|
|
1523
1403
|
* ```ts
|
|
1404
|
+
* import * as assert from "node:assert"
|
|
1524
1405
|
* import { BigDecimal, Option } from "effect"
|
|
1525
1406
|
*
|
|
1526
1407
|
* assert.deepStrictEqual(BigDecimal.safeFromNumber(123), Option.some(BigDecimal.make(123n, 0)))
|
|
@@ -1548,10 +1429,9 @@ export const safeFromNumber = (n: number): Option.Option<BigDecimal> => {
|
|
|
1548
1429
|
/**
|
|
1549
1430
|
* Parses a numerical `string` into a `BigDecimal`.
|
|
1550
1431
|
*
|
|
1551
|
-
* @param s - The `string` to parse.
|
|
1552
|
-
*
|
|
1553
1432
|
* @example
|
|
1554
1433
|
* ```ts
|
|
1434
|
+
* import * as assert from "node:assert"
|
|
1555
1435
|
* import { BigDecimal, Option } from "effect"
|
|
1556
1436
|
*
|
|
1557
1437
|
* assert.deepStrictEqual(BigDecimal.fromString("123"), Option.some(BigDecimal.make(123n, 0)))
|
|
@@ -1610,10 +1490,9 @@ export const fromString = (s: string): Option.Option<BigDecimal> => {
|
|
|
1610
1490
|
/**
|
|
1611
1491
|
* Parses a numerical `string` into a `BigDecimal`.
|
|
1612
1492
|
*
|
|
1613
|
-
* @param s - The `string` to parse.
|
|
1614
|
-
*
|
|
1615
1493
|
* @example
|
|
1616
1494
|
* ```ts
|
|
1495
|
+
* import * as assert from "node:assert"
|
|
1617
1496
|
* import { unsafeFromString, make } from "effect/BigDecimal"
|
|
1618
1497
|
*
|
|
1619
1498
|
* assert.deepStrictEqual(unsafeFromString("123"), make(123n, 0))
|
|
@@ -1633,10 +1512,9 @@ export const unsafeFromString = (s: string): BigDecimal =>
|
|
|
1633
1512
|
* If the scale of the `BigDecimal` is greater than or equal to 16, the `BigDecimal` will
|
|
1634
1513
|
* be formatted in scientific notation.
|
|
1635
1514
|
*
|
|
1636
|
-
* @param n - The `BigDecimal` to format.
|
|
1637
|
-
*
|
|
1638
1515
|
* @example
|
|
1639
1516
|
* ```ts
|
|
1517
|
+
* import * as assert from "node:assert"
|
|
1640
1518
|
* import { format, unsafeFromString } from "effect/BigDecimal"
|
|
1641
1519
|
*
|
|
1642
1520
|
* assert.deepStrictEqual(format(unsafeFromString("-5")), "-5")
|
|
@@ -1681,10 +1559,9 @@ export const format = (n: BigDecimal): string => {
|
|
|
1681
1559
|
/**
|
|
1682
1560
|
* Formats a given `BigDecimal` as a `string` in scientific notation.
|
|
1683
1561
|
*
|
|
1684
|
-
* @param n - The `BigDecimal` to format.
|
|
1685
|
-
*
|
|
1686
1562
|
* @example
|
|
1687
1563
|
* ```ts
|
|
1564
|
+
* import * as assert from "node:assert"
|
|
1688
1565
|
* import { toExponential, make } from "effect/BigDecimal"
|
|
1689
1566
|
*
|
|
1690
1567
|
* assert.deepStrictEqual(toExponential(make(123456n, -5)), "1.23456e+10")
|
|
@@ -1717,10 +1594,9 @@ export const toExponential = (n: BigDecimal): string => {
|
|
|
1717
1594
|
*
|
|
1718
1595
|
* This function will produce incorrect results if the `BigDecimal` exceeds the 64-bit range of a `number`.
|
|
1719
1596
|
*
|
|
1720
|
-
* @param n - The `BigDecimal` to convert.
|
|
1721
|
-
*
|
|
1722
1597
|
* @example
|
|
1723
1598
|
* ```ts
|
|
1599
|
+
* import * as assert from "node:assert"
|
|
1724
1600
|
* import { unsafeToNumber, unsafeFromString } from "effect/BigDecimal"
|
|
1725
1601
|
*
|
|
1726
1602
|
* assert.deepStrictEqual(unsafeToNumber(unsafeFromString("123.456")), 123.456)
|
|
@@ -1734,10 +1610,9 @@ export const unsafeToNumber = (n: BigDecimal): number => Number(format(n))
|
|
|
1734
1610
|
/**
|
|
1735
1611
|
* Checks if a given `BigDecimal` is an integer.
|
|
1736
1612
|
*
|
|
1737
|
-
* @param n - The `BigDecimal` to check.
|
|
1738
|
-
*
|
|
1739
1613
|
* @example
|
|
1740
1614
|
* ```ts
|
|
1615
|
+
* import * as assert from "node:assert"
|
|
1741
1616
|
* import { isInteger, unsafeFromString } from "effect/BigDecimal"
|
|
1742
1617
|
*
|
|
1743
1618
|
* assert.deepStrictEqual(isInteger(unsafeFromString("0")), true)
|
|
@@ -1753,10 +1628,9 @@ export const isInteger = (n: BigDecimal): boolean => normalize(n).scale <= 0
|
|
|
1753
1628
|
/**
|
|
1754
1629
|
* Checks if a given `BigDecimal` is `0`.
|
|
1755
1630
|
*
|
|
1756
|
-
* @param n - The `BigDecimal` to check.
|
|
1757
|
-
*
|
|
1758
1631
|
* @example
|
|
1759
1632
|
* ```ts
|
|
1633
|
+
* import * as assert from "node:assert"
|
|
1760
1634
|
* import { isZero, unsafeFromString } from "effect/BigDecimal"
|
|
1761
1635
|
*
|
|
1762
1636
|
* assert.deepStrictEqual(isZero(unsafeFromString("0")), true)
|
|
@@ -1771,10 +1645,9 @@ export const isZero = (n: BigDecimal): boolean => n.value === bigint0
|
|
|
1771
1645
|
/**
|
|
1772
1646
|
* Checks if a given `BigDecimal` is negative.
|
|
1773
1647
|
*
|
|
1774
|
-
* @param n - The `BigDecimal` to check.
|
|
1775
|
-
*
|
|
1776
1648
|
* @example
|
|
1777
1649
|
* ```ts
|
|
1650
|
+
* import * as assert from "node:assert"
|
|
1778
1651
|
* import { isNegative, unsafeFromString } from "effect/BigDecimal"
|
|
1779
1652
|
*
|
|
1780
1653
|
* assert.deepStrictEqual(isNegative(unsafeFromString("-1")), true)
|
|
@@ -1790,10 +1663,9 @@ export const isNegative = (n: BigDecimal): boolean => n.value < bigint0
|
|
|
1790
1663
|
/**
|
|
1791
1664
|
* Checks if a given `BigDecimal` is positive.
|
|
1792
1665
|
*
|
|
1793
|
-
* @param n - The `BigDecimal` to check.
|
|
1794
|
-
*
|
|
1795
1666
|
* @example
|
|
1796
1667
|
* ```ts
|
|
1668
|
+
* import * as assert from "node:assert"
|
|
1797
1669
|
* import { isPositive, unsafeFromString } from "effect/BigDecimal"
|
|
1798
1670
|
*
|
|
1799
1671
|
* assert.deepStrictEqual(isPositive(unsafeFromString("-1")), false)
|