<commit_before>import chunkify from '../index'
import ChunkifyOptions from '../options'
import _ from 'underscore'
import {verify_usage} from './utilities'


const USAGE = 'Usage: chunkify.map(Array array, Function fn, [Object options])';

let map = (array, fn, options) => {
  verify_usage(array, fn, USAGE);
  let map_results = [];
  let push_result = (result) => {
    map_results.push(result);
    return result;
  };
  return chunkify.each(array, _.compose(push_result, fn), options).then(() => {
    return map_results;
  });
};


export default map<commit_msg>Improve naming a bit<commit_after>import chunkify from '../index'
import ChunkifyOptions from '../options'
import _ from 'underscore'
import {verify_usage} from './utilities'


const USAGE = 'Usage: chunkify.map(Array array, Function fn, [Object options])';

let map = (array, fn, options) => {
  verify_usage(array, fn, USAGE);
  let mapped = [];
  let pusher = (result) => {
    mapped.push(result);
    return result;
  };
  let mapper = _.compose(pusher, fn);
  return chunkify.each(array, mapper, options).then(() => {
    return mapped;
  });
};


export default map
{'fraction_non_alphanumeric': 0.15100965759438104, 'fraction_numerical': 0.0, 'mean_word_length': 4.135135135135135, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '6296346', 'n_tokens_mistral': 370, 'n_tokens_neox': 363, 'n_words': 105}