<commit_before>var pull = require('../')

require('tape')('async-map', function (t) {

  pull.count()
  .pipe(pull.take(21))
  .pipe(pull.asyncMap(function (data, cb) {
    return cb(null, data + 1)
  }))
  .pipe(pull.collect(function (err, ary) {
    console.log(ary)
    t.equal(ary.length, 21)
    t.end()
  }))

})<commit_msg>test for paraMap<commit_after>var pull = require('../')

require('tape')('async-map', function (t) {

  pull.count()
  .pipe(pull.take(21))
  .pipe(pull.asyncMap(function (data, cb) {
    return cb(null, data + 1)
  }))
  .pipe(pull.collect(function (err, ary) {
    console.log(ary)
    t.equal(ary.length, 21)
    t.end()
  }))

})

require('tape')('para-map', function (t) {

  var n = 0, m = 0, w = 6, i = 0
  pull.count()
  .pipe(pull.take(21))
  .pipe(pull.paraMap(function (data, cb) {
    console.log('>', i++)
    n ++
    m = Math.max(m, n)
    setTimeout(function () {
      n --

      console.log('<')
      cb(null, data + 1)
    }, Math.random() * 20)
  }, w))
  .pipe(pull.collect(function (err, ary) {
    console.log(ary)
    t.equal(ary.length, 21)
    t.equal(m, w)
    t.end()
  }))

})


{'fraction_non_alphanumeric': 0.218612818261633, 'fraction_numerical': 0.018437225636523266, 'mean_word_length': 2.737704918032787, 'pattern_counts': {'":': 0, '<': 4, '<?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': '6493514', 'n_tokens_mistral': 487, 'n_tokens_neox': 460, 'n_words': 87}