Added feature to pop each item using the `popEach` function

Added feature to pop each item using the `popEach` function and pass a callback to receive the popped item.