You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| Word Limit |`word-limit`|`{umbValue: intro \| word-limit:15}`|
70
70
71
+
72
+
## UFM Expressions (JavaScript-like syntax)
73
+
74
+
UFM can also support JavaScript-like expressions to allow for basic logic within label templates and descriptions. This is especially useful for advanced label rendering, fallback values, and dynamic formatting without developing your own custom UFM components or filters.
75
+
76
+
### Syntax
77
+
78
+
Expressions are defined using the `${ ... }` syntax. This is different to the syntax outlined above. You can use standard JavaScript operators, function calls, and property access.
Expressions can reference property aliases, perform calculations, concatenate strings, and more.
92
+
93
+
### Supported operations
94
+
95
+
- Arithmetic (`+`, `-`, `*`, `/`)
96
+
- Logical (`&&`, `||`, `!`)
97
+
- Conditional (`? :`)
98
+
- Function calls (limited to safe native/built-in functions like `toUpperCase()`, `toLowerCase()`, etc.)
99
+
- Property access (`myProperty.length`)
100
+
101
+
### Sandboxed evaluation
102
+
103
+
All expressions are evaluated in a sandbox. Only safe operations and methods are allowed. Access to global objects, external APIs, or unsafe functions will be blocked. To extend expressions with your own functions, it is recommended to use the piped UFM Filter syntax.
0 commit comments