@fable-org/fable-library-js 2.0.0-beta.4 → 2.0.0-beta.5

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.
Files changed (97) hide show
  1. package/Array.js +56 -52
  2. package/Async.js +8 -7
  3. package/AsyncBuilder.js +6 -6
  4. package/BigInt.js +3 -3
  5. package/Boolean.js +2 -1
  6. package/CHANGELOG.md +8 -0
  7. package/Char.js +64 -31
  8. package/CollectionUtil.js +3 -3
  9. package/Date.js +50 -46
  10. package/DateOffset.js +38 -48
  11. package/DateOnly.js +6 -6
  12. package/Decimal.js +4 -4
  13. package/Double.js +2 -1
  14. package/FSharp.Collections.js +28 -10
  15. package/FSharp.Core.js +23 -23
  16. package/Global.js +21 -0
  17. package/Guid.js +5 -4
  18. package/Int32.js +17 -17
  19. package/List.js +36 -35
  20. package/Long.js +3 -2
  21. package/MailboxProcessor.js +2 -1
  22. package/Map.js +29 -27
  23. package/MapUtil.js +4 -4
  24. package/MutableMap.js +22 -10
  25. package/MutableSet.js +3 -3
  26. package/Option.js +3 -3
  27. package/Random.js +12 -11
  28. package/Range.js +2 -2
  29. package/Reflection.js +16 -16
  30. package/RegExp.js +4 -3
  31. package/Seq.js +31 -29
  32. package/Set.js +34 -33
  33. package/String.js +44 -35
  34. package/System.Collections.Generic.js +20 -4
  35. package/System.Text.js +3 -3
  36. package/System.js +283 -0
  37. package/TimeOnly.js +6 -6
  38. package/TimeSpan.js +5 -5
  39. package/Types.js +1 -17
  40. package/Uri.js +25 -19
  41. package/Util.js +31 -17
  42. package/package.json +1 -1
  43. package/Array.d.ts +0 -123
  44. package/Async.d.ts +0 -26
  45. package/AsyncBuilder.d.ts +0 -59
  46. package/BigInt.d.ts +0 -129
  47. package/BitConverter.d.ts +0 -27
  48. package/Boolean.d.ts +0 -3
  49. package/Char.d.ts +0 -65
  50. package/Choice.d.ts +0 -121
  51. package/CollectionUtil.d.ts +0 -7
  52. package/ConditionalWeakTable.d.ts +0 -9
  53. package/Date.d.ts +0 -69
  54. package/DateOffset.d.ts +0 -64
  55. package/DateOnly.d.ts +0 -18
  56. package/Decimal.d.ts +0 -63
  57. package/Double.d.ts +0 -11
  58. package/Encoding.d.ts +0 -12
  59. package/Event.d.ts +0 -31
  60. package/FSharp.Collections.d.ts +0 -7
  61. package/FSharp.Core.CompilerServices.d.ts +0 -12
  62. package/FSharp.Core.d.ts +0 -30
  63. package/Global.d.ts +0 -24
  64. package/Guid.d.ts +0 -10
  65. package/Int32.d.ts +0 -28
  66. package/List.d.ts +0 -143
  67. package/Long.d.ts +0 -3
  68. package/MailboxProcessor.d.ts +0 -25
  69. package/Map.d.ts +0 -178
  70. package/MapUtil.d.ts +0 -12
  71. package/MutableMap.d.ts +0 -52
  72. package/MutableSet.d.ts +0 -39
  73. package/Native.d.ts +0 -3
  74. package/Numeric.d.ts +0 -20
  75. package/Observable.d.ts +0 -32
  76. package/Option.d.ts +0 -29
  77. package/Random.d.ts +0 -37
  78. package/Range.d.ts +0 -12
  79. package/Reflection.d.ts +0 -119
  80. package/RegExp.d.ts +0 -10
  81. package/Result.d.ts +0 -37
  82. package/Seq.d.ts +0 -164
  83. package/Seq2.d.ts +0 -18
  84. package/Set.d.ts +0 -190
  85. package/String.d.ts +0 -58
  86. package/System.Collections.Generic.d.ts +0 -79
  87. package/System.Text.d.ts +0 -40
  88. package/SystemException.d.ts +0 -5
  89. package/SystemException.js +0 -5
  90. package/TimeOnly.d.ts +0 -15
  91. package/TimeSpan.d.ts +0 -35
  92. package/Timer.d.ts +0 -19
  93. package/Types.d.ts +0 -58
  94. package/Unicode.13.0.0.d.ts +0 -2
  95. package/Uri.d.ts +0 -31
  96. package/Util.d.ts +0 -212
  97. package/lib/big.d.ts +0 -5
package/TimeSpan.js CHANGED
@@ -1,4 +1,4 @@
1
- import { comparePrimitives, padLeftAndRightWithZeros, padWithZeros } from "./Util.js";
1
+ import { Exception, comparePrimitives, padLeftAndRightWithZeros, padWithZeros } from "./Util.js";
2
2
  import { toInt64, fromFloat64 } from "./BigInt.js";
3
3
  /**
4
4
  * Calls:
@@ -98,7 +98,7 @@ export function duration(x) {
98
98
  }
99
99
  export function toString(ts, format = "c", _provider) {
100
100
  if (["c", "g", "G"].indexOf(format) === -1) {
101
- throw new Error("Custom formats are not supported");
101
+ throw new Exception("Custom formats are not supported");
102
102
  }
103
103
  const d = Math.abs(days(ts));
104
104
  const h = Math.abs(hours(ts));
@@ -114,7 +114,7 @@ export function parse(str) {
114
114
  if (firstDot === -1 && firstColon === -1) { // There is only a day ex: 4
115
115
  const d = parseInt(str, 0);
116
116
  if (isNaN(d)) {
117
- throw new Error(`String '${str}' was not recognized as a valid TimeSpan.`);
117
+ throw new Exception(`String '${str}' was not recognized as a valid TimeSpan.`);
118
118
  }
119
119
  else {
120
120
  return create(d, 0, 0, 0, 0);
@@ -161,13 +161,13 @@ export function parse(str) {
161
161
  ms = +r[8] / 10000;
162
162
  break;
163
163
  default:
164
- throw new Error(`String '${str}' was not recognized as a valid TimeSpan.`);
164
+ throw new Exception(`String '${str}' was not recognized as a valid TimeSpan.`);
165
165
  }
166
166
  }
167
167
  return sign * create(d, h, m, s, ms);
168
168
  }
169
169
  }
170
- throw new Error(`String '${str}' was not recognized as a valid TimeSpan.`);
170
+ throw new Exception(`String '${str}' was not recognized as a valid TimeSpan.`);
171
171
  }
172
172
  export function tryParse(v, defValue) {
173
173
  try {
package/Types.js CHANGED
@@ -1,4 +1,4 @@
1
- import { combineHashCodes, compare, compareArrays, equalArrays, equals, sameConstructor, numberHash, structuralHash } from "./Util.js";
1
+ import { Exception, combineHashCodes, compare, compareArrays, equalArrays, equals, sameConstructor, numberHash, structuralHash } from "./Util.js";
2
2
  export function seqToString(self) {
3
3
  let count = 0;
4
4
  let str = "[";
@@ -172,22 +172,6 @@ export class FSharpRef {
172
172
  }
173
173
  }
174
174
  // EXCEPTIONS
175
- // Exception is intentionally not derived from Error, for performance reasons (see #2160)
176
- export class Exception {
177
- constructor(message) {
178
- this.message = message;
179
- }
180
- }
181
- export function isException(x) {
182
- return x instanceof Exception || x instanceof Error;
183
- }
184
- export function isPromise(x) {
185
- return x instanceof Promise;
186
- }
187
- export function ensureErrorOrException(e) {
188
- // Exceptionally admitting promises as errors for compatibility with React.suspense (see #3298)
189
- return (isException(e) || isPromise(e)) ? e : new Error(String(e));
190
- }
191
175
  export class FSharpException extends Exception {
192
176
  toJSON() { return recordToJSON(this); }
193
177
  toString() { return recordToString(this); }
package/Uri.js CHANGED
@@ -1,3 +1,9 @@
1
+ import { Exception } from "./Util.js";
2
+ export const UriKind = {
3
+ RelativeOrAbsolute: 0,
4
+ Absolute: 1,
5
+ Relative: 2,
6
+ };
1
7
  const ok = (value) => ({
2
8
  tag: "ok",
3
9
  value,
@@ -18,41 +24,41 @@ export class Uri {
18
24
  }
19
25
  static tryCreateWithKind(uri, kind) {
20
26
  switch (kind) {
21
- case 1 /* UriKind.Absolute */:
27
+ case UriKind.Absolute:
22
28
  return Uri.isAbsoluteUri(uri)
23
29
  ? ok(new Uri({ original: uri, value: new URL(uri), kind }))
24
30
  : error("Invalid URI: The format of the URI could not be determined.");
25
- case 2 /* UriKind.Relative */:
31
+ case UriKind.Relative:
26
32
  return Uri.isAbsoluteUri(uri)
27
33
  ? error("URI is not a relative path.")
28
34
  : ok(new Uri({ original: uri, value: uri, kind }));
29
- case 0 /* UriKind.RelativeOrAbsolute */:
35
+ case UriKind.RelativeOrAbsolute:
30
36
  return Uri.isAbsoluteUri(uri)
31
- ? ok(new Uri({ original: uri, value: new URL(uri), kind: 1 /* UriKind.Absolute */ }))
32
- : ok(new Uri({ original: uri, value: uri, kind: 2 /* UriKind.Relative */ }));
37
+ ? ok(new Uri({ original: uri, value: new URL(uri), kind: UriKind.Absolute }))
38
+ : ok(new Uri({ original: uri, value: uri, kind: UriKind.Relative }));
33
39
  default:
34
40
  const never = kind;
35
41
  return never;
36
42
  }
37
43
  }
38
44
  static tryCreateWithBase(baseUri, relativeUri) {
39
- return baseUri.uri.kind !== 1 /* UriKind.Absolute */
45
+ return baseUri.uri.kind !== UriKind.Absolute
40
46
  ? error("Base URI should have Absolute kind")
41
47
  : typeof relativeUri === "string"
42
48
  ? ok(new Uri({
43
49
  original: new URL(relativeUri, baseUri.uri.value).toString(),
44
50
  value: new URL(relativeUri, baseUri.uri.value),
45
- kind: 1 /* UriKind.Absolute */,
51
+ kind: UriKind.Absolute,
46
52
  }))
47
- : relativeUri.uri.kind === 2 /* UriKind.Relative */
53
+ : relativeUri.uri.kind === UriKind.Relative
48
54
  ? ok(new Uri({
49
55
  original: new URL(relativeUri.uri.value, baseUri.uri.value).toString(),
50
56
  value: new URL(relativeUri.uri.value, baseUri.uri.value),
51
- kind: 1 /* UriKind.Absolute */,
57
+ kind: UriKind.Absolute,
52
58
  }))
53
59
  : ok(baseUri);
54
60
  }
55
- static tryCreateImpl(value, kindOrUri = 1 /* UriKind.Absolute */) {
61
+ static tryCreateImpl(value, kindOrUri = UriKind.Absolute) {
56
62
  return typeof value === "string"
57
63
  ? typeof kindOrUri !== "number"
58
64
  ? error("Kind must be specified when the baseUri is a string.")
@@ -61,19 +67,19 @@ export class Uri {
61
67
  ? error("Kind should not be specified when the baseUri is an absolute Uri.")
62
68
  : Uri.tryCreateWithBase(value, kindOrUri);
63
69
  }
64
- static create(value, kindOrUri = 1 /* UriKind.Absolute */) {
70
+ static create(value, kindOrUri = UriKind.Absolute) {
65
71
  const result = Uri.tryCreateImpl(value, kindOrUri);
66
72
  switch (result.tag) {
67
73
  case "ok":
68
74
  return result.value;
69
75
  case "error":
70
- throw new Error(result.error);
76
+ throw new Exception(result.error);
71
77
  default:
72
78
  const never = result;
73
79
  return never;
74
80
  }
75
81
  }
76
- static tryCreate(value, kindOrUri = 1 /* UriKind.Absolute */, out) {
82
+ static tryCreate(value, kindOrUri = UriKind.Absolute, out) {
77
83
  const result = Uri.tryCreateImpl(value, kindOrUri);
78
84
  switch (result.tag) {
79
85
  case "ok":
@@ -88,9 +94,9 @@ export class Uri {
88
94
  }
89
95
  toString() {
90
96
  switch (this.uri.kind) {
91
- case 1 /* UriKind.Absolute */:
97
+ case UriKind.Absolute:
92
98
  return decodeURIComponent(this.asUrl().toString());
93
- case 2 /* UriKind.Relative */:
99
+ case UriKind.Relative:
94
100
  return this.uri.value;
95
101
  default:
96
102
  const never = this.uri;
@@ -99,17 +105,17 @@ export class Uri {
99
105
  }
100
106
  asUrl() {
101
107
  switch (this.uri.kind) {
102
- case 1 /* UriKind.Absolute */:
108
+ case UriKind.Absolute:
103
109
  return this.uri.value;
104
- case 2 /* UriKind.Relative */:
105
- throw new Error("This operation is not supported for a relative URI.");
110
+ case UriKind.Relative:
111
+ throw new Exception("This operation is not supported for a relative URI.");
106
112
  default:
107
113
  const never = this.uri;
108
114
  return never;
109
115
  }
110
116
  }
111
117
  get isAbsoluteUri() {
112
- return this.uri.kind === 1 /* UriKind.Absolute */;
118
+ return this.uri.kind === UriKind.Absolute;
113
119
  }
114
120
  get absoluteUri() {
115
121
  return this.asUrl().href;
package/Util.js CHANGED
@@ -1,6 +1,31 @@
1
+ // Don't change, this corresponds to DateTimeKind.Kind enum values in .NET
2
+ export const DateTimeKind = {
3
+ Unspecified: 0,
4
+ Utc: 1,
5
+ Local: 2,
6
+ };
7
+ // Exception is intentionally not derived from Error, for performance reasons (see #2160)
8
+ export class Exception {
9
+ constructor(msg) {
10
+ this.message = msg ?? "";
11
+ }
12
+ }
13
+ export function isException(x) {
14
+ return x instanceof Exception || x instanceof Error;
15
+ }
16
+ export function isPromise(x) {
17
+ return x instanceof Promise;
18
+ }
19
+ export function ensureErrorOrException(e) {
20
+ // Exceptionally admitting promises as errors for compatibility with React.suspense (see #3298)
21
+ return (isException(e) || isPromise(e)) ? e : new Exception(String(e));
22
+ }
1
23
  export function isArrayLike(x) {
2
24
  return Array.isArray(x) || ArrayBuffer.isView(x);
3
25
  }
26
+ export function isMutableArray(x) {
27
+ return Array.isArray(x) || ArrayBuffer.isView(x);
28
+ }
4
29
  export function isIterable(x) {
5
30
  return x != null && typeof x === "object" && Symbol.iterator in x;
6
31
  }
@@ -34,9 +59,7 @@ export function sameConstructor(x, y) {
34
59
  return Object.getPrototypeOf(x)?.constructor === Object.getPrototypeOf(y)?.constructor;
35
60
  }
36
61
  export class Enumerable {
37
- constructor(en) {
38
- this.en = en;
39
- }
62
+ constructor(en) { this.en = en; }
40
63
  GetEnumerator() { return this.en; }
41
64
  "System.Collections.IEnumerable.GetEnumerator"() { return this.en; }
42
65
  [Symbol.iterator]() {
@@ -50,8 +73,8 @@ export class Enumerable {
50
73
  }
51
74
  export class Enumerator {
52
75
  constructor(iter) {
53
- this.iter = iter;
54
76
  this.current = defaultOf();
77
+ this.iter = iter;
55
78
  }
56
79
  ["System.Collections.Generic.IEnumerator`1.get_Current"]() {
57
80
  return this.current;
@@ -65,7 +88,7 @@ export class Enumerator {
65
88
  return !cur.done;
66
89
  }
67
90
  ["System.Collections.IEnumerator.Reset"]() {
68
- throw new Error("JS iterators cannot be reset");
91
+ throw new Exception("JS iterators cannot be reset");
69
92
  }
70
93
  Dispose() {
71
94
  return;
@@ -124,7 +147,7 @@ export function comparerFromEqualityComparer(comparer) {
124
147
  }
125
148
  export function assertEqual(actual, expected, msg) {
126
149
  if (!equals(actual, expected)) {
127
- throw Object.assign(new Error(msg || `Expected: ${expected} - Actual: ${actual}`), {
150
+ throw Object.assign(new Exception(msg || `Expected: ${expected} - Actual: ${actual}`), {
128
151
  actual,
129
152
  expected,
130
153
  });
@@ -132,7 +155,7 @@ export function assertEqual(actual, expected, msg) {
132
155
  }
133
156
  export function assertNotEqual(actual, expected, msg) {
134
157
  if (equals(actual, expected)) {
135
- throw Object.assign(new Error(msg || `Expected: ${expected} - Actual: ${actual}`), {
158
+ throw Object.assign(new Exception(msg || `Expected: ${expected} - Actual: ${actual}`), {
136
159
  actual,
137
160
  expected,
138
161
  });
@@ -167,7 +190,7 @@ export function dateOffset(date) {
167
190
  const date1 = date;
168
191
  return typeof date1.offset === "number"
169
192
  ? date1.offset
170
- : (date.kind === 1 /* DateKind.UTC */
193
+ : (date.kind === DateTimeKind.Utc
171
194
  ? 0 : date.getTimezoneOffset() * -60000);
172
195
  }
173
196
  export function int16ToString(i, radix) {
@@ -336,15 +359,6 @@ function equalObjects(x, y) {
336
359
  export function physicalEquals(x, y) {
337
360
  return x === y;
338
361
  }
339
- export function nullableEquals(x, y) {
340
- if (x == null) {
341
- return y == null;
342
- }
343
- if (y == null) {
344
- return false;
345
- }
346
- return equals(x, y);
347
- }
348
362
  export function equals(x, y) {
349
363
  if (x === y) {
350
364
  return true;
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": "2.0.0-beta.4",
6
+ "version": "2.0.0-beta.5",
7
7
  "description": "Core library used by F# projects compiled with fable.io",
8
8
  "author": "Fable Contributors",
9
9
  "license": "MIT",
package/Array.d.ts DELETED
@@ -1,123 +0,0 @@
1
- import { int32 } from "./Int32.js";
2
- import { Option } from "./Option.js";
3
- import { IComparer, Nullable, IEqualityComparer } from "./Util.js";
4
- import { FSharpRef } from "./Types.js";
5
- export declare function append<T>(array1: T[], array2: T[], cons?: any): T[];
6
- export declare function filter<T>(predicate: ((arg0: T) => boolean), array: T[]): T[];
7
- export declare function fill<T>(target: T[], targetIndex: int32, count: int32, value: T): T[];
8
- export declare function getSubArray<T>(array: T[], start: int32, count: int32): T[];
9
- export declare function last<T>(array: T[]): T;
10
- export declare function tryLast<T>(array: T[]): Option<T>;
11
- export declare function mapIndexed<T, U>(f: ((arg0: int32, arg1: T) => U), source: T[], cons?: any): U[];
12
- export declare function map<T, U>(f: ((arg0: T) => U), source: T[], cons?: any): U[];
13
- export declare function mapIndexed2<T1, T2, U>(f: ((arg0: int32, arg1: T1, arg2: T2) => U), source1: T1[], source2: T2[], cons?: any): U[];
14
- export declare function map2<T1, T2, U>(f: ((arg0: T1, arg1: T2) => U), source1: T1[], source2: T2[], cons?: any): U[];
15
- export declare function mapIndexed3<T1, T2, T3, U>(f: ((arg0: int32, arg1: T1, arg2: T2, arg3: T3) => U), source1: T1[], source2: T2[], source3: T3[], cons?: any): U[];
16
- export declare function map3<T1, T2, T3, U>(f: ((arg0: T1, arg1: T2, arg2: T3) => U), source1: T1[], source2: T2[], source3: T3[], cons?: any): U[];
17
- export declare function mapFold<T, State, Result>(mapping: ((arg0: State, arg1: T) => [Result, State]), state: State, array: T[], cons?: any): [Result[], State];
18
- export declare function mapFoldBack<T, State, Result>(mapping: ((arg0: T, arg1: State) => [Result, State]), array: T[], state: State, cons?: any): [Result[], State];
19
- export declare function indexed<T>(source: T[]): [int32, T][];
20
- export declare function truncate<T>(count: int32, array: T[]): T[];
21
- export declare function concat<T>(arrays: Iterable<T[]>, cons?: any): T[];
22
- export declare function collect<T, U>(mapping: ((arg0: T) => U[]), array: T[], cons?: any): U[];
23
- export declare function where<$a>(predicate: ((arg0: $a) => boolean), array: $a[]): $a[];
24
- export declare function indexOf<T>(array: T[], item_1: T, start: Option<int32>, count: Option<int32>, eq: IEqualityComparer<T>): int32;
25
- export declare function contains<T>(value: T, array: T[], eq: IEqualityComparer<T>): boolean;
26
- export declare function empty<$a>(cons: Nullable<any>): $a[];
27
- export declare function singleton<T>(value: T, cons?: any): T[];
28
- export declare function initialize<T>(count: int32, initializer: ((arg0: int32) => T), cons?: any): T[];
29
- export declare function pairwise<T>(array: T[]): [T, T][];
30
- export declare function replicate<T>(count: int32, initial: T, cons?: any): T[];
31
- export declare function copy<T>(array: T[]): T[];
32
- export declare function copyTo<T>(source: T[], sourceIndex: int32, target: T[], targetIndex: int32, count: int32): void;
33
- export declare function reverse<T>(array: T[]): T[];
34
- export declare function scan<T, State>(folder: ((arg0: State, arg1: T) => State), state: State, array: T[], cons?: any): State[];
35
- export declare function scanBack<T, State>(folder: ((arg0: T, arg1: State) => State), array: T[], state: State, cons?: any): State[];
36
- export declare function skip<T>(count: int32, array: T[], cons?: any): T[];
37
- export declare function skipWhile<T>(predicate: ((arg0: T) => boolean), array: T[], cons?: any): T[];
38
- export declare function take<T>(count: int32, array: T[], cons?: any): T[];
39
- export declare function takeWhile<T>(predicate: ((arg0: T) => boolean), array: T[], cons?: any): T[];
40
- export declare function addInPlace<T>(x: T, array: T[]): void;
41
- export declare function addRangeInPlace<T>(range: Iterable<T>, array: T[]): void;
42
- export declare function insertRangeInPlace<T>(index: int32, range: Iterable<T>, array: T[]): void;
43
- export declare function removeInPlace<T>(item_1: T, array: T[], eq: IEqualityComparer<T>): boolean;
44
- export declare function removeAllInPlace<T>(predicate: ((arg0: T) => boolean), array: T[]): int32;
45
- export declare function partition<T>(f: ((arg0: T) => boolean), source: T[], cons?: any): [T[], T[]];
46
- export declare function find<T>(predicate: ((arg0: T) => boolean), array: T[]): T;
47
- export declare function tryFind<T>(predicate: ((arg0: T) => boolean), array: T[]): Option<T>;
48
- export declare function findIndex<T>(predicate: ((arg0: T) => boolean), array: T[]): int32;
49
- export declare function tryFindIndex<T>(predicate: ((arg0: T) => boolean), array: T[]): Option<int32>;
50
- export declare function pick<$a, $b>(chooser: ((arg0: $a) => Option<$b>), array: $a[]): $b;
51
- export declare function tryPick<$a, $b>(chooser: ((arg0: $a) => Option<$b>), array: $a[]): Option<$b>;
52
- export declare function findBack<$a>(predicate: ((arg0: $a) => boolean), array: $a[]): $a;
53
- export declare function tryFindBack<$a>(predicate: ((arg0: $a) => boolean), array: $a[]): Option<$a>;
54
- export declare function findLastIndex<$a>(predicate: ((arg0: $a) => boolean), array: $a[]): int32;
55
- export declare function findIndexBack<$a>(predicate: ((arg0: $a) => boolean), array: $a[]): int32;
56
- export declare function tryFindIndexBack<$a>(predicate: ((arg0: $a) => boolean), array: $a[]): Option<int32>;
57
- export declare function choose<T, U>(chooser: ((arg0: T) => Option<U>), array: T[], cons?: any): U[];
58
- export declare function foldIndexed<T, State>(folder: ((arg0: int32, arg1: State, arg2: T) => State), state: State, array: T[]): State;
59
- export declare function fold<T, State>(folder: ((arg0: State, arg1: T) => State), state: State, array: T[]): State;
60
- export declare function iterate<T>(action: ((arg0: T) => void), array: T[]): void;
61
- export declare function iterateIndexed<T>(action: ((arg0: int32, arg1: T) => void), array: T[]): void;
62
- export declare function iterate2<T1, T2>(action: ((arg0: T1, arg1: T2) => void), array1: T1[], array2: T2[]): void;
63
- export declare function iterateIndexed2<T1, T2>(action: ((arg0: int32, arg1: T1, arg2: T2) => void), array1: T1[], array2: T2[]): void;
64
- export declare function isEmpty<T>(array: T[]): boolean;
65
- export declare function forAll<T>(predicate: ((arg0: T) => boolean), array: T[]): boolean;
66
- export declare function permute<T>(f: ((arg0: int32) => int32), array: T[]): T[];
67
- export declare function setSlice<T>(target: T[], lower: Option<int32>, upper: Option<int32>, source: T[]): void;
68
- export declare function sortInPlaceBy<a, b>(projection: ((arg0: a) => b), xs: a[], comparer: IComparer<b>): void;
69
- export declare function sortInPlace<T>(xs: T[], comparer: IComparer<T>): void;
70
- export declare function sort<T>(xs: T[], comparer: IComparer<T>): T[];
71
- export declare function sortBy<a, b>(projection: ((arg0: a) => b), xs: a[], comparer: IComparer<b>): a[];
72
- export declare function sortDescending<T>(xs: T[], comparer: IComparer<T>): T[];
73
- export declare function sortByDescending<a, b>(projection: ((arg0: a) => b), xs: a[], comparer: IComparer<b>): a[];
74
- export declare function sortWith<T>(comparer: ((arg0: T, arg1: T) => int32), xs: T[]): T[];
75
- export declare function allPairs<T1, T2>(xs: T1[], ys: T2[]): [T1, T2][];
76
- export declare function unfold<T, State>(generator: ((arg0: State) => Option<[T, State]>), state: State): T[];
77
- export declare function unzip<$a, $b>(array: [$a, $b][]): [$a[], $b[]];
78
- export declare function unzip3<$a, $b, $c>(array: [$a, $b, $c][]): [$a[], $b[], $c[]];
79
- export declare function zip<T, U>(array1: T[], array2: U[]): [T, U][];
80
- export declare function zip3<T, U, V>(array1: T[], array2: U[], array3: V[]): [T, U, V][];
81
- export declare function chunkBySize<T>(chunkSize: int32, array: T[]): T[][];
82
- export declare function splitAt<T>(index: int32, array: T[]): [T[], T[]];
83
- export declare function compareWith<T>(comparer: ((arg0: T, arg1: T) => int32), source1: T[], source2: T[]): int32;
84
- export declare function compareTo<T>(comparer: ((arg0: T, arg1: T) => int32), source1: T[], source2: T[]): int32;
85
- export declare function equalsWith<T>(equals: ((arg0: T, arg1: T) => boolean), source1: T[], source2: T[]): boolean;
86
- export declare function exactlyOne<T>(array: T[]): T;
87
- export declare function tryExactlyOne<T>(array: T[]): Option<T>;
88
- export declare function head<T>(array: T[]): T;
89
- export declare function tryHead<T>(array: T[]): Option<T>;
90
- export declare function tail<T>(array: T[]): T[];
91
- export declare function item<T>(index: int32, array: T[]): T;
92
- export declare function setItem<T>(array: T[], index: int32, value: T): void;
93
- export declare function tryItem<T>(index: int32, array: T[]): Option<T>;
94
- export declare function foldBackIndexed<T, State>(folder: ((arg0: int32, arg1: T, arg2: State) => State), array: T[], state: State): State;
95
- export declare function foldBack<T, State>(folder: ((arg0: T, arg1: State) => State), array: T[], state: State): State;
96
- export declare function foldIndexed2<$a, $b, $c>(folder: ((arg0: int32, arg1: $a, arg2: $b, arg3: $c) => $a), state: $a, array1: $b[], array2: $c[]): $a;
97
- export declare function fold2<T1, T2, State>(folder: ((arg0: State, arg1: T1, arg2: T2) => State), state: State, array1: T1[], array2: T2[]): State;
98
- export declare function foldBackIndexed2<T1, T2, State>(folder: ((arg0: int32, arg1: T1, arg2: T2, arg3: State) => State), array1: T1[], array2: T2[], state: State): State;
99
- export declare function foldBack2<T1, T2, State>(f: ((arg0: T1, arg1: T2, arg2: State) => State), array1: T1[], array2: T2[], state: State): State;
100
- export declare function reduce<T>(reduction: ((arg0: T, arg1: T) => T), array: T[]): T;
101
- export declare function reduceBack<T>(reduction: ((arg0: T, arg1: T) => T), array: T[]): T;
102
- export declare function forAll2<$a, $b>(predicate: ((arg0: $a, arg1: $b) => boolean), array1: $a[], array2: $b[]): boolean;
103
- export declare function existsOffset<T>(predicate_mut: ((arg0: T) => boolean), array_mut: T[], index_mut: int32): boolean;
104
- export declare function exists<$a>(predicate: ((arg0: $a) => boolean), array: $a[]): boolean;
105
- export declare function existsOffset2<$a, $b>(predicate_mut: ((arg0: $a, arg1: $b) => boolean), array1_mut: $a[], array2_mut: $b[], index_mut: int32): boolean;
106
- export declare function exists2<$a, $b>(predicate: ((arg0: $a, arg1: $b) => boolean), array1: $a[], array2: $b[]): boolean;
107
- export declare function sum<T>(array: T[], adder: any): T;
108
- export declare function sumBy<T, T2>(projection: ((arg0: T) => T2), array: T[], adder: any): T2;
109
- export declare function maxBy<a, b>(projection: ((arg0: a) => b), xs: a[], comparer: IComparer<b>): a;
110
- export declare function max<a>(xs: a[], comparer: IComparer<a>): a;
111
- export declare function minBy<a, b>(projection: ((arg0: a) => b), xs: a[], comparer: IComparer<b>): a;
112
- export declare function min<a>(xs: a[], comparer: IComparer<a>): a;
113
- export declare function average<T>(array: T[], averager: any): T;
114
- export declare function averageBy<T, T2>(projection: ((arg0: T) => T2), array: T[], averager: any): T2;
115
- export declare function windowed<T>(windowSize: int32, source: T[]): T[][];
116
- export declare function splitInto<T>(chunks: int32, array: T[]): T[][];
117
- export declare function transpose<T>(arrays: Iterable<T[]>, cons?: any): T[][];
118
- export declare function insertAt<T>(index: int32, y: T, xs: T[], cons?: any): T[];
119
- export declare function insertManyAt<T>(index: int32, ys: Iterable<T>, xs: T[], cons?: any): T[];
120
- export declare function removeAt<T>(index: int32, xs: T[]): T[];
121
- export declare function removeManyAt<T>(index: int32, count: int32, xs: T[]): T[];
122
- export declare function updateAt<T>(index: int32, y: T, xs: T[], cons?: any): T[];
123
- export declare function resize<T>(xs: FSharpRef<T[]>, newSize: int32, zero?: Option<T>, cons?: any): void;
package/Async.d.ts DELETED
@@ -1,26 +0,0 @@
1
- import { Continuation, Continuations } from "./AsyncBuilder.js";
2
- import { Async, IAsyncContext, CancellationToken } from "./AsyncBuilder.js";
3
- import { FSharpChoice$2_$union } from "./Choice.js";
4
- export declare function makeAsync<T>(body: Async<T>): Async<T>;
5
- export declare function invoke<T>(computation: Async<T>, ctx: IAsyncContext<T>): void;
6
- export declare function callThenInvoke<T, U>(ctx: IAsyncContext<T>, result1: U, part2: (x: U) => Async<T>): void;
7
- export declare function bind<T, U>(ctx: IAsyncContext<T>, part1: Async<U>, part2: (x: U) => Async<T>): void;
8
- export declare function createCancellationToken(arg?: boolean | number): CancellationToken;
9
- export declare function cancel(token: CancellationToken): void;
10
- export declare function cancelAfter(token: CancellationToken, ms: number): void;
11
- export declare function isCancellationRequested(token: CancellationToken): boolean;
12
- export declare function throwIfCancellationRequested(token: CancellationToken): void;
13
- export declare function startChild<T>(computation: Async<T>, ms?: number): Async<Async<T>>;
14
- export declare function awaitPromise<T>(p: Promise<T>): (ctx: IAsyncContext<T>) => void;
15
- export declare function cancellationToken(): (ctx: IAsyncContext<CancellationToken>) => void;
16
- export declare const defaultCancellationToken: CancellationToken;
17
- export declare function catchAsync<T>(work: Async<T>): (ctx: IAsyncContext<FSharpChoice$2_$union<T, Error>>) => void;
18
- export declare function fromContinuations<T>(f: (conts: Continuations<T>) => void): (ctx: IAsyncContext<T>) => void;
19
- export declare function ignore<T>(computation: Async<T>): (ctx: IAsyncContext<undefined>) => void;
20
- export declare function parallel<T>(computations: Iterable<Async<T>>): (ctx: IAsyncContext<Awaited<T>[]>) => void;
21
- export declare function sequential<T>(computations: Iterable<Async<T>>): (ctx: IAsyncContext<T[]>) => void;
22
- export declare function sleep(millisecondsDueTime: number): (ctx: IAsyncContext<void>) => void;
23
- export declare function start<T>(computation: Async<T>, cancellationToken?: CancellationToken): void;
24
- export declare function startImmediate<T>(computation: Async<T>, cancellationToken?: CancellationToken): void;
25
- export declare function startWithContinuations<T>(computation: Async<T>, continuation: Continuation<T>, exceptionContinuation: Continuation<any>, cancellationContinuation: Continuation<any>, cancelToken?: CancellationToken): void;
26
- export declare function startAsPromise<T>(computation: Async<T>, cancellationToken?: CancellationToken): Promise<T>;
package/AsyncBuilder.d.ts DELETED
@@ -1,59 +0,0 @@
1
- import { IDisposable } from "./Util.js";
2
- export interface AsyncReplyChannel<Reply> {
3
- reply(value: Reply): void;
4
- }
5
- export type Continuation<T> = (x: T) => void;
6
- export type Continuations<T> = [
7
- Continuation<T>,
8
- Continuation<Error>,
9
- Continuation<OperationCanceledError>
10
- ];
11
- export declare class CancellationToken implements IDisposable {
12
- private _id;
13
- private _cancelled;
14
- private _listeners;
15
- constructor(cancelled?: boolean);
16
- get isCancelled(): boolean;
17
- cancel(): void;
18
- addListener(f: () => void): number;
19
- removeListener(id: number): boolean;
20
- register(f: (state?: any) => void, state?: any): {
21
- Dispose(): void;
22
- };
23
- Dispose(): void;
24
- }
25
- export declare class OperationCanceledError extends Error {
26
- constructor();
27
- }
28
- export declare class Trampoline {
29
- static get maxTrampolineCallCount(): number;
30
- private callCount;
31
- constructor();
32
- incrementAndCheck(): boolean;
33
- hijack(f: () => void): void;
34
- }
35
- export interface IAsyncContext<T> {
36
- onSuccess: Continuation<T>;
37
- onError: Continuation<Error>;
38
- onCancel: Continuation<OperationCanceledError>;
39
- cancelToken: CancellationToken;
40
- trampoline: Trampoline;
41
- }
42
- export type Async<T> = (x: IAsyncContext<T>) => void;
43
- export declare function protectedCont<T>(f: Async<T>): (ctx: IAsyncContext<T>) => void;
44
- export declare function protectedBind<T, U>(computation: Async<T>, binder: (x: T) => Async<U>): (ctx: IAsyncContext<U>) => void;
45
- export declare function protectedReturn<T>(value: T): (ctx: IAsyncContext<T>) => void;
46
- export declare class AsyncBuilder {
47
- Bind<T, U>(computation: Async<T>, binder: (x: T) => Async<U>): (ctx: IAsyncContext<U>) => void;
48
- Combine<T>(computation1: Async<void>, computation2: Async<T>): (ctx: IAsyncContext<T>) => void;
49
- Delay<T>(generator: () => Async<T>): (ctx: IAsyncContext<T>) => void;
50
- For<T>(sequence: Iterable<T>, body: (x: T) => Async<void>): Async<void>;
51
- Return<T>(value: T): (ctx: IAsyncContext<T>) => void;
52
- ReturnFrom<T>(computation: Async<T>): Async<T>;
53
- TryFinally<T>(computation: Async<T>, compensation: () => void): (ctx: IAsyncContext<T>) => void;
54
- TryWith<T>(computation: Async<T>, catchHandler: (e: any) => Async<T>): (ctx: IAsyncContext<T>) => void;
55
- Using<T extends IDisposable, U>(resource: T, binder: (x: T) => Async<U>): (ctx: IAsyncContext<U>) => void;
56
- While(guard: () => boolean, computation: Async<void>): Async<void>;
57
- Zero(): (ctx: IAsyncContext<void>) => void;
58
- }
59
- export declare const singleton: AsyncBuilder;
package/BigInt.d.ts DELETED
@@ -1,129 +0,0 @@
1
- import { FSharpRef } from "./Types.js";
2
- import { int8, uint8, int16, uint16, int32, uint32, float16, float32, float64 } from "./Int32.js";
3
- import { decimal } from "./Decimal.js";
4
- export type int64 = bigint;
5
- export type uint64 = bigint;
6
- export type int128 = bigint;
7
- export type uint128 = bigint;
8
- export type nativeint = bigint;
9
- export type unativeint = bigint;
10
- export declare function isBigInt(x: any): boolean;
11
- export declare function hash(x: bigint): int32;
12
- export declare function equals(x: bigint, y: bigint): boolean;
13
- export declare function compare(x: bigint, y: bigint): int32;
14
- export declare function abs(x: bigint): bigint;
15
- export declare function sign(x: bigint): int32;
16
- export declare function max(x: bigint, y: bigint): bigint;
17
- export declare function min(x: bigint, y: bigint): bigint;
18
- export declare function maxMagnitude(x: bigint, y: bigint): bigint;
19
- export declare function minMagnitude(x: bigint, y: bigint): bigint;
20
- export declare function clamp(x: bigint, min: bigint, max: bigint): bigint;
21
- export declare function add(x: bigint, y: bigint): bigint;
22
- export declare function subtract(x: bigint, y: bigint): bigint;
23
- export declare function multiply(x: bigint, y: bigint): bigint;
24
- export declare function divide(x: bigint, y: bigint): bigint;
25
- export declare function remainder(x: bigint, y: bigint): bigint;
26
- export declare function negate(x: bigint): bigint;
27
- export declare function op_UnaryNegation(x: bigint): bigint;
28
- export declare function op_LogicalNot(x: bigint): bigint;
29
- export declare function op_UnaryPlus(x: bigint): bigint;
30
- export declare function op_Addition(x: bigint, y: bigint): bigint;
31
- export declare function op_Subtraction(x: bigint, y: bigint): bigint;
32
- export declare function op_Multiply(x: bigint, y: bigint): bigint;
33
- export declare function op_Division(x: bigint, y: bigint): bigint;
34
- export declare function op_Modulus(x: bigint, y: bigint): bigint;
35
- export declare function op_RightShift(x: bigint, n: int32): bigint;
36
- export declare function op_LeftShift(x: bigint, n: int32): bigint;
37
- export declare function op_BitwiseAnd(x: bigint, y: bigint): bigint;
38
- export declare function op_BitwiseOr(x: bigint, y: bigint): bigint;
39
- export declare function op_ExclusiveOr(x: bigint, y: bigint): bigint;
40
- export declare function op_LessThan(x: bigint, y: bigint): boolean;
41
- export declare function op_LessThanOrEqual(x: bigint, y: bigint): boolean;
42
- export declare function op_GreaterThan(x: bigint, y: bigint): boolean;
43
- export declare function op_GreaterThanOrEqual(x: bigint, y: bigint): boolean;
44
- export declare function op_Equality(x: bigint, y: bigint): boolean;
45
- export declare function op_Inequality(x: bigint, y: bigint): boolean;
46
- export declare function get_Zero(): bigint;
47
- export declare function get_One(): bigint;
48
- export declare function get_MinusOne(): bigint;
49
- export declare function get_IsZero(x: bigint): boolean;
50
- export declare function get_IsOne(x: bigint): boolean;
51
- export declare function get_IsEven(x: bigint): boolean;
52
- export declare function get_IsPowerOfTwo(x: bigint): boolean;
53
- export declare function get_Sign(x: bigint): int32;
54
- export declare function isNegative(x: bigint): boolean;
55
- export declare function isPositive(x: bigint): boolean;
56
- export declare function isEvenInteger(x: bigint): boolean;
57
- export declare function isOddInteger(x: bigint): boolean;
58
- export declare function isPow2(x: bigint): boolean;
59
- export declare function fromZero(): bigint;
60
- export declare function fromOne(): bigint;
61
- export declare function fromInt8(n: int8): bigint;
62
- export declare function fromUInt8(n: uint8): bigint;
63
- export declare function fromInt16(n: int16): bigint;
64
- export declare function fromUInt16(n: uint16): bigint;
65
- export declare function fromInt32(n: int32): bigint;
66
- export declare function fromUInt32(n: uint32): bigint;
67
- export declare function fromInt64(n: int64): bigint;
68
- export declare function fromUInt64(n: uint64): bigint;
69
- export declare function fromInt128(n: int128): bigint;
70
- export declare function fromUInt128(n: uint128): bigint;
71
- export declare function fromNativeInt(n: nativeint): bigint;
72
- export declare function fromUNativeInt(n: unativeint): bigint;
73
- export declare function fromFloat16(n: float16): bigint;
74
- export declare function fromFloat32(n: float32): bigint;
75
- export declare function fromFloat64(n: float64): bigint;
76
- export declare function fromDecimal(d: decimal): bigint;
77
- export declare function fromBigInt(x: bigint): bigint;
78
- export declare function fromBoolean(b: boolean): bigint;
79
- export declare function fromChar(c: string): bigint;
80
- export declare function fromString(s: string): bigint;
81
- export declare function fromByteArray(bytes: ArrayLike<uint8>): bigint;
82
- export declare function toByteArray(value: bigint): number[];
83
- export declare function toIntN_unchecked(bits: number, x: bigint, signed: boolean): bigint;
84
- export declare function toIntN(bits: number, x: bigint, signed: boolean): bigint;
85
- export declare function toInt8(x: bigint): int8;
86
- export declare function toUInt8(x: bigint): uint8;
87
- export declare function toInt16(x: bigint): int16;
88
- export declare function toUInt16(x: bigint): uint16;
89
- export declare function toInt32(x: bigint): int32;
90
- export declare function toUInt32(x: bigint): uint32;
91
- export declare function toInt64(x: bigint): int64;
92
- export declare function toUInt64(x: bigint): uint64;
93
- export declare function toInt128(x: bigint): int128;
94
- export declare function toUInt128(x: bigint): uint128;
95
- export declare function toNativeInt(x: bigint): nativeint;
96
- export declare function toUNativeInt(x: bigint): unativeint;
97
- export declare function toInt8_unchecked(x: bigint): int8;
98
- export declare function toUInt8_unchecked(x: bigint): uint8;
99
- export declare function toInt16_unchecked(x: bigint): int16;
100
- export declare function toUInt16_unchecked(x: bigint): uint16;
101
- export declare function toInt32_unchecked(x: bigint): int32;
102
- export declare function toUInt32_unchecked(x: bigint): uint32;
103
- export declare function toInt64_unchecked(x: bigint): int64;
104
- export declare function toUInt64_unchecked(x: bigint): uint64;
105
- export declare function toInt128_unchecked(x: bigint): int128;
106
- export declare function toUInt128_unchecked(x: bigint): uint128;
107
- export declare function toNativeInt_unchecked(x: bigint): nativeint;
108
- export declare function toUNativeInt_unchecked(x: bigint): unativeint;
109
- export declare function toFloat16(x: bigint): float16;
110
- export declare function toFloat32(x: bigint): float32;
111
- export declare function toFloat64(x: bigint): float64;
112
- export declare function toDecimal(x: bigint): decimal;
113
- export declare function toBigInt(x: bigint): bigint;
114
- export declare function toBoolean(x: bigint): boolean;
115
- export declare function toChar(x: bigint): string;
116
- export declare function toString(x: bigint): string;
117
- export declare function tryParse(s: string, res: FSharpRef<bigint>): boolean;
118
- export declare function parse(s: string): bigint;
119
- export declare function pow(x: bigint, n: int32): bigint;
120
- export declare function modPow(x: bigint, e: bigint, m: bigint): bigint;
121
- export declare function divRem(x: bigint, y: bigint): [bigint, bigint];
122
- export declare function divRem(x: bigint, y: bigint, out: FSharpRef<bigint>): bigint;
123
- export declare function greatestCommonDivisor(x: bigint, y: bigint): bigint;
124
- export declare function getBitLength(x: bigint): int64;
125
- export declare function log2(x: bigint): float64;
126
- export declare function log10(x: bigint): float64;
127
- export declare function ln(x: bigint): float64;
128
- export declare function log(x: bigint, base: float64): float64;
129
- export declare function ilog2(x: bigint): bigint;