@fable-org/fable-library-ts 1.0.0 → 1.2.0
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 +101 -86
- package/CHANGELOG.md +18 -0
- package/Date.ts +354 -25
- package/List.ts +3 -3
- package/Map.ts +3 -3
- package/MutableMap.ts +2 -1
- package/MutableSet.ts +2 -1
- package/Random.ts +7 -7
- package/Set.ts +2 -2
- package/String.ts +4 -0
- package/System.Collections.Generic.ts +11 -11
- package/System.Text.ts +69 -9
- package/Util.ts +2 -13
- package/package.json +1 -1
package/System.Text.ts
CHANGED
|
@@ -88,11 +88,41 @@ export function StringBuilder__AppendFormat_433E080(x: StringBuilder, fmt: strin
|
|
|
88
88
|
return x;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
export function StringBuilder__AppendFormat_Z3B30EC65(x: StringBuilder, fmt: string, o1: any, o2: any): StringBuilder {
|
|
92
|
+
void (x.buf.push(format(fmt, o1, o2)));
|
|
93
|
+
return x;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function StringBuilder__AppendFormat_10D165E0(x: StringBuilder, fmt: string, o1: any, o2: any, o3: any): StringBuilder {
|
|
97
|
+
void (x.buf.push(format(fmt, o1, o2, o3)));
|
|
98
|
+
return x;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function StringBuilder__AppendFormat_Z17053F5(x: StringBuilder, fmt: string, arr: any[]): StringBuilder {
|
|
102
|
+
void (x.buf.push(format(fmt, ...arr)));
|
|
103
|
+
return x;
|
|
104
|
+
}
|
|
105
|
+
|
|
91
106
|
export function StringBuilder__AppendFormat_Z696D8D1B(x: StringBuilder, provider: any, fmt: string, o: any): StringBuilder {
|
|
92
107
|
void (x.buf.push(format(provider, fmt, o)));
|
|
93
108
|
return x;
|
|
94
109
|
}
|
|
95
110
|
|
|
111
|
+
export function StringBuilder__AppendFormat_26802C9E(x: StringBuilder, provider: any, fmt: string, o1: any, o2: any): StringBuilder {
|
|
112
|
+
void (x.buf.push(format(provider, fmt, o1, o2)));
|
|
113
|
+
return x;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function StringBuilder__AppendFormat_Z471ADCBB(x: StringBuilder, provider: any, fmt: string, o1: any, o2: any, o3: any): StringBuilder {
|
|
117
|
+
void (x.buf.push(format(provider, fmt, o1, o2, o3)));
|
|
118
|
+
return x;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export function StringBuilder__AppendFormat_6C2E3E6E(x: StringBuilder, provider: any, fmt: string, arr: any[]): StringBuilder {
|
|
122
|
+
void (x.buf.push(format(provider, fmt, ...arr)));
|
|
123
|
+
return x;
|
|
124
|
+
}
|
|
125
|
+
|
|
96
126
|
export function StringBuilder__AppendLine(x: StringBuilder): StringBuilder {
|
|
97
127
|
void (x.buf.push("\n"));
|
|
98
128
|
return x;
|
|
@@ -104,6 +134,43 @@ export function StringBuilder__AppendLine_Z721C83C5(x: StringBuilder, s: string)
|
|
|
104
134
|
return x;
|
|
105
135
|
}
|
|
106
136
|
|
|
137
|
+
export function StringBuilder__Clear(x: StringBuilder): StringBuilder {
|
|
138
|
+
clear(x.buf);
|
|
139
|
+
return x;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export function StringBuilder__get_Chars_Z524259A4(x: StringBuilder, index: int32): string {
|
|
143
|
+
let len = 0;
|
|
144
|
+
let i = -1;
|
|
145
|
+
while (((i + 1) < x.buf.length) && (len < index)) {
|
|
146
|
+
i = ((i + 1) | 0);
|
|
147
|
+
len = ((len + x.buf[i].length) | 0);
|
|
148
|
+
}
|
|
149
|
+
if (((index < 0) ? true : (i < 0)) ? true : (i >= x.buf.length)) {
|
|
150
|
+
throw new Error("Index was outside the bounds of the array");
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
const pos: int32 = ((len - index) - 1) | 0;
|
|
154
|
+
return x.buf[i][pos];
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export function StringBuilder__set_Chars_413E0D0A(x: StringBuilder, index: int32, value: string): void {
|
|
159
|
+
let len = 0;
|
|
160
|
+
let i = -1;
|
|
161
|
+
while (((i + 1) < x.buf.length) && (len < index)) {
|
|
162
|
+
i = ((i + 1) | 0);
|
|
163
|
+
len = ((len + x.buf[i].length) | 0);
|
|
164
|
+
}
|
|
165
|
+
if (((index < 0) ? true : (i < 0)) ? true : (i >= x.buf.length)) {
|
|
166
|
+
throw new Error("Index was outside the bounds of the array");
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
const pos: int32 = ((len - index) - 1) | 0;
|
|
170
|
+
x.buf[i] = ((x.buf[i].slice(0, (pos - 1) + 1) + value) + x.buf[i].slice(pos + 1, x.buf[i].length));
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
107
174
|
export function StringBuilder__Replace_Z766F94C0(x: StringBuilder, oldValue: string, newValue: string): StringBuilder {
|
|
108
175
|
for (let i: int32 = x.buf.length - 1; i >= 0; i--) {
|
|
109
176
|
x.buf[i] = replace(x.buf[i], oldValue, newValue);
|
|
@@ -112,10 +179,8 @@ export function StringBuilder__Replace_Z766F94C0(x: StringBuilder, oldValue: str
|
|
|
112
179
|
}
|
|
113
180
|
|
|
114
181
|
export function StringBuilder__Replace_Z384F8060(x: StringBuilder, oldValue: string, newValue: string): StringBuilder {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
return x;
|
|
182
|
+
const str: string = replace(toString(x), oldValue, newValue);
|
|
183
|
+
return StringBuilder__Append_Z721C83C5(StringBuilder__Clear(x), str);
|
|
119
184
|
}
|
|
120
185
|
|
|
121
186
|
export function StringBuilder__get_Length(x: StringBuilder): int32 {
|
|
@@ -130,8 +195,3 @@ export function StringBuilder__ToString_Z37302880(x: StringBuilder, firstIndex:
|
|
|
130
195
|
return substring(toString(x), firstIndex, length);
|
|
131
196
|
}
|
|
132
197
|
|
|
133
|
-
export function StringBuilder__Clear(x: StringBuilder): StringBuilder {
|
|
134
|
-
clear(x.buf);
|
|
135
|
-
return x;
|
|
136
|
-
}
|
|
137
|
-
|
package/Util.ts
CHANGED
|
@@ -270,22 +270,11 @@ export function lazyFromValue<T>(v: T) {
|
|
|
270
270
|
}
|
|
271
271
|
|
|
272
272
|
export function padWithZeros(i: number, length: number) {
|
|
273
|
-
|
|
274
|
-
while (str.length < length) {
|
|
275
|
-
str = "0" + str;
|
|
276
|
-
}
|
|
277
|
-
return str;
|
|
273
|
+
return i.toString(10).padStart(length, "0");
|
|
278
274
|
}
|
|
279
275
|
|
|
280
276
|
export function padLeftAndRightWithZeros(i: number, lengthLeft: number, lengthRight: number) {
|
|
281
|
-
|
|
282
|
-
while (str.length < lengthLeft) {
|
|
283
|
-
str = "0" + str;
|
|
284
|
-
}
|
|
285
|
-
while (str.length < lengthRight) {
|
|
286
|
-
str = str + "0";
|
|
287
|
-
}
|
|
288
|
-
return str;
|
|
277
|
+
return i.toString(10).padStart(lengthLeft, "0").padEnd(lengthRight, "0");
|
|
289
278
|
}
|
|
290
279
|
|
|
291
280
|
export function dateOffset(date: IDateTime | IDateTimeOffset): number {
|
package/package.json
CHANGED