use super::funejson::Value; use super::todo_item::Todo; use super::todo_item_validate_todo::{todos_from_value, todos_to_value}; use super::todo_list_update_todo::index_of_todo; /// Delete one todo; the others keep their order values (gaps are harmless). /// /// # Panics /// On an unknown id. pub fn remove_todo(todos: &[Todo], id: &str) -> Vec { let at = index_of_todo(todos, id); let mut out = todos.to_vec(); out.remove(at); out } pub fn fune_vector(args: &[Value]) -> Value { let todos = todos_from_value(&args[0]); todos_to_value(&remove_todo(&todos, args[1].as_str())) }