@fable-org/fable-library-ts 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.
- package/Array.ts +253 -247
- package/Async.ts +13 -12
- package/AsyncBuilder.ts +10 -11
- package/BigInt.ts +6 -6
- package/BitConverter.ts +3 -3
- package/Boolean.ts +3 -2
- package/CHANGELOG.md +8 -0
- package/Char.ts +38 -35
- package/Choice.ts +36 -12
- package/CollectionUtil.ts +4 -4
- package/Date.ts +67 -62
- package/DateOffset.ts +48 -57
- package/DateOnly.ts +8 -8
- package/Decimal.ts +9 -9
- package/Double.ts +3 -2
- package/Encoding.ts +1 -1
- package/Event.ts +3 -3
- package/FSharp.Collections.ts +31 -13
- package/FSharp.Core.CompilerServices.ts +4 -4
- package/FSharp.Core.ts +34 -34
- package/Global.ts +44 -2
- package/Guid.ts +7 -6
- package/Int32.ts +20 -17
- package/List.ts +57 -56
- package/Long.ts +6 -5
- package/MailboxProcessor.ts +8 -7
- package/Map.ts +67 -65
- package/MapUtil.ts +5 -5
- package/MutableMap.ts +32 -20
- package/MutableSet.ts +12 -12
- package/Native.ts +3 -3
- package/Numeric.ts +1 -1
- package/Observable.ts +3 -3
- package/Option.ts +3 -3
- package/Random.ts +34 -34
- package/Range.ts +7 -7
- package/Reflection.ts +73 -40
- package/RegExp.ts +5 -3
- package/Result.ts +31 -27
- package/Seq.ts +56 -54
- package/Seq2.ts +14 -14
- package/Set.ts +81 -80
- package/String.ts +41 -38
- package/System.Collections.Generic.ts +45 -25
- package/System.Text.ts +12 -12
- package/System.ts +366 -0
- package/TimeOnly.ts +10 -10
- package/TimeSpan.ts +11 -11
- package/Timer.ts +2 -2
- package/Types.ts +1 -19
- package/Uri.ts +13 -10
- package/Util.ts +74 -26
- package/package.json +1 -1
- package/tsconfig.json +18 -5
- package/SystemException.ts +0 -7
package/String.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { toString as dateToString } from "./Date.
|
|
2
|
-
import { compare as numericCompare, isNumeric, isIntegral, multiply, Numeric, toExponential, toFixed, toHex, toPrecision } from "./Numeric.
|
|
3
|
-
import { escape } from "./RegExp.
|
|
4
|
-
import { toString } from "./Types.
|
|
1
|
+
import { toString as dateToString } from "./Date.ts";
|
|
2
|
+
import { compare as numericCompare, isNumeric, isIntegral, multiply, Numeric, toExponential, toFixed, toHex, toPrecision } from "./Numeric.ts";
|
|
3
|
+
import { escape } from "./RegExp.ts";
|
|
4
|
+
import { toString } from "./Types.ts";
|
|
5
|
+
import { Exception } from "./Util.ts";
|
|
5
6
|
|
|
6
7
|
const fsFormatRegExp = /(^|[^%])%([0+\- ]*)(\*|\d+)?(?:\.(\d+))?(\w)/g;
|
|
7
8
|
const interpolateRegExp = /(?:(^|[^%])%([0+\- ]*)(\d+)?(?:\.(\d+))?(\w))?%P\(\)/g;
|
|
@@ -11,14 +12,16 @@ function isLessThan(x: Numeric, y: number) {
|
|
|
11
12
|
return numericCompare(x, y) < 0;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
const
|
|
15
|
-
CurrentCulture
|
|
16
|
-
CurrentCultureIgnoreCase
|
|
17
|
-
InvariantCulture
|
|
18
|
-
InvariantCultureIgnoreCase
|
|
19
|
-
Ordinal
|
|
20
|
-
OrdinalIgnoreCase
|
|
21
|
-
}
|
|
15
|
+
export const StringComparison = {
|
|
16
|
+
CurrentCulture: 0,
|
|
17
|
+
CurrentCultureIgnoreCase: 1,
|
|
18
|
+
InvariantCulture: 2,
|
|
19
|
+
InvariantCultureIgnoreCase: 3,
|
|
20
|
+
Ordinal: 4,
|
|
21
|
+
OrdinalIgnoreCase: 5,
|
|
22
|
+
} as const;
|
|
23
|
+
|
|
24
|
+
export type StringComparison = typeof StringComparison[keyof typeof StringComparison];
|
|
22
25
|
|
|
23
26
|
function cmp(x: string, y: string, ic: boolean | StringComparison) {
|
|
24
27
|
function isIgnoreCase(i: boolean | StringComparison) {
|
|
@@ -48,10 +51,10 @@ export function compare(...args: any[]): number {
|
|
|
48
51
|
case 2: return cmp(args[0], args[1], false);
|
|
49
52
|
case 3: return cmp(args[0], args[1], args[2]);
|
|
50
53
|
case 4: return cmp(args[0], args[1], args[2] === true);
|
|
51
|
-
case 5: return cmp(args[0].
|
|
52
|
-
case 6: return cmp(args[0].
|
|
53
|
-
case 7: return cmp(args[0].
|
|
54
|
-
default: throw new
|
|
54
|
+
case 5: return cmp(args[0].slice(args[1], args[1] + args[4]), args[2].slice(args[3], args[3] + args[4]), false);
|
|
55
|
+
case 6: return cmp(args[0].slice(args[1], args[1] + args[4]), args[2].slice(args[3], args[3] + args[4]), args[5]);
|
|
56
|
+
case 7: return cmp(args[0].slice(args[1], args[1] + args[4]), args[2].slice(args[3], args[3] + args[4]), args[5] === true);
|
|
57
|
+
default: throw new Exception("String.compare: Unsupported number of parameters");
|
|
55
58
|
}
|
|
56
59
|
}
|
|
57
60
|
|
|
@@ -68,7 +71,7 @@ export function startsWith(str: string, pattern: string, ic: boolean | StringCom
|
|
|
68
71
|
return str.startsWith(pattern);
|
|
69
72
|
}
|
|
70
73
|
if (str.length >= pattern.length) {
|
|
71
|
-
return cmp(str.
|
|
74
|
+
return cmp(str.slice(0, pattern.length), pattern, ic) === 0;
|
|
72
75
|
}
|
|
73
76
|
return false;
|
|
74
77
|
}
|
|
@@ -78,7 +81,7 @@ export function endsWith(str: string, pattern: string, ic: boolean | StringCompa
|
|
|
78
81
|
return str.endsWith(pattern);
|
|
79
82
|
}
|
|
80
83
|
if (str.length >= pattern.length) {
|
|
81
|
-
return cmp(str.
|
|
84
|
+
return cmp(str.slice(-pattern.length), pattern, ic) === 0;
|
|
82
85
|
}
|
|
83
86
|
return false;
|
|
84
87
|
}
|
|
@@ -89,14 +92,14 @@ export function indexOfAny(str: string, anyOf: string[], ...args: number[]) {
|
|
|
89
92
|
}
|
|
90
93
|
const startIndex = (args.length > 0) ? args[0] : 0;
|
|
91
94
|
if (startIndex < 0) {
|
|
92
|
-
throw new
|
|
95
|
+
throw new Exception("Start index cannot be negative");
|
|
93
96
|
}
|
|
94
97
|
const length = (args.length > 1) ? args[1] : str.length - startIndex;
|
|
95
98
|
if (length < 0) {
|
|
96
|
-
throw new
|
|
99
|
+
throw new Exception("Length cannot be negative");
|
|
97
100
|
}
|
|
98
101
|
if (startIndex + length > str.length) {
|
|
99
|
-
throw new
|
|
102
|
+
throw new Exception("Invalid startIndex and length");
|
|
100
103
|
}
|
|
101
104
|
const endIndex = startIndex + length
|
|
102
105
|
const anyOfAsStr = "".concat.apply("", anyOf);
|
|
@@ -166,7 +169,7 @@ export function toText(arg: IPrintfFormat | string) {
|
|
|
166
169
|
|
|
167
170
|
export function toFail(arg: IPrintfFormat | string) {
|
|
168
171
|
return continuePrint((x: string) => {
|
|
169
|
-
throw new
|
|
172
|
+
throw new Exception(x);
|
|
170
173
|
}, arg);
|
|
171
174
|
}
|
|
172
175
|
|
|
@@ -246,7 +249,7 @@ function createPrinter(cont: (...args: any[]) => any, _strParts: string[], _matc
|
|
|
246
249
|
}
|
|
247
250
|
else if (padLength === "*") {
|
|
248
251
|
if (arg < 0) {
|
|
249
|
-
throw new
|
|
252
|
+
throw new Exception("Non-negative number required");
|
|
250
253
|
}
|
|
251
254
|
padArg = arg;
|
|
252
255
|
continue;
|
|
@@ -320,7 +323,7 @@ export function format(str: string | object, ...args: any[]) {
|
|
|
320
323
|
|
|
321
324
|
return str2.replace(formatRegExp, (_, idx: number, padLength, format, precision, pattern) => {
|
|
322
325
|
if (idx < 0 || idx >= args.length) {
|
|
323
|
-
throw new
|
|
326
|
+
throw new Exception("Index must be greater or equal to zero and less than the arguments' length.")
|
|
324
327
|
}
|
|
325
328
|
let rep = args[idx];
|
|
326
329
|
let parts;
|
|
@@ -329,7 +332,7 @@ export function format(str: string | object, ...args: any[]) {
|
|
|
329
332
|
switch (format) {
|
|
330
333
|
case "b": case "B":
|
|
331
334
|
if (!isIntegral(rep)) {
|
|
332
|
-
throw new
|
|
335
|
+
throw new Exception("Format specifier was invalid.");
|
|
333
336
|
}
|
|
334
337
|
rep = (rep >>> 0).toString(2).replace(/^0+/, "").padStart(precision || 1, "0");
|
|
335
338
|
break;
|
|
@@ -348,7 +351,7 @@ export function format(str: string | object, ...args: any[]) {
|
|
|
348
351
|
break;
|
|
349
352
|
case "d": case "D":
|
|
350
353
|
if (!isIntegral(rep)) {
|
|
351
|
-
throw new
|
|
354
|
+
throw new Exception("Format specifier was invalid.");
|
|
352
355
|
}
|
|
353
356
|
rep = String(rep);
|
|
354
357
|
if (precision != null) {
|
|
@@ -388,10 +391,10 @@ export function format(str: string | object, ...args: any[]) {
|
|
|
388
391
|
rep = thousandSeparate(parts.integral) + "." + padRight(parts.decimal, precision, "0") + " %";
|
|
389
392
|
break;
|
|
390
393
|
case "r": case "R":
|
|
391
|
-
throw new
|
|
394
|
+
throw new Exception("The round-trip format is not supported by Fable");
|
|
392
395
|
case "x": case "X":
|
|
393
396
|
if (!isIntegral(rep)) {
|
|
394
|
-
throw new
|
|
397
|
+
throw new Exception("Format specifier was invalid.");
|
|
395
398
|
}
|
|
396
399
|
precision = precision != null ? precision : 2;
|
|
397
400
|
rep = padLeft(toHex(rep), precision, "0");
|
|
@@ -403,7 +406,7 @@ export function format(str: string | object, ...args: any[]) {
|
|
|
403
406
|
// If we have format and were not able to handle it throw
|
|
404
407
|
// See: https://learn.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings#standard-format-specifiers
|
|
405
408
|
if (format) {
|
|
406
|
-
throw new
|
|
409
|
+
throw new Exception("Format specifier was invalid.");
|
|
407
410
|
}
|
|
408
411
|
|
|
409
412
|
if (pattern) {
|
|
@@ -461,7 +464,7 @@ export function format(str: string | object, ...args: any[]) {
|
|
|
461
464
|
|
|
462
465
|
export function initialize(n: number, f: (i: number) => string) {
|
|
463
466
|
if (n < 0) {
|
|
464
|
-
throw new
|
|
467
|
+
throw new Exception("String length must be non-negative");
|
|
465
468
|
}
|
|
466
469
|
const xs = new Array(n);
|
|
467
470
|
for (let i = 0; i < n; i++) {
|
|
@@ -472,7 +475,7 @@ export function initialize(n: number, f: (i: number) => string) {
|
|
|
472
475
|
|
|
473
476
|
export function insert(str: string, startIndex: number, value: string) {
|
|
474
477
|
if (startIndex < 0 || startIndex > str.length) {
|
|
475
|
-
throw new
|
|
478
|
+
throw new Exception("startIndex is negative or greater than the length of this instance.");
|
|
476
479
|
}
|
|
477
480
|
return str.substring(0, startIndex) + value + str.substring(startIndex);
|
|
478
481
|
}
|
|
@@ -500,13 +503,13 @@ export function join<T>(delimiter: string, xs: Iterable<T>): string {
|
|
|
500
503
|
export function joinWithIndices(delimiter: string, xs: string[], startIndex: number, count: number) {
|
|
501
504
|
const endIndexPlusOne = startIndex + count;
|
|
502
505
|
if (endIndexPlusOne > xs.length) {
|
|
503
|
-
throw new
|
|
506
|
+
throw new Exception("Index and count must refer to a location within the buffer.");
|
|
504
507
|
}
|
|
505
508
|
return xs.slice(startIndex, endIndexPlusOne).join(delimiter);
|
|
506
509
|
}
|
|
507
510
|
|
|
508
511
|
function notSupported(name: string): never {
|
|
509
|
-
throw new
|
|
512
|
+
throw new Exception("The environment doesn't support '" + name + "', please use a polyfill.");
|
|
510
513
|
}
|
|
511
514
|
|
|
512
515
|
export function toBase64String(inArray: ArrayLike<number>) {
|
|
@@ -545,10 +548,10 @@ export function padRight(str: string, len: number, ch?: string) {
|
|
|
545
548
|
|
|
546
549
|
export function remove(str: string, startIndex: number, count?: number) {
|
|
547
550
|
if (startIndex >= str.length) {
|
|
548
|
-
throw new
|
|
551
|
+
throw new Exception("startIndex must be less than length of string");
|
|
549
552
|
}
|
|
550
553
|
if (typeof count === "number" && (startIndex + count) > str.length) {
|
|
551
|
-
throw new
|
|
554
|
+
throw new Exception("Index and count must refer to a location within the string.");
|
|
552
555
|
}
|
|
553
556
|
return str.slice(0, startIndex) + (typeof count === "number" ? str.substr(startIndex + count) : "");
|
|
554
557
|
}
|
|
@@ -563,7 +566,7 @@ export function replicate(n: number, x: string) {
|
|
|
563
566
|
|
|
564
567
|
export function getCharAtIndex(input: string, index: number) {
|
|
565
568
|
if (index < 0 || index >= input.length) {
|
|
566
|
-
throw new
|
|
569
|
+
throw new Exception("Index was outside the bounds of the array.");
|
|
567
570
|
}
|
|
568
571
|
return input[index];
|
|
569
572
|
}
|
|
@@ -572,7 +575,7 @@ export function split(str: string, splitters: string[], count?: number, options?
|
|
|
572
575
|
count = typeof count === "number" ? count : undefined;
|
|
573
576
|
options = typeof options === "number" ? options : 0;
|
|
574
577
|
if (count && count < 0) {
|
|
575
|
-
throw new
|
|
578
|
+
throw new Exception("Count cannot be less than zero");
|
|
576
579
|
}
|
|
577
580
|
if (count === 0) {
|
|
578
581
|
return [];
|
|
@@ -643,7 +646,7 @@ export function filter(pred: (char: string) => boolean, x: string) {
|
|
|
643
646
|
|
|
644
647
|
export function substring(str: string, startIndex: number, length?: number) {
|
|
645
648
|
if ((startIndex + (length || 0) > str.length)) {
|
|
646
|
-
throw new
|
|
649
|
+
throw new Exception("Invalid startIndex and/or length");
|
|
647
650
|
}
|
|
648
651
|
return length != null ? str.substr(startIndex, length) : str.substr(startIndex);
|
|
649
652
|
}
|
|
@@ -1,18 +1,38 @@
|
|
|
1
1
|
|
|
2
|
-
import { IDisposable, disposeSafe, defaultOf, toIterator, IEnumerator, getEnumerator, structuralHash, equals as equals_1, IEqualityComparer, compare, IComparer,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
2
|
+
import { IDisposable, disposeSafe, defaultOf, MutableArray, toIterator, IEnumerator, getEnumerator, structuralHash, equals as equals_1, IEqualityComparer, compare, IComparer, Exception } from "./Util.ts";
|
|
3
|
+
import { class_type, TypeInfo } from "./Reflection.ts";
|
|
4
|
+
import { SR_Arg_KeyNotFound } from "./Global.ts";
|
|
5
|
+
import { int32 } from "./Int32.ts";
|
|
6
|
+
import { toArray, empty, singleton, append, enumerateWhile, delay } from "./Seq.ts";
|
|
7
|
+
import { setItem, initialize, copyTo, fill, item as item_1 } from "./Array.ts";
|
|
8
|
+
import { max } from "./Double.ts";
|
|
9
|
+
import { FSharpRef } from "./Types.ts";
|
|
10
|
+
import { ArgumentOutOfRangeException_$ctor_Z721C83C5 } from "./System.ts";
|
|
11
|
+
|
|
12
|
+
export class KeyNotFoundException extends Exception {
|
|
13
|
+
constructor(message: string) {
|
|
14
|
+
super(message);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function KeyNotFoundException_$reflection(): TypeInfo {
|
|
19
|
+
return class_type("System.Collections.Generic.KeyNotFoundException", undefined, KeyNotFoundException, class_type("System.Exception"));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function KeyNotFoundException_$ctor_Z721C83C5(message: string): KeyNotFoundException {
|
|
23
|
+
return new KeyNotFoundException(message);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function KeyNotFoundException_$ctor(): KeyNotFoundException {
|
|
27
|
+
return KeyNotFoundException_$ctor_Z721C83C5(SR_Arg_KeyNotFound);
|
|
28
|
+
}
|
|
9
29
|
|
|
10
30
|
export class Comparer$1<T> implements IComparer<T> {
|
|
11
31
|
readonly comparison: ((arg0: T, arg1: T) => int32);
|
|
12
32
|
constructor(comparison: ((arg0: T, arg1: T) => int32)) {
|
|
13
33
|
this.comparison = comparison;
|
|
14
34
|
}
|
|
15
|
-
Compare(x:
|
|
35
|
+
Compare(x: T, y: T): int32 {
|
|
16
36
|
const _: Comparer$1<T> = this;
|
|
17
37
|
return ((x == null) ? ((y == null) ? 0 : -1) : ((y == null) ? 1 : _.comparison(x, y))) | 0;
|
|
18
38
|
}
|
|
@@ -45,7 +65,7 @@ export class EqualityComparer$1<T> implements IEqualityComparer<T> {
|
|
|
45
65
|
this.equals = equals;
|
|
46
66
|
this.getHashCode = getHashCode;
|
|
47
67
|
}
|
|
48
|
-
Equals(x:
|
|
68
|
+
Equals(x: T, y: T): boolean {
|
|
49
69
|
const _: EqualityComparer$1<T> = this;
|
|
50
70
|
return (x == null) ? (y == null) : ((y == null) ? false : _.equals(x, y));
|
|
51
71
|
}
|
|
@@ -80,9 +100,9 @@ export function EqualityComparer$1__GetHashCode_2B595<T>(_: EqualityComparer$1<T
|
|
|
80
100
|
}
|
|
81
101
|
|
|
82
102
|
export class Stack$1<T> implements Iterable<T> {
|
|
83
|
-
contents: T
|
|
103
|
+
contents: MutableArray<T>;
|
|
84
104
|
count: int32;
|
|
85
|
-
constructor(initialContents: T
|
|
105
|
+
constructor(initialContents: MutableArray<T>, initialCount: int32) {
|
|
86
106
|
this.contents = initialContents;
|
|
87
107
|
this.count = (initialCount | 0);
|
|
88
108
|
}
|
|
@@ -109,7 +129,7 @@ export function Stack$1_$reflection(gen0: TypeInfo): TypeInfo {
|
|
|
109
129
|
return class_type("System.Collections.Generic.Stack`1", [gen0], Stack$1);
|
|
110
130
|
}
|
|
111
131
|
|
|
112
|
-
function Stack$1_$ctor_Z3B4C077E<T>(initialContents: T
|
|
132
|
+
function Stack$1_$ctor_Z3B4C077E<T>(initialContents: MutableArray<T>, initialCount: int32): Stack$1<T> {
|
|
113
133
|
return new Stack$1(initialContents, initialCount);
|
|
114
134
|
}
|
|
115
135
|
|
|
@@ -122,14 +142,14 @@ export function Stack$1_$ctor<T>(): Stack$1<T> {
|
|
|
122
142
|
}
|
|
123
143
|
|
|
124
144
|
export function Stack$1_$ctor_BB573A<T>(xs: Iterable<T>): Stack$1<T> {
|
|
125
|
-
const arr: T
|
|
145
|
+
const arr: MutableArray<T> = Array.from(xs);
|
|
126
146
|
return Stack$1_$ctor_Z3B4C077E<T>(arr, arr.length);
|
|
127
147
|
}
|
|
128
148
|
|
|
129
149
|
export function Stack$1__Ensure_Z524259A4<T>(_: Stack$1<T>, newSize: int32): void {
|
|
130
150
|
const oldSize: int32 = _.contents.length | 0;
|
|
131
151
|
if (newSize > oldSize) {
|
|
132
|
-
const old: T
|
|
152
|
+
const old: MutableArray<T> = _.contents;
|
|
133
153
|
_.contents = fill(new Array(max(newSize, oldSize * 2)), 0, max(newSize, oldSize * 2), null);
|
|
134
154
|
copyTo<T>(old, 0, _.contents, 0, _.count);
|
|
135
155
|
}
|
|
@@ -199,16 +219,16 @@ export function Stack$1__TrimExcess<T>(this$: Stack$1<T>): void {
|
|
|
199
219
|
}
|
|
200
220
|
}
|
|
201
221
|
|
|
202
|
-
export function Stack$1__ToArray<T>(_: Stack$1<T>): T
|
|
222
|
+
export function Stack$1__ToArray<T>(_: Stack$1<T>): MutableArray<T> {
|
|
203
223
|
return initialize<T>(_.count, (i: int32): T => item_1((_.count - 1) - i, _.contents));
|
|
204
224
|
}
|
|
205
225
|
|
|
206
226
|
export class Queue$1<T> implements Iterable<T> {
|
|
207
|
-
contents: T
|
|
227
|
+
contents: MutableArray<T>;
|
|
208
228
|
count: int32;
|
|
209
229
|
head: int32;
|
|
210
230
|
tail: int32;
|
|
211
|
-
constructor(initialContents: T
|
|
231
|
+
constructor(initialContents: MutableArray<T>, initialCount: int32) {
|
|
212
232
|
this.contents = initialContents;
|
|
213
233
|
this.count = (initialCount | 0);
|
|
214
234
|
this.head = 0;
|
|
@@ -231,13 +251,13 @@ export function Queue$1_$reflection(gen0: TypeInfo): TypeInfo {
|
|
|
231
251
|
return class_type("System.Collections.Generic.Queue`1", [gen0], Queue$1);
|
|
232
252
|
}
|
|
233
253
|
|
|
234
|
-
function Queue$1_$ctor_Z3B4C077E<T>(initialContents: T
|
|
254
|
+
function Queue$1_$ctor_Z3B4C077E<T>(initialContents: MutableArray<T>, initialCount: int32): Queue$1<T> {
|
|
235
255
|
return new Queue$1(initialContents, initialCount);
|
|
236
256
|
}
|
|
237
257
|
|
|
238
258
|
export function Queue$1_$ctor_Z524259A4<T>(initialCapacity: int32): Queue$1<T> {
|
|
239
259
|
if (initialCapacity < 0) {
|
|
240
|
-
throw
|
|
260
|
+
throw ArgumentOutOfRangeException_$ctor_Z721C83C5("capacity is less than 0");
|
|
241
261
|
}
|
|
242
262
|
return Queue$1_$ctor_Z3B4C077E<T>(fill(new Array(initialCapacity), 0, initialCapacity, null), 0);
|
|
243
263
|
}
|
|
@@ -247,7 +267,7 @@ export function Queue$1_$ctor<T>(): Queue$1<T> {
|
|
|
247
267
|
}
|
|
248
268
|
|
|
249
269
|
export function Queue$1_$ctor_BB573A<T>(xs: Iterable<T>): Queue$1<T> {
|
|
250
|
-
const arr: T
|
|
270
|
+
const arr: MutableArray<T> = Array.from(xs);
|
|
251
271
|
return Queue$1_$ctor_Z3B4C077E<T>(arr, arr.length);
|
|
252
272
|
}
|
|
253
273
|
|
|
@@ -266,7 +286,7 @@ export function Queue$1__Enqueue_2B595<T>(_: Queue$1<T>, value: T): void {
|
|
|
266
286
|
|
|
267
287
|
export function Queue$1__Dequeue<T>(_: Queue$1<T>): T {
|
|
268
288
|
if (_.count === 0) {
|
|
269
|
-
throw new
|
|
289
|
+
throw new Exception("Queue is empty");
|
|
270
290
|
}
|
|
271
291
|
const value: T = item_1(_.head, _.contents);
|
|
272
292
|
_.head = (((_.head + 1) % Queue$1__size<T>(_)) | 0);
|
|
@@ -276,7 +296,7 @@ export function Queue$1__Dequeue<T>(_: Queue$1<T>): T {
|
|
|
276
296
|
|
|
277
297
|
export function Queue$1__Peek<T>(_: Queue$1<T>): T {
|
|
278
298
|
if (_.count === 0) {
|
|
279
|
-
throw new
|
|
299
|
+
throw new Exception("Queue is empty");
|
|
280
300
|
}
|
|
281
301
|
return item_1(_.head, _.contents);
|
|
282
302
|
}
|
|
@@ -328,11 +348,11 @@ export function Queue$1__TrimExcess<T>(_: Queue$1<T>): void {
|
|
|
328
348
|
}
|
|
329
349
|
}
|
|
330
350
|
|
|
331
|
-
export function Queue$1__ToArray<T>(_: Queue$1<T>): T
|
|
351
|
+
export function Queue$1__ToArray<T>(_: Queue$1<T>): MutableArray<T> {
|
|
332
352
|
return toArray<T>(Queue$1__toSeq<T>(_));
|
|
333
353
|
}
|
|
334
354
|
|
|
335
|
-
export function Queue$1__CopyTo_Z3B4C077E<T>(_: Queue$1<T>, target: T
|
|
355
|
+
export function Queue$1__CopyTo_Z3B4C077E<T>(_: Queue$1<T>, target: MutableArray<T>, start: int32): void {
|
|
336
356
|
let i: int32 = start;
|
|
337
357
|
const enumerator: IEnumerator<T> = getEnumerator(Queue$1__toSeq<T>(_));
|
|
338
358
|
try {
|
|
@@ -356,7 +376,7 @@ export function Queue$1__toIndex_Z524259A4<T>(this$: Queue$1<T>, i: int32): int3
|
|
|
356
376
|
}
|
|
357
377
|
|
|
358
378
|
export function Queue$1__ensure_Z524259A4<T>(this$: Queue$1<T>, requiredSize: int32): void {
|
|
359
|
-
const newBuffer: T
|
|
379
|
+
const newBuffer: MutableArray<T> = fill(new Array(requiredSize), 0, requiredSize, null);
|
|
360
380
|
if (this$.head < this$.tail) {
|
|
361
381
|
copyTo<T>(this$.contents, this$.head, newBuffer, 0, this$.count);
|
|
362
382
|
}
|
package/System.Text.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
import { replace, format, replicate, substring, isNullOrEmpty, join } from "./String.
|
|
3
|
-
import { float64, int32 } from "./Int32.
|
|
4
|
-
import { class_type, TypeInfo } from "./Reflection.
|
|
5
|
-
import { toString } from "./Types.
|
|
6
|
-
import { clear,
|
|
2
|
+
import { replace, format, replicate, substring, isNullOrEmpty, join } from "./String.ts";
|
|
3
|
+
import { float64, int32 } from "./Int32.ts";
|
|
4
|
+
import { class_type, TypeInfo } from "./Reflection.ts";
|
|
5
|
+
import { toString } from "./Types.ts";
|
|
6
|
+
import { Exception, clear, MutableArray, int32ToString } from "./Util.ts";
|
|
7
7
|
|
|
8
8
|
export class StringBuilder {
|
|
9
9
|
readonly buf: string[];
|
|
@@ -39,12 +39,12 @@ export function StringBuilder_$ctor(): StringBuilder {
|
|
|
39
39
|
return StringBuilder_$ctor_Z18115A39("", 16);
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
export function StringBuilder__Append_Z721C83C5(x: StringBuilder, s:
|
|
42
|
+
export function StringBuilder__Append_Z721C83C5(x: StringBuilder, s: string): StringBuilder {
|
|
43
43
|
void (x.buf.push(toString(s)));
|
|
44
44
|
return x;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
export function StringBuilder__Append_487EF8FB(x: StringBuilder, s:
|
|
47
|
+
export function StringBuilder__Append_487EF8FB(x: StringBuilder, s: string, startIndex: int32, count: int32): StringBuilder {
|
|
48
48
|
void (x.buf.push(substring(toString(s), startIndex, count)));
|
|
49
49
|
return x;
|
|
50
50
|
}
|
|
@@ -80,7 +80,7 @@ export function StringBuilder__Append_4E60E31B(x: StringBuilder, o: any): String
|
|
|
80
80
|
return x;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
export function StringBuilder__Append_Z372E4D23(x: StringBuilder, cs: string
|
|
83
|
+
export function StringBuilder__Append_Z372E4D23(x: StringBuilder, cs: MutableArray<string>): StringBuilder {
|
|
84
84
|
void (x.buf.push(cs.join('')));
|
|
85
85
|
return x;
|
|
86
86
|
}
|
|
@@ -105,7 +105,7 @@ export function StringBuilder__AppendFormat_10D165E0(x: StringBuilder, fmt: stri
|
|
|
105
105
|
return x;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
export function StringBuilder__AppendFormat_Z17053F5(x: StringBuilder, fmt: string, arr: any
|
|
108
|
+
export function StringBuilder__AppendFormat_Z17053F5(x: StringBuilder, fmt: string, arr: MutableArray<any>): StringBuilder {
|
|
109
109
|
void (x.buf.push(format(fmt, ...arr)));
|
|
110
110
|
return x;
|
|
111
111
|
}
|
|
@@ -125,7 +125,7 @@ export function StringBuilder__AppendFormat_Z471ADCBB(x: StringBuilder, provider
|
|
|
125
125
|
return x;
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
export function StringBuilder__AppendFormat_6C2E3E6E(x: StringBuilder, provider: any, fmt: string, arr: any
|
|
128
|
+
export function StringBuilder__AppendFormat_6C2E3E6E(x: StringBuilder, provider: any, fmt: string, arr: MutableArray<any>): StringBuilder {
|
|
129
129
|
void (x.buf.push(format(provider, fmt, ...arr)));
|
|
130
130
|
return x;
|
|
131
131
|
}
|
|
@@ -154,7 +154,7 @@ export function StringBuilder__get_Chars_Z524259A4(x: StringBuilder, index: int3
|
|
|
154
154
|
len = ((len + x.buf[i].length) | 0);
|
|
155
155
|
}
|
|
156
156
|
if (((index < 0) ? true : (i < 0)) ? true : (i >= x.buf.length)) {
|
|
157
|
-
throw new
|
|
157
|
+
throw new Exception("Index was outside the bounds of the array");
|
|
158
158
|
}
|
|
159
159
|
else {
|
|
160
160
|
const pos: int32 = ((len - index) - 1) | 0;
|
|
@@ -170,7 +170,7 @@ export function StringBuilder__set_Chars_413E0D0A(x: StringBuilder, index: int32
|
|
|
170
170
|
len = ((len + x.buf[i].length) | 0);
|
|
171
171
|
}
|
|
172
172
|
if (((index < 0) ? true : (i < 0)) ? true : (i >= x.buf.length)) {
|
|
173
|
-
throw new
|
|
173
|
+
throw new Exception("Index was outside the bounds of the array");
|
|
174
174
|
}
|
|
175
175
|
else {
|
|
176
176
|
const pos: int32 = ((len - index) - 1) | 0;
|