mirror of
https://github.com/vlang/v.git
synced 2025-09-13 14:32:26 +03:00
toml: add convenience convertion of Doc to map[string]toml.Any (#12473)
This commit is contained in:
parent
c28041cecc
commit
7b9cca7524
1 changed files with 6 additions and 0 deletions
|
@ -89,6 +89,12 @@ pub fn (d Doc) to_json() string {
|
|||
return d.ast.to_json()
|
||||
}
|
||||
|
||||
// to_any converts the `Doc` to toml.Any type.
|
||||
pub fn (d Doc) to_any() Any {
|
||||
values := d.ast.table as map[string]ast.Value
|
||||
return d.ast_to_any(values)
|
||||
}
|
||||
|
||||
// value queries a value from the TOML document.
|
||||
// `key` should be in "dotted" form (`a.b.c`).
|
||||
// `key` supports quoted keys like `a."b.c"`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue