compostjs 0.0.11 → 0.1.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/dist/compost.js +34 -28
- package/dist/core.js +94 -73
- package/dist/fable_modules/fable-library-js.4.28.0/Array.d.ts +123 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Array.js +1242 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Async.d.ts +26 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Async.js +145 -0
- package/dist/fable_modules/fable-library-js.4.28.0/AsyncBuilder.d.ts +59 -0
- package/dist/fable_modules/fable-library-js.4.28.0/AsyncBuilder.js +183 -0
- package/dist/fable_modules/fable-library-js.4.28.0/BigInt.d.ts +115 -0
- package/dist/fable_modules/fable-library-js.4.28.0/BigInt.js +283 -0
- package/dist/fable_modules/fable-library-js.4.28.0/BitConverter.d.ts +27 -0
- package/dist/fable_modules/fable-library-js.4.28.0/BitConverter.js +138 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Boolean.d.ts +3 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Boolean.js +21 -0
- package/dist/fable_modules/fable-library-js.4.28.0/CHANGELOG.md +100 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Char.d.ts +65 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Char.js +169 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Choice.d.ts +121 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Choice.js +184 -0
- package/dist/fable_modules/fable-library-js.4.28.0/CollectionUtil.d.ts +7 -0
- package/dist/fable_modules/fable-library-js.4.28.0/CollectionUtil.js +182 -0
- package/dist/fable_modules/fable-library-js.4.28.0/ConditionalWeakTable.d.ts +9 -0
- package/dist/fable_modules/fable-library-js.4.28.0/ConditionalWeakTable.js +21 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Date.d.ts +70 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Date.js +748 -0
- package/dist/fable_modules/fable-library-js.4.28.0/DateOffset.d.ts +63 -0
- package/dist/fable_modules/fable-library-js.4.28.0/DateOffset.js +268 -0
- package/dist/fable_modules/fable-library-js.4.28.0/DateOnly.d.ts +18 -0
- package/dist/fable_modules/fable-library-js.4.28.0/DateOnly.js +124 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Decimal.d.ts +45 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Decimal.js +212 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Double.d.ts +11 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Double.js +46 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Encoding.d.ts +12 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Encoding.js +173 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Event.d.ts +31 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Event.js +93 -0
- package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Collections.d.ts +7 -0
- package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Collections.js +27 -0
- package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Core.CompilerServices.d.ts +12 -0
- package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Core.CompilerServices.js +27 -0
- package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Core.d.ts +17 -0
- package/dist/fable_modules/fable-library-js.4.28.0/FSharp.Core.js +69 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Global.d.ts +24 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Global.js +8 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Guid.d.ts +10 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Guid.js +142 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Int32.d.ts +28 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Int32.js +135 -0
- package/dist/fable_modules/fable-library-js.4.28.0/List.d.ts +143 -0
- package/dist/fable_modules/fable-library-js.4.28.0/List.js +1273 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Long.d.ts +3 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Long.js +46 -0
- package/dist/fable_modules/fable-library-js.4.28.0/MailboxProcessor.d.ts +25 -0
- package/dist/fable_modules/fable-library-js.4.28.0/MailboxProcessor.js +93 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Map.d.ts +178 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Map.js +1396 -0
- package/dist/fable_modules/fable-library-js.4.28.0/MapUtil.d.ts +12 -0
- package/dist/fable_modules/fable-library-js.4.28.0/MapUtil.js +127 -0
- package/dist/fable_modules/fable-library-js.4.28.0/MutableMap.d.ts +52 -0
- package/dist/fable_modules/fable-library-js.4.28.0/MutableMap.js +327 -0
- package/dist/fable_modules/fable-library-js.4.28.0/MutableSet.d.ts +39 -0
- package/dist/fable_modules/fable-library-js.4.28.0/MutableSet.js +233 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Native.d.ts +2 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Native.js +8 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Numeric.d.ts +19 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Numeric.js +71 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Observable.d.ts +32 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Observable.js +113 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Option.d.ts +28 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Option.js +96 -0
- package/dist/fable_modules/fable-library-js.4.28.0/README.md +3 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Random.d.ts +37 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Random.js +170 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Range.d.ts +12 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Range.js +45 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Reflection.d.ts +119 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Reflection.js +461 -0
- package/dist/fable_modules/fable-library-js.4.28.0/RegExp.d.ts +10 -0
- package/dist/fable_modules/fable-library-js.4.28.0/RegExp.js +131 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Result.d.ts +37 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Result.js +165 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Seq.d.ts +165 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Seq.js +1378 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Seq2.d.ts +18 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Seq2.js +111 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Set.d.ts +190 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Set.js +1789 -0
- package/dist/fable_modules/fable-library-js.4.28.0/String.d.ts +58 -0
- package/dist/fable_modules/fable-library-js.4.28.0/String.js +554 -0
- package/dist/fable_modules/fable-library-js.4.28.0/System.Collections.Generic.d.ts +79 -0
- package/dist/fable_modules/fable-library-js.4.28.0/System.Collections.Generic.js +317 -0
- package/dist/fable_modules/fable-library-js.4.28.0/System.Text.d.ts +38 -0
- package/dist/fable_modules/fable-library-js.4.28.0/System.Text.js +162 -0
- package/dist/fable_modules/fable-library-js.4.28.0/SystemException.d.ts +5 -0
- package/dist/fable_modules/fable-library-js.4.28.0/SystemException.js +5 -0
- package/dist/fable_modules/fable-library-js.4.28.0/TimeOnly.d.ts +15 -0
- package/dist/fable_modules/fable-library-js.4.28.0/TimeOnly.js +122 -0
- package/dist/fable_modules/fable-library-js.4.28.0/TimeSpan.d.ts +34 -0
- package/dist/fable_modules/fable-library-js.4.28.0/TimeSpan.js +177 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Timer.d.ts +19 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Timer.js +67 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Types.d.ts +58 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Types.js +208 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Unicode.13.0.0.d.ts +2 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Unicode.13.0.0.js +4 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Uri.d.ts +31 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Uri.js +159 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Util.d.ts +210 -0
- package/dist/fable_modules/fable-library-js.4.28.0/Util.js +769 -0
- package/dist/fable_modules/fable-library-js.4.28.0/big.d.ts +338 -0
- package/dist/fable_modules/fable-library-js.4.28.0/lib/big.d.ts +5 -0
- package/dist/fable_modules/fable-library-js.4.28.0/lib/big.js +825 -0
- package/dist/fable_modules/fable-library-js.4.28.0/package.json +24 -0
- package/dist/fable_modules/project_cracked.json +1 -0
- package/package.json +5 -4
- package/.claude/settings.local.json +0 -11
- package/copy-latest.sh +0 -1
- package/dist/fable-library.2.10.1/Array.js +0 -1336
- package/dist/fable-library.2.10.1/Async.js +0 -121
- package/dist/fable-library.2.10.1/AsyncBuilder.js +0 -200
- package/dist/fable-library.2.10.1/Date.js +0 -501
- package/dist/fable-library.2.10.1/Decimal.js +0 -208
- package/dist/fable-library.2.10.1/Event.js +0 -193
- package/dist/fable-library.2.10.1/Int32.js +0 -157
- package/dist/fable-library.2.10.1/List.js +0 -1234
- package/dist/fable-library.2.10.1/Long.js +0 -155
- package/dist/fable-library.2.10.1/Map.js +0 -1292
- package/dist/fable-library.2.10.1/MutableMap.js +0 -360
- package/dist/fable-library.2.10.1/MutableSet.js +0 -279
- package/dist/fable-library.2.10.1/Observable.js +0 -131
- package/dist/fable-library.2.10.1/Option.js +0 -118
- package/dist/fable-library.2.10.1/Reflection.js +0 -345
- package/dist/fable-library.2.10.1/RegExp.js +0 -118
- package/dist/fable-library.2.10.1/Seq.js +0 -917
- package/dist/fable-library.2.10.1/Set.js +0 -1692
- package/dist/fable-library.2.10.1/String.js +0 -679
- package/dist/fable-library.2.10.1/Types.js +0 -308
- package/dist/fable-library.2.10.1/Util.js +0 -761
- package/dist/helpers.js +0 -31
- package/dist/lib/big.js +0 -905
- package/dist/lib/long.js +0 -1375
- package/index.html +0 -49
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { fromParts, truncate } from "./Decimal.js";
|
|
2
|
+
import { bigintHash } from "./Util.js";
|
|
3
|
+
const isBigEndian = false;
|
|
4
|
+
BigInt.prototype.toJSON = function () {
|
|
5
|
+
return `${this.toString()}`;
|
|
6
|
+
};
|
|
7
|
+
const zero = 0n;
|
|
8
|
+
const one = 1n;
|
|
9
|
+
const two = 2n;
|
|
10
|
+
const minusOne = -1n;
|
|
11
|
+
export function isBigInt(x) {
|
|
12
|
+
return typeof x === "bigint";
|
|
13
|
+
}
|
|
14
|
+
export function hash(x) {
|
|
15
|
+
return bigintHash(x);
|
|
16
|
+
}
|
|
17
|
+
export function equals(x, y) {
|
|
18
|
+
return x === y;
|
|
19
|
+
}
|
|
20
|
+
export function compare(x, y) {
|
|
21
|
+
return x < y ? -1 : x > y ? 1 : 0;
|
|
22
|
+
}
|
|
23
|
+
export function abs(x) { return x < zero ? -x : x; }
|
|
24
|
+
export function sign(x) { return x < zero ? -1 : x > zero ? 1 : 0; }
|
|
25
|
+
export function max(x, y) { return x > y ? x : y; }
|
|
26
|
+
export function min(x, y) { return x < y ? x : y; }
|
|
27
|
+
export function maxMagnitude(x, y) { return abs(x) > abs(y) ? x : y; }
|
|
28
|
+
export function minMagnitude(x, y) { return abs(x) < abs(y) ? x : y; }
|
|
29
|
+
export function clamp(x, min, max) {
|
|
30
|
+
return x < min ? min : x > max ? max : x;
|
|
31
|
+
}
|
|
32
|
+
export function add(x, y) { return x + y; }
|
|
33
|
+
export function subtract(x, y) { return x - y; }
|
|
34
|
+
export function multiply(x, y) { return x * y; }
|
|
35
|
+
export function divide(x, y) { return x / y; }
|
|
36
|
+
export function remainder(x, y) { return x % y; }
|
|
37
|
+
export function negate(x) { return -x; }
|
|
38
|
+
export function op_UnaryNegation(x) { return -x; }
|
|
39
|
+
export function op_LogicalNot(x) { return ~x; }
|
|
40
|
+
export function op_UnaryPlus(x) { return x; }
|
|
41
|
+
export function op_Addition(x, y) { return x + y; }
|
|
42
|
+
export function op_Subtraction(x, y) { return x - y; }
|
|
43
|
+
export function op_Multiply(x, y) { return x * y; }
|
|
44
|
+
export function op_Division(x, y) { return x / y; }
|
|
45
|
+
export function op_Modulus(x, y) { return x % y; }
|
|
46
|
+
export function op_RightShift(x, n) { return x >> BigInt(n); }
|
|
47
|
+
export function op_LeftShift(x, n) { return x << BigInt(n); }
|
|
48
|
+
export function op_BitwiseAnd(x, y) { return x & y; }
|
|
49
|
+
export function op_BitwiseOr(x, y) { return x | y; }
|
|
50
|
+
export function op_ExclusiveOr(x, y) { return x ^ y; }
|
|
51
|
+
export function op_LessThan(x, y) { return x < y; }
|
|
52
|
+
export function op_LessThanOrEqual(x, y) { return x <= y; }
|
|
53
|
+
export function op_GreaterThan(x, y) { return x > y; }
|
|
54
|
+
export function op_GreaterThanOrEqual(x, y) { return x >= y; }
|
|
55
|
+
export function op_Equality(x, y) { return x === y; }
|
|
56
|
+
export function op_Inequality(x, y) { return x !== y; }
|
|
57
|
+
export function get_Zero() { return zero; }
|
|
58
|
+
export function get_One() { return one; }
|
|
59
|
+
export function get_MinusOne() { return minusOne; }
|
|
60
|
+
export function get_IsZero(x) { return x === zero; }
|
|
61
|
+
export function get_IsOne(x) { return x === one; }
|
|
62
|
+
export function get_IsEven(x) { return isEvenInteger(x); }
|
|
63
|
+
export function get_IsPowerOfTwo(x) { return isPow2(x); }
|
|
64
|
+
export function get_Sign(x) { return sign(x); }
|
|
65
|
+
export function isNegative(x) { return x < zero; }
|
|
66
|
+
export function isPositive(x) { return x > zero; }
|
|
67
|
+
export function isEvenInteger(x) { return (x % two) === zero; }
|
|
68
|
+
export function isOddInteger(x) { return (x % two) !== zero; }
|
|
69
|
+
export function isPow2(x) { return (x & (x - one)) === zero; }
|
|
70
|
+
export function fromZero() { return zero; }
|
|
71
|
+
export function fromOne() { return one; }
|
|
72
|
+
export function fromInt8(n) { return BigInt(n); }
|
|
73
|
+
export function fromUInt8(n) { return BigInt(n); }
|
|
74
|
+
export function fromInt16(n) { return BigInt(n); }
|
|
75
|
+
export function fromUInt16(n) { return BigInt(n); }
|
|
76
|
+
export function fromInt32(n) { return BigInt(n); }
|
|
77
|
+
export function fromUInt32(n) { return BigInt(n); }
|
|
78
|
+
export function fromInt64(n) { return n; }
|
|
79
|
+
export function fromUInt64(n) { return n; }
|
|
80
|
+
export function fromInt128(n) { return n; }
|
|
81
|
+
export function fromUInt128(n) { return n; }
|
|
82
|
+
export function fromNativeInt(n) { return n; }
|
|
83
|
+
export function fromUNativeInt(n) { return n; }
|
|
84
|
+
export function fromFloat16(n) { return BigInt(Math.trunc(n)); }
|
|
85
|
+
export function fromFloat32(n) { return BigInt(Math.trunc(n)); }
|
|
86
|
+
export function fromFloat64(n) { return BigInt(Math.trunc(n)); }
|
|
87
|
+
export function fromDecimal(d) { return BigInt(truncate(d).toString()); }
|
|
88
|
+
export function fromBigInt(x) { return x; }
|
|
89
|
+
export function fromBoolean(b) { return BigInt(b); }
|
|
90
|
+
export function fromChar(c) { return BigInt(c.charCodeAt(0)); }
|
|
91
|
+
export function fromString(s) { return BigInt(s); }
|
|
92
|
+
export function fromByteArray(bytes) {
|
|
93
|
+
return fromSignedBytes(bytes, isBigEndian);
|
|
94
|
+
}
|
|
95
|
+
export function toByteArray(value) {
|
|
96
|
+
return toSignedBytes(value, isBigEndian);
|
|
97
|
+
}
|
|
98
|
+
export function toInt8(x) { return Number(BigInt.asIntN(8, x)); }
|
|
99
|
+
export function toUInt8(x) { return Number(BigInt.asUintN(8, x)); }
|
|
100
|
+
export function toInt16(x) { return Number(BigInt.asIntN(16, x)); }
|
|
101
|
+
export function toUInt16(x) { return Number(BigInt.asUintN(16, x)); }
|
|
102
|
+
export function toInt32(x) { return Number(BigInt.asIntN(32, x)); }
|
|
103
|
+
export function toUInt32(x) { return Number(BigInt.asUintN(32, x)); }
|
|
104
|
+
export function toInt64(x) { return BigInt.asIntN(64, x); }
|
|
105
|
+
export function toUInt64(x) { return BigInt.asUintN(64, x); }
|
|
106
|
+
export function toInt128(x) { return BigInt.asIntN(128, x); }
|
|
107
|
+
export function toUInt128(x) { return BigInt.asUintN(128, x); }
|
|
108
|
+
export function toNativeInt(x) { return BigInt.asIntN(64, x); }
|
|
109
|
+
export function toUNativeInt(x) { return BigInt.asUintN(64, x); }
|
|
110
|
+
export function toFloat16(x) { return Number(x); }
|
|
111
|
+
export function toFloat32(x) { return Number(x); }
|
|
112
|
+
export function toFloat64(x) { return Number(x); }
|
|
113
|
+
export function toDecimal(x) {
|
|
114
|
+
const isNegative = x < zero;
|
|
115
|
+
const bits = abs(x);
|
|
116
|
+
const low = Number(BigInt.asUintN(32, bits));
|
|
117
|
+
const mid = Number(BigInt.asUintN(32, bits >> 32n));
|
|
118
|
+
const high = Number(BigInt.asUintN(32, bits >> 64n));
|
|
119
|
+
const scale = 0;
|
|
120
|
+
return fromParts(low, mid, high, isNegative, scale);
|
|
121
|
+
}
|
|
122
|
+
export function toBigInt(x) { return x; }
|
|
123
|
+
export function toBoolean(x) { return x !== zero; }
|
|
124
|
+
export function toChar(x) {
|
|
125
|
+
return String.fromCharCode(toUInt16(x));
|
|
126
|
+
}
|
|
127
|
+
export function toString(x) { return x.toString(); }
|
|
128
|
+
export function tryParse(s, res) {
|
|
129
|
+
try {
|
|
130
|
+
res.contents = BigInt(s);
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
export function parse(s) {
|
|
138
|
+
return BigInt(s);
|
|
139
|
+
}
|
|
140
|
+
export function pow(x, n) {
|
|
141
|
+
return x ** BigInt(n);
|
|
142
|
+
}
|
|
143
|
+
export function modPow(x, e, m) {
|
|
144
|
+
return (x ** e) % m;
|
|
145
|
+
}
|
|
146
|
+
export function divRem(x, y, out) {
|
|
147
|
+
const div = x / y;
|
|
148
|
+
const rem = x % y;
|
|
149
|
+
if (out === void 0) {
|
|
150
|
+
return [div, rem];
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
out.contents = rem;
|
|
154
|
+
return div;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
export function greatestCommonDivisor(x, y) {
|
|
158
|
+
while (y > zero) {
|
|
159
|
+
const q = x / y;
|
|
160
|
+
const r = x - q * y;
|
|
161
|
+
x = y;
|
|
162
|
+
y = r;
|
|
163
|
+
}
|
|
164
|
+
return x;
|
|
165
|
+
}
|
|
166
|
+
export function getBitLength(x) {
|
|
167
|
+
return fromFloat64(x === zero ? 1 : log2(abs(x)) + 1);
|
|
168
|
+
}
|
|
169
|
+
export function log2(x) {
|
|
170
|
+
const n = Number(x);
|
|
171
|
+
if (Number.isFinite(n))
|
|
172
|
+
return Math.log2(n); // fast path
|
|
173
|
+
if (x < zero)
|
|
174
|
+
return Number.NaN;
|
|
175
|
+
let shift = one;
|
|
176
|
+
while (x >= (one << shift)) {
|
|
177
|
+
shift = shift << one;
|
|
178
|
+
}
|
|
179
|
+
let log = zero;
|
|
180
|
+
while (shift > one) {
|
|
181
|
+
shift = shift >> one;
|
|
182
|
+
if (x >= (one << shift)) {
|
|
183
|
+
log = log + shift;
|
|
184
|
+
x = x >> shift;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return Number(log);
|
|
188
|
+
}
|
|
189
|
+
export function log10(x) {
|
|
190
|
+
return log2(x) * Math.log10(2);
|
|
191
|
+
}
|
|
192
|
+
export function ln(x) {
|
|
193
|
+
return log2(x) * Math.log(2);
|
|
194
|
+
}
|
|
195
|
+
export function log(x, base) {
|
|
196
|
+
return log2(x) / Math.log2(base);
|
|
197
|
+
}
|
|
198
|
+
export function ilog2(x) {
|
|
199
|
+
return BigInt(log2(x));
|
|
200
|
+
}
|
|
201
|
+
// export function copySign
|
|
202
|
+
// export function createChecked
|
|
203
|
+
// export function createSaturating
|
|
204
|
+
// export function createTruncating
|
|
205
|
+
// export function getByteCount
|
|
206
|
+
// export function leadingZeroCount
|
|
207
|
+
// export function popCount
|
|
208
|
+
// export function rotateLeft
|
|
209
|
+
// export function rotateRight
|
|
210
|
+
// export function trailingZeroCount
|
|
211
|
+
// export function tryFormat
|
|
212
|
+
// export function tryWriteBytes
|
|
213
|
+
// -------------------------------------------------
|
|
214
|
+
// Binary serialization
|
|
215
|
+
// -------------------------------------------------
|
|
216
|
+
const hexCodes = new Uint8Array([48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 97, 98, 99, 100, 101, 102]);
|
|
217
|
+
function fromHexCode(code) {
|
|
218
|
+
if (48 <= code && code <= 57)
|
|
219
|
+
return code - 48;
|
|
220
|
+
if (97 <= code && code <= 102)
|
|
221
|
+
return code - 97 + 10;
|
|
222
|
+
if (65 <= code && code <= 70)
|
|
223
|
+
return code - 65 + 10;
|
|
224
|
+
throw Error(`Invalid hex code: ${code}`);
|
|
225
|
+
}
|
|
226
|
+
function toSignedBytes(x, isBigEndian) {
|
|
227
|
+
const isNeg = x < 0n;
|
|
228
|
+
if (isNeg) {
|
|
229
|
+
const len = log2(-x);
|
|
230
|
+
const bits = len + (8 - len % 8);
|
|
231
|
+
const pow2 = (1n << BigInt(bits));
|
|
232
|
+
x = x + pow2; // two's complement
|
|
233
|
+
}
|
|
234
|
+
const hex = x.toString(16);
|
|
235
|
+
const len = hex.length;
|
|
236
|
+
const odd = len % 2;
|
|
237
|
+
const first = hex.charCodeAt(0);
|
|
238
|
+
const isLow = 48 <= first && first <= 55; // 0..7
|
|
239
|
+
const start = (isNeg && isLow) || (!isNeg && !isLow) ? 1 : 0;
|
|
240
|
+
const bytes = new Uint8Array(start + (len + odd) / 2);
|
|
241
|
+
const inc = isBigEndian ? 1 : -1;
|
|
242
|
+
let pos = isBigEndian ? 0 : bytes.length - 1;
|
|
243
|
+
if (start > 0) {
|
|
244
|
+
bytes[pos] = isNeg ? 255 : 0;
|
|
245
|
+
pos += inc;
|
|
246
|
+
}
|
|
247
|
+
if (odd > 0) {
|
|
248
|
+
bytes[pos] = fromHexCode(first);
|
|
249
|
+
pos += inc;
|
|
250
|
+
}
|
|
251
|
+
for (let i = odd; i < len; i += 2, pos += inc) {
|
|
252
|
+
const a = fromHexCode(hex.charCodeAt(i));
|
|
253
|
+
const b = fromHexCode(hex.charCodeAt(i + 1));
|
|
254
|
+
bytes[pos] = (a << 4) | b;
|
|
255
|
+
}
|
|
256
|
+
return bytes;
|
|
257
|
+
}
|
|
258
|
+
function fromSignedBytes(bytes, isBigEndian) {
|
|
259
|
+
if (bytes == null) {
|
|
260
|
+
throw new Error("bytes is null");
|
|
261
|
+
}
|
|
262
|
+
const len = bytes.length;
|
|
263
|
+
const first = isBigEndian ? 0 : len - 1;
|
|
264
|
+
const isNeg = bytes[first] > 127;
|
|
265
|
+
const codes = new Uint16Array(len * 2 + 2);
|
|
266
|
+
codes[0] = 48; // 0
|
|
267
|
+
codes[1] = 120; // x
|
|
268
|
+
const inc = isBigEndian ? 1 : -1;
|
|
269
|
+
let pos = isBigEndian ? 0 : len - 1;
|
|
270
|
+
for (let i = 0; i < bytes.length; i++, pos += inc) {
|
|
271
|
+
const byte = bytes[pos];
|
|
272
|
+
codes[2 * i + 2] = hexCodes[byte >> 4];
|
|
273
|
+
codes[2 * i + 3] = hexCodes[byte & 15];
|
|
274
|
+
}
|
|
275
|
+
const str = String.fromCharCode.apply(null, codes);
|
|
276
|
+
let x = BigInt(str);
|
|
277
|
+
if (isNeg) {
|
|
278
|
+
const bits = len * 8;
|
|
279
|
+
const pow2 = (1n << BigInt(bits));
|
|
280
|
+
x = x - pow2; // two's complement
|
|
281
|
+
}
|
|
282
|
+
return x;
|
|
283
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { uint8, int16, uint16, int32, uint32, float32, float64 } from "./Int32.js";
|
|
2
|
+
import { int64, uint64 } from "./BigInt.js";
|
|
3
|
+
import { char } from "./Char.js";
|
|
4
|
+
export declare function isLittleEndian(): boolean;
|
|
5
|
+
export declare function getBytesBoolean(value: boolean): Uint8Array;
|
|
6
|
+
export declare function getBytesChar(value: char): Uint8Array;
|
|
7
|
+
export declare function getBytesInt16(value: int16): Uint8Array;
|
|
8
|
+
export declare function getBytesInt32(value: int32): Uint8Array;
|
|
9
|
+
export declare function getBytesInt64(value: int64): Uint8Array;
|
|
10
|
+
export declare function getBytesUInt16(value: uint16): Uint8Array;
|
|
11
|
+
export declare function getBytesUInt32(value: uint32): Uint8Array;
|
|
12
|
+
export declare function getBytesUInt64(value: uint64): Uint8Array;
|
|
13
|
+
export declare function getBytesSingle(value: float32): Uint8Array;
|
|
14
|
+
export declare function getBytesDouble(value: float64): Uint8Array;
|
|
15
|
+
export declare function int64BitsToDouble(value: int64): float64;
|
|
16
|
+
export declare function doubleToInt64Bits(value: float64): int64;
|
|
17
|
+
export declare function toBoolean(bytes: ArrayLike<uint8>, offset: int32): boolean;
|
|
18
|
+
export declare function toChar(bytes: ArrayLike<uint8>, offset: int32): char;
|
|
19
|
+
export declare function toInt16(bytes: ArrayLike<uint8>, offset: int32): int16;
|
|
20
|
+
export declare function toInt32(bytes: ArrayLike<uint8>, offset: int32): int32;
|
|
21
|
+
export declare function toInt64(bytes: ArrayLike<uint8>, offset: int32): int64;
|
|
22
|
+
export declare function toUInt16(bytes: ArrayLike<uint8>, offset: int32): uint16;
|
|
23
|
+
export declare function toUInt32(bytes: ArrayLike<uint8>, offset: int32): uint32;
|
|
24
|
+
export declare function toUInt64(bytes: ArrayLike<uint8>, offset: int32): uint64;
|
|
25
|
+
export declare function toSingle(bytes: ArrayLike<uint8>, offset: int32): float32;
|
|
26
|
+
export declare function toDouble(bytes: ArrayLike<uint8>, offset: int32): float64;
|
|
27
|
+
export declare function toString(bytes: ArrayLike<uint8>, offset?: int32, count?: int32): string;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
const littleEndian = true;
|
|
2
|
+
export function isLittleEndian() {
|
|
3
|
+
return littleEndian;
|
|
4
|
+
}
|
|
5
|
+
export function getBytesBoolean(value) {
|
|
6
|
+
const bytes = new Uint8Array(1);
|
|
7
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
8
|
+
view.setUint8(0, value ? 1 : 0);
|
|
9
|
+
return bytes;
|
|
10
|
+
}
|
|
11
|
+
export function getBytesChar(value) {
|
|
12
|
+
const bytes = new Uint8Array(2);
|
|
13
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
14
|
+
view.setUint16(0, value.charCodeAt(0), littleEndian);
|
|
15
|
+
return bytes;
|
|
16
|
+
}
|
|
17
|
+
export function getBytesInt16(value) {
|
|
18
|
+
const bytes = new Uint8Array(2);
|
|
19
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
20
|
+
view.setInt16(0, value, littleEndian);
|
|
21
|
+
return bytes;
|
|
22
|
+
}
|
|
23
|
+
export function getBytesInt32(value) {
|
|
24
|
+
const bytes = new Uint8Array(4);
|
|
25
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
26
|
+
view.setInt32(0, value, littleEndian);
|
|
27
|
+
return bytes;
|
|
28
|
+
}
|
|
29
|
+
export function getBytesInt64(value) {
|
|
30
|
+
const bytes = new Uint8Array(8);
|
|
31
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
32
|
+
view.setBigInt64(0, value, littleEndian);
|
|
33
|
+
return bytes;
|
|
34
|
+
}
|
|
35
|
+
export function getBytesUInt16(value) {
|
|
36
|
+
const bytes = new Uint8Array(2);
|
|
37
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
38
|
+
view.setUint16(0, value, littleEndian);
|
|
39
|
+
return bytes;
|
|
40
|
+
}
|
|
41
|
+
export function getBytesUInt32(value) {
|
|
42
|
+
const bytes = new Uint8Array(4);
|
|
43
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
44
|
+
view.setUint32(0, value, littleEndian);
|
|
45
|
+
return bytes;
|
|
46
|
+
}
|
|
47
|
+
export function getBytesUInt64(value) {
|
|
48
|
+
const bytes = new Uint8Array(8);
|
|
49
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
50
|
+
view.setBigUint64(0, value, littleEndian);
|
|
51
|
+
return bytes;
|
|
52
|
+
}
|
|
53
|
+
export function getBytesSingle(value) {
|
|
54
|
+
const bytes = new Uint8Array(4);
|
|
55
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
56
|
+
view.setFloat32(0, value, littleEndian);
|
|
57
|
+
return bytes;
|
|
58
|
+
}
|
|
59
|
+
export function getBytesDouble(value) {
|
|
60
|
+
const bytes = new Uint8Array(8);
|
|
61
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
62
|
+
view.setFloat64(0, value, littleEndian);
|
|
63
|
+
return bytes;
|
|
64
|
+
}
|
|
65
|
+
export function int64BitsToDouble(value) {
|
|
66
|
+
const buffer = new ArrayBuffer(8);
|
|
67
|
+
const view = new DataView(buffer);
|
|
68
|
+
view.setBigInt64(0, value, littleEndian);
|
|
69
|
+
return view.getFloat64(0, littleEndian);
|
|
70
|
+
}
|
|
71
|
+
export function doubleToInt64Bits(value) {
|
|
72
|
+
const buffer = new ArrayBuffer(8);
|
|
73
|
+
const view = new DataView(buffer);
|
|
74
|
+
view.setFloat64(0, value, littleEndian);
|
|
75
|
+
return view.getBigInt64(0, littleEndian);
|
|
76
|
+
}
|
|
77
|
+
export function toBoolean(bytes, offset) {
|
|
78
|
+
const array = ArrayBuffer.isView(bytes) ? bytes : Uint8Array.from(bytes);
|
|
79
|
+
const view = new DataView(array.buffer, array.byteOffset, array.byteLength);
|
|
80
|
+
return view.getUint8(offset) === 1 ? true : false;
|
|
81
|
+
}
|
|
82
|
+
export function toChar(bytes, offset) {
|
|
83
|
+
const array = ArrayBuffer.isView(bytes) ? bytes : Uint8Array.from(bytes);
|
|
84
|
+
const view = new DataView(array.buffer, array.byteOffset, array.byteLength);
|
|
85
|
+
const code = view.getUint16(offset, littleEndian);
|
|
86
|
+
return String.fromCharCode(code);
|
|
87
|
+
}
|
|
88
|
+
export function toInt16(bytes, offset) {
|
|
89
|
+
const array = ArrayBuffer.isView(bytes) ? bytes : Uint8Array.from(bytes);
|
|
90
|
+
const view = new DataView(array.buffer, array.byteOffset, array.byteLength);
|
|
91
|
+
return view.getInt16(offset, littleEndian);
|
|
92
|
+
}
|
|
93
|
+
export function toInt32(bytes, offset) {
|
|
94
|
+
const array = ArrayBuffer.isView(bytes) ? bytes : Uint8Array.from(bytes);
|
|
95
|
+
const view = new DataView(array.buffer, array.byteOffset, array.byteLength);
|
|
96
|
+
return view.getInt32(offset, littleEndian);
|
|
97
|
+
}
|
|
98
|
+
export function toInt64(bytes, offset) {
|
|
99
|
+
const array = ArrayBuffer.isView(bytes) ? bytes : Uint8Array.from(bytes);
|
|
100
|
+
const view = new DataView(array.buffer, array.byteOffset, array.byteLength);
|
|
101
|
+
return view.getBigInt64(offset, littleEndian);
|
|
102
|
+
}
|
|
103
|
+
export function toUInt16(bytes, offset) {
|
|
104
|
+
const array = ArrayBuffer.isView(bytes) ? bytes : Uint8Array.from(bytes);
|
|
105
|
+
const view = new DataView(array.buffer, array.byteOffset, array.byteLength);
|
|
106
|
+
return view.getUint16(offset, littleEndian);
|
|
107
|
+
}
|
|
108
|
+
export function toUInt32(bytes, offset) {
|
|
109
|
+
const array = ArrayBuffer.isView(bytes) ? bytes : Uint8Array.from(bytes);
|
|
110
|
+
const view = new DataView(array.buffer, array.byteOffset, array.byteLength);
|
|
111
|
+
return view.getUint32(offset, littleEndian);
|
|
112
|
+
}
|
|
113
|
+
export function toUInt64(bytes, offset) {
|
|
114
|
+
const array = ArrayBuffer.isView(bytes) ? bytes : Uint8Array.from(bytes);
|
|
115
|
+
const view = new DataView(array.buffer, array.byteOffset, array.byteLength);
|
|
116
|
+
return view.getBigUint64(offset, littleEndian);
|
|
117
|
+
}
|
|
118
|
+
export function toSingle(bytes, offset) {
|
|
119
|
+
const array = ArrayBuffer.isView(bytes) ? bytes : Uint8Array.from(bytes);
|
|
120
|
+
const view = new DataView(array.buffer, array.byteOffset, array.byteLength);
|
|
121
|
+
return view.getFloat32(offset, littleEndian);
|
|
122
|
+
}
|
|
123
|
+
export function toDouble(bytes, offset) {
|
|
124
|
+
const array = ArrayBuffer.isView(bytes) ? bytes : Uint8Array.from(bytes);
|
|
125
|
+
const view = new DataView(array.buffer, array.byteOffset, array.byteLength);
|
|
126
|
+
return view.getFloat64(offset, littleEndian);
|
|
127
|
+
}
|
|
128
|
+
export function toString(bytes, offset, count) {
|
|
129
|
+
const array = ArrayBuffer.isView(bytes) ? bytes : Uint8Array.from(bytes);
|
|
130
|
+
let buffer = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
|
|
131
|
+
if (offset != null && count != null) {
|
|
132
|
+
buffer = buffer.subarray(offset, offset + count);
|
|
133
|
+
}
|
|
134
|
+
else if (offset != null) {
|
|
135
|
+
buffer = buffer.subarray(offset);
|
|
136
|
+
}
|
|
137
|
+
return Array.from(buffer).map((b) => ("0" + b.toString(16)).slice(-2)).join("-");
|
|
138
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FSharpRef } from "./Types.js";
|
|
2
|
+
export function tryParse(str, defValue) {
|
|
3
|
+
if (str != null && str.match(/^\s*true\s*$/i)) {
|
|
4
|
+
defValue.contents = true;
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
else if (str != null && str.match(/^\s*false\s*$/i)) {
|
|
8
|
+
defValue.contents = false;
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
export function parse(str) {
|
|
14
|
+
const defValue = new FSharpRef(false);
|
|
15
|
+
if (tryParse(str, defValue)) {
|
|
16
|
+
return defValue.contents;
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
throw new Error(`String '${str}' was not recognized as a valid Boolean.`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## Unreleased
|
|
9
|
+
|
|
10
|
+
## 1.11.0- 2025-04-26
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
* [JS/TS] Propagate non-captured exception when running `Async.Start` or `Async.StartImmediate` (by @MangelMaxime)
|
|
15
|
+
* [JS/TS] Remove `Async.RunSynchronously` (by @MangelMaxime)
|
|
16
|
+
* [JS/TS] Change signature of `startWithContinuations` to always require all its arguments (by @MangelMaxime)
|
|
17
|
+
|
|
18
|
+
## 1.7.0 - 2024-11-19
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
* [JS/TS] Added missing IReadOnlyCollection helpers (#3953)
|
|
23
|
+
|
|
24
|
+
## 1.6.0 - 2024-10-02
|
|
25
|
+
|
|
26
|
+
### Removed
|
|
27
|
+
|
|
28
|
+
* Remove `Async` (from `Async.ts`) class (by @MangelMaxime)
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
* Renamed `IAsync` to `Async` in `AsyncBuilder.ts` (#3906) (by @ncave)
|
|
33
|
+
|
|
34
|
+
## 1.5.0 - 2024-09-19
|
|
35
|
+
|
|
36
|
+
### Added
|
|
37
|
+
|
|
38
|
+
* [JS/TS] Add support for `OrdinalIgnoreCase` overload for `String.EndsWith` (#3892) (by @goswinr)
|
|
39
|
+
* [JS/TS] Add `uri.Port`, `uri.IsDefaultPort` (by @MangelMaxime)
|
|
40
|
+
|
|
41
|
+
### Fixed
|
|
42
|
+
|
|
43
|
+
* [JS/TS] Fix escaping of `{` and `}` in FormattableString (#3890) (by @roboz0r)
|
|
44
|
+
* [JS/TS] Fix `uri.Host` to return the host name without the port (by @MangelMaxime)
|
|
45
|
+
* [JS/TS] Fix TypeScript compilation by resolving type of `jsOptions` (#3894) (by @ManngelMaxime)
|
|
46
|
+
|
|
47
|
+
## 1.4.3 - 2024-09-04
|
|
48
|
+
|
|
49
|
+
* [JS/TS] Fixed Decimal comparisons (#3884) (by @ncave)
|
|
50
|
+
|
|
51
|
+
## 1.4.2 - 2024-06-13
|
|
52
|
+
|
|
53
|
+
### Fixed
|
|
54
|
+
|
|
55
|
+
* [JS/TS] Fixed BigInt.ToDecimal with negative values (#3500) (by @ncave)
|
|
56
|
+
|
|
57
|
+
## 1.4.1 - 2024-06-13
|
|
58
|
+
|
|
59
|
+
### Fixed
|
|
60
|
+
|
|
61
|
+
* [JS/TS] Fixed DateTime.MinValue, DateTime.MaxValue (#3836) (by @ncave)
|
|
62
|
+
|
|
63
|
+
## 1.4.0 - 2024-03-20
|
|
64
|
+
|
|
65
|
+
### Added
|
|
66
|
+
|
|
67
|
+
* [JS/TS] Add `ConditionalWeakTable` (by @chkn)
|
|
68
|
+
|
|
69
|
+
## 1.3.0 - 2024-03-18
|
|
70
|
+
|
|
71
|
+
* [JS/TS] `Boolean.tryParse` should not crash on `null` string (@goswinr)
|
|
72
|
+
|
|
73
|
+
## 1.2.0 - 2024-03-01
|
|
74
|
+
|
|
75
|
+
### Fixed
|
|
76
|
+
|
|
77
|
+
* [GH-3772](https://github.com/fable-compiler/Fable/pull/3772) [JS/TS] Re-implement `DateTime.ToString` custom format handling (by @MangelMaxime)
|
|
78
|
+
|
|
79
|
+
It now supports all custom format specifiers, and behave as if `CultureInfo.InvariantCulture` was used (Fable does not support Globalization).
|
|
80
|
+
|
|
81
|
+
## 1.1.0 - 2024-02-20
|
|
82
|
+
|
|
83
|
+
### Added
|
|
84
|
+
|
|
85
|
+
#### JavaScript
|
|
86
|
+
|
|
87
|
+
* [GH-3759](https://github.com/fable-compiler/Fable/issues/3759) Add `StringBuilder.Chars` (by @MangelMaxime)
|
|
88
|
+
* Add `StringBuilder.AppendFormat` (by @ncave)
|
|
89
|
+
* [GH-3748](https://github.com/fable-compiler/Fable/pull/3748) Add `Array.getItem` and `Array.setItem` (by @MangelMaxime)
|
|
90
|
+
|
|
91
|
+
## 1.0.0 - 2024-02-13
|
|
92
|
+
|
|
93
|
+
* Release stable version
|
|
94
|
+
|
|
95
|
+
## 1.0.0-beta-001 - 2024-02-12
|
|
96
|
+
|
|
97
|
+
### Changed
|
|
98
|
+
|
|
99
|
+
* Separate `Result` from `Choice`
|
|
100
|
+
* Released as part of Fable 4.12.0
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export type char = string;
|
|
2
|
+
export declare const enum UnicodeCategory {
|
|
3
|
+
UppercaseLetter = 0,
|
|
4
|
+
LowercaseLetter = 1,
|
|
5
|
+
TitlecaseLetter = 2,
|
|
6
|
+
ModifierLetter = 3,
|
|
7
|
+
OtherLetter = 4,
|
|
8
|
+
NonSpacingMark = 5,
|
|
9
|
+
SpacingCombiningMark = 6,
|
|
10
|
+
EnclosingMark = 7,
|
|
11
|
+
DecimalDigitNumber = 8,
|
|
12
|
+
LetterNumber = 9,
|
|
13
|
+
OtherNumber = 10,
|
|
14
|
+
SpaceSeparator = 11,
|
|
15
|
+
LineSeparator = 12,
|
|
16
|
+
ParagraphSeparator = 13,
|
|
17
|
+
Control = 14,
|
|
18
|
+
Format = 15,
|
|
19
|
+
Surrogate = 16,
|
|
20
|
+
PrivateUse = 17,
|
|
21
|
+
ConnectorPunctuation = 18,
|
|
22
|
+
DashPunctuation = 19,
|
|
23
|
+
OpenPunctuation = 20,
|
|
24
|
+
ClosePunctuation = 21,
|
|
25
|
+
InitialQuotePunctuation = 22,
|
|
26
|
+
FinalQuotePunctuation = 23,
|
|
27
|
+
OtherPunctuation = 24,
|
|
28
|
+
MathSymbol = 25,
|
|
29
|
+
CurrencySymbol = 26,
|
|
30
|
+
ModifierSymbol = 27,
|
|
31
|
+
OtherSymbol = 28,
|
|
32
|
+
OtherNotAssigned = 29
|
|
33
|
+
}
|
|
34
|
+
export declare const getUnicodeCategory: (s: string) => number;
|
|
35
|
+
export declare const isControl: (s: string) => boolean;
|
|
36
|
+
export declare const isDigit: (s: string) => boolean;
|
|
37
|
+
export declare const isLetter: (s: string) => boolean;
|
|
38
|
+
export declare const isLetterOrDigit: (s: string) => boolean;
|
|
39
|
+
export declare const isUpper: (s: string) => boolean;
|
|
40
|
+
export declare const isLower: (s: string) => boolean;
|
|
41
|
+
export declare const isNumber: (s: string) => boolean;
|
|
42
|
+
export declare const isPunctuation: (s: string) => boolean;
|
|
43
|
+
export declare const isSeparator: (s: string) => boolean;
|
|
44
|
+
export declare const isSymbol: (s: string) => boolean;
|
|
45
|
+
export declare const isWhiteSpace: (s: string) => boolean;
|
|
46
|
+
export declare const isHighSurrogate: (s: string) => boolean;
|
|
47
|
+
export declare const isLowSurrogate: (s: string) => boolean;
|
|
48
|
+
export declare const isSurrogate: (s: string) => boolean;
|
|
49
|
+
export declare function getUnicodeCategory2(s: string, index: number): number;
|
|
50
|
+
export declare function isControl2(s: string, index: number): boolean;
|
|
51
|
+
export declare function isDigit2(s: string, index: number): boolean;
|
|
52
|
+
export declare function isLetter2(s: string, index: number): boolean;
|
|
53
|
+
export declare function isLetterOrDigit2(s: string, index: number): boolean;
|
|
54
|
+
export declare function isUpper2(s: string, index: number): boolean;
|
|
55
|
+
export declare function isLower2(s: string, index: number): boolean;
|
|
56
|
+
export declare function isNumber2(s: string, index: number): boolean;
|
|
57
|
+
export declare function isPunctuation2(s: string, index: number): boolean;
|
|
58
|
+
export declare function isSeparator2(s: string, index: number): boolean;
|
|
59
|
+
export declare function isSymbol2(s: string, index: number): boolean;
|
|
60
|
+
export declare function isWhiteSpace2(s: string, index: number): boolean;
|
|
61
|
+
export declare function isHighSurrogate2(s: string, index: number): boolean;
|
|
62
|
+
export declare function isLowSurrogate2(s: string, index: number): boolean;
|
|
63
|
+
export declare function isSurrogate2(s: string, index: number): boolean;
|
|
64
|
+
export declare function isSurrogatePair(s: string, index: string | number): boolean;
|
|
65
|
+
export declare function parse(input: string): string;
|