mirror of
https://github.com/nushell/nushell
synced 2025-01-15 14:44:14 +00:00
Flatten records. Not thoroughly tested though (#845)
This commit is contained in:
parent
69954a362d
commit
f4c0538653
1 changed files with 8 additions and 0 deletions
|
@ -166,10 +166,18 @@ fn flat_value(columns: &[CellPath], item: &Value, _name_tag: Span) -> Vec<Value>
|
||||||
}
|
}
|
||||||
pairs
|
pairs
|
||||||
};
|
};
|
||||||
|
|
||||||
for (column, value) in records_iterator {
|
for (column, value) in records_iterator {
|
||||||
let column_requested = columns.iter().find(|c| c.into_string() == *column);
|
let column_requested = columns.iter().find(|c| c.into_string() == *column);
|
||||||
|
|
||||||
match value {
|
match value {
|
||||||
|
Value::Record {
|
||||||
|
cols,
|
||||||
|
vals,
|
||||||
|
span: _,
|
||||||
|
} => cols.iter().enumerate().for_each(|(idx, column)| {
|
||||||
|
out.insert(column.to_string(), vals[idx].clone());
|
||||||
|
}),
|
||||||
Value::List { vals, span: _ } if vals.iter().all(|f| f.as_record().is_ok()) => {
|
Value::List { vals, span: _ } if vals.iter().all(|f| f.as_record().is_ok()) => {
|
||||||
let mut cs = vec![];
|
let mut cs = vec![];
|
||||||
let mut vs = vec![];
|
let mut vs = vec![];
|
||||||
|
|
Loading…
Reference in a new issue