docs
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
:sig
|
||||
DValue DValue::map(std::function<DValue (const DValue& item, String key)> f) const
|
||||
|
||||
:params
|
||||
f : mapper called for each iterated item
|
||||
return value : mapped copy
|
||||
|
||||
:see
|
||||
0_DValue
|
||||
2_DValue_each
|
||||
2_DValue_filter
|
||||
|
||||
:content
|
||||
Builds a new `DValue` by replacing each iterated child with the mapper's returned value. List-shaped input stays list-shaped and is re-indexed by `push()`. Map-shaped input preserves keys. Scalar input is mapped once and pushed into a list.
|
||||
|
||||
```cpp
|
||||
DValue labels = rows.map([](const DValue& row, String) {
|
||||
DValue out; out = row.get_by_path("label").to_string(); return(out);
|
||||
});
|
||||
```
|
||||
Reference in New Issue
Block a user