pub fn times<T, F>(count: usize, iteratee: F) -> Vec<T>Expand description
Generates a collection by invoking the provided function iteratee a specified number of times.
This function calls the iteratee function count times, passing in the current index each time,
and collects the results into a Vec<T>.
§Arguments
count- The number of times to invokeiteratee.iteratee- A function that takes the current index and returns a value of typeT.
§Returns
Vec<T>- A vector containing the results of each invocation ofiteratee.
§Examples
use lowdash::times;
let result = times(5, |i| i * 2);
assert_eq!(result, vec![0, 2, 4, 6, 8]);use lowdash::times;
let result = times(3, |i| format!("Item {}", i));
assert_eq!(result, vec!["Item 0", "Item 1", "Item 2"]);