@elaraai/east-ui-components 0.0.1-beta.13 → 0.0.1-beta.15
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/index.cjs +736 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +737 -48
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -53768,8 +53768,8 @@ const EastChakraTable = React.memo(function EastChakraTable2({
|
|
|
53768
53768
|
const columnHelper = createColumnHelper();
|
|
53769
53769
|
const columns = React.useMemo(() => {
|
|
53770
53770
|
return value.columns.map((col) => {
|
|
53771
|
-
const print2 =
|
|
53772
|
-
const compare =
|
|
53771
|
+
const print2 = east.printFor(col.valueType);
|
|
53772
|
+
const compare = east.compareFor(col.valueType);
|
|
53773
53773
|
const width = getSomeorUndefined(col.width);
|
|
53774
53774
|
const minWidth = getSomeorUndefined(col.minWidth);
|
|
53775
53775
|
const maxWidth = getSomeorUndefined(col.maxWidth);
|
|
@@ -55072,8 +55072,8 @@ const EastChakraGantt = React.memo(function EastChakraGantt2({
|
|
|
55072
55072
|
const columnHelper = createColumnHelper();
|
|
55073
55073
|
const columns = React.useMemo(() => {
|
|
55074
55074
|
return value.columns.map((col) => {
|
|
55075
|
-
const print2 = east.printFor(col.
|
|
55076
|
-
const compare = east.compareFor(col.
|
|
55075
|
+
const print2 = east.printFor(col.valueType);
|
|
55076
|
+
const compare = east.compareFor(col.valueType);
|
|
55077
55077
|
const width = getSomeorUndefined(col.width);
|
|
55078
55078
|
const minWidth = getSomeorUndefined(col.minWidth);
|
|
55079
55079
|
const maxWidth = getSomeorUndefined(col.maxWidth);
|
|
@@ -55777,6 +55777,7 @@ const PlannerEvent = ({
|
|
|
55777
55777
|
const label = React.useMemo(() => getSomeorUndefined(value.label), [value.label]);
|
|
55778
55778
|
const textColor = React.useMemo(() => getSomeorUndefined(value.color), [value.color]);
|
|
55779
55779
|
const backgroundColor = React.useMemo(() => getSomeorUndefined(value.background), [value.background]);
|
|
55780
|
+
const customStrokeColor = React.useMemo(() => getSomeorUndefined(value.stroke), [value.stroke]);
|
|
55780
55781
|
const eventOpacity = React.useMemo(() => getSomeorUndefined(value.opacity), [value.opacity]);
|
|
55781
55782
|
const fontWeight = React.useMemo(() => {
|
|
55782
55783
|
var _a2;
|
|
@@ -55794,8 +55795,9 @@ const PlannerEvent = ({
|
|
|
55794
55795
|
var _a2;
|
|
55795
55796
|
return (_a2 = getSomeorUndefined(value.textAlign)) == null ? void 0 : _a2.type;
|
|
55796
55797
|
}, [value.textAlign]);
|
|
55797
|
-
const [fillColor,
|
|
55798
|
+
const [fillColor, paletteStrokeColor] = react.useToken("colors", [`${colorPalette}.500`, `${colorPalette}.600`]);
|
|
55798
55799
|
const actualFillColor = backgroundColor ?? fillColor;
|
|
55800
|
+
const actualStrokeColor = customStrokeColor ?? paletteStrokeColor;
|
|
55799
55801
|
const { baseX, baseWidth } = React.useMemo(() => {
|
|
55800
55802
|
const { start, end: end3 } = localSlots;
|
|
55801
55803
|
const slotIndex = Number(start - slotRangeStart);
|
|
@@ -55946,7 +55948,7 @@ const PlannerEvent = ({
|
|
|
55946
55948
|
width: eventWidth,
|
|
55947
55949
|
height,
|
|
55948
55950
|
fill: actualFillColor,
|
|
55949
|
-
stroke:
|
|
55951
|
+
stroke: actualStrokeColor,
|
|
55950
55952
|
strokeWidth: isActive ? 3 : 2,
|
|
55951
55953
|
opacity: baseOpacity,
|
|
55952
55954
|
rx: 4,
|
|
@@ -56389,8 +56391,8 @@ const EastChakraPlanner = React.memo(function EastChakraPlanner2({
|
|
|
56389
56391
|
const columnHelper = createColumnHelper();
|
|
56390
56392
|
const columns = React.useMemo(() => {
|
|
56391
56393
|
return value.columns.map((col) => {
|
|
56392
|
-
const print2 = east.printFor(col.
|
|
56393
|
-
const compare = east.compareFor(col.
|
|
56394
|
+
const print2 = east.printFor(col.valueType);
|
|
56395
|
+
const compare = east.compareFor(col.valueType);
|
|
56394
56396
|
const width = getSomeorUndefined(col.width);
|
|
56395
56397
|
const minWidth = getSomeorUndefined(col.minWidth);
|
|
56396
56398
|
const maxWidth = getSomeorUndefined(col.maxWidth);
|
|
@@ -70571,6 +70573,46 @@ class BooleanExpr extends Expr {
|
|
|
70571
70573
|
else_body: false_expr[AstSymbol]
|
|
70572
70574
|
});
|
|
70573
70575
|
}
|
|
70576
|
+
/**
|
|
70577
|
+
* Checks if this boolean equals another value.
|
|
70578
|
+
*
|
|
70579
|
+
* @param other - The value to compare against
|
|
70580
|
+
* @returns A BooleanExpr that is true if the values are equal
|
|
70581
|
+
*
|
|
70582
|
+
* @example
|
|
70583
|
+
* ```ts
|
|
70584
|
+
* const isEqual = East.function([BooleanType, BooleanType], BooleanType, ($, a, b) => {
|
|
70585
|
+
* $.return(a.equals(b));
|
|
70586
|
+
* });
|
|
70587
|
+
* const compiled = East.compile(isEqual.toIR(), []);
|
|
70588
|
+
* compiled(true, true); // true
|
|
70589
|
+
* compiled(false, false); // true
|
|
70590
|
+
* compiled(true, false); // false
|
|
70591
|
+
* ```
|
|
70592
|
+
*/
|
|
70593
|
+
equals(other) {
|
|
70594
|
+
return equal(this, other);
|
|
70595
|
+
}
|
|
70596
|
+
/**
|
|
70597
|
+
* Checks if this boolean does not equal another value.
|
|
70598
|
+
*
|
|
70599
|
+
* @param other - The value to compare against
|
|
70600
|
+
* @returns A BooleanExpr that is true if the values are not equal
|
|
70601
|
+
*
|
|
70602
|
+
* @example
|
|
70603
|
+
* ```ts
|
|
70604
|
+
* const isNotEqual = East.function([BooleanType, BooleanType], BooleanType, ($, a, b) => {
|
|
70605
|
+
* $.return(a.notEquals(b));
|
|
70606
|
+
* });
|
|
70607
|
+
* const compiled = East.compile(isNotEqual.toIR(), []);
|
|
70608
|
+
* compiled(true, false); // true
|
|
70609
|
+
* compiled(false, true); // true
|
|
70610
|
+
* compiled(true, true); // false
|
|
70611
|
+
* ```
|
|
70612
|
+
*/
|
|
70613
|
+
notEquals(other) {
|
|
70614
|
+
return notEqual(this, other);
|
|
70615
|
+
}
|
|
70574
70616
|
}
|
|
70575
70617
|
class IntegerExpr extends Expr {
|
|
70576
70618
|
constructor(ast, createExpr) {
|
|
@@ -70844,6 +70886,124 @@ class IntegerExpr extends Expr {
|
|
|
70844
70886
|
arguments: [this[AstSymbol]]
|
|
70845
70887
|
});
|
|
70846
70888
|
}
|
|
70889
|
+
/**
|
|
70890
|
+
* Checks if this integer equals another value.
|
|
70891
|
+
*
|
|
70892
|
+
* @param other - The value to compare against
|
|
70893
|
+
* @returns A BooleanExpr that is true if the values are equal
|
|
70894
|
+
*
|
|
70895
|
+
* @example
|
|
70896
|
+
* ```ts
|
|
70897
|
+
* const isEqual = East.function([IntegerType, IntegerType], BooleanType, ($, a, b) => {
|
|
70898
|
+
* $.return(a.equals(b));
|
|
70899
|
+
* });
|
|
70900
|
+
* const compiled = East.compile(isEqual.toIR(), []);
|
|
70901
|
+
* compiled(5n, 5n); // true
|
|
70902
|
+
* compiled(5n, 3n); // false
|
|
70903
|
+
* ```
|
|
70904
|
+
*/
|
|
70905
|
+
equals(other) {
|
|
70906
|
+
return equal(this, other);
|
|
70907
|
+
}
|
|
70908
|
+
/**
|
|
70909
|
+
* Checks if this integer does not equal another value.
|
|
70910
|
+
*
|
|
70911
|
+
* @param other - The value to compare against
|
|
70912
|
+
* @returns A BooleanExpr that is true if the values are not equal
|
|
70913
|
+
*
|
|
70914
|
+
* @example
|
|
70915
|
+
* ```ts
|
|
70916
|
+
* const isNotEqual = East.function([IntegerType, IntegerType], BooleanType, ($, a, b) => {
|
|
70917
|
+
* $.return(a.notEquals(b));
|
|
70918
|
+
* });
|
|
70919
|
+
* const compiled = East.compile(isNotEqual.toIR(), []);
|
|
70920
|
+
* compiled(5n, 3n); // true
|
|
70921
|
+
* compiled(5n, 5n); // false
|
|
70922
|
+
* ```
|
|
70923
|
+
*/
|
|
70924
|
+
notEquals(other) {
|
|
70925
|
+
return notEqual(this, other);
|
|
70926
|
+
}
|
|
70927
|
+
/**
|
|
70928
|
+
* Checks if this integer is greater than another value.
|
|
70929
|
+
*
|
|
70930
|
+
* @param other - The value to compare against
|
|
70931
|
+
* @returns A BooleanExpr that is true if this value is greater
|
|
70932
|
+
*
|
|
70933
|
+
* @example
|
|
70934
|
+
* ```ts
|
|
70935
|
+
* const isGreater = East.function([IntegerType, IntegerType], BooleanType, ($, a, b) => {
|
|
70936
|
+
* $.return(a.greaterThan(b));
|
|
70937
|
+
* });
|
|
70938
|
+
* const compiled = East.compile(isGreater.toIR(), []);
|
|
70939
|
+
* compiled(5n, 3n); // true
|
|
70940
|
+
* compiled(3n, 5n); // false
|
|
70941
|
+
* compiled(5n, 5n); // false
|
|
70942
|
+
* ```
|
|
70943
|
+
*/
|
|
70944
|
+
greaterThan(other) {
|
|
70945
|
+
return greater(this, other);
|
|
70946
|
+
}
|
|
70947
|
+
/**
|
|
70948
|
+
* Checks if this integer is less than another value.
|
|
70949
|
+
*
|
|
70950
|
+
* @param other - The value to compare against
|
|
70951
|
+
* @returns A BooleanExpr that is true if this value is less
|
|
70952
|
+
*
|
|
70953
|
+
* @example
|
|
70954
|
+
* ```ts
|
|
70955
|
+
* const isLess = East.function([IntegerType, IntegerType], BooleanType, ($, a, b) => {
|
|
70956
|
+
* $.return(a.lessThan(b));
|
|
70957
|
+
* });
|
|
70958
|
+
* const compiled = East.compile(isLess.toIR(), []);
|
|
70959
|
+
* compiled(3n, 5n); // true
|
|
70960
|
+
* compiled(5n, 3n); // false
|
|
70961
|
+
* compiled(5n, 5n); // false
|
|
70962
|
+
* ```
|
|
70963
|
+
*/
|
|
70964
|
+
lessThan(other) {
|
|
70965
|
+
return less(this, other);
|
|
70966
|
+
}
|
|
70967
|
+
/**
|
|
70968
|
+
* Checks if this integer is greater than or equal to another value.
|
|
70969
|
+
*
|
|
70970
|
+
* @param other - The value to compare against
|
|
70971
|
+
* @returns A BooleanExpr that is true if this value is greater than or equal
|
|
70972
|
+
*
|
|
70973
|
+
* @example
|
|
70974
|
+
* ```ts
|
|
70975
|
+
* const isGreaterOrEqual = East.function([IntegerType, IntegerType], BooleanType, ($, a, b) => {
|
|
70976
|
+
* $.return(a.greaterThanOrEqual(b));
|
|
70977
|
+
* });
|
|
70978
|
+
* const compiled = East.compile(isGreaterOrEqual.toIR(), []);
|
|
70979
|
+
* compiled(5n, 3n); // true
|
|
70980
|
+
* compiled(5n, 5n); // true
|
|
70981
|
+
* compiled(3n, 5n); // false
|
|
70982
|
+
* ```
|
|
70983
|
+
*/
|
|
70984
|
+
greaterThanOrEqual(other) {
|
|
70985
|
+
return greaterEqual(this, other);
|
|
70986
|
+
}
|
|
70987
|
+
/**
|
|
70988
|
+
* Checks if this integer is less than or equal to another value.
|
|
70989
|
+
*
|
|
70990
|
+
* @param other - The value to compare against
|
|
70991
|
+
* @returns A BooleanExpr that is true if this value is less than or equal
|
|
70992
|
+
*
|
|
70993
|
+
* @example
|
|
70994
|
+
* ```ts
|
|
70995
|
+
* const isLessOrEqual = East.function([IntegerType, IntegerType], BooleanType, ($, a, b) => {
|
|
70996
|
+
* $.return(a.lessThanOrEqual(b));
|
|
70997
|
+
* });
|
|
70998
|
+
* const compiled = East.compile(isLessOrEqual.toIR(), []);
|
|
70999
|
+
* compiled(3n, 5n); // true
|
|
71000
|
+
* compiled(5n, 5n); // true
|
|
71001
|
+
* compiled(5n, 3n); // false
|
|
71002
|
+
* ```
|
|
71003
|
+
*/
|
|
71004
|
+
lessThanOrEqual(other) {
|
|
71005
|
+
return lessEqual(this, other);
|
|
71006
|
+
}
|
|
70847
71007
|
}
|
|
70848
71008
|
class FloatExpr extends Expr {
|
|
70849
71009
|
constructor(ast, createExpr) {
|
|
@@ -71407,6 +71567,127 @@ class FloatExpr extends Expr {
|
|
|
71407
71567
|
arguments: [this[AstSymbol]]
|
|
71408
71568
|
});
|
|
71409
71569
|
}
|
|
71570
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
71571
|
+
// Comparison methods
|
|
71572
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
71573
|
+
/**
|
|
71574
|
+
* Checks if this float equals another value.
|
|
71575
|
+
*
|
|
71576
|
+
* @param other - The value to compare against
|
|
71577
|
+
* @returns A BooleanExpr that is true if the values are equal
|
|
71578
|
+
*
|
|
71579
|
+
* @example
|
|
71580
|
+
* ```ts
|
|
71581
|
+
* const checkEqual = East.function([FloatType, FloatType], BooleanType, ($, x, y) => {
|
|
71582
|
+
* $.return(x.equals(y));
|
|
71583
|
+
* });
|
|
71584
|
+
* const compiled = East.compile(checkEqual.toIR(), []);
|
|
71585
|
+
* compiled(3.14, 3.14); // true
|
|
71586
|
+
* compiled(3.14, 2.0); // false
|
|
71587
|
+
* ```
|
|
71588
|
+
*/
|
|
71589
|
+
equals(other) {
|
|
71590
|
+
return equal(this, other);
|
|
71591
|
+
}
|
|
71592
|
+
/**
|
|
71593
|
+
* Checks if this float does not equal another value.
|
|
71594
|
+
*
|
|
71595
|
+
* @param other - The value to compare against
|
|
71596
|
+
* @returns A BooleanExpr that is true if the values are not equal
|
|
71597
|
+
*
|
|
71598
|
+
* @example
|
|
71599
|
+
* ```ts
|
|
71600
|
+
* const checkNotEqual = East.function([FloatType, FloatType], BooleanType, ($, x, y) => {
|
|
71601
|
+
* $.return(x.notEquals(y));
|
|
71602
|
+
* });
|
|
71603
|
+
* const compiled = East.compile(checkNotEqual.toIR(), []);
|
|
71604
|
+
* compiled(3.14, 2.0); // true
|
|
71605
|
+
* compiled(3.14, 3.14); // false
|
|
71606
|
+
* ```
|
|
71607
|
+
*/
|
|
71608
|
+
notEquals(other) {
|
|
71609
|
+
return notEqual(this, other);
|
|
71610
|
+
}
|
|
71611
|
+
/**
|
|
71612
|
+
* Checks if this float is greater than another value.
|
|
71613
|
+
*
|
|
71614
|
+
* @param other - The value to compare against
|
|
71615
|
+
* @returns A BooleanExpr that is true if this value is greater
|
|
71616
|
+
*
|
|
71617
|
+
* @example
|
|
71618
|
+
* ```ts
|
|
71619
|
+
* const checkGreater = East.function([FloatType, FloatType], BooleanType, ($, x, y) => {
|
|
71620
|
+
* $.return(x.greaterThan(y));
|
|
71621
|
+
* });
|
|
71622
|
+
* const compiled = East.compile(checkGreater.toIR(), []);
|
|
71623
|
+
* compiled(3.14, 2.0); // true
|
|
71624
|
+
* compiled(2.0, 3.14); // false
|
|
71625
|
+
* compiled(3.14, 3.14); // false
|
|
71626
|
+
* ```
|
|
71627
|
+
*/
|
|
71628
|
+
greaterThan(other) {
|
|
71629
|
+
return greater(this, other);
|
|
71630
|
+
}
|
|
71631
|
+
/**
|
|
71632
|
+
* Checks if this float is less than another value.
|
|
71633
|
+
*
|
|
71634
|
+
* @param other - The value to compare against
|
|
71635
|
+
* @returns A BooleanExpr that is true if this value is less
|
|
71636
|
+
*
|
|
71637
|
+
* @example
|
|
71638
|
+
* ```ts
|
|
71639
|
+
* const checkLess = East.function([FloatType, FloatType], BooleanType, ($, x, y) => {
|
|
71640
|
+
* $.return(x.lessThan(y));
|
|
71641
|
+
* });
|
|
71642
|
+
* const compiled = East.compile(checkLess.toIR(), []);
|
|
71643
|
+
* compiled(2.0, 3.14); // true
|
|
71644
|
+
* compiled(3.14, 2.0); // false
|
|
71645
|
+
* compiled(3.14, 3.14); // false
|
|
71646
|
+
* ```
|
|
71647
|
+
*/
|
|
71648
|
+
lessThan(other) {
|
|
71649
|
+
return less(this, other);
|
|
71650
|
+
}
|
|
71651
|
+
/**
|
|
71652
|
+
* Checks if this float is greater than or equal to another value.
|
|
71653
|
+
*
|
|
71654
|
+
* @param other - The value to compare against
|
|
71655
|
+
* @returns A BooleanExpr that is true if this value is greater than or equal
|
|
71656
|
+
*
|
|
71657
|
+
* @example
|
|
71658
|
+
* ```ts
|
|
71659
|
+
* const checkGte = East.function([FloatType, FloatType], BooleanType, ($, x, y) => {
|
|
71660
|
+
* $.return(x.greaterThanOrEqual(y));
|
|
71661
|
+
* });
|
|
71662
|
+
* const compiled = East.compile(checkGte.toIR(), []);
|
|
71663
|
+
* compiled(3.14, 2.0); // true
|
|
71664
|
+
* compiled(3.14, 3.14); // true
|
|
71665
|
+
* compiled(2.0, 3.14); // false
|
|
71666
|
+
* ```
|
|
71667
|
+
*/
|
|
71668
|
+
greaterThanOrEqual(other) {
|
|
71669
|
+
return greaterEqual(this, other);
|
|
71670
|
+
}
|
|
71671
|
+
/**
|
|
71672
|
+
* Checks if this float is less than or equal to another value.
|
|
71673
|
+
*
|
|
71674
|
+
* @param other - The value to compare against
|
|
71675
|
+
* @returns A BooleanExpr that is true if this value is less than or equal
|
|
71676
|
+
*
|
|
71677
|
+
* @example
|
|
71678
|
+
* ```ts
|
|
71679
|
+
* const checkLte = East.function([FloatType, FloatType], BooleanType, ($, x, y) => {
|
|
71680
|
+
* $.return(x.lessThanOrEqual(y));
|
|
71681
|
+
* });
|
|
71682
|
+
* const compiled = East.compile(checkLte.toIR(), []);
|
|
71683
|
+
* compiled(2.0, 3.14); // true
|
|
71684
|
+
* compiled(3.14, 3.14); // true
|
|
71685
|
+
* compiled(3.14, 2.0); // false
|
|
71686
|
+
* ```
|
|
71687
|
+
*/
|
|
71688
|
+
lessThanOrEqual(other) {
|
|
71689
|
+
return lessEqual(this, other);
|
|
71690
|
+
}
|
|
71410
71691
|
}
|
|
71411
71692
|
function validateCrossPlatformCompatible(regex) {
|
|
71412
71693
|
const result = {
|
|
@@ -72154,6 +72435,124 @@ class StringExpr extends Expr {
|
|
|
72154
72435
|
arguments: [this[AstSymbol]]
|
|
72155
72436
|
});
|
|
72156
72437
|
}
|
|
72438
|
+
/**
|
|
72439
|
+
* Checks if this string equals another value.
|
|
72440
|
+
*
|
|
72441
|
+
* @param other - The value to compare against
|
|
72442
|
+
* @returns A BooleanExpr that is true if the values are equal
|
|
72443
|
+
*
|
|
72444
|
+
* @example
|
|
72445
|
+
* ```ts
|
|
72446
|
+
* const isEqual = East.function([StringType, StringType], BooleanType, ($, a, b) => {
|
|
72447
|
+
* $.return(a.equals(b));
|
|
72448
|
+
* });
|
|
72449
|
+
* const compiled = East.compile(isEqual.toIR(), []);
|
|
72450
|
+
* compiled("hello", "hello"); // true
|
|
72451
|
+
* compiled("hello", "world"); // false
|
|
72452
|
+
* ```
|
|
72453
|
+
*/
|
|
72454
|
+
equals(other) {
|
|
72455
|
+
return equal(this, other);
|
|
72456
|
+
}
|
|
72457
|
+
/**
|
|
72458
|
+
* Checks if this string does not equal another value.
|
|
72459
|
+
*
|
|
72460
|
+
* @param other - The value to compare against
|
|
72461
|
+
* @returns A BooleanExpr that is true if the values are not equal
|
|
72462
|
+
*
|
|
72463
|
+
* @example
|
|
72464
|
+
* ```ts
|
|
72465
|
+
* const isNotEqual = East.function([StringType, StringType], BooleanType, ($, a, b) => {
|
|
72466
|
+
* $.return(a.notEquals(b));
|
|
72467
|
+
* });
|
|
72468
|
+
* const compiled = East.compile(isNotEqual.toIR(), []);
|
|
72469
|
+
* compiled("hello", "world"); // true
|
|
72470
|
+
* compiled("hello", "hello"); // false
|
|
72471
|
+
* ```
|
|
72472
|
+
*/
|
|
72473
|
+
notEquals(other) {
|
|
72474
|
+
return notEqual(this, other);
|
|
72475
|
+
}
|
|
72476
|
+
/**
|
|
72477
|
+
* Checks if this string is greater than another value (lexicographically).
|
|
72478
|
+
*
|
|
72479
|
+
* @param other - The value to compare against
|
|
72480
|
+
* @returns A BooleanExpr that is true if this string is greater
|
|
72481
|
+
*
|
|
72482
|
+
* @example
|
|
72483
|
+
* ```ts
|
|
72484
|
+
* const isGreater = East.function([StringType, StringType], BooleanType, ($, a, b) => {
|
|
72485
|
+
* $.return(a.greaterThan(b));
|
|
72486
|
+
* });
|
|
72487
|
+
* const compiled = East.compile(isGreater.toIR(), []);
|
|
72488
|
+
* compiled("b", "a"); // true
|
|
72489
|
+
* compiled("a", "b"); // false
|
|
72490
|
+
* compiled("a", "a"); // false
|
|
72491
|
+
* ```
|
|
72492
|
+
*/
|
|
72493
|
+
greaterThan(other) {
|
|
72494
|
+
return greater(this, other);
|
|
72495
|
+
}
|
|
72496
|
+
/**
|
|
72497
|
+
* Checks if this string is less than another value (lexicographically).
|
|
72498
|
+
*
|
|
72499
|
+
* @param other - The value to compare against
|
|
72500
|
+
* @returns A BooleanExpr that is true if this string is less
|
|
72501
|
+
*
|
|
72502
|
+
* @example
|
|
72503
|
+
* ```ts
|
|
72504
|
+
* const isLess = East.function([StringType, StringType], BooleanType, ($, a, b) => {
|
|
72505
|
+
* $.return(a.lessThan(b));
|
|
72506
|
+
* });
|
|
72507
|
+
* const compiled = East.compile(isLess.toIR(), []);
|
|
72508
|
+
* compiled("a", "b"); // true
|
|
72509
|
+
* compiled("b", "a"); // false
|
|
72510
|
+
* compiled("a", "a"); // false
|
|
72511
|
+
* ```
|
|
72512
|
+
*/
|
|
72513
|
+
lessThan(other) {
|
|
72514
|
+
return less(this, other);
|
|
72515
|
+
}
|
|
72516
|
+
/**
|
|
72517
|
+
* Checks if this string is greater than or equal to another value (lexicographically).
|
|
72518
|
+
*
|
|
72519
|
+
* @param other - The value to compare against
|
|
72520
|
+
* @returns A BooleanExpr that is true if this string is greater than or equal
|
|
72521
|
+
*
|
|
72522
|
+
* @example
|
|
72523
|
+
* ```ts
|
|
72524
|
+
* const isGreaterOrEqual = East.function([StringType, StringType], BooleanType, ($, a, b) => {
|
|
72525
|
+
* $.return(a.greaterThanOrEqual(b));
|
|
72526
|
+
* });
|
|
72527
|
+
* const compiled = East.compile(isGreaterOrEqual.toIR(), []);
|
|
72528
|
+
* compiled("b", "a"); // true
|
|
72529
|
+
* compiled("a", "a"); // true
|
|
72530
|
+
* compiled("a", "b"); // false
|
|
72531
|
+
* ```
|
|
72532
|
+
*/
|
|
72533
|
+
greaterThanOrEqual(other) {
|
|
72534
|
+
return greaterEqual(this, other);
|
|
72535
|
+
}
|
|
72536
|
+
/**
|
|
72537
|
+
* Checks if this string is less than or equal to another value (lexicographically).
|
|
72538
|
+
*
|
|
72539
|
+
* @param other - The value to compare against
|
|
72540
|
+
* @returns A BooleanExpr that is true if this string is less than or equal
|
|
72541
|
+
*
|
|
72542
|
+
* @example
|
|
72543
|
+
* ```ts
|
|
72544
|
+
* const isLessOrEqual = East.function([StringType, StringType], BooleanType, ($, a, b) => {
|
|
72545
|
+
* $.return(a.lessThanOrEqual(b));
|
|
72546
|
+
* });
|
|
72547
|
+
* const compiled = East.compile(isLessOrEqual.toIR(), []);
|
|
72548
|
+
* compiled("a", "b"); // true
|
|
72549
|
+
* compiled("a", "a"); // true
|
|
72550
|
+
* compiled("b", "a"); // false
|
|
72551
|
+
* ```
|
|
72552
|
+
*/
|
|
72553
|
+
lessThanOrEqual(other) {
|
|
72554
|
+
return lessEqual(this, other);
|
|
72555
|
+
}
|
|
72157
72556
|
}
|
|
72158
72557
|
function tokenizeDateTimeFormat(format2) {
|
|
72159
72558
|
const tokens = [];
|
|
@@ -73026,6 +73425,124 @@ class DateTimeExpr extends Expr {
|
|
|
73026
73425
|
arguments: [this[AstSymbol], tokensArray[AstSymbol]]
|
|
73027
73426
|
});
|
|
73028
73427
|
}
|
|
73428
|
+
/**
|
|
73429
|
+
* Checks if this DateTime equals another value.
|
|
73430
|
+
*
|
|
73431
|
+
* @param other - The value to compare against
|
|
73432
|
+
* @returns A BooleanExpr that is true if the values are equal
|
|
73433
|
+
*
|
|
73434
|
+
* @example
|
|
73435
|
+
* ```ts
|
|
73436
|
+
* const isEqual = East.function([DateTimeType, DateTimeType], BooleanType, ($, a, b) => {
|
|
73437
|
+
* $.return(a.equals(b));
|
|
73438
|
+
* });
|
|
73439
|
+
* const compiled = East.compile(isEqual.toIR(), []);
|
|
73440
|
+
* compiled(new Date("2025-01-15T00:00:00.000Z"), new Date("2025-01-15T00:00:00.000Z")); // true
|
|
73441
|
+
* compiled(new Date("2025-01-15T00:00:00.000Z"), new Date("2025-01-16T00:00:00.000Z")); // false
|
|
73442
|
+
* ```
|
|
73443
|
+
*/
|
|
73444
|
+
equals(other) {
|
|
73445
|
+
return equal(this, other);
|
|
73446
|
+
}
|
|
73447
|
+
/**
|
|
73448
|
+
* Checks if this DateTime does not equal another value.
|
|
73449
|
+
*
|
|
73450
|
+
* @param other - The value to compare against
|
|
73451
|
+
* @returns A BooleanExpr that is true if the values are not equal
|
|
73452
|
+
*
|
|
73453
|
+
* @example
|
|
73454
|
+
* ```ts
|
|
73455
|
+
* const isNotEqual = East.function([DateTimeType, DateTimeType], BooleanType, ($, a, b) => {
|
|
73456
|
+
* $.return(a.notEquals(b));
|
|
73457
|
+
* });
|
|
73458
|
+
* const compiled = East.compile(isNotEqual.toIR(), []);
|
|
73459
|
+
* compiled(new Date("2025-01-15T00:00:00.000Z"), new Date("2025-01-16T00:00:00.000Z")); // true
|
|
73460
|
+
* compiled(new Date("2025-01-15T00:00:00.000Z"), new Date("2025-01-15T00:00:00.000Z")); // false
|
|
73461
|
+
* ```
|
|
73462
|
+
*/
|
|
73463
|
+
notEquals(other) {
|
|
73464
|
+
return notEqual(this, other);
|
|
73465
|
+
}
|
|
73466
|
+
/**
|
|
73467
|
+
* Checks if this DateTime is after another value.
|
|
73468
|
+
*
|
|
73469
|
+
* @param other - The value to compare against
|
|
73470
|
+
* @returns A BooleanExpr that is true if this DateTime is after the other
|
|
73471
|
+
*
|
|
73472
|
+
* @example
|
|
73473
|
+
* ```ts
|
|
73474
|
+
* const isAfter = East.function([DateTimeType, DateTimeType], BooleanType, ($, a, b) => {
|
|
73475
|
+
* $.return(a.greaterThan(b));
|
|
73476
|
+
* });
|
|
73477
|
+
* const compiled = East.compile(isAfter.toIR(), []);
|
|
73478
|
+
* compiled(new Date("2025-01-16T00:00:00.000Z"), new Date("2025-01-15T00:00:00.000Z")); // true
|
|
73479
|
+
* compiled(new Date("2025-01-15T00:00:00.000Z"), new Date("2025-01-16T00:00:00.000Z")); // false
|
|
73480
|
+
* compiled(new Date("2025-01-15T00:00:00.000Z"), new Date("2025-01-15T00:00:00.000Z")); // false
|
|
73481
|
+
* ```
|
|
73482
|
+
*/
|
|
73483
|
+
greaterThan(other) {
|
|
73484
|
+
return greater(this, other);
|
|
73485
|
+
}
|
|
73486
|
+
/**
|
|
73487
|
+
* Checks if this DateTime is before another value.
|
|
73488
|
+
*
|
|
73489
|
+
* @param other - The value to compare against
|
|
73490
|
+
* @returns A BooleanExpr that is true if this DateTime is before the other
|
|
73491
|
+
*
|
|
73492
|
+
* @example
|
|
73493
|
+
* ```ts
|
|
73494
|
+
* const isBefore = East.function([DateTimeType, DateTimeType], BooleanType, ($, a, b) => {
|
|
73495
|
+
* $.return(a.lessThan(b));
|
|
73496
|
+
* });
|
|
73497
|
+
* const compiled = East.compile(isBefore.toIR(), []);
|
|
73498
|
+
* compiled(new Date("2025-01-15T00:00:00.000Z"), new Date("2025-01-16T00:00:00.000Z")); // true
|
|
73499
|
+
* compiled(new Date("2025-01-16T00:00:00.000Z"), new Date("2025-01-15T00:00:00.000Z")); // false
|
|
73500
|
+
* compiled(new Date("2025-01-15T00:00:00.000Z"), new Date("2025-01-15T00:00:00.000Z")); // false
|
|
73501
|
+
* ```
|
|
73502
|
+
*/
|
|
73503
|
+
lessThan(other) {
|
|
73504
|
+
return less(this, other);
|
|
73505
|
+
}
|
|
73506
|
+
/**
|
|
73507
|
+
* Checks if this DateTime is after or equal to another value.
|
|
73508
|
+
*
|
|
73509
|
+
* @param other - The value to compare against
|
|
73510
|
+
* @returns A BooleanExpr that is true if this DateTime is after or equal to the other
|
|
73511
|
+
*
|
|
73512
|
+
* @example
|
|
73513
|
+
* ```ts
|
|
73514
|
+
* const isAfterOrEqual = East.function([DateTimeType, DateTimeType], BooleanType, ($, a, b) => {
|
|
73515
|
+
* $.return(a.greaterThanOrEqual(b));
|
|
73516
|
+
* });
|
|
73517
|
+
* const compiled = East.compile(isAfterOrEqual.toIR(), []);
|
|
73518
|
+
* compiled(new Date("2025-01-16T00:00:00.000Z"), new Date("2025-01-15T00:00:00.000Z")); // true
|
|
73519
|
+
* compiled(new Date("2025-01-15T00:00:00.000Z"), new Date("2025-01-15T00:00:00.000Z")); // true
|
|
73520
|
+
* compiled(new Date("2025-01-15T00:00:00.000Z"), new Date("2025-01-16T00:00:00.000Z")); // false
|
|
73521
|
+
* ```
|
|
73522
|
+
*/
|
|
73523
|
+
greaterThanOrEqual(other) {
|
|
73524
|
+
return greaterEqual(this, other);
|
|
73525
|
+
}
|
|
73526
|
+
/**
|
|
73527
|
+
* Checks if this DateTime is before or equal to another value.
|
|
73528
|
+
*
|
|
73529
|
+
* @param other - The value to compare against
|
|
73530
|
+
* @returns A BooleanExpr that is true if this DateTime is before or equal to the other
|
|
73531
|
+
*
|
|
73532
|
+
* @example
|
|
73533
|
+
* ```ts
|
|
73534
|
+
* const isBeforeOrEqual = East.function([DateTimeType, DateTimeType], BooleanType, ($, a, b) => {
|
|
73535
|
+
* $.return(a.lessThanOrEqual(b));
|
|
73536
|
+
* });
|
|
73537
|
+
* const compiled = East.compile(isBeforeOrEqual.toIR(), []);
|
|
73538
|
+
* compiled(new Date("2025-01-15T00:00:00.000Z"), new Date("2025-01-16T00:00:00.000Z")); // true
|
|
73539
|
+
* compiled(new Date("2025-01-15T00:00:00.000Z"), new Date("2025-01-15T00:00:00.000Z")); // true
|
|
73540
|
+
* compiled(new Date("2025-01-16T00:00:00.000Z"), new Date("2025-01-15T00:00:00.000Z")); // false
|
|
73541
|
+
* ```
|
|
73542
|
+
*/
|
|
73543
|
+
lessThanOrEqual(other) {
|
|
73544
|
+
return lessEqual(this, other);
|
|
73545
|
+
}
|
|
73029
73546
|
}
|
|
73030
73547
|
function isFor(type, typeCtx = []) {
|
|
73031
73548
|
if (!isVariant(type)) {
|
|
@@ -74556,6 +75073,49 @@ class BlobExpr extends Expr {
|
|
|
74556
75073
|
arguments: [this[AstSymbol], configAst]
|
|
74557
75074
|
});
|
|
74558
75075
|
}
|
|
75076
|
+
/**
|
|
75077
|
+
* Checks if this blob equals another blob (byte-by-byte comparison).
|
|
75078
|
+
*
|
|
75079
|
+
* @param other - The blob to compare against
|
|
75080
|
+
* @returns A BooleanExpr that is true if the blobs are identical
|
|
75081
|
+
*
|
|
75082
|
+
* @example
|
|
75083
|
+
* ```ts
|
|
75084
|
+
* const isEqual = East.function([BlobType, BlobType], BooleanType, ($, a, b) => {
|
|
75085
|
+
* $.return(a.equals(b));
|
|
75086
|
+
* });
|
|
75087
|
+
* const compiled = East.compile(isEqual.toIR(), []);
|
|
75088
|
+
* const blob1 = new Uint8Array([1, 2, 3]);
|
|
75089
|
+
* const blob2 = new Uint8Array([1, 2, 3]);
|
|
75090
|
+
* const blob3 = new Uint8Array([1, 2, 4]);
|
|
75091
|
+
* compiled(blob1, blob2); // true
|
|
75092
|
+
* compiled(blob1, blob3); // false
|
|
75093
|
+
* ```
|
|
75094
|
+
*/
|
|
75095
|
+
equals(other) {
|
|
75096
|
+
return equal(this, other);
|
|
75097
|
+
}
|
|
75098
|
+
/**
|
|
75099
|
+
* Checks if this blob does not equal another blob.
|
|
75100
|
+
*
|
|
75101
|
+
* @param other - The blob to compare against
|
|
75102
|
+
* @returns A BooleanExpr that is true if the blobs are different
|
|
75103
|
+
*
|
|
75104
|
+
* @example
|
|
75105
|
+
* ```ts
|
|
75106
|
+
* const isNotEqual = East.function([BlobType, BlobType], BooleanType, ($, a, b) => {
|
|
75107
|
+
* $.return(a.notEquals(b));
|
|
75108
|
+
* });
|
|
75109
|
+
* const compiled = East.compile(isNotEqual.toIR(), []);
|
|
75110
|
+
* const blob1 = new Uint8Array([1, 2, 3]);
|
|
75111
|
+
* const blob2 = new Uint8Array([1, 2, 4]);
|
|
75112
|
+
* compiled(blob1, blob2); // true
|
|
75113
|
+
* compiled(blob1, blob1); // false
|
|
75114
|
+
* ```
|
|
75115
|
+
*/
|
|
75116
|
+
notEquals(other) {
|
|
75117
|
+
return notEqual(this, other);
|
|
75118
|
+
}
|
|
74559
75119
|
}
|
|
74560
75120
|
class ArrayExpr extends Expr {
|
|
74561
75121
|
constructor(value_type, ast, createExpr) {
|
|
@@ -76363,6 +76923,44 @@ class ArrayExpr extends Expr {
|
|
|
76363
76923
|
arguments: [this[AstSymbol], configAst]
|
|
76364
76924
|
});
|
|
76365
76925
|
}
|
|
76926
|
+
/**
|
|
76927
|
+
* Checks if this array equals another array (deep comparison).
|
|
76928
|
+
*
|
|
76929
|
+
* @param other - The array to compare against
|
|
76930
|
+
* @returns A BooleanExpr that is true if the arrays are deeply equal
|
|
76931
|
+
*
|
|
76932
|
+
* @example
|
|
76933
|
+
* ```ts
|
|
76934
|
+
* const isEqual = East.function([ArrayType(IntegerType), ArrayType(IntegerType)], BooleanType, ($, a, b) => {
|
|
76935
|
+
* $.return(a.equals(b));
|
|
76936
|
+
* });
|
|
76937
|
+
* const compiled = East.compile(isEqual.toIR(), []);
|
|
76938
|
+
* compiled([1n, 2n, 3n], [1n, 2n, 3n]); // true
|
|
76939
|
+
* compiled([1n, 2n], [1n, 2n, 3n]); // false
|
|
76940
|
+
* ```
|
|
76941
|
+
*/
|
|
76942
|
+
equals(other) {
|
|
76943
|
+
return equal(this, other);
|
|
76944
|
+
}
|
|
76945
|
+
/**
|
|
76946
|
+
* Checks if this array does not equal another array.
|
|
76947
|
+
*
|
|
76948
|
+
* @param other - The array to compare against
|
|
76949
|
+
* @returns A BooleanExpr that is true if the arrays are not equal
|
|
76950
|
+
*
|
|
76951
|
+
* @example
|
|
76952
|
+
* ```ts
|
|
76953
|
+
* const isNotEqual = East.function([ArrayType(IntegerType), ArrayType(IntegerType)], BooleanType, ($, a, b) => {
|
|
76954
|
+
* $.return(a.notEquals(b));
|
|
76955
|
+
* });
|
|
76956
|
+
* const compiled = East.compile(isNotEqual.toIR(), []);
|
|
76957
|
+
* compiled([1n, 2n], [1n, 2n, 3n]); // true
|
|
76958
|
+
* compiled([1n, 2n, 3n], [1n, 2n, 3n]); // false
|
|
76959
|
+
* ```
|
|
76960
|
+
*/
|
|
76961
|
+
notEquals(other) {
|
|
76962
|
+
return notEqual(this, other);
|
|
76963
|
+
}
|
|
76366
76964
|
}
|
|
76367
76965
|
class SetExpr extends Expr {
|
|
76368
76966
|
constructor(key_type, ast, createExpr) {
|
|
@@ -77436,6 +78034,44 @@ class SetExpr extends Expr {
|
|
|
77436
78034
|
}
|
|
77437
78035
|
}
|
|
77438
78036
|
}
|
|
78037
|
+
/**
|
|
78038
|
+
* Checks if this set equals another set (same elements).
|
|
78039
|
+
*
|
|
78040
|
+
* @param other - The set to compare against
|
|
78041
|
+
* @returns A BooleanExpr that is true if the sets are equal
|
|
78042
|
+
*
|
|
78043
|
+
* @example
|
|
78044
|
+
* ```ts
|
|
78045
|
+
* const isEqual = East.function([SetType(IntegerType), SetType(IntegerType)], BooleanType, ($, a, b) => {
|
|
78046
|
+
* $.return(a.equals(b));
|
|
78047
|
+
* });
|
|
78048
|
+
* const compiled = East.compile(isEqual.toIR(), []);
|
|
78049
|
+
* compiled(new Set([1n, 2n, 3n]), new Set([1n, 2n, 3n])); // true
|
|
78050
|
+
* compiled(new Set([1n, 2n]), new Set([1n, 2n, 3n])); // false
|
|
78051
|
+
* ```
|
|
78052
|
+
*/
|
|
78053
|
+
equals(other) {
|
|
78054
|
+
return equal(this, other);
|
|
78055
|
+
}
|
|
78056
|
+
/**
|
|
78057
|
+
* Checks if this set does not equal another set.
|
|
78058
|
+
*
|
|
78059
|
+
* @param other - The set to compare against
|
|
78060
|
+
* @returns A BooleanExpr that is true if the sets are not equal
|
|
78061
|
+
*
|
|
78062
|
+
* @example
|
|
78063
|
+
* ```ts
|
|
78064
|
+
* const isNotEqual = East.function([SetType(IntegerType), SetType(IntegerType)], BooleanType, ($, a, b) => {
|
|
78065
|
+
* $.return(a.notEquals(b));
|
|
78066
|
+
* });
|
|
78067
|
+
* const compiled = East.compile(isNotEqual.toIR(), []);
|
|
78068
|
+
* compiled(new Set([1n, 2n]), new Set([1n, 2n, 3n])); // true
|
|
78069
|
+
* compiled(new Set([1n, 2n, 3n]), new Set([1n, 2n, 3n])); // false
|
|
78070
|
+
* ```
|
|
78071
|
+
*/
|
|
78072
|
+
notEquals(other) {
|
|
78073
|
+
return notEqual(this, other);
|
|
78074
|
+
}
|
|
77439
78075
|
}
|
|
77440
78076
|
class DictExpr extends Expr {
|
|
77441
78077
|
constructor(key_type, value_type, ast, createExpr) {
|
|
@@ -78856,6 +79492,44 @@ class DictExpr extends Expr {
|
|
|
78856
79492
|
}
|
|
78857
79493
|
}
|
|
78858
79494
|
}
|
|
79495
|
+
/**
|
|
79496
|
+
* Checks if this dictionary equals another dictionary (same key-value pairs).
|
|
79497
|
+
*
|
|
79498
|
+
* @param other - The dictionary to compare against
|
|
79499
|
+
* @returns A BooleanExpr that is true if the dictionaries are equal
|
|
79500
|
+
*
|
|
79501
|
+
* @example
|
|
79502
|
+
* ```ts
|
|
79503
|
+
* const isEqual = East.function([DictType(StringType, IntegerType), DictType(StringType, IntegerType)], BooleanType, ($, a, b) => {
|
|
79504
|
+
* $.return(a.equals(b));
|
|
79505
|
+
* });
|
|
79506
|
+
* const compiled = East.compile(isEqual.toIR(), []);
|
|
79507
|
+
* compiled(new Map([["a", 1n], ["b", 2n]]), new Map([["a", 1n], ["b", 2n]])); // true
|
|
79508
|
+
* compiled(new Map([["a", 1n]]), new Map([["a", 1n], ["b", 2n]])); // false
|
|
79509
|
+
* ```
|
|
79510
|
+
*/
|
|
79511
|
+
equals(other) {
|
|
79512
|
+
return equal(this, other);
|
|
79513
|
+
}
|
|
79514
|
+
/**
|
|
79515
|
+
* Checks if this dictionary does not equal another dictionary.
|
|
79516
|
+
*
|
|
79517
|
+
* @param other - The dictionary to compare against
|
|
79518
|
+
* @returns A BooleanExpr that is true if the dictionaries are not equal
|
|
79519
|
+
*
|
|
79520
|
+
* @example
|
|
79521
|
+
* ```ts
|
|
79522
|
+
* const isNotEqual = East.function([DictType(StringType, IntegerType), DictType(StringType, IntegerType)], BooleanType, ($, a, b) => {
|
|
79523
|
+
* $.return(a.notEquals(b));
|
|
79524
|
+
* });
|
|
79525
|
+
* const compiled = East.compile(isNotEqual.toIR(), []);
|
|
79526
|
+
* compiled(new Map([["a", 1n]]), new Map([["a", 1n], ["b", 2n]])); // true
|
|
79527
|
+
* compiled(new Map([["a", 1n], ["b", 2n]]), new Map([["a", 1n], ["b", 2n]])); // false
|
|
79528
|
+
* ```
|
|
79529
|
+
*/
|
|
79530
|
+
notEquals(other) {
|
|
79531
|
+
return notEqual(this, other);
|
|
79532
|
+
}
|
|
78859
79533
|
}
|
|
78860
79534
|
const _StructExpr = class StructExpr extends Expr {
|
|
78861
79535
|
constructor(field_types, ast, factory) {
|
|
@@ -78934,60 +79608,56 @@ class VariantExpr extends Expr {
|
|
|
78934
79608
|
const handlers = Object.fromEntries(Object.keys(this.cases).map((caseName) => [caseName, caseName === name ? (_$, data) => data : ($, _data) => onOther($)]));
|
|
78935
79609
|
return Expr.match(this, handlers);
|
|
78936
79610
|
}
|
|
79611
|
+
// Implementation
|
|
79612
|
+
match(handlers, defaultHandler) {
|
|
79613
|
+
const completeHandlers = Object.fromEntries(Object.keys(this.cases).map((caseName) => [
|
|
79614
|
+
caseName,
|
|
79615
|
+
handlers[caseName] ?? (defaultHandler ? (($, _data) => defaultHandler($)) : void 0)
|
|
79616
|
+
]));
|
|
79617
|
+
return Expr.match(this, completeHandlers);
|
|
79618
|
+
}
|
|
78937
79619
|
/**
|
|
78938
|
-
*
|
|
78939
|
-
*
|
|
78940
|
-
* This method allows partial matching where you only need to handle the cases you care about,
|
|
78941
|
-
* with a required default handler for any unmatched cases. This is more ergonomic than
|
|
78942
|
-
* exhaustive matching when you only need to handle a subset of cases.
|
|
79620
|
+
* Checks if this variant equals another variant (same tag and value).
|
|
78943
79621
|
*
|
|
78944
|
-
* @
|
|
78945
|
-
* @
|
|
78946
|
-
* @param handlers - Object mapping case names to handler functions (not all cases required)
|
|
78947
|
-
* @param defaultHandler - Required handler for any unmatched cases
|
|
78948
|
-
* @returns Expression of the union type of all handler return types and default return type
|
|
78949
|
-
*
|
|
78950
|
-
* @see {@link Expr.match} for exhaustive pattern matching requiring all cases
|
|
78951
|
-
* @see {@link unwrap} for extracting a single case value
|
|
79622
|
+
* @param other - The variant to compare against
|
|
79623
|
+
* @returns A BooleanExpr that is true if the variants are equal
|
|
78952
79624
|
*
|
|
78953
79625
|
* @example
|
|
78954
79626
|
* ```ts
|
|
78955
79627
|
* const OptionType = VariantType({ some: IntegerType, none: NullType });
|
|
78956
79628
|
*
|
|
78957
|
-
*
|
|
78958
|
-
*
|
|
78959
|
-
* $.return(opt.match({
|
|
78960
|
-
* some: ($, val) => val
|
|
78961
|
-
* }, ($) => 0n));
|
|
79629
|
+
* const isEqual = East.function([OptionType, OptionType], BooleanType, ($, a, b) => {
|
|
79630
|
+
* $.return(a.equals(b));
|
|
78962
79631
|
* });
|
|
78963
|
-
* const compiled = East.compile(
|
|
78964
|
-
* compiled(
|
|
78965
|
-
* compiled(
|
|
79632
|
+
* const compiled = East.compile(isEqual.toIR(), []);
|
|
79633
|
+
* compiled(variant("some", 42n), variant("some", 42n)); // true
|
|
79634
|
+
* compiled(variant("some", 42n), variant("some", 0n)); // false
|
|
79635
|
+
* compiled(variant("some", 42n), variant("none", null)); // false
|
|
78966
79636
|
* ```
|
|
79637
|
+
*/
|
|
79638
|
+
equals(other) {
|
|
79639
|
+
return equal(this, other);
|
|
79640
|
+
}
|
|
79641
|
+
/**
|
|
79642
|
+
* Checks if this variant does not equal another variant.
|
|
79643
|
+
*
|
|
79644
|
+
* @param other - The variant to compare against
|
|
79645
|
+
* @returns A BooleanExpr that is true if the variants are not equal
|
|
78967
79646
|
*
|
|
78968
79647
|
* @example
|
|
78969
79648
|
* ```ts
|
|
78970
|
-
* const
|
|
78971
|
-
*
|
|
78972
|
-
*
|
|
78973
|
-
*
|
|
78974
|
-
* $.return(result.match({
|
|
78975
|
-
* ok: ($, val) => val,
|
|
78976
|
-
* error: ($, _msg) => -1n
|
|
78977
|
-
* }, ($) => 0n)); // pending -> 0
|
|
79649
|
+
* const OptionType = VariantType({ some: IntegerType, none: NullType });
|
|
79650
|
+
*
|
|
79651
|
+
* const isNotEqual = East.function([OptionType, OptionType], BooleanType, ($, a, b) => {
|
|
79652
|
+
* $.return(a.notEquals(b));
|
|
78978
79653
|
* });
|
|
78979
|
-
* const compiled = East.compile(
|
|
78980
|
-
* compiled(
|
|
78981
|
-
* compiled(
|
|
78982
|
-
* compiled(Expr.variant("pending", null)); // 0n
|
|
79654
|
+
* const compiled = East.compile(isNotEqual.toIR(), []);
|
|
79655
|
+
* compiled(variant("some", 42n), variant("some", 0n)); // true
|
|
79656
|
+
* compiled(variant("some", 42n), variant("some", 42n)); // false
|
|
78983
79657
|
* ```
|
|
78984
79658
|
*/
|
|
78985
|
-
|
|
78986
|
-
|
|
78987
|
-
caseName,
|
|
78988
|
-
handlers[caseName] ?? (($, _data) => defaultHandler($))
|
|
78989
|
-
]));
|
|
78990
|
-
return Expr.match(this, completeHandlers);
|
|
79659
|
+
notEquals(other) {
|
|
79660
|
+
return notEqual(this, other);
|
|
78991
79661
|
}
|
|
78992
79662
|
}
|
|
78993
79663
|
function printLocationValue(location) {
|
|
@@ -80961,8 +81631,27 @@ class EastError extends Error {
|
|
|
80961
81631
|
constructor(message, options) {
|
|
80962
81632
|
super(message, options.cause === void 0 ? void 0 : { cause: options.cause });
|
|
80963
81633
|
__publicField(this, "location");
|
|
81634
|
+
__publicField(this, "eastMessage");
|
|
81635
|
+
this.eastMessage = message;
|
|
80964
81636
|
this.location = [options.location];
|
|
80965
81637
|
}
|
|
81638
|
+
toString() {
|
|
81639
|
+
const loc = this.location[0];
|
|
81640
|
+
const header = `${loc.filename}:${loc.line}:${loc.column}: ${this.eastMessage}`;
|
|
81641
|
+
if (this.location.length <= 1) {
|
|
81642
|
+
return header;
|
|
81643
|
+
}
|
|
81644
|
+
const lines = [header, "Stack trace:"];
|
|
81645
|
+
for (let i2 = this.location.length - 1; i2 >= 1; i2--) {
|
|
81646
|
+
const frame = this.location[i2];
|
|
81647
|
+
lines.push(` at ${frame.filename}:${frame.line}:${frame.column}`);
|
|
81648
|
+
}
|
|
81649
|
+
return lines.join("\n");
|
|
81650
|
+
}
|
|
81651
|
+
/** Format for use with Error.message */
|
|
81652
|
+
get formattedMessage() {
|
|
81653
|
+
return this.toString();
|
|
81654
|
+
}
|
|
80966
81655
|
}
|
|
80967
81656
|
const _BufferWriter = class _BufferWriter {
|
|
80968
81657
|
constructor(initialCapacity = 16384) {
|