fix: stabilize runtime follow-up regressions
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
:sig
|
||||
bool DTree::is_array() const
|
||||
|
||||
:params
|
||||
return value : true when the node is map-shaped
|
||||
|
||||
:see
|
||||
>types
|
||||
0_DTree
|
||||
is_list
|
||||
has
|
||||
each
|
||||
|
||||
:content
|
||||
Tests whether a `DTree` node is map-shaped, i.e. holds nested child values rather than a scalar. This is a read accessor: it is `const`, never creates or modifies nodes, and dereferences internal references automatically.
|
||||
|
||||
`is_array()` is true for both list-like and keyed containers; use `is_list()` to distinguish the two:
|
||||
|
||||
```cpp
|
||||
DTree rows = sqlite_query(db, "select * from notes");
|
||||
if(rows.is_array())
|
||||
{
|
||||
rows.each([&](const DTree& row, String key) {
|
||||
// ...
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
Scalar values (strings, numbers, booleans, pointers) return `false`, as do unresolvable references.
|
||||
|
||||
## Related Concepts
|
||||
|
||||
- PHP: `is_array()`
|
||||
- JavaScript: `typeof value === "object"`
|
||||
Reference in New Issue
Block a user