filtering empty lines

This commit is contained in:
Fernando Herrera 2021-09-23 20:44:50 +01:00
parent 04990eeba4
commit cb9db792a6

View File

@ -39,9 +39,13 @@ impl Command for Lines {
.map(|s| s.to_string()) .map(|s| s.to_string())
.collect::<Vec<String>>(); .collect::<Vec<String>>();
let iter = lines let iter = lines.into_iter().filter_map(move |s| {
.into_iter() if !s.is_empty() {
.map(move |s| Value::String { val: s, span }); Some(Value::String { val: s, span })
} else {
None
}
});
Value::Stream { Value::Stream {
stream: ValueStream(Rc::new(RefCell::new(iter))), stream: ValueStream(Rc::new(RefCell::new(iter))),