<commit_before>'use strict';

/*
 * Execute `fn` `n` times.
 */
module.exports = function (n, fn) {
    var promises = [];
    var i;

    for (i = 1; i <= n; ++i) {
        try {
            promises.push(fn(i));
        } catch (error) {
            return Promise.reject(error);
        }
    }

    return Promise.all(promises);
};<commit_msg>update promise/times — lint, es6<commit_after>'use strict'

const limitConcurrency = require('./util/limitConcurrency')

// Execute `fn` `n` times.

module.exports = (n, fn, options) => {
  const operations = []
  options = options || {concurrency: Infinity}

  while (operations.length < n) {
    operations.push(fn.bind(null, operations.length + 1))
  }

  return limitConcurrency(options.concurrency, operations)
}
{'fraction_non_alphanumeric': 0.15837696335078533, 'fraction_numerical': 0.003926701570680628, 'mean_word_length': 2.8059701492537314, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2734617', 'n_tokens_mistral': 253, 'n_tokens_neox': 247, 'n_words': 60}