ensure iterate function takes a callback function