3 module.exports = syncForEach;
6 * A facade that allows {@link Array.forEach} to be called as though it were asynchronous.
8 * @param {array} array - The array to iterate over
9 * @param {function} iterator - The function to call for each item in the array
10 * @param {function} done - The function to call when all iterators have completed
12 function syncForEach (array, iterator, done) {
13 array.forEach(item => {
14 iterator(item, () => {
15 // Note: No error-handling here because this is currently only ever called
16 // by DirectoryReader, which never passes an `error` parameter to the callback.
17 // Instead, DirectoryReader emits an "error" event if an error occurs.