@fable-org/fable-library-js 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.js CHANGED
@@ -111,10 +111,11 @@ export function toFloat16(x) { return Number(x); }
111
111
  export function toFloat32(x) { return Number(x); }
112
112
  export function toFloat64(x) { return Number(x); }
113
113
  export function toDecimal(x) {
114
- const low = Number(BigInt.asUintN(32, x));
115
- const mid = Number(BigInt.asUintN(32, x >> 32n));
116
- const high = Number(BigInt.asUintN(32, x >> 64n));
117
114
  const isNegative = x < zero;
115
+ const bits = abs(x);
116
+ const low = Number(BigInt.asUintN(32, bits));
117
+ const mid = Number(BigInt.asUintN(32, bits >> 32n));
118
+ const high = Number(BigInt.asUintN(32, bits >> 64n));
118
119
  const scale = 0;
119
120
  return fromParts(low, mid, high, isNegative, scale);
120
121
  }
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.js CHANGED
@@ -490,7 +490,6 @@ export function parseRaw(input) {
490
490
  let offset = null;
491
491
  if (isNaN(date.getTime())) {
492
492
  // Try to check strings JS Date cannot parse (see #1045, #1422)
493
- // tslint:disable-next-line:max-line-length
494
493
  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);
495
494
  if (m != null) {
496
495
  let baseDate;
package/Decimal.js CHANGED
@@ -34,13 +34,13 @@ export function equals(x, y) {
34
34
  return !x.cmp(y);
35
35
  }
36
36
  export function abs(x) { return x.abs(); }
37
- export function sign(x) { return x < get_Zero ? -1 : x > get_Zero ? 1 : 0; }
38
- export function max(x, y) { return x > y ? x : y; }
39
- export function min(x, y) { return x < y ? x : y; }
40
- export function maxMagnitude(x, y) { return abs(x) > abs(y) ? x : y; }
41
- export function minMagnitude(x, y) { return abs(x) < abs(y) ? x : y; }
37
+ export function sign(x) { return x.lt(get_Zero) ? -1 : x.gt(get_Zero) ? 1 : 0; }
38
+ export function max(x, y) { return x.gt(y) ? x : y; }
39
+ export function min(x, y) { return x.lt(y) ? x : y; }
40
+ export function maxMagnitude(x, y) { return abs(x).gt(abs(y)) ? x : y; }
41
+ export function minMagnitude(x, y) { return abs(x).lt(abs(y)) ? x : y; }
42
42
  export function clamp(x, min, max) {
43
- return x < min ? min : x > max ? max : x;
43
+ return x.lt(min) ? min : x.gt(max) ? max : x;
44
44
  }
45
45
  export function round(x, digits = 0) {
46
46
  return x.round(digits, 2 /* ROUND_HALF_EVEN */);
package/Reflection.d.ts CHANGED
@@ -78,7 +78,7 @@ export declare function namespace(t: TypeInfo): string;
78
78
  export declare function isArray(t: TypeInfo): boolean;
79
79
  export declare function getElementType(t: TypeInfo): TypeInfo | undefined;
80
80
  export declare function isGenericType(t: TypeInfo): boolean;
81
- export declare function isGenericParameter(t: TypeInfo): boolean;
81
+ export declare function isGenericParameter(t: TypeInfo): t is GenericParameter;
82
82
  export declare function isEnum(t: TypeInfo): boolean;
83
83
  export declare function isSubclassOf(t1: TypeInfo, t2: TypeInfo): boolean;
84
84
  export declare function isInstanceOfType(t: TypeInfo, o: any): boolean;
package/RegExp.js CHANGED
@@ -41,7 +41,6 @@ export function matches(reg, input, startAt = 0) {
41
41
  const matches = [];
42
42
  let m;
43
43
  let lastMatchIndex = -1;
44
- // tslint:disable-next-line:no-conditional-assignment
45
44
  while ((m = reg.exec(input)) != null) {
46
45
  // It can happen even global regex get stuck, see #2845
47
46
  if (m.index === lastMatchIndex) {
package/Types.d.ts CHANGED
@@ -38,8 +38,8 @@ export declare class Exception {
38
38
  message?: string | undefined;
39
39
  constructor(message?: string | undefined);
40
40
  }
41
- export declare function isException(x: any): boolean;
42
- export declare function isPromise(x: any): boolean;
41
+ export declare function isException(x: any): x is Error | Exception;
42
+ export declare function isPromise(x: any): x is Promise<any>;
43
43
  export declare function ensureErrorOrException(e: any): any;
44
44
  export declare abstract class FSharpException extends Exception implements IEquatable<FSharpException>, IComparable<FSharpException> {
45
45
  toJSON(): any;
package/Uri.js CHANGED
@@ -9,7 +9,6 @@ export class Uri {
9
9
  }
10
10
  static isAbsoluteUri(uri) {
11
11
  try {
12
- // tslint:disable-next-line no-unused-expression
13
12
  new URL(uri);
14
13
  return true;
15
14
  }
package/Util.d.ts CHANGED
@@ -65,7 +65,7 @@ export declare class Enumerable<T> implements IEnumerable<T> {
65
65
  GetEnumerator(): IEnumerator<T>;
66
66
  "System.Collections.IEnumerable.GetEnumerator"(): IEnumerator<any>;
67
67
  [Symbol.iterator](): this;
68
- next(): IteratorResult<T, any>;
68
+ next(): IteratorResult<T>;
69
69
  }
70
70
  export declare class Enumerator<T> implements IEnumerator<T> {
71
71
  private iter;
package/Util.js CHANGED
@@ -1,4 +1,3 @@
1
- // tslint:disable:ban-types
2
1
  export function isArrayLike(x) {
3
2
  return Array.isArray(x) || ArrayBuffer.isView(x);
4
3
  }
package/lib/big.js CHANGED
@@ -1,5 +1,4 @@
1
1
  // Adapted from https://github.com/MikeMcl/big.js/blob/0f94dc9110d55c4f324a47ba6a2e832ce23ac589/big.mjs
2
- /* tslint:disable */
3
2
  var P = {};
4
3
  /*
5
4
  * big.js v6.0.3
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": false,
4
4
  "type": "module",
5
5
  "name": "@fable-org/fable-library-js",
6
- "version": "1.4.1",
6
+ "version": "1.4.3",
7
7
  "description": "Core library used by F# projects compiled with fable.io",
8
8
  "author": "Fable Contributors",
9
9
  "license": "MIT",