code: function mapAndChain(array, promiseFn) {
    // Start the promise chain with a resolved promise.
    return array.reduce((chain, item) => chain.then(() => promiseFn(item)), Promise.resolve());
  }
docs: Apply the given promise-returning function to each member of the array. Ensure each promise completes before starting the next one to avoid spinning up too many file operations at once. This is effectively like Promise.all(), while ensuring that the items are processed in a completely sequential order.