@fable-org/fable-library-ts 1.4.1 → 1.4.3
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/BigInt.ts +4 -3
- package/CHANGELOG.md +10 -0
- package/Date.ts +0 -1
- package/Decimal.ts +6 -6
- package/RegExp.ts +0 -1
- package/TimeSpan.ts +0 -1
- package/Types.ts +1 -1
- package/Uri.ts +0 -1
- package/Util.ts +0 -2
- package/lib/big.js +0 -1
- package/package.json +1 -1
package/BigInt.ts
CHANGED
|
@@ -148,10 +148,11 @@ export function toFloat32(x: bigint): float32 { return Number(x); }
|
|
|
148
148
|
export function toFloat64(x: bigint): float64 { return Number(x); }
|
|
149
149
|
|
|
150
150
|
export function toDecimal(x: bigint): decimal {
|
|
151
|
-
const low = Number(BigInt.asUintN(32, x))
|
|
152
|
-
const mid = Number(BigInt.asUintN(32, x >> 32n))
|
|
153
|
-
const high = Number(BigInt.asUintN(32, x >> 64n))
|
|
154
151
|
const isNegative = x < zero;
|
|
152
|
+
const bits = abs(x);
|
|
153
|
+
const low = Number(BigInt.asUintN(32, bits));
|
|
154
|
+
const mid = Number(BigInt.asUintN(32, bits >> 32n));
|
|
155
|
+
const high = Number(BigInt.asUintN(32, bits >> 64n));
|
|
155
156
|
const scale = 0;
|
|
156
157
|
return fromParts(low, mid, high, isNegative, scale)
|
|
157
158
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## Unreleased
|
|
9
9
|
|
|
10
|
+
## 1.4.3 - 2024-09-04
|
|
11
|
+
|
|
12
|
+
* [JS/TS] Fixed Decimal comparisons (#3884) (by @ncave)
|
|
13
|
+
|
|
14
|
+
## 1.4.2 - 2024-06-13
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
* [JS/TS] Fixed BigInt.ToDecimal with negative values (#3500) (by @ncave)
|
|
19
|
+
|
|
10
20
|
## 1.4.1 - 2024-06-13
|
|
11
21
|
|
|
12
22
|
### Fixed
|
package/Date.ts
CHANGED
|
@@ -524,7 +524,6 @@ export function parseRaw(input: string): [Date, Offset] {
|
|
|
524
524
|
|
|
525
525
|
if (isNaN(date.getTime())) {
|
|
526
526
|
// Try to check strings JS Date cannot parse (see #1045, #1422)
|
|
527
|
-
// tslint:disable-next-line:max-line-length
|
|
528
527
|
const m = /^\s*(\d+[^\w\s:]\d+[^\w\s:]\d+)?\s*(\d+:\d+(?::\d+(?:\.\d+)?)?)?\s*([AaPp][Mm])?\s*(Z|[+-]([01]?\d):?([0-5]?\d)?)?\s*$/.exec(input);
|
|
529
528
|
if (m != null) {
|
|
530
529
|
let baseDate: Date;
|
package/Decimal.ts
CHANGED
|
@@ -44,16 +44,16 @@ export function equals(x: Decimal, y: Decimal) {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
export function abs(x: Decimal) { return x.abs(); }
|
|
47
|
-
export function sign(x: Decimal): number { return x
|
|
47
|
+
export function sign(x: Decimal): number { return x.lt(get_Zero) ? -1 : x.gt(get_Zero) ? 1 : 0; }
|
|
48
48
|
|
|
49
|
-
export function max(x: Decimal, y: Decimal): Decimal { return x
|
|
50
|
-
export function min(x: Decimal, y: Decimal): Decimal { return x
|
|
49
|
+
export function max(x: Decimal, y: Decimal): Decimal { return x.gt(y) ? x : y; }
|
|
50
|
+
export function min(x: Decimal, y: Decimal): Decimal { return x.lt(y) ? x : y; }
|
|
51
51
|
|
|
52
|
-
export function maxMagnitude(x: Decimal, y: Decimal): Decimal { return abs(x)
|
|
53
|
-
export function minMagnitude(x: Decimal, y: Decimal): Decimal { return abs(x)
|
|
52
|
+
export function maxMagnitude(x: Decimal, y: Decimal): Decimal { return abs(x).gt(abs(y)) ? x : y; }
|
|
53
|
+
export function minMagnitude(x: Decimal, y: Decimal): Decimal { return abs(x).lt(abs(y)) ? x : y; }
|
|
54
54
|
|
|
55
55
|
export function clamp(x: Decimal, min: Decimal, max: Decimal): Decimal {
|
|
56
|
-
return x
|
|
56
|
+
return x.lt(min) ? min : x.gt(max) ? max : x;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
export function round(x: Decimal, digits: number = 0) {
|
package/RegExp.ts
CHANGED
|
@@ -48,7 +48,6 @@ export function matches(reg: RegExp, input: string, startAt = 0) {
|
|
|
48
48
|
const matches: RegExpExecArray[] = [];
|
|
49
49
|
let m: RegExpExecArray | null;
|
|
50
50
|
let lastMatchIndex = -1;
|
|
51
|
-
// tslint:disable-next-line:no-conditional-assignment
|
|
52
51
|
while ((m = reg.exec(input)) != null) {
|
|
53
52
|
// It can happen even global regex get stuck, see #2845
|
|
54
53
|
if (m.index === lastMatchIndex) {
|
package/TimeSpan.ts
CHANGED
package/Types.ts
CHANGED
|
@@ -199,7 +199,7 @@ export function isPromise(x: any) {
|
|
|
199
199
|
return x instanceof Promise;
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
-
export function ensureErrorOrException(e: any) {
|
|
202
|
+
export function ensureErrorOrException(e: any): any {
|
|
203
203
|
// Exceptionally admitting promises as errors for compatibility with React.suspense (see #3298)
|
|
204
204
|
return (isException(e) || isPromise(e)) ? e : new Error(String(e));
|
|
205
205
|
}
|
package/Uri.ts
CHANGED
package/Util.ts
CHANGED
package/lib/big.js
CHANGED
package/package.json
CHANGED