@fable-org/fable-library-ts 1.4.2 → 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/CHANGELOG.md CHANGED
@@ -7,6 +7,10 @@ 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
+
10
14
  ## 1.4.2 - 2024-06-13
11
15
 
12
16
  ### 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 < get_Zero ? -1 : x > get_Zero ? 1 : 0; }
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 > y ? x : y; }
50
- export function min(x: Decimal, y: Decimal): Decimal { return x < y ? x : y; }
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) > abs(y) ? x : y; }
53
- export function minMagnitude(x: Decimal, y: Decimal): Decimal { return abs(x) < abs(y) ? x : y; }
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 < min ? min : x > max ? max : 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
@@ -1,4 +1,3 @@
1
- // tslint:disable:max-line-length
2
1
  import { FSharpRef } from "./Types.js";
3
2
  import { comparePrimitives, padLeftAndRightWithZeros, padWithZeros } from "./Util.js";
4
3
  import { toInt64, fromFloat64 } from "./BigInt.js";
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
@@ -26,7 +26,6 @@ export class Uri {
26
26
 
27
27
  private static isAbsoluteUri(uri: string): boolean {
28
28
  try {
29
- // tslint:disable-next-line no-unused-expression
30
29
  new URL(uri);
31
30
  return true;
32
31
  } catch {
package/Util.ts CHANGED
@@ -1,5 +1,3 @@
1
- // tslint:disable:ban-types
2
-
3
1
  // Don't change, this corresponds to DateTime.Kind enum values in .NET
4
2
  export const enum DateKind {
5
3
  Unspecified = 0,
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
 
4
3
  var P = {};
5
4
 
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": false,
4
4
  "type": "module",
5
5
  "name": "@fable-org/fable-library-ts",
6
- "version": "1.4.2",
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",