@fable-org/fable-library-js 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.d.ts +2 -1
- package/Array.js +99 -85
- package/CHANGELOG.md +18 -0
- package/Date.js +336 -39
- package/List.js +3 -3
- package/Map.js +3 -3
- package/MutableMap.js +2 -1
- package/MutableSet.js +2 -1
- package/Random.js +7 -7
- package/Set.js +2 -2
- package/String.d.ts +1 -0
- package/String.js +3 -0
- package/System.Collections.Generic.js +11 -11
- package/System.Text.d.ts +9 -1
- package/System.Text.js +60 -8
- package/Util.js +2 -13
- package/package.json +1 -1
package/System.Text.js
CHANGED
|
@@ -69,10 +69,34 @@ export function StringBuilder__AppendFormat_433E080(x, fmt, o) {
|
|
|
69
69
|
void (x.buf.push(format(fmt, o)));
|
|
70
70
|
return x;
|
|
71
71
|
}
|
|
72
|
+
export function StringBuilder__AppendFormat_Z3B30EC65(x, fmt, o1, o2) {
|
|
73
|
+
void (x.buf.push(format(fmt, o1, o2)));
|
|
74
|
+
return x;
|
|
75
|
+
}
|
|
76
|
+
export function StringBuilder__AppendFormat_10D165E0(x, fmt, o1, o2, o3) {
|
|
77
|
+
void (x.buf.push(format(fmt, o1, o2, o3)));
|
|
78
|
+
return x;
|
|
79
|
+
}
|
|
80
|
+
export function StringBuilder__AppendFormat_Z17053F5(x, fmt, arr) {
|
|
81
|
+
void (x.buf.push(format(fmt, ...arr)));
|
|
82
|
+
return x;
|
|
83
|
+
}
|
|
72
84
|
export function StringBuilder__AppendFormat_Z696D8D1B(x, provider, fmt, o) {
|
|
73
85
|
void (x.buf.push(format(provider, fmt, o)));
|
|
74
86
|
return x;
|
|
75
87
|
}
|
|
88
|
+
export function StringBuilder__AppendFormat_26802C9E(x, provider, fmt, o1, o2) {
|
|
89
|
+
void (x.buf.push(format(provider, fmt, o1, o2)));
|
|
90
|
+
return x;
|
|
91
|
+
}
|
|
92
|
+
export function StringBuilder__AppendFormat_Z471ADCBB(x, provider, fmt, o1, o2, o3) {
|
|
93
|
+
void (x.buf.push(format(provider, fmt, o1, o2, o3)));
|
|
94
|
+
return x;
|
|
95
|
+
}
|
|
96
|
+
export function StringBuilder__AppendFormat_6C2E3E6E(x, provider, fmt, arr) {
|
|
97
|
+
void (x.buf.push(format(provider, fmt, ...arr)));
|
|
98
|
+
return x;
|
|
99
|
+
}
|
|
76
100
|
export function StringBuilder__AppendLine(x) {
|
|
77
101
|
void (x.buf.push("\n"));
|
|
78
102
|
return x;
|
|
@@ -82,6 +106,40 @@ export function StringBuilder__AppendLine_Z721C83C5(x, s) {
|
|
|
82
106
|
void (x.buf.push("\n"));
|
|
83
107
|
return x;
|
|
84
108
|
}
|
|
109
|
+
export function StringBuilder__Clear(x) {
|
|
110
|
+
clear(x.buf);
|
|
111
|
+
return x;
|
|
112
|
+
}
|
|
113
|
+
export function StringBuilder__get_Chars_Z524259A4(x, index) {
|
|
114
|
+
let len = 0;
|
|
115
|
+
let i = -1;
|
|
116
|
+
while (((i + 1) < x.buf.length) && (len < index)) {
|
|
117
|
+
i = ((i + 1) | 0);
|
|
118
|
+
len = ((len + x.buf[i].length) | 0);
|
|
119
|
+
}
|
|
120
|
+
if (((index < 0) ? true : (i < 0)) ? true : (i >= x.buf.length)) {
|
|
121
|
+
throw new Error("Index was outside the bounds of the array");
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
const pos = ((len - index) - 1) | 0;
|
|
125
|
+
return x.buf[i][pos];
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
export function StringBuilder__set_Chars_413E0D0A(x, index, value) {
|
|
129
|
+
let len = 0;
|
|
130
|
+
let i = -1;
|
|
131
|
+
while (((i + 1) < x.buf.length) && (len < index)) {
|
|
132
|
+
i = ((i + 1) | 0);
|
|
133
|
+
len = ((len + x.buf[i].length) | 0);
|
|
134
|
+
}
|
|
135
|
+
if (((index < 0) ? true : (i < 0)) ? true : (i >= x.buf.length)) {
|
|
136
|
+
throw new Error("Index was outside the bounds of the array");
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
const pos = ((len - index) - 1) | 0;
|
|
140
|
+
x.buf[i] = ((x.buf[i].slice(0, (pos - 1) + 1) + value) + x.buf[i].slice(pos + 1, x.buf[i].length));
|
|
141
|
+
}
|
|
142
|
+
}
|
|
85
143
|
export function StringBuilder__Replace_Z766F94C0(x, oldValue, newValue) {
|
|
86
144
|
for (let i = x.buf.length - 1; i >= 0; i--) {
|
|
87
145
|
x.buf[i] = replace(x.buf[i], oldValue, newValue);
|
|
@@ -89,10 +147,8 @@ export function StringBuilder__Replace_Z766F94C0(x, oldValue, newValue) {
|
|
|
89
147
|
return x;
|
|
90
148
|
}
|
|
91
149
|
export function StringBuilder__Replace_Z384F8060(x, oldValue, newValue) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
return x;
|
|
150
|
+
const str = replace(toString(x), oldValue, newValue);
|
|
151
|
+
return StringBuilder__Append_Z721C83C5(StringBuilder__Clear(x), str);
|
|
96
152
|
}
|
|
97
153
|
export function StringBuilder__get_Length(x) {
|
|
98
154
|
let len = 0;
|
|
@@ -104,7 +160,3 @@ export function StringBuilder__get_Length(x) {
|
|
|
104
160
|
export function StringBuilder__ToString_Z37302880(x, firstIndex, length) {
|
|
105
161
|
return substring(toString(x), firstIndex, length);
|
|
106
162
|
}
|
|
107
|
-
export function StringBuilder__Clear(x) {
|
|
108
|
-
clear(x.buf);
|
|
109
|
-
return x;
|
|
110
|
-
}
|
package/Util.js
CHANGED
|
@@ -159,21 +159,10 @@ export function lazyFromValue(v) {
|
|
|
159
159
|
return new Lazy(() => v);
|
|
160
160
|
}
|
|
161
161
|
export function padWithZeros(i, length) {
|
|
162
|
-
|
|
163
|
-
while (str.length < length) {
|
|
164
|
-
str = "0" + str;
|
|
165
|
-
}
|
|
166
|
-
return str;
|
|
162
|
+
return i.toString(10).padStart(length, "0");
|
|
167
163
|
}
|
|
168
164
|
export function padLeftAndRightWithZeros(i, lengthLeft, lengthRight) {
|
|
169
|
-
|
|
170
|
-
while (str.length < lengthLeft) {
|
|
171
|
-
str = "0" + str;
|
|
172
|
-
}
|
|
173
|
-
while (str.length < lengthRight) {
|
|
174
|
-
str = str + "0";
|
|
175
|
-
}
|
|
176
|
-
return str;
|
|
165
|
+
return i.toString(10).padStart(lengthLeft, "0").padEnd(lengthRight, "0");
|
|
177
166
|
}
|
|
178
167
|
export function dateOffset(date) {
|
|
179
168
|
const date1 = date;
|
package/package.json
CHANGED