1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

toml: add convenience convertion of Doc to map[string]toml.Any (#12473)

This commit is contained in:
Larpon 2021-11-15 18:00:09 +01:00 committed by GitHub
parent c28041cecc
commit 7b9cca7524
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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"`.