compostjs 0.0.8 → 0.0.12

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 (141) hide show
  1. package/README.md +4 -4
  2. package/dist/fable_modules/fable-library-js.4.28.0/Array.d.ts +123 -0
  3. package/dist/fable_modules/fable-library-js.4.28.0/Array.js +1242 -0
  4. package/dist/fable_modules/fable-library-js.4.28.0/Async.d.ts +26 -0
  5. package/dist/fable_modules/fable-library-js.4.28.0/Async.js +145 -0
  6. package/dist/fable_modules/fable-library-js.4.28.0/AsyncBuilder.d.ts +59 -0
  7. package/dist/fable_modules/fable-library-js.4.28.0/AsyncBuilder.js +183 -0
  8. package/dist/fable_modules/fable-library-js.4.28.0/BigInt.d.ts +115 -0
  9. package/dist/fable_modules/fable-library-js.4.28.0/BigInt.js +283 -0
  10. package/dist/fable_modules/fable-library-js.4.28.0/BitConverter.d.ts +27 -0
  11. package/dist/fable_modules/fable-library-js.4.28.0/BitConverter.js +138 -0
  12. package/dist/fable_modules/fable-library-js.4.28.0/Boolean.d.ts +3 -0
  13. package/dist/fable_modules/fable-library-js.4.28.0/Boolean.js +21 -0
  14. package/dist/fable_modules/fable-library-js.4.28.0/CHANGELOG.md +100 -0
  15. package/dist/fable_modules/fable-library-js.4.28.0/Char.d.ts +65 -0
  16. package/dist/fable_modules/fable-library-js.4.28.0/Char.js +169 -0
  17. package/dist/fable_modules/fable-library-js.4.28.0/Choice.d.ts +121 -0
  18. package/dist/fable_modules/fable-library-js.4.28.0/Choice.js +184 -0
  19. package/dist/fable_modules/fable-library-js.4.28.0/CollectionUtil.d.ts +7 -0
  20. package/dist/fable_modules/fable-library-js.4.28.0/CollectionUtil.js +182 -0
  21. package/dist/fable_modules/fable-library-js.4.28.0/ConditionalWeakTable.d.ts +9 -0
  22. package/dist/fable_modules/fable-library-js.4.28.0/ConditionalWeakTable.js +21 -0
  23. package/dist/fable_modules/fable-library-js.4.28.0/Date.d.ts +70 -0
  24. package/dist/fable_modules/fable-library-js.4.28.0/Date.js +748 -0
  25. package/dist/fable_modules/fable-library-js.4.28.0/DateOffset.d.ts +63 -0
  26. package/dist/fable_modules/fable-library-js.4.28.0/DateOffset.js +268 -0
  27. package/dist/fable_modules/fable-library-js.4.28.0/DateOnly.d.ts +18 -0
  28. package/dist/fable_modules/fable-library-js.4.28.0/DateOnly.js +124 -0
  29. package/dist/fable_modules/fable-library-js.4.28.0/Decimal.d.ts +45 -0
  30. package/dist/fable_modules/fable-library-js.4.28.0/Decimal.js +212 -0
  31. package/dist/fable_modules/fable-library-js.4.28.0/Double.d.ts +11 -0
  32. package/dist/fable_modules/fable-library-js.4.28.0/Double.js +46 -0
  33. package/dist/fable_modules/fable-library-js.4.28.0/Encoding.d.ts +12 -0
  34. package/dist/fable_modules/fable-library-js.4.28.0/Encoding.js +173 -0
  35. package/dist/fable_modules/fable-library-js.4.28.0/Event.d.ts +31 -0
  36. package/dist/fable_modules/fable-library-js.4.28.0/Event.js +93 -0
  37. package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Collections.d.ts +7 -0
  38. package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Collections.js +27 -0
  39. package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Core.CompilerServices.d.ts +12 -0
  40. package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Core.CompilerServices.js +27 -0
  41. package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Core.d.ts +17 -0
  42. package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Core.js +69 -0
  43. package/dist/fable_modules/fable-library-js.4.28.0/Global.d.ts +24 -0
  44. package/dist/fable_modules/fable-library-js.4.28.0/Global.js +8 -0
  45. package/dist/fable_modules/fable-library-js.4.28.0/Guid.d.ts +10 -0
  46. package/dist/fable_modules/fable-library-js.4.28.0/Guid.js +142 -0
  47. package/dist/fable_modules/fable-library-js.4.28.0/Int32.d.ts +28 -0
  48. package/dist/fable_modules/fable-library-js.4.28.0/Int32.js +135 -0
  49. package/dist/fable_modules/fable-library-js.4.28.0/List.d.ts +143 -0
  50. package/dist/fable_modules/fable-library-js.4.28.0/List.js +1273 -0
  51. package/dist/fable_modules/fable-library-js.4.28.0/Long.d.ts +3 -0
  52. package/dist/fable_modules/fable-library-js.4.28.0/Long.js +46 -0
  53. package/dist/fable_modules/fable-library-js.4.28.0/MailboxProcessor.d.ts +25 -0
  54. package/dist/fable_modules/fable-library-js.4.28.0/MailboxProcessor.js +93 -0
  55. package/dist/fable_modules/fable-library-js.4.28.0/Map.d.ts +178 -0
  56. package/dist/fable_modules/fable-library-js.4.28.0/Map.js +1396 -0
  57. package/dist/fable_modules/fable-library-js.4.28.0/MapUtil.d.ts +12 -0
  58. package/dist/fable_modules/fable-library-js.4.28.0/MapUtil.js +127 -0
  59. package/dist/fable_modules/fable-library-js.4.28.0/MutableMap.d.ts +52 -0
  60. package/dist/fable_modules/fable-library-js.4.28.0/MutableMap.js +327 -0
  61. package/dist/fable_modules/fable-library-js.4.28.0/MutableSet.d.ts +39 -0
  62. package/dist/fable_modules/fable-library-js.4.28.0/MutableSet.js +233 -0
  63. package/dist/fable_modules/fable-library-js.4.28.0/Native.d.ts +2 -0
  64. package/dist/fable_modules/fable-library-js.4.28.0/Native.js +8 -0
  65. package/dist/fable_modules/fable-library-js.4.28.0/Numeric.d.ts +19 -0
  66. package/dist/fable_modules/fable-library-js.4.28.0/Numeric.js +71 -0
  67. package/dist/fable_modules/fable-library-js.4.28.0/Observable.d.ts +32 -0
  68. package/dist/fable_modules/fable-library-js.4.28.0/Observable.js +113 -0
  69. package/dist/fable_modules/fable-library-js.4.28.0/Option.d.ts +28 -0
  70. package/dist/fable_modules/fable-library-js.4.28.0/Option.js +96 -0
  71. package/dist/fable_modules/fable-library-js.4.28.0/README.md +3 -0
  72. package/dist/fable_modules/fable-library-js.4.28.0/Random.d.ts +37 -0
  73. package/dist/fable_modules/fable-library-js.4.28.0/Random.js +170 -0
  74. package/dist/fable_modules/fable-library-js.4.28.0/Range.d.ts +12 -0
  75. package/dist/fable_modules/fable-library-js.4.28.0/Range.js +45 -0
  76. package/dist/fable_modules/fable-library-js.4.28.0/Reflection.d.ts +119 -0
  77. package/dist/fable_modules/fable-library-js.4.28.0/Reflection.js +461 -0
  78. package/dist/fable_modules/fable-library-js.4.28.0/RegExp.d.ts +10 -0
  79. package/dist/fable_modules/fable-library-js.4.28.0/RegExp.js +131 -0
  80. package/dist/fable_modules/fable-library-js.4.28.0/Result.d.ts +37 -0
  81. package/dist/fable_modules/fable-library-js.4.28.0/Result.js +165 -0
  82. package/dist/fable_modules/fable-library-js.4.28.0/Seq.d.ts +165 -0
  83. package/dist/fable_modules/fable-library-js.4.28.0/Seq.js +1378 -0
  84. package/dist/fable_modules/fable-library-js.4.28.0/Seq2.d.ts +18 -0
  85. package/dist/fable_modules/fable-library-js.4.28.0/Seq2.js +111 -0
  86. package/dist/fable_modules/fable-library-js.4.28.0/Set.d.ts +190 -0
  87. package/dist/fable_modules/fable-library-js.4.28.0/Set.js +1789 -0
  88. package/dist/fable_modules/fable-library-js.4.28.0/String.d.ts +58 -0
  89. package/dist/fable_modules/fable-library-js.4.28.0/String.js +554 -0
  90. package/dist/fable_modules/fable-library-js.4.28.0/System.Collections.Generic.d.ts +79 -0
  91. package/dist/fable_modules/fable-library-js.4.28.0/System.Collections.Generic.js +317 -0
  92. package/dist/fable_modules/fable-library-js.4.28.0/System.Text.d.ts +38 -0
  93. package/dist/fable_modules/fable-library-js.4.28.0/System.Text.js +162 -0
  94. package/dist/fable_modules/fable-library-js.4.28.0/SystemException.d.ts +5 -0
  95. package/dist/fable_modules/fable-library-js.4.28.0/SystemException.js +5 -0
  96. package/dist/fable_modules/fable-library-js.4.28.0/TimeOnly.d.ts +15 -0
  97. package/dist/fable_modules/fable-library-js.4.28.0/TimeOnly.js +122 -0
  98. package/dist/fable_modules/fable-library-js.4.28.0/TimeSpan.d.ts +34 -0
  99. package/dist/fable_modules/fable-library-js.4.28.0/TimeSpan.js +177 -0
  100. package/dist/fable_modules/fable-library-js.4.28.0/Timer.d.ts +19 -0
  101. package/dist/fable_modules/fable-library-js.4.28.0/Timer.js +67 -0
  102. package/dist/fable_modules/fable-library-js.4.28.0/Types.d.ts +58 -0
  103. package/dist/fable_modules/fable-library-js.4.28.0/Types.js +208 -0
  104. package/dist/fable_modules/fable-library-js.4.28.0/Unicode.13.0.0.d.ts +2 -0
  105. package/dist/fable_modules/fable-library-js.4.28.0/Unicode.13.0.0.js +4 -0
  106. package/dist/fable_modules/fable-library-js.4.28.0/Uri.d.ts +31 -0
  107. package/dist/fable_modules/fable-library-js.4.28.0/Uri.js +159 -0
  108. package/dist/fable_modules/fable-library-js.4.28.0/Util.d.ts +210 -0
  109. package/dist/fable_modules/fable-library-js.4.28.0/Util.js +769 -0
  110. package/dist/fable_modules/fable-library-js.4.28.0/big.d.ts +338 -0
  111. package/dist/fable_modules/fable-library-js.4.28.0/lib/big.d.ts +5 -0
  112. package/dist/fable_modules/fable-library-js.4.28.0/lib/big.js +825 -0
  113. package/dist/fable_modules/fable-library-js.4.28.0/package.json +24 -0
  114. package/dist/fable_modules/project_cracked.json +1 -0
  115. package/package.json +6 -5
  116. package/.claude/settings.local.json +0 -11
  117. package/dist/fable-library.2.10.1/Array.js +0 -1336
  118. package/dist/fable-library.2.10.1/Async.js +0 -121
  119. package/dist/fable-library.2.10.1/AsyncBuilder.js +0 -200
  120. package/dist/fable-library.2.10.1/Date.js +0 -501
  121. package/dist/fable-library.2.10.1/Decimal.js +0 -208
  122. package/dist/fable-library.2.10.1/Event.js +0 -193
  123. package/dist/fable-library.2.10.1/Int32.js +0 -157
  124. package/dist/fable-library.2.10.1/List.js +0 -1234
  125. package/dist/fable-library.2.10.1/Long.js +0 -155
  126. package/dist/fable-library.2.10.1/Map.js +0 -1292
  127. package/dist/fable-library.2.10.1/MutableMap.js +0 -360
  128. package/dist/fable-library.2.10.1/MutableSet.js +0 -279
  129. package/dist/fable-library.2.10.1/Observable.js +0 -131
  130. package/dist/fable-library.2.10.1/Option.js +0 -118
  131. package/dist/fable-library.2.10.1/Reflection.js +0 -345
  132. package/dist/fable-library.2.10.1/RegExp.js +0 -118
  133. package/dist/fable-library.2.10.1/Seq.js +0 -917
  134. package/dist/fable-library.2.10.1/Set.js +0 -1692
  135. package/dist/fable-library.2.10.1/String.js +0 -679
  136. package/dist/fable-library.2.10.1/Types.js +0 -308
  137. package/dist/fable-library.2.10.1/Util.js +0 -761
  138. package/dist/helpers.js +0 -31
  139. package/dist/lib/big.js +0 -905
  140. package/dist/lib/long.js +0 -1375
  141. package/index.html +0 -49
@@ -0,0 +1,169 @@
1
+ import * as Unicode from "./Unicode.13.0.0.js";
2
+ function getCategoryFunc() {
3
+ // unpack Unicode codepoint ranges (delta encoded) and general categories
4
+ const offset = 35; // offsets unprintable characters
5
+ const a1 = [...Unicode.rangeDeltas].map((ch) => (ch.codePointAt(0) ?? 0) - offset);
6
+ const a2 = [...Unicode.categories].map((ch) => (ch.codePointAt(0) ?? 0) - offset);
7
+ const codepoints = new Uint32Array(a1);
8
+ const categories = new Uint8Array(a2);
9
+ for (let i = 1; i < codepoints.length; ++i) {
10
+ codepoints[i] += codepoints[i - 1];
11
+ }
12
+ // binary search in unicode ranges
13
+ return (cp) => {
14
+ let hi = codepoints.length;
15
+ let lo = 0;
16
+ while (hi - lo > 1) {
17
+ const mid = Math.floor((hi + lo) / 2);
18
+ const test = codepoints[mid];
19
+ if (cp < test) {
20
+ hi = mid;
21
+ }
22
+ else if (cp === test) {
23
+ hi = lo = mid;
24
+ break;
25
+ }
26
+ else if (test < cp) {
27
+ lo = mid;
28
+ }
29
+ }
30
+ return categories[lo];
31
+ };
32
+ }
33
+ const isControlMask = 1 << 14 /* UnicodeCategory.Control */;
34
+ const isDigitMask = 1 << 8 /* UnicodeCategory.DecimalDigitNumber */;
35
+ const isLetterMask = 0
36
+ | 1 << 0 /* UnicodeCategory.UppercaseLetter */
37
+ | 1 << 1 /* UnicodeCategory.LowercaseLetter */
38
+ | 1 << 2 /* UnicodeCategory.TitlecaseLetter */
39
+ | 1 << 3 /* UnicodeCategory.ModifierLetter */
40
+ | 1 << 4 /* UnicodeCategory.OtherLetter */;
41
+ const isLetterOrDigitMask = isLetterMask | isDigitMask;
42
+ const isUpperMask = 1 << 0 /* UnicodeCategory.UppercaseLetter */;
43
+ const isLowerMask = 1 << 1 /* UnicodeCategory.LowercaseLetter */;
44
+ const isNumberMask = 0
45
+ | 1 << 8 /* UnicodeCategory.DecimalDigitNumber */
46
+ | 1 << 9 /* UnicodeCategory.LetterNumber */
47
+ | 1 << 10 /* UnicodeCategory.OtherNumber */;
48
+ const isPunctuationMask = 0
49
+ | 1 << 18 /* UnicodeCategory.ConnectorPunctuation */
50
+ | 1 << 19 /* UnicodeCategory.DashPunctuation */
51
+ | 1 << 20 /* UnicodeCategory.OpenPunctuation */
52
+ | 1 << 21 /* UnicodeCategory.ClosePunctuation */
53
+ | 1 << 22 /* UnicodeCategory.InitialQuotePunctuation */
54
+ | 1 << 23 /* UnicodeCategory.FinalQuotePunctuation */
55
+ | 1 << 24 /* UnicodeCategory.OtherPunctuation */;
56
+ const isSeparatorMask = 0
57
+ | 1 << 11 /* UnicodeCategory.SpaceSeparator */
58
+ | 1 << 12 /* UnicodeCategory.LineSeparator */
59
+ | 1 << 13 /* UnicodeCategory.ParagraphSeparator */;
60
+ const isSymbolMask = 0
61
+ | 1 << 25 /* UnicodeCategory.MathSymbol */
62
+ | 1 << 26 /* UnicodeCategory.CurrencySymbol */
63
+ | 1 << 27 /* UnicodeCategory.ModifierSymbol */
64
+ | 1 << 28 /* UnicodeCategory.OtherSymbol */;
65
+ const isWhiteSpaceMask = 0
66
+ | 1 << 11 /* UnicodeCategory.SpaceSeparator */
67
+ | 1 << 12 /* UnicodeCategory.LineSeparator */
68
+ | 1 << 13 /* UnicodeCategory.ParagraphSeparator */;
69
+ const unicodeCategoryFunc = getCategoryFunc();
70
+ function charCodeAt(s, index) {
71
+ if (index >= 0 && index < s.length) {
72
+ return s.charCodeAt(index);
73
+ }
74
+ else {
75
+ throw new Error("Index out of range.");
76
+ }
77
+ }
78
+ export const getUnicodeCategory = (s) => getUnicodeCategory2(s, 0);
79
+ export const isControl = (s) => isControl2(s, 0);
80
+ export const isDigit = (s) => isDigit2(s, 0);
81
+ export const isLetter = (s) => isLetter2(s, 0);
82
+ export const isLetterOrDigit = (s) => isLetterOrDigit2(s, 0);
83
+ export const isUpper = (s) => isUpper2(s, 0);
84
+ export const isLower = (s) => isLower2(s, 0);
85
+ export const isNumber = (s) => isNumber2(s, 0);
86
+ export const isPunctuation = (s) => isPunctuation2(s, 0);
87
+ export const isSeparator = (s) => isSeparator2(s, 0);
88
+ export const isSymbol = (s) => isSymbol2(s, 0);
89
+ export const isWhiteSpace = (s) => isWhiteSpace2(s, 0);
90
+ export const isHighSurrogate = (s) => isHighSurrogate2(s, 0);
91
+ export const isLowSurrogate = (s) => isLowSurrogate2(s, 0);
92
+ export const isSurrogate = (s) => isSurrogate2(s, 0);
93
+ export function getUnicodeCategory2(s, index) {
94
+ const cp = charCodeAt(s, index);
95
+ return unicodeCategoryFunc(cp);
96
+ }
97
+ export function isControl2(s, index) {
98
+ const test = 1 << getUnicodeCategory2(s, index);
99
+ return (test & isControlMask) !== 0;
100
+ }
101
+ export function isDigit2(s, index) {
102
+ const test = 1 << getUnicodeCategory2(s, index);
103
+ return (test & isDigitMask) !== 0;
104
+ }
105
+ export function isLetter2(s, index) {
106
+ const test = 1 << getUnicodeCategory2(s, index);
107
+ return (test & isLetterMask) !== 0;
108
+ }
109
+ export function isLetterOrDigit2(s, index) {
110
+ const test = 1 << getUnicodeCategory2(s, index);
111
+ return (test & isLetterOrDigitMask) !== 0;
112
+ }
113
+ export function isUpper2(s, index) {
114
+ const test = 1 << getUnicodeCategory2(s, index);
115
+ return (test & isUpperMask) !== 0;
116
+ }
117
+ export function isLower2(s, index) {
118
+ const test = 1 << getUnicodeCategory2(s, index);
119
+ return (test & isLowerMask) !== 0;
120
+ }
121
+ export function isNumber2(s, index) {
122
+ const test = 1 << getUnicodeCategory2(s, index);
123
+ return (test & isNumberMask) !== 0;
124
+ }
125
+ export function isPunctuation2(s, index) {
126
+ const test = 1 << getUnicodeCategory2(s, index);
127
+ return (test & isPunctuationMask) !== 0;
128
+ }
129
+ export function isSeparator2(s, index) {
130
+ const test = 1 << getUnicodeCategory2(s, index);
131
+ return (test & isSeparatorMask) !== 0;
132
+ }
133
+ export function isSymbol2(s, index) {
134
+ const test = 1 << getUnicodeCategory2(s, index);
135
+ return (test & isSymbolMask) !== 0;
136
+ }
137
+ export function isWhiteSpace2(s, index) {
138
+ const test = 1 << getUnicodeCategory2(s, index);
139
+ if ((test & isWhiteSpaceMask) !== 0) {
140
+ return true;
141
+ }
142
+ const cp = charCodeAt(s, index);
143
+ return (0x09 <= cp && cp <= 0x0D) || cp === 0x85 || cp === 0xA0;
144
+ }
145
+ export function isHighSurrogate2(s, index) {
146
+ const cp = charCodeAt(s, index);
147
+ return (0xD800 <= cp && cp <= 0xDBFF);
148
+ }
149
+ export function isLowSurrogate2(s, index) {
150
+ const cp = charCodeAt(s, index);
151
+ return (0xDC00 <= cp && cp <= 0xDFFF);
152
+ }
153
+ export function isSurrogate2(s, index) {
154
+ const cp = charCodeAt(s, index);
155
+ return (0xD800 <= cp && cp <= 0xDFFF);
156
+ }
157
+ export function isSurrogatePair(s, index) {
158
+ return typeof index === "number"
159
+ ? isHighSurrogate2(s, index) && isLowSurrogate2(s, index + 1)
160
+ : isHighSurrogate(s) && isLowSurrogate(index);
161
+ }
162
+ export function parse(input) {
163
+ if (input.length === 1) {
164
+ return input[0];
165
+ }
166
+ else {
167
+ throw new Error("String must be exactly one character long.");
168
+ }
169
+ }
@@ -0,0 +1,121 @@
1
+ import { Union } from "./Types.js";
2
+ import { TypeInfo } from "./Reflection.js";
3
+ import { Option } from "./Option.js";
4
+ export type FSharpChoice$2_$union<T1, T2> = FSharpChoice$2<T1, T2, 0> | FSharpChoice$2<T1, T2, 1>;
5
+ export type FSharpChoice$2_$cases<T1, T2> = {
6
+ 0: ["Choice1Of2", [T1]];
7
+ 1: ["Choice2Of2", [T2]];
8
+ };
9
+ export declare function FSharpChoice$2_Choice1Of2<T1, T2>(Item: T1): FSharpChoice$2<T1, T2, 0>;
10
+ export declare function FSharpChoice$2_Choice2Of2<T1, T2>(Item: T2): FSharpChoice$2<T1, T2, 1>;
11
+ export declare class FSharpChoice$2<T1, T2, Tag extends keyof FSharpChoice$2_$cases<T1, T2>> extends Union<Tag, FSharpChoice$2_$cases<T1, T2>[Tag][0]> {
12
+ readonly tag: Tag;
13
+ readonly fields: FSharpChoice$2_$cases<T1, T2>[Tag][1];
14
+ constructor(tag: Tag, fields: FSharpChoice$2_$cases<T1, T2>[Tag][1]);
15
+ cases(): string[];
16
+ }
17
+ export declare function FSharpChoice$2_$reflection(gen0: TypeInfo, gen1: TypeInfo): TypeInfo;
18
+ export type FSharpChoice$3_$union<T1, T2, T3> = FSharpChoice$3<T1, T2, T3, 0> | FSharpChoice$3<T1, T2, T3, 1> | FSharpChoice$3<T1, T2, T3, 2>;
19
+ export type FSharpChoice$3_$cases<T1, T2, T3> = {
20
+ 0: ["Choice1Of3", [T1]];
21
+ 1: ["Choice2Of3", [T2]];
22
+ 2: ["Choice3Of3", [T3]];
23
+ };
24
+ export declare function FSharpChoice$3_Choice1Of3<T1, T2, T3>(Item: T1): FSharpChoice$3<T1, T2, T3, 0>;
25
+ export declare function FSharpChoice$3_Choice2Of3<T1, T2, T3>(Item: T2): FSharpChoice$3<T1, T2, T3, 1>;
26
+ export declare function FSharpChoice$3_Choice3Of3<T1, T2, T3>(Item: T3): FSharpChoice$3<T1, T2, T3, 2>;
27
+ export declare class FSharpChoice$3<T1, T2, T3, Tag extends keyof FSharpChoice$3_$cases<T1, T2, T3>> extends Union<Tag, FSharpChoice$3_$cases<T1, T2, T3>[Tag][0]> {
28
+ readonly tag: Tag;
29
+ readonly fields: FSharpChoice$3_$cases<T1, T2, T3>[Tag][1];
30
+ constructor(tag: Tag, fields: FSharpChoice$3_$cases<T1, T2, T3>[Tag][1]);
31
+ cases(): string[];
32
+ }
33
+ export declare function FSharpChoice$3_$reflection(gen0: TypeInfo, gen1: TypeInfo, gen2: TypeInfo): TypeInfo;
34
+ export type FSharpChoice$4_$union<T1, T2, T3, T4> = FSharpChoice$4<T1, T2, T3, T4, 0> | FSharpChoice$4<T1, T2, T3, T4, 1> | FSharpChoice$4<T1, T2, T3, T4, 2> | FSharpChoice$4<T1, T2, T3, T4, 3>;
35
+ export type FSharpChoice$4_$cases<T1, T2, T3, T4> = {
36
+ 0: ["Choice1Of4", [T1]];
37
+ 1: ["Choice2Of4", [T2]];
38
+ 2: ["Choice3Of4", [T3]];
39
+ 3: ["Choice4Of4", [T4]];
40
+ };
41
+ export declare function FSharpChoice$4_Choice1Of4<T1, T2, T3, T4>(Item: T1): FSharpChoice$4<T1, T2, T3, T4, 0>;
42
+ export declare function FSharpChoice$4_Choice2Of4<T1, T2, T3, T4>(Item: T2): FSharpChoice$4<T1, T2, T3, T4, 1>;
43
+ export declare function FSharpChoice$4_Choice3Of4<T1, T2, T3, T4>(Item: T3): FSharpChoice$4<T1, T2, T3, T4, 2>;
44
+ export declare function FSharpChoice$4_Choice4Of4<T1, T2, T3, T4>(Item: T4): FSharpChoice$4<T1, T2, T3, T4, 3>;
45
+ export declare class FSharpChoice$4<T1, T2, T3, T4, Tag extends keyof FSharpChoice$4_$cases<T1, T2, T3, T4>> extends Union<Tag, FSharpChoice$4_$cases<T1, T2, T3, T4>[Tag][0]> {
46
+ readonly tag: Tag;
47
+ readonly fields: FSharpChoice$4_$cases<T1, T2, T3, T4>[Tag][1];
48
+ constructor(tag: Tag, fields: FSharpChoice$4_$cases<T1, T2, T3, T4>[Tag][1]);
49
+ cases(): string[];
50
+ }
51
+ export declare function FSharpChoice$4_$reflection(gen0: TypeInfo, gen1: TypeInfo, gen2: TypeInfo, gen3: TypeInfo): TypeInfo;
52
+ export type FSharpChoice$5_$union<T1, T2, T3, T4, T5> = FSharpChoice$5<T1, T2, T3, T4, T5, 0> | FSharpChoice$5<T1, T2, T3, T4, T5, 1> | FSharpChoice$5<T1, T2, T3, T4, T5, 2> | FSharpChoice$5<T1, T2, T3, T4, T5, 3> | FSharpChoice$5<T1, T2, T3, T4, T5, 4>;
53
+ export type FSharpChoice$5_$cases<T1, T2, T3, T4, T5> = {
54
+ 0: ["Choice1Of5", [T1]];
55
+ 1: ["Choice2Of5", [T2]];
56
+ 2: ["Choice3Of5", [T3]];
57
+ 3: ["Choice4Of5", [T4]];
58
+ 4: ["Choice5Of5", [T5]];
59
+ };
60
+ export declare function FSharpChoice$5_Choice1Of5<T1, T2, T3, T4, T5>(Item: T1): FSharpChoice$5<T1, T2, T3, T4, T5, 0>;
61
+ export declare function FSharpChoice$5_Choice2Of5<T1, T2, T3, T4, T5>(Item: T2): FSharpChoice$5<T1, T2, T3, T4, T5, 1>;
62
+ export declare function FSharpChoice$5_Choice3Of5<T1, T2, T3, T4, T5>(Item: T3): FSharpChoice$5<T1, T2, T3, T4, T5, 2>;
63
+ export declare function FSharpChoice$5_Choice4Of5<T1, T2, T3, T4, T5>(Item: T4): FSharpChoice$5<T1, T2, T3, T4, T5, 3>;
64
+ export declare function FSharpChoice$5_Choice5Of5<T1, T2, T3, T4, T5>(Item: T5): FSharpChoice$5<T1, T2, T3, T4, T5, 4>;
65
+ export declare class FSharpChoice$5<T1, T2, T3, T4, T5, Tag extends keyof FSharpChoice$5_$cases<T1, T2, T3, T4, T5>> extends Union<Tag, FSharpChoice$5_$cases<T1, T2, T3, T4, T5>[Tag][0]> {
66
+ readonly tag: Tag;
67
+ readonly fields: FSharpChoice$5_$cases<T1, T2, T3, T4, T5>[Tag][1];
68
+ constructor(tag: Tag, fields: FSharpChoice$5_$cases<T1, T2, T3, T4, T5>[Tag][1]);
69
+ cases(): string[];
70
+ }
71
+ export declare function FSharpChoice$5_$reflection(gen0: TypeInfo, gen1: TypeInfo, gen2: TypeInfo, gen3: TypeInfo, gen4: TypeInfo): TypeInfo;
72
+ export type FSharpChoice$6_$union<T1, T2, T3, T4, T5, T6> = FSharpChoice$6<T1, T2, T3, T4, T5, T6, 0> | FSharpChoice$6<T1, T2, T3, T4, T5, T6, 1> | FSharpChoice$6<T1, T2, T3, T4, T5, T6, 2> | FSharpChoice$6<T1, T2, T3, T4, T5, T6, 3> | FSharpChoice$6<T1, T2, T3, T4, T5, T6, 4> | FSharpChoice$6<T1, T2, T3, T4, T5, T6, 5>;
73
+ export type FSharpChoice$6_$cases<T1, T2, T3, T4, T5, T6> = {
74
+ 0: ["Choice1Of6", [T1]];
75
+ 1: ["Choice2Of6", [T2]];
76
+ 2: ["Choice3Of6", [T3]];
77
+ 3: ["Choice4Of6", [T4]];
78
+ 4: ["Choice5Of6", [T5]];
79
+ 5: ["Choice6Of6", [T6]];
80
+ };
81
+ export declare function FSharpChoice$6_Choice1Of6<T1, T2, T3, T4, T5, T6>(Item: T1): FSharpChoice$6<T1, T2, T3, T4, T5, T6, 0>;
82
+ export declare function FSharpChoice$6_Choice2Of6<T1, T2, T3, T4, T5, T6>(Item: T2): FSharpChoice$6<T1, T2, T3, T4, T5, T6, 1>;
83
+ export declare function FSharpChoice$6_Choice3Of6<T1, T2, T3, T4, T5, T6>(Item: T3): FSharpChoice$6<T1, T2, T3, T4, T5, T6, 2>;
84
+ export declare function FSharpChoice$6_Choice4Of6<T1, T2, T3, T4, T5, T6>(Item: T4): FSharpChoice$6<T1, T2, T3, T4, T5, T6, 3>;
85
+ export declare function FSharpChoice$6_Choice5Of6<T1, T2, T3, T4, T5, T6>(Item: T5): FSharpChoice$6<T1, T2, T3, T4, T5, T6, 4>;
86
+ export declare function FSharpChoice$6_Choice6Of6<T1, T2, T3, T4, T5, T6>(Item: T6): FSharpChoice$6<T1, T2, T3, T4, T5, T6, 5>;
87
+ export declare class FSharpChoice$6<T1, T2, T3, T4, T5, T6, Tag extends keyof FSharpChoice$6_$cases<T1, T2, T3, T4, T5, T6>> extends Union<Tag, FSharpChoice$6_$cases<T1, T2, T3, T4, T5, T6>[Tag][0]> {
88
+ readonly tag: Tag;
89
+ readonly fields: FSharpChoice$6_$cases<T1, T2, T3, T4, T5, T6>[Tag][1];
90
+ constructor(tag: Tag, fields: FSharpChoice$6_$cases<T1, T2, T3, T4, T5, T6>[Tag][1]);
91
+ cases(): string[];
92
+ }
93
+ export declare function FSharpChoice$6_$reflection(gen0: TypeInfo, gen1: TypeInfo, gen2: TypeInfo, gen3: TypeInfo, gen4: TypeInfo, gen5: TypeInfo): TypeInfo;
94
+ export type FSharpChoice$7_$union<T1, T2, T3, T4, T5, T6, T7> = FSharpChoice$7<T1, T2, T3, T4, T5, T6, T7, 0> | FSharpChoice$7<T1, T2, T3, T4, T5, T6, T7, 1> | FSharpChoice$7<T1, T2, T3, T4, T5, T6, T7, 2> | FSharpChoice$7<T1, T2, T3, T4, T5, T6, T7, 3> | FSharpChoice$7<T1, T2, T3, T4, T5, T6, T7, 4> | FSharpChoice$7<T1, T2, T3, T4, T5, T6, T7, 5> | FSharpChoice$7<T1, T2, T3, T4, T5, T6, T7, 6>;
95
+ export type FSharpChoice$7_$cases<T1, T2, T3, T4, T5, T6, T7> = {
96
+ 0: ["Choice1Of7", [T1]];
97
+ 1: ["Choice2Of7", [T2]];
98
+ 2: ["Choice3Of7", [T3]];
99
+ 3: ["Choice4Of7", [T4]];
100
+ 4: ["Choice5Of7", [T5]];
101
+ 5: ["Choice6Of7", [T6]];
102
+ 6: ["Choice7Of7", [T7]];
103
+ };
104
+ export declare function FSharpChoice$7_Choice1Of7<T1, T2, T3, T4, T5, T6, T7>(Item: T1): FSharpChoice$7<T1, T2, T3, T4, T5, T6, T7, 0>;
105
+ export declare function FSharpChoice$7_Choice2Of7<T1, T2, T3, T4, T5, T6, T7>(Item: T2): FSharpChoice$7<T1, T2, T3, T4, T5, T6, T7, 1>;
106
+ export declare function FSharpChoice$7_Choice3Of7<T1, T2, T3, T4, T5, T6, T7>(Item: T3): FSharpChoice$7<T1, T2, T3, T4, T5, T6, T7, 2>;
107
+ export declare function FSharpChoice$7_Choice4Of7<T1, T2, T3, T4, T5, T6, T7>(Item: T4): FSharpChoice$7<T1, T2, T3, T4, T5, T6, T7, 3>;
108
+ export declare function FSharpChoice$7_Choice5Of7<T1, T2, T3, T4, T5, T6, T7>(Item: T5): FSharpChoice$7<T1, T2, T3, T4, T5, T6, T7, 4>;
109
+ export declare function FSharpChoice$7_Choice6Of7<T1, T2, T3, T4, T5, T6, T7>(Item: T6): FSharpChoice$7<T1, T2, T3, T4, T5, T6, T7, 5>;
110
+ export declare function FSharpChoice$7_Choice7Of7<T1, T2, T3, T4, T5, T6, T7>(Item: T7): FSharpChoice$7<T1, T2, T3, T4, T5, T6, T7, 6>;
111
+ export declare class FSharpChoice$7<T1, T2, T3, T4, T5, T6, T7, Tag extends keyof FSharpChoice$7_$cases<T1, T2, T3, T4, T5, T6, T7>> extends Union<Tag, FSharpChoice$7_$cases<T1, T2, T3, T4, T5, T6, T7>[Tag][0]> {
112
+ readonly tag: Tag;
113
+ readonly fields: FSharpChoice$7_$cases<T1, T2, T3, T4, T5, T6, T7>[Tag][1];
114
+ constructor(tag: Tag, fields: FSharpChoice$7_$cases<T1, T2, T3, T4, T5, T6, T7>[Tag][1]);
115
+ cases(): string[];
116
+ }
117
+ export declare function FSharpChoice$7_$reflection(gen0: TypeInfo, gen1: TypeInfo, gen2: TypeInfo, gen3: TypeInfo, gen4: TypeInfo, gen5: TypeInfo, gen6: TypeInfo): TypeInfo;
118
+ export declare function Choice_makeChoice1Of2<T1, a>(x: T1): FSharpChoice$2_$union<T1, a>;
119
+ export declare function Choice_makeChoice2Of2<T2, a>(x: T2): FSharpChoice$2_$union<a, T2>;
120
+ export declare function Choice_tryValueIfChoice1Of2<T1, T2>(x: FSharpChoice$2_$union<T1, T2>): Option<T1>;
121
+ export declare function Choice_tryValueIfChoice2Of2<T1, T2>(x: FSharpChoice$2_$union<T1, T2>): Option<T2>;
@@ -0,0 +1,184 @@
1
+ import { Union } from "./Types.js";
2
+ import { union_type } from "./Reflection.js";
3
+ import { some } from "./Option.js";
4
+ export function FSharpChoice$2_Choice1Of2(Item) {
5
+ return new FSharpChoice$2(0, [Item]);
6
+ }
7
+ export function FSharpChoice$2_Choice2Of2(Item) {
8
+ return new FSharpChoice$2(1, [Item]);
9
+ }
10
+ export class FSharpChoice$2 extends Union {
11
+ constructor(tag, fields) {
12
+ super();
13
+ this.tag = tag;
14
+ this.fields = fields;
15
+ }
16
+ cases() {
17
+ return ["Choice1Of2", "Choice2Of2"];
18
+ }
19
+ }
20
+ export function FSharpChoice$2_$reflection(gen0, gen1) {
21
+ return union_type("FSharp.Core.FSharpChoice`2", [gen0, gen1], FSharpChoice$2, () => [[["Item", gen0]], [["Item", gen1]]]);
22
+ }
23
+ export function FSharpChoice$3_Choice1Of3(Item) {
24
+ return new FSharpChoice$3(0, [Item]);
25
+ }
26
+ export function FSharpChoice$3_Choice2Of3(Item) {
27
+ return new FSharpChoice$3(1, [Item]);
28
+ }
29
+ export function FSharpChoice$3_Choice3Of3(Item) {
30
+ return new FSharpChoice$3(2, [Item]);
31
+ }
32
+ export class FSharpChoice$3 extends Union {
33
+ constructor(tag, fields) {
34
+ super();
35
+ this.tag = tag;
36
+ this.fields = fields;
37
+ }
38
+ cases() {
39
+ return ["Choice1Of3", "Choice2Of3", "Choice3Of3"];
40
+ }
41
+ }
42
+ export function FSharpChoice$3_$reflection(gen0, gen1, gen2) {
43
+ return union_type("FSharp.Core.FSharpChoice`3", [gen0, gen1, gen2], FSharpChoice$3, () => [[["Item", gen0]], [["Item", gen1]], [["Item", gen2]]]);
44
+ }
45
+ export function FSharpChoice$4_Choice1Of4(Item) {
46
+ return new FSharpChoice$4(0, [Item]);
47
+ }
48
+ export function FSharpChoice$4_Choice2Of4(Item) {
49
+ return new FSharpChoice$4(1, [Item]);
50
+ }
51
+ export function FSharpChoice$4_Choice3Of4(Item) {
52
+ return new FSharpChoice$4(2, [Item]);
53
+ }
54
+ export function FSharpChoice$4_Choice4Of4(Item) {
55
+ return new FSharpChoice$4(3, [Item]);
56
+ }
57
+ export class FSharpChoice$4 extends Union {
58
+ constructor(tag, fields) {
59
+ super();
60
+ this.tag = tag;
61
+ this.fields = fields;
62
+ }
63
+ cases() {
64
+ return ["Choice1Of4", "Choice2Of4", "Choice3Of4", "Choice4Of4"];
65
+ }
66
+ }
67
+ export function FSharpChoice$4_$reflection(gen0, gen1, gen2, gen3) {
68
+ return union_type("FSharp.Core.FSharpChoice`4", [gen0, gen1, gen2, gen3], FSharpChoice$4, () => [[["Item", gen0]], [["Item", gen1]], [["Item", gen2]], [["Item", gen3]]]);
69
+ }
70
+ export function FSharpChoice$5_Choice1Of5(Item) {
71
+ return new FSharpChoice$5(0, [Item]);
72
+ }
73
+ export function FSharpChoice$5_Choice2Of5(Item) {
74
+ return new FSharpChoice$5(1, [Item]);
75
+ }
76
+ export function FSharpChoice$5_Choice3Of5(Item) {
77
+ return new FSharpChoice$5(2, [Item]);
78
+ }
79
+ export function FSharpChoice$5_Choice4Of5(Item) {
80
+ return new FSharpChoice$5(3, [Item]);
81
+ }
82
+ export function FSharpChoice$5_Choice5Of5(Item) {
83
+ return new FSharpChoice$5(4, [Item]);
84
+ }
85
+ export class FSharpChoice$5 extends Union {
86
+ constructor(tag, fields) {
87
+ super();
88
+ this.tag = tag;
89
+ this.fields = fields;
90
+ }
91
+ cases() {
92
+ return ["Choice1Of5", "Choice2Of5", "Choice3Of5", "Choice4Of5", "Choice5Of5"];
93
+ }
94
+ }
95
+ export function FSharpChoice$5_$reflection(gen0, gen1, gen2, gen3, gen4) {
96
+ return union_type("FSharp.Core.FSharpChoice`5", [gen0, gen1, gen2, gen3, gen4], FSharpChoice$5, () => [[["Item", gen0]], [["Item", gen1]], [["Item", gen2]], [["Item", gen3]], [["Item", gen4]]]);
97
+ }
98
+ export function FSharpChoice$6_Choice1Of6(Item) {
99
+ return new FSharpChoice$6(0, [Item]);
100
+ }
101
+ export function FSharpChoice$6_Choice2Of6(Item) {
102
+ return new FSharpChoice$6(1, [Item]);
103
+ }
104
+ export function FSharpChoice$6_Choice3Of6(Item) {
105
+ return new FSharpChoice$6(2, [Item]);
106
+ }
107
+ export function FSharpChoice$6_Choice4Of6(Item) {
108
+ return new FSharpChoice$6(3, [Item]);
109
+ }
110
+ export function FSharpChoice$6_Choice5Of6(Item) {
111
+ return new FSharpChoice$6(4, [Item]);
112
+ }
113
+ export function FSharpChoice$6_Choice6Of6(Item) {
114
+ return new FSharpChoice$6(5, [Item]);
115
+ }
116
+ export class FSharpChoice$6 extends Union {
117
+ constructor(tag, fields) {
118
+ super();
119
+ this.tag = tag;
120
+ this.fields = fields;
121
+ }
122
+ cases() {
123
+ return ["Choice1Of6", "Choice2Of6", "Choice3Of6", "Choice4Of6", "Choice5Of6", "Choice6Of6"];
124
+ }
125
+ }
126
+ export function FSharpChoice$6_$reflection(gen0, gen1, gen2, gen3, gen4, gen5) {
127
+ return union_type("FSharp.Core.FSharpChoice`6", [gen0, gen1, gen2, gen3, gen4, gen5], FSharpChoice$6, () => [[["Item", gen0]], [["Item", gen1]], [["Item", gen2]], [["Item", gen3]], [["Item", gen4]], [["Item", gen5]]]);
128
+ }
129
+ export function FSharpChoice$7_Choice1Of7(Item) {
130
+ return new FSharpChoice$7(0, [Item]);
131
+ }
132
+ export function FSharpChoice$7_Choice2Of7(Item) {
133
+ return new FSharpChoice$7(1, [Item]);
134
+ }
135
+ export function FSharpChoice$7_Choice3Of7(Item) {
136
+ return new FSharpChoice$7(2, [Item]);
137
+ }
138
+ export function FSharpChoice$7_Choice4Of7(Item) {
139
+ return new FSharpChoice$7(3, [Item]);
140
+ }
141
+ export function FSharpChoice$7_Choice5Of7(Item) {
142
+ return new FSharpChoice$7(4, [Item]);
143
+ }
144
+ export function FSharpChoice$7_Choice6Of7(Item) {
145
+ return new FSharpChoice$7(5, [Item]);
146
+ }
147
+ export function FSharpChoice$7_Choice7Of7(Item) {
148
+ return new FSharpChoice$7(6, [Item]);
149
+ }
150
+ export class FSharpChoice$7 extends Union {
151
+ constructor(tag, fields) {
152
+ super();
153
+ this.tag = tag;
154
+ this.fields = fields;
155
+ }
156
+ cases() {
157
+ return ["Choice1Of7", "Choice2Of7", "Choice3Of7", "Choice4Of7", "Choice5Of7", "Choice6Of7", "Choice7Of7"];
158
+ }
159
+ }
160
+ export function FSharpChoice$7_$reflection(gen0, gen1, gen2, gen3, gen4, gen5, gen6) {
161
+ return union_type("FSharp.Core.FSharpChoice`7", [gen0, gen1, gen2, gen3, gen4, gen5, gen6], FSharpChoice$7, () => [[["Item", gen0]], [["Item", gen1]], [["Item", gen2]], [["Item", gen3]], [["Item", gen4]], [["Item", gen5]], [["Item", gen6]]]);
162
+ }
163
+ export function Choice_makeChoice1Of2(x) {
164
+ return FSharpChoice$2_Choice1Of2(x);
165
+ }
166
+ export function Choice_makeChoice2Of2(x) {
167
+ return FSharpChoice$2_Choice2Of2(x);
168
+ }
169
+ export function Choice_tryValueIfChoice1Of2(x) {
170
+ if (x.tag === /* Choice1Of2 */ 0) {
171
+ return some(x.fields[0]);
172
+ }
173
+ else {
174
+ return undefined;
175
+ }
176
+ }
177
+ export function Choice_tryValueIfChoice2Of2(x) {
178
+ if (x.tag === /* Choice2Of2 */ 1) {
179
+ return some(x.fields[0]);
180
+ }
181
+ else {
182
+ return undefined;
183
+ }
184
+ }
@@ -0,0 +1,7 @@
1
+ export declare function count<T>(col: Iterable<T>): number;
2
+ export declare function isReadOnly<T>(col: Iterable<T>): boolean;
3
+ export declare function copyTo<T>(col: Iterable<T>, array: T[], arrayIndex: number): void;
4
+ export declare function contains<T>(col: Iterable<T>, item: T): boolean;
5
+ export declare function add<T>(col: Iterable<T>, item: T): void;
6
+ export declare function remove<T>(col: Iterable<T>, item: T): boolean;
7
+ export declare function clear<T>(col: Iterable<T>): void;
@@ -0,0 +1,182 @@
1
+ import { equals, isArrayLike } from "./Util.js";
2
+ export function count(col) {
3
+ if (typeof col["System.Collections.Generic.ICollection`1.get_Count"] === "function") {
4
+ return col["System.Collections.Generic.ICollection`1.get_Count"](); // collection
5
+ }
6
+ else {
7
+ if (typeof col["System.Collections.Generic.IReadOnlyCollection`1.get_Count"] === "function") {
8
+ return col["System.Collections.Generic.IReadOnlyCollection`1.get_Count"](); // collection
9
+ }
10
+ else {
11
+ if (isArrayLike(col)) {
12
+ return col.length; // array, resize array
13
+ }
14
+ else {
15
+ if (typeof col.size === "number") {
16
+ return col.size; // map, set
17
+ }
18
+ else {
19
+ let count = 0;
20
+ for (const _ of col) {
21
+ count++;
22
+ }
23
+ return count; // other collections
24
+ }
25
+ }
26
+ }
27
+ }
28
+ }
29
+ export function isReadOnly(col) {
30
+ if (typeof col["System.Collections.Generic.ICollection`1.get_IsReadOnly"] === "function") {
31
+ return col["System.Collections.Generic.ICollection`1.get_IsReadOnly"](); // collection
32
+ }
33
+ else {
34
+ if (isArrayLike(col)) {
35
+ return ArrayBuffer.isView(col); // true for typed arrays, false for other arrays
36
+ }
37
+ else {
38
+ if (typeof col.size === "number") {
39
+ return false; // map, set
40
+ }
41
+ else {
42
+ return true; // other collections
43
+ }
44
+ }
45
+ }
46
+ }
47
+ export function copyTo(col, array, arrayIndex) {
48
+ if (typeof col["System.Collections.Generic.ICollection`1.CopyToZ3B4C077E"] === "function") {
49
+ col["System.Collections.Generic.ICollection`1.CopyToZ3B4C077E"](array, arrayIndex); // collection
50
+ }
51
+ else {
52
+ let i = arrayIndex;
53
+ for (const v of col) {
54
+ array[i] = v;
55
+ i++;
56
+ }
57
+ }
58
+ }
59
+ export function contains(col, item) {
60
+ if (typeof col["System.Collections.Generic.ICollection`1.Contains2B595"] === "function") {
61
+ return col["System.Collections.Generic.ICollection`1.Contains2B595"](item); // collection
62
+ }
63
+ else {
64
+ if (isArrayLike(col)) {
65
+ let i = col.findIndex(x => equals(x, item)); // array, resize array
66
+ return i >= 0;
67
+ }
68
+ else {
69
+ if (typeof col.has === "function") {
70
+ if (typeof col.set === "function" && isArrayLike(item)) {
71
+ return col.has(item[0]) && equals(col.get(item[0]), item[1]); // map
72
+ }
73
+ else {
74
+ return col.has(item); // set
75
+ }
76
+ }
77
+ else {
78
+ return false; // other collections
79
+ }
80
+ }
81
+ }
82
+ }
83
+ export function add(col, item) {
84
+ if (typeof col["System.Collections.Generic.ICollection`1.Add2B595"] === "function") {
85
+ return col["System.Collections.Generic.ICollection`1.Add2B595"](item); // collection
86
+ }
87
+ else {
88
+ if (isArrayLike(col)) {
89
+ if (ArrayBuffer.isView(col)) {
90
+ // TODO: throw for typed arrays?
91
+ }
92
+ else {
93
+ col.push(item); // array, resize array
94
+ }
95
+ }
96
+ else {
97
+ if (typeof col.add === "function") {
98
+ return col.add(item); // set
99
+ }
100
+ else {
101
+ if (typeof col.has === "function"
102
+ && typeof col.set === "function"
103
+ && isArrayLike(item)) {
104
+ if (col.has(item[0]) === false) {
105
+ col.set(item[0], item[1]); // map
106
+ }
107
+ else {
108
+ throw new Error("An item with the same key has already been added. Key: " + item[0]);
109
+ }
110
+ }
111
+ else {
112
+ // TODO: throw for other collections?
113
+ }
114
+ }
115
+ }
116
+ }
117
+ }
118
+ export function remove(col, item) {
119
+ if (typeof col["System.Collections.Generic.ICollection`1.Remove2B595"] === "function") {
120
+ return col["System.Collections.Generic.ICollection`1.Remove2B595"](item); // collection
121
+ }
122
+ else {
123
+ if (isArrayLike(col)) {
124
+ if (ArrayBuffer.isView(col)) {
125
+ // TODO: throw for typed arrays
126
+ return false;
127
+ }
128
+ else {
129
+ let i = col.findIndex(x => equals(x, item));
130
+ if (i >= 0) {
131
+ col.splice(i, 1); // array, resize array
132
+ return true;
133
+ }
134
+ else {
135
+ return false;
136
+ }
137
+ }
138
+ }
139
+ else {
140
+ if (typeof col.delete === "function") {
141
+ if (typeof col.set === "function" && isArrayLike(item)) {
142
+ if (col.has(item[0]) && equals(col.get(item[0]), item[1])) {
143
+ return col.delete(item[0]); // map
144
+ }
145
+ else {
146
+ return false;
147
+ }
148
+ }
149
+ else {
150
+ return col.delete(item); // set
151
+ }
152
+ }
153
+ else {
154
+ // TODO: throw for other collections?
155
+ return false; // other collections
156
+ }
157
+ }
158
+ }
159
+ }
160
+ export function clear(col) {
161
+ if (typeof col["System.Collections.Generic.ICollection`1.Clear"] === "function") {
162
+ return col["System.Collections.Generic.ICollection`1.Clear"](); // collection
163
+ }
164
+ else {
165
+ if (isArrayLike(col)) {
166
+ if (ArrayBuffer.isView(col)) {
167
+ // TODO: throw for typed arrays?
168
+ }
169
+ else {
170
+ col.splice(0); // array, resize array
171
+ }
172
+ }
173
+ else {
174
+ if (typeof col.clear === "function") {
175
+ col.clear(); // map, set
176
+ }
177
+ else {
178
+ // TODO: throw for other collections?
179
+ }
180
+ }
181
+ }
182
+ }
@@ -0,0 +1,9 @@
1
+ export declare class ConditionalWeakTable<TKey extends object, TValue> {
2
+ private weakMap;
3
+ delete(key: TKey): boolean;
4
+ get(key: TKey): TValue | undefined;
5
+ has(key: TKey): boolean;
6
+ set(key: TKey, value: TValue): WeakMap<TKey, TValue>;
7
+ clear(): void;
8
+ }
9
+ export default ConditionalWeakTable;