@fable-org/fable-library-js 2.0.0-beta.3 → 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.js +64 -60
- package/Async.js +8 -7
- package/AsyncBuilder.js +6 -6
- package/BigInt.js +3 -3
- package/Boolean.js +2 -1
- package/CHANGELOG.md +12 -0
- package/Char.js +64 -31
- package/CollectionUtil.js +3 -3
- package/Date.js +50 -46
- package/DateOffset.js +38 -48
- package/DateOnly.js +6 -6
- package/Decimal.js +4 -4
- package/Double.js +2 -1
- package/FSharp.Collections.js +28 -10
- package/FSharp.Core.js +19 -19
- package/Global.js +21 -0
- package/Guid.js +5 -4
- package/Int32.js +17 -17
- package/List.js +74 -63
- package/Long.js +3 -2
- package/MailboxProcessor.js +2 -1
- package/Map.js +39 -42
- package/MapUtil.js +4 -4
- package/MutableMap.js +22 -10
- package/MutableSet.js +3 -3
- package/Native.js +9 -3
- package/Option.js +10 -2
- package/Random.js +13 -12
- package/Range.js +2 -2
- package/Reflection.js +16 -16
- package/RegExp.js +4 -3
- package/Seq.js +38 -46
- package/Set.js +41 -42
- package/String.js +44 -35
- package/System.Collections.Generic.js +22 -6
- package/System.Text.js +8 -8
- package/System.js +283 -0
- package/TimeOnly.js +6 -6
- package/TimeSpan.js +5 -5
- package/Types.js +1 -17
- package/Uri.js +25 -19
- package/Util.js +32 -9
- package/package.json +23 -23
- package/Array.d.ts +0 -123
- package/Async.d.ts +0 -26
- package/AsyncBuilder.d.ts +0 -59
- package/BigInt.d.ts +0 -129
- package/BitConverter.d.ts +0 -27
- package/Boolean.d.ts +0 -3
- package/Char.d.ts +0 -65
- package/Choice.d.ts +0 -121
- package/CollectionUtil.d.ts +0 -7
- package/ConditionalWeakTable.d.ts +0 -9
- package/Date.d.ts +0 -69
- package/DateOffset.d.ts +0 -64
- package/DateOnly.d.ts +0 -18
- package/Decimal.d.ts +0 -63
- package/Double.d.ts +0 -11
- package/Encoding.d.ts +0 -12
- package/Event.d.ts +0 -31
- package/FSharp.Collections.d.ts +0 -7
- package/FSharp.Core.CompilerServices.d.ts +0 -12
- package/FSharp.Core.d.ts +0 -31
- package/Global.d.ts +0 -24
- package/Guid.d.ts +0 -10
- package/Int32.d.ts +0 -28
- package/List.d.ts +0 -143
- package/Long.d.ts +0 -3
- package/MailboxProcessor.d.ts +0 -25
- package/Map.d.ts +0 -178
- package/MapUtil.d.ts +0 -12
- package/MutableMap.d.ts +0 -52
- package/MutableSet.d.ts +0 -39
- package/Native.d.ts +0 -2
- package/Numeric.d.ts +0 -20
- package/Observable.d.ts +0 -32
- package/Option.d.ts +0 -28
- package/Random.d.ts +0 -37
- package/Range.d.ts +0 -12
- package/Reflection.d.ts +0 -119
- package/RegExp.d.ts +0 -10
- package/Result.d.ts +0 -37
- package/Seq.d.ts +0 -165
- package/Seq2.d.ts +0 -18
- package/Set.d.ts +0 -190
- package/String.d.ts +0 -58
- package/System.Collections.Generic.d.ts +0 -79
- package/System.Text.d.ts +0 -39
- package/SystemException.d.ts +0 -5
- package/SystemException.js +0 -5
- package/TimeOnly.d.ts +0 -15
- package/TimeSpan.d.ts +0 -35
- package/Timer.d.ts +0 -19
- package/Types.d.ts +0 -58
- package/Unicode.13.0.0.d.ts +0 -2
- package/Uri.d.ts +0 -31
- package/Util.d.ts +0 -210
- package/lib/big.d.ts +0 -5
package/Reflection.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Record, Union } from "./Types.js";
|
|
2
|
-
import { combineHashCodes, equalArraysWith, stringHash } from "./Util.js";
|
|
2
|
+
import { Exception, combineHashCodes, equalArraysWith, stringHash } from "./Util.js";
|
|
3
3
|
import Decimal from "./Decimal.js";
|
|
4
4
|
export class CaseInfo {
|
|
5
5
|
constructor(declaringType, tag, name, fields) {
|
|
@@ -135,7 +135,7 @@ export function name(info) {
|
|
|
135
135
|
}
|
|
136
136
|
else {
|
|
137
137
|
const i = info.fullname.lastIndexOf(".");
|
|
138
|
-
return i === -1 ? info.fullname : info.fullname.
|
|
138
|
+
return i === -1 ? info.fullname : info.fullname.slice(i + 1);
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
else {
|
|
@@ -161,7 +161,7 @@ export function namespace(t) {
|
|
|
161
161
|
}
|
|
162
162
|
else {
|
|
163
163
|
const i = t.fullname.lastIndexOf(".");
|
|
164
|
-
return i === -1 ? "" : t.fullname.
|
|
164
|
+
return i === -1 ? "" : t.fullname.slice(0, i);
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
export function isArray(t) {
|
|
@@ -239,7 +239,7 @@ export function getEnumValues(t) {
|
|
|
239
239
|
return t.enumCases.map((kv) => kv[1]);
|
|
240
240
|
}
|
|
241
241
|
else {
|
|
242
|
-
throw new
|
|
242
|
+
throw new Exception(`${t.fullname} is not an enum type`);
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
export function getEnumNames(t) {
|
|
@@ -247,7 +247,7 @@ export function getEnumNames(t) {
|
|
|
247
247
|
return t.enumCases.map((kv) => kv[0]);
|
|
248
248
|
}
|
|
249
249
|
else {
|
|
250
|
-
throw new
|
|
250
|
+
throw new Exception(`${t.fullname} is not an enum type`);
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
function getEnumCase(t, v) {
|
|
@@ -258,7 +258,7 @@ function getEnumCase(t, v) {
|
|
|
258
258
|
return kv;
|
|
259
259
|
}
|
|
260
260
|
}
|
|
261
|
-
throw new
|
|
261
|
+
throw new Exception(`'${v}' was not found in ${t.fullname}`);
|
|
262
262
|
}
|
|
263
263
|
else {
|
|
264
264
|
for (const kv of t.enumCases) {
|
|
@@ -271,7 +271,7 @@ function getEnumCase(t, v) {
|
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
else {
|
|
274
|
-
throw new
|
|
274
|
+
throw new Exception(`${t.fullname} is not an enum type`);
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
export function parseEnum(t, str) {
|
|
@@ -307,7 +307,7 @@ export function getUnionCases(t) {
|
|
|
307
307
|
return t.cases();
|
|
308
308
|
}
|
|
309
309
|
else {
|
|
310
|
-
throw new
|
|
310
|
+
throw new Exception(`${t.fullname} is not an F# union type`);
|
|
311
311
|
}
|
|
312
312
|
}
|
|
313
313
|
export function getRecordElements(t) {
|
|
@@ -315,7 +315,7 @@ export function getRecordElements(t) {
|
|
|
315
315
|
return t.fields();
|
|
316
316
|
}
|
|
317
317
|
else {
|
|
318
|
-
throw new
|
|
318
|
+
throw new Exception(`${t.fullname} is not an F# record type`);
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
321
|
export function getTupleElements(t) {
|
|
@@ -323,7 +323,7 @@ export function getTupleElements(t) {
|
|
|
323
323
|
return t.generics;
|
|
324
324
|
}
|
|
325
325
|
else {
|
|
326
|
-
throw new
|
|
326
|
+
throw new Exception(`${t.fullname} is not a tuple type`);
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
329
|
export function getFunctionElements(t) {
|
|
@@ -332,7 +332,7 @@ export function getFunctionElements(t) {
|
|
|
332
332
|
return [gen[0], gen[1]];
|
|
333
333
|
}
|
|
334
334
|
else {
|
|
335
|
-
throw new
|
|
335
|
+
throw new Exception(`${t.fullname} is not an F# function type`);
|
|
336
336
|
}
|
|
337
337
|
}
|
|
338
338
|
export function isUnion(t) {
|
|
@@ -353,7 +353,7 @@ export function getUnionFields(v, t) {
|
|
|
353
353
|
const cases = getUnionCases(t);
|
|
354
354
|
const case_ = cases[v.tag];
|
|
355
355
|
if (case_ == null) {
|
|
356
|
-
throw new
|
|
356
|
+
throw new Exception(`Cannot find case ${v.name} in union type`);
|
|
357
357
|
}
|
|
358
358
|
return [case_, v.fields];
|
|
359
359
|
}
|
|
@@ -378,7 +378,7 @@ export function getTupleField(v, i) {
|
|
|
378
378
|
export function makeUnion(uci, values) {
|
|
379
379
|
const expectedLength = (uci.fields || []).length;
|
|
380
380
|
if (values.length !== expectedLength) {
|
|
381
|
-
throw new
|
|
381
|
+
throw new Exception(`Expected an array of length ${expectedLength} but got ${values.length}`);
|
|
382
382
|
}
|
|
383
383
|
const construct = uci.declaringType.construct;
|
|
384
384
|
if (construct == null) {
|
|
@@ -395,7 +395,7 @@ export function makeUnion(uci, values) {
|
|
|
395
395
|
export function makeRecord(t, values) {
|
|
396
396
|
const fields = getRecordElements(t);
|
|
397
397
|
if (fields.length !== values.length) {
|
|
398
|
-
throw new
|
|
398
|
+
throw new Exception(`Expected an array of length ${fields.length} but got ${values.length}`);
|
|
399
399
|
}
|
|
400
400
|
return t.construct != null
|
|
401
401
|
? new t.construct(...values)
|
|
@@ -434,7 +434,7 @@ export function createInstance(t, consArgs) {
|
|
|
434
434
|
// Even though char is a value type, it's erased to string, and Unchecked.defaultof<char> is null
|
|
435
435
|
return null;
|
|
436
436
|
default:
|
|
437
|
-
throw new
|
|
437
|
+
throw new Exception(`Cannot access constructor of ${t.fullname}`);
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
440
|
}
|
|
@@ -444,7 +444,7 @@ export function getValue(propertyInfo, v) {
|
|
|
444
444
|
// Fable.Core.Reflection
|
|
445
445
|
function assertUnion(x) {
|
|
446
446
|
if (!(x instanceof Union)) {
|
|
447
|
-
throw new
|
|
447
|
+
throw new Exception(`Value is not an F# union type`);
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
450
|
export function getCaseTag(x) {
|
package/RegExp.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Exception } from "./Util.js";
|
|
1
2
|
export function create(pattern, options = 0) {
|
|
2
3
|
// Supported RegexOptions
|
|
3
4
|
// * IgnoreCase: 0x0001
|
|
@@ -6,7 +7,7 @@ export function create(pattern, options = 0) {
|
|
|
6
7
|
// * Singleline: 0x0010
|
|
7
8
|
// * ECMAScript: 0x0100 (ignored)
|
|
8
9
|
if ((options & ~(1 ^ 2 ^ 8 ^ 16 ^ 256)) !== 0) {
|
|
9
|
-
throw new
|
|
10
|
+
throw new Exception("RegexOptions only supports: IgnoreCase, Multiline, Compiled, Singleline and ECMAScript");
|
|
10
11
|
}
|
|
11
12
|
// Set always global and unicode flags for compatibility with dotnet, see #2925
|
|
12
13
|
let flags = "gu";
|
|
@@ -32,10 +33,10 @@ export function match(reg, input, startAt = 0) {
|
|
|
32
33
|
}
|
|
33
34
|
export function matches(reg, input, startAt = 0) {
|
|
34
35
|
if (input == null) {
|
|
35
|
-
throw new
|
|
36
|
+
throw new Exception("Input cannot ve null");
|
|
36
37
|
}
|
|
37
38
|
if (!reg.global) {
|
|
38
|
-
throw new
|
|
39
|
+
throw new Exception("Non-global RegExp"); // Prevent infinite loop
|
|
39
40
|
}
|
|
40
41
|
reg.lastIndex = startAt;
|
|
41
42
|
const matches = [];
|
package/Seq.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InvalidOperationException_$ctor_Z721C83C5, NotSupportedException_$ctor_Z721C83C5 } from "./System.js";
|
|
2
|
+
import { clear, Exception, isDisposable, isArrayLike, toIterator, disposeSafe, getEnumerator } from "./Util.js";
|
|
2
3
|
import { toString } from "./Types.js";
|
|
3
4
|
import { class_type } from "./Reflection.js";
|
|
4
5
|
import { some, value as value_1 } from "./Option.js";
|
|
5
|
-
import {
|
|
6
|
+
import { KeyNotFoundException_$ctor_Z721C83C5 } from "./System.Collections.Generic.js";
|
|
7
|
+
import { Operators_Lock, Operators_NullArgCheck } from "./FSharp.Core.js";
|
|
6
8
|
import { chunkBySize as chunkBySize_1, permute as permute_1, transpose as transpose_1, map as map_1, windowed as windowed_1, splitInto as splitInto_1, pairwise as pairwise_1, scanBack as scanBack_1, reverse as reverse_1, mapFoldBack as mapFoldBack_1, mapFold as mapFold_1, tryItem as tryItem_1, tryHead as tryHead_1, foldBack2 as foldBack2_1, foldBack as foldBack_1, tryFindIndexBack as tryFindIndexBack_1, tryFindBack as tryFindBack_1, singleton as singleton_1 } from "./Array.js";
|
|
7
9
|
import { length as length_1, tryItem as tryItem_2, isEmpty as isEmpty_1, tryHead as tryHead_2, ofSeq as ofSeq_1, ofArray as ofArray_1, toArray as toArray_1, FSharpList } from "./List.js";
|
|
8
10
|
import { SR_indexOutOfBounds } from "./Global.js";
|
|
@@ -14,13 +16,13 @@ export const SR_keyNotFoundAlt = "An index satisfying the predicate was not foun
|
|
|
14
16
|
export const SR_notEnoughElements = "The input sequence has an insufficient number of elements.";
|
|
15
17
|
export const SR_resetNotSupported = "Reset is not supported on this enumerator.";
|
|
16
18
|
export function Enumerator_noReset() {
|
|
17
|
-
throw
|
|
19
|
+
throw NotSupportedException_$ctor_Z721C83C5(SR_resetNotSupported);
|
|
18
20
|
}
|
|
19
21
|
export function Enumerator_notStarted() {
|
|
20
|
-
throw
|
|
22
|
+
throw InvalidOperationException_$ctor_Z721C83C5(SR_enumerationNotStarted);
|
|
21
23
|
}
|
|
22
24
|
export function Enumerator_alreadyFinished() {
|
|
23
|
-
throw
|
|
25
|
+
throw InvalidOperationException_$ctor_Z721C83C5(SR_enumerationAlreadyFinished);
|
|
24
26
|
}
|
|
25
27
|
export class Enumerator_Seq {
|
|
26
28
|
constructor(f) {
|
|
@@ -153,7 +155,7 @@ export function Enumerator_concat(sources) {
|
|
|
153
155
|
else {
|
|
154
156
|
let res = undefined;
|
|
155
157
|
while (res == null) {
|
|
156
|
-
let copyOfStruct;
|
|
158
|
+
let copyOfStruct = undefined;
|
|
157
159
|
const outerOpt_1 = outerOpt;
|
|
158
160
|
const innerOpt_1 = innerOpt;
|
|
159
161
|
if (outerOpt_1 != null) {
|
|
@@ -294,19 +296,13 @@ export function Enumerator_unfold(f, state) {
|
|
|
294
296
|
});
|
|
295
297
|
}
|
|
296
298
|
export function indexNotFound() {
|
|
297
|
-
throw
|
|
298
|
-
}
|
|
299
|
-
export function checkNonNull(argName, arg) {
|
|
300
|
-
if (Operators_IsNull(arg)) {
|
|
301
|
-
Operators_NullArg(argName);
|
|
302
|
-
}
|
|
299
|
+
throw KeyNotFoundException_$ctor_Z721C83C5(SR_keyNotFoundAlt);
|
|
303
300
|
}
|
|
304
301
|
export function mkSeq(f) {
|
|
305
302
|
return Enumerator_Seq_$ctor_673A07F2(f);
|
|
306
303
|
}
|
|
307
304
|
export function ofSeq(xs) {
|
|
308
|
-
|
|
309
|
-
return getEnumerator(xs);
|
|
305
|
+
return getEnumerator(Operators_NullArgCheck("source", xs));
|
|
310
306
|
}
|
|
311
307
|
export function delay(generator) {
|
|
312
308
|
return mkSeq(() => getEnumerator(generator()));
|
|
@@ -365,10 +361,7 @@ export function append(xs, ys) {
|
|
|
365
361
|
return concat([xs, ys]);
|
|
366
362
|
}
|
|
367
363
|
export function cast(xs) {
|
|
368
|
-
return mkSeq(() =>
|
|
369
|
-
checkNonNull("source", xs);
|
|
370
|
-
return Enumerator_cast(getEnumerator(xs));
|
|
371
|
-
});
|
|
364
|
+
return mkSeq(() => Enumerator_cast(getEnumerator(Operators_NullArgCheck("source", xs))));
|
|
372
365
|
}
|
|
373
366
|
export function choose(chooser, xs) {
|
|
374
367
|
return generate(() => ofSeq(xs), (e) => {
|
|
@@ -442,7 +435,7 @@ export function enumerateThenFinally(source, compensation) {
|
|
|
442
435
|
}
|
|
443
436
|
export function enumerateUsing(resource, source) {
|
|
444
437
|
const compensation = () => {
|
|
445
|
-
if (
|
|
438
|
+
if (resource == null) {
|
|
446
439
|
}
|
|
447
440
|
else {
|
|
448
441
|
let copyOfStruct = resource;
|
|
@@ -510,14 +503,14 @@ export function exactlyOne(xs) {
|
|
|
510
503
|
if (e["System.Collections.IEnumerator.MoveNext"]()) {
|
|
511
504
|
const v = e["System.Collections.Generic.IEnumerator`1.get_Current"]();
|
|
512
505
|
if (e["System.Collections.IEnumerator.MoveNext"]()) {
|
|
513
|
-
throw new
|
|
506
|
+
throw new Exception((SR_inputSequenceTooLong + "\\nParameter name: ") + "source");
|
|
514
507
|
}
|
|
515
508
|
else {
|
|
516
509
|
return v;
|
|
517
510
|
}
|
|
518
511
|
}
|
|
519
512
|
else {
|
|
520
|
-
throw new
|
|
513
|
+
throw new Exception((SR_inputSequenceEmpty + "\\nParameter name: ") + "source");
|
|
521
514
|
}
|
|
522
515
|
}
|
|
523
516
|
finally {
|
|
@@ -690,7 +683,7 @@ export function tryHead(xs) {
|
|
|
690
683
|
export function head(xs) {
|
|
691
684
|
const matchValue = tryHead(xs);
|
|
692
685
|
if (matchValue == null) {
|
|
693
|
-
throw new
|
|
686
|
+
throw new Exception((SR_inputSequenceEmpty + "\\nParameter name: ") + "source");
|
|
694
687
|
}
|
|
695
688
|
else {
|
|
696
689
|
return value_1(matchValue);
|
|
@@ -756,7 +749,7 @@ export function tryItem(index, xs) {
|
|
|
756
749
|
export function item(index, xs) {
|
|
757
750
|
const matchValue = tryItem(index, xs);
|
|
758
751
|
if (matchValue == null) {
|
|
759
|
-
throw new
|
|
752
|
+
throw new Exception((SR_notEnoughElements + "\\nParameter name: ") + "index");
|
|
760
753
|
}
|
|
761
754
|
else {
|
|
762
755
|
return value_1(matchValue);
|
|
@@ -809,7 +802,7 @@ export function tryLast(xs) {
|
|
|
809
802
|
export function last(xs) {
|
|
810
803
|
const matchValue = tryLast(xs);
|
|
811
804
|
if (matchValue == null) {
|
|
812
|
-
throw new
|
|
805
|
+
throw new Exception((SR_notEnoughElements + "\\nParameter name: ") + "source");
|
|
813
806
|
}
|
|
814
807
|
else {
|
|
815
808
|
return value_1(matchValue);
|
|
@@ -899,8 +892,7 @@ export function map3(mapping, xs, ys, zs) {
|
|
|
899
892
|
});
|
|
900
893
|
}
|
|
901
894
|
export function readOnly(xs) {
|
|
902
|
-
|
|
903
|
-
return map((x) => x, xs);
|
|
895
|
+
return map((x) => x, Operators_NullArgCheck("source", xs));
|
|
904
896
|
}
|
|
905
897
|
export class CachedSeq$1 {
|
|
906
898
|
constructor(cleanup, res) {
|
|
@@ -933,13 +925,13 @@ export function CachedSeq$1__Clear(_) {
|
|
|
933
925
|
_.cleanup();
|
|
934
926
|
}
|
|
935
927
|
export function cache(source) {
|
|
936
|
-
|
|
928
|
+
const source_1 = Operators_NullArgCheck("source", source);
|
|
937
929
|
const prefix = [];
|
|
938
930
|
let enumeratorR = undefined;
|
|
939
931
|
return CachedSeq$1_$ctor_Z7A8347D4(() => {
|
|
940
932
|
Operators_Lock(prefix, () => {
|
|
941
933
|
clear(prefix);
|
|
942
|
-
let matchResult, e;
|
|
934
|
+
let matchResult = undefined, e = undefined;
|
|
943
935
|
if (enumeratorR != null) {
|
|
944
936
|
if (value_1(enumeratorR) != null) {
|
|
945
937
|
matchResult = 0;
|
|
@@ -971,7 +963,7 @@ export function cache(source) {
|
|
|
971
963
|
optEnumerator_2 = value_1(enumeratorR);
|
|
972
964
|
}
|
|
973
965
|
else {
|
|
974
|
-
const optEnumerator = getEnumerator(
|
|
966
|
+
const optEnumerator = getEnumerator(source_1);
|
|
975
967
|
enumeratorR = some(optEnumerator);
|
|
976
968
|
optEnumerator_2 = optEnumerator;
|
|
977
969
|
}
|
|
@@ -1051,7 +1043,7 @@ export function reduce(folder, xs) {
|
|
|
1051
1043
|
return loop(e["System.Collections.Generic.IEnumerator`1.get_Current"]());
|
|
1052
1044
|
}
|
|
1053
1045
|
else {
|
|
1054
|
-
throw new
|
|
1046
|
+
throw new Exception(SR_inputSequenceEmpty);
|
|
1055
1047
|
}
|
|
1056
1048
|
}
|
|
1057
1049
|
finally {
|
|
@@ -1064,7 +1056,7 @@ export function reduceBack(folder, xs) {
|
|
|
1064
1056
|
return arr.reduceRight(folder);
|
|
1065
1057
|
}
|
|
1066
1058
|
else {
|
|
1067
|
-
throw new
|
|
1059
|
+
throw new Exception(SR_inputSequenceEmpty);
|
|
1068
1060
|
}
|
|
1069
1061
|
}
|
|
1070
1062
|
export function replicate(n, x) {
|
|
@@ -1091,7 +1083,7 @@ export function skip(count, source) {
|
|
|
1091
1083
|
try {
|
|
1092
1084
|
for (let _ = 1; _ <= count; _++) {
|
|
1093
1085
|
if (!e["System.Collections.IEnumerator.MoveNext"]()) {
|
|
1094
|
-
throw new
|
|
1086
|
+
throw new Exception((SR_notEnoughElements + "\\nParameter name: ") + "source");
|
|
1095
1087
|
}
|
|
1096
1088
|
}
|
|
1097
1089
|
return Enumerator_enumerateThenFinally(() => {
|
|
@@ -1124,7 +1116,7 @@ export function take(count, xs) {
|
|
|
1124
1116
|
return some(e["System.Collections.Generic.IEnumerator`1.get_Current"]());
|
|
1125
1117
|
}
|
|
1126
1118
|
else {
|
|
1127
|
-
throw new
|
|
1119
|
+
throw new Exception((SR_notEnoughElements + "\\nParameter name: ") + "source");
|
|
1128
1120
|
}
|
|
1129
1121
|
}
|
|
1130
1122
|
else {
|
|
@@ -1212,7 +1204,7 @@ export function average(xs, averager) {
|
|
|
1212
1204
|
return averager.Add(acc, x);
|
|
1213
1205
|
}, averager.GetZero(), xs);
|
|
1214
1206
|
if (count === 0) {
|
|
1215
|
-
throw new
|
|
1207
|
+
throw new Exception((SR_inputSequenceEmpty + "\\nParameter name: ") + "source");
|
|
1216
1208
|
}
|
|
1217
1209
|
else {
|
|
1218
1210
|
return averager.DivideByInt(total, count);
|
|
@@ -1225,7 +1217,7 @@ export function averageBy(f, xs, averager) {
|
|
|
1225
1217
|
return averager.Add(acc, f(x));
|
|
1226
1218
|
}, averager.GetZero(), xs);
|
|
1227
1219
|
if (count === 0) {
|
|
1228
|
-
throw new
|
|
1220
|
+
throw new Exception((SR_inputSequenceEmpty + "\\nParameter name: ") + "source");
|
|
1229
1221
|
}
|
|
1230
1222
|
else {
|
|
1231
1223
|
return averager.DivideByInt(total, count);
|
|
@@ -1240,7 +1232,7 @@ export function chunkBySize(chunkSize, xs) {
|
|
|
1240
1232
|
export function insertAt(index, y, xs) {
|
|
1241
1233
|
let isDone = false;
|
|
1242
1234
|
if (index < 0) {
|
|
1243
|
-
throw new
|
|
1235
|
+
throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
|
|
1244
1236
|
}
|
|
1245
1237
|
return generateIndexed(() => ofSeq(xs), (i, e) => {
|
|
1246
1238
|
if ((isDone ? true : (i < index)) && e["System.Collections.IEnumerator.MoveNext"]()) {
|
|
@@ -1252,7 +1244,7 @@ export function insertAt(index, y, xs) {
|
|
|
1252
1244
|
}
|
|
1253
1245
|
else {
|
|
1254
1246
|
if (!isDone) {
|
|
1255
|
-
throw new
|
|
1247
|
+
throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
|
|
1256
1248
|
}
|
|
1257
1249
|
return undefined;
|
|
1258
1250
|
}
|
|
@@ -1263,7 +1255,7 @@ export function insertAt(index, y, xs) {
|
|
|
1263
1255
|
export function insertManyAt(index, ys, xs) {
|
|
1264
1256
|
let status = -1;
|
|
1265
1257
|
if (index < 0) {
|
|
1266
|
-
throw new
|
|
1258
|
+
throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
|
|
1267
1259
|
}
|
|
1268
1260
|
return generateIndexed(() => [ofSeq(xs), ofSeq(ys)], (i, tupledArg) => {
|
|
1269
1261
|
const e1 = tupledArg[0];
|
|
@@ -1290,7 +1282,7 @@ export function insertManyAt(index, ys, xs) {
|
|
|
1290
1282
|
}
|
|
1291
1283
|
else {
|
|
1292
1284
|
if (status < 1) {
|
|
1293
|
-
throw new
|
|
1285
|
+
throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
|
|
1294
1286
|
}
|
|
1295
1287
|
return undefined;
|
|
1296
1288
|
}
|
|
@@ -1306,7 +1298,7 @@ export function insertManyAt(index, ys, xs) {
|
|
|
1306
1298
|
export function removeAt(index, xs) {
|
|
1307
1299
|
let isDone = false;
|
|
1308
1300
|
if (index < 0) {
|
|
1309
|
-
throw new
|
|
1301
|
+
throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
|
|
1310
1302
|
}
|
|
1311
1303
|
return generateIndexed(() => ofSeq(xs), (i, e) => {
|
|
1312
1304
|
if ((isDone ? true : (i < index)) && e["System.Collections.IEnumerator.MoveNext"]()) {
|
|
@@ -1318,7 +1310,7 @@ export function removeAt(index, xs) {
|
|
|
1318
1310
|
}
|
|
1319
1311
|
else {
|
|
1320
1312
|
if (!isDone) {
|
|
1321
|
-
throw new
|
|
1313
|
+
throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
|
|
1322
1314
|
}
|
|
1323
1315
|
return undefined;
|
|
1324
1316
|
}
|
|
@@ -1328,7 +1320,7 @@ export function removeAt(index, xs) {
|
|
|
1328
1320
|
}
|
|
1329
1321
|
export function removeManyAt(index, count, xs) {
|
|
1330
1322
|
if (index < 0) {
|
|
1331
|
-
throw new
|
|
1323
|
+
throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
|
|
1332
1324
|
}
|
|
1333
1325
|
return generateIndexed(() => ofSeq(xs), (i, e) => {
|
|
1334
1326
|
if (i < index) {
|
|
@@ -1336,14 +1328,14 @@ export function removeManyAt(index, count, xs) {
|
|
|
1336
1328
|
return some(e["System.Collections.Generic.IEnumerator`1.get_Current"]());
|
|
1337
1329
|
}
|
|
1338
1330
|
else {
|
|
1339
|
-
throw new
|
|
1331
|
+
throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
|
|
1340
1332
|
}
|
|
1341
1333
|
}
|
|
1342
1334
|
else {
|
|
1343
1335
|
if (i === index) {
|
|
1344
1336
|
for (let _ = 1; _ <= count; _++) {
|
|
1345
1337
|
if (!e["System.Collections.IEnumerator.MoveNext"]()) {
|
|
1346
|
-
throw new
|
|
1338
|
+
throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "count");
|
|
1347
1339
|
}
|
|
1348
1340
|
}
|
|
1349
1341
|
}
|
|
@@ -1356,7 +1348,7 @@ export function removeManyAt(index, count, xs) {
|
|
|
1356
1348
|
export function updateAt(index, y, xs) {
|
|
1357
1349
|
let isDone = false;
|
|
1358
1350
|
if (index < 0) {
|
|
1359
|
-
throw new
|
|
1351
|
+
throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
|
|
1360
1352
|
}
|
|
1361
1353
|
return generateIndexed(() => ofSeq(xs), (i, e) => {
|
|
1362
1354
|
if ((isDone ? true : (i < index)) && e["System.Collections.IEnumerator.MoveNext"]()) {
|
|
@@ -1368,7 +1360,7 @@ export function updateAt(index, y, xs) {
|
|
|
1368
1360
|
}
|
|
1369
1361
|
else {
|
|
1370
1362
|
if (!isDone) {
|
|
1371
|
-
throw new
|
|
1363
|
+
throw new Exception((SR_indexOutOfBounds + "\\nParameter name: ") + "index");
|
|
1372
1364
|
}
|
|
1373
1365
|
return undefined;
|
|
1374
1366
|
}
|