docs
This commit is contained in:
@@ -12,7 +12,8 @@ unit_render
|
||||
3_C++ Preprocessor
|
||||
map
|
||||
filter
|
||||
dv_filter
|
||||
2_DValue_filter
|
||||
2_DValue_map
|
||||
|
||||
:content
|
||||
UCE is server-first C++ with a small template preprocessor. It does not try to be React, but several concepts map cleanly.
|
||||
@@ -45,10 +46,10 @@ That keeps file-based and hierarchical routing in normal UCE code instead of hid
|
||||
The function library includes small collection helpers for common route/menu/card transformations:
|
||||
|
||||
```cpp
|
||||
auto visible = filter(routes, [](String route) { return(route != "admin"); });
|
||||
auto labels = map(visible, [](String route) { return(to_upper(route)); });
|
||||
DValue app_items = dv_filter(menu, [](DValue item, String key) { return(item["section"].to_string() == "app"); });
|
||||
DValue by_section = dv_group_by(menu, [](DValue item, String key) { return(item["section"].to_string()); });
|
||||
auto visible = routes.filter([](String route) { return(route != "admin"); });
|
||||
auto labels = visible.map([](String route) { return(to_upper(route)); });
|
||||
DValue app_items = menu.filter([](DValue item, String key) { return(item["section"].to_string() == "app"); });
|
||||
DValue labels_by_key = menu.map([](DValue item, String key) { DValue out; out = item["label"].to_string(); return(out); });
|
||||
```
|
||||
|
||||
Use these when a short transformation is clearer than a loop. Prefer explicit loops for side effects or multi-step validation.
|
||||
|
||||
Reference in New Issue
Block a user