diff --git a/src/commands/compact.rs b/src/commands/compact.rs index ab0c96ba41..4660e88adc 100644 --- a/src/commands/compact.rs +++ b/src/commands/compact.rs @@ -37,7 +37,7 @@ pub fn compact( CompactArgs { rest: columns }: CompactArgs, RunnableContext { input, .. }: RunnableContext, ) -> Result { - let objects = input.values.take_while(move |item| { + let objects = input.values.filter(move |item| { let keep = if columns.is_empty() { item.is_some() } else { diff --git a/src/commands/default.rs b/src/commands/default.rs index 099fd32e0d..52d33e463c 100644 --- a/src/commands/default.rs +++ b/src/commands/default.rs @@ -59,7 +59,7 @@ fn default( if should_add { match item.insert_data_at_path(&column.item, value.item.clone()) { Some(new_value) => result.push_back(ReturnSuccess::value(new_value)), - None => {} + None => result.push_back(ReturnSuccess::value(item)), } } else { result.push_back(ReturnSuccess::value(item)); diff --git a/tests/commands_test.rs b/tests/commands_test.rs index 4da12d5c80..59621539db 100644 --- a/tests/commands_test.rs +++ b/tests/commands_test.rs @@ -4,7 +4,7 @@ use helpers as h; use helpers::{Playground, Stub::*}; #[test] -fn default() { +fn default_row_data_if_column_missing() { Playground::setup("default_test_1", |dirs, sandbox| { sandbox.with_files(vec![FileWithContentToBeTrimmed( "los_tres_amigos.json",