@@ -8,6 +8,8 @@ const customOperators = new Map(
88 $clientId : ( ) => localStorage . getItem ( "clientId" ) ,
99 $session_id : ( ) => localStorage . getItem ( "session_id" ) ,
1010 $value : ( element ) => element . getValue ( ) || "" ,
11+ // TODO: get length of value
12+ // $length: (element) => {element.getValue() || ""},
1113 $innerWidth : ( ) => window . innerWidth ,
1214 $innerHeight : ( ) => window . innerHeight ,
1315 $href : ( ) => window . location . href . replace ( / \/ $ / , "" ) ,
@@ -34,7 +36,19 @@ const customOperators = new Map(
3436 return path === "/" ? "" : path ;
3537 } ,
3638 $param : ( element , args ) => args ,
37- $setValue : ( element , args ) => element . setValue ( ...args ) || ""
39+ $setValue : ( element , args ) => element . setValue ( ...args ) || "" ,
40+ $true : ( ) => true ,
41+ $false : ( ) => false ,
42+ // TODO: Handle uuid generation
43+ // $uid: () => uid.generate(6),
44+ $parse : ( element , args ) => {
45+ let value = args || "" ;
46+ try {
47+ return JSON . parse ( value ) ;
48+ } catch ( e ) {
49+ return value ;
50+ }
51+ }
3852 } )
3953) ;
4054
@@ -49,7 +63,8 @@ const propertyOperators = new Set([
4963 "$className" ,
5064 "$textContent" ,
5165 "$innerHTML" ,
52- "$getValue"
66+ "$getValue" ,
67+ "$reset"
5368] ) ;
5469
5570// Combine all known operator keys for the main parsing regex
0 commit comments