Add docs on JSON parsing.

This commit is contained in:
Stephen Chung
2020-04-10 15:18:26 +08:00
parent adbfceb5be
commit 5d611d1674
3 changed files with 220 additions and 40 deletions

View File

@@ -631,12 +631,14 @@ impl Engine<'_> {
});
// Register map access functions
#[cfg(not(feature = "no_index"))]
self.register_fn("keys", |map: Map| {
map.into_iter()
.map(|(k, _)| k.into_dynamic())
.collect::<Vec<_>>()
});
#[cfg(not(feature = "no_index"))]
self.register_fn("values", |map: Map| {
map.into_iter().map(|(_, v)| v).collect::<Vec<_>>()
});