<commit_before>var vows = require('vows');
var assert = require('assert');

var seq = require('../lib/sequence.js')();

vows.describe('Sequence').addBatch({
  "constructor" : {
    "always return score instance": function() {
      assert(seq() instanceof seq);
    },
    "time is 4/4 by default": function() {
      assert(seq().time.beats, 4);
      assert(seq().time.sub, 4);
    },
  },
  "parse no plugins": function() {
    var s = seq('a b');
    assert.equal(s.value(0), 'a');
    assert.equal(s.value(1), 'b');
  },
  "map": {
    "returns a sequence": function() {
      var s = seq('a b').map(function(a) { return a; });
      assert(s instanceof seq);
    },
    "apply the interatee": function() {
      var s = seq('a b').map(function(e) {
        return e.clone({ value: e.value().toUpperCase() })
      });
      assert.equal(s.events[0].value(), 'A');
      assert.equal(s.events[1].value(), 'B');
    }
  },
  "morph": function() {
    var s = seq('a b').morph(function(event, newSeq) {
      newSeq.add(event, {value: event.value().toUpperCase() });
    });
    assert.equal(s.events[0].value(), 'A');
    assert.equal(s.events[1].value(), 'B');
  },
  "toString": function() {<commit_msg>Add Sequence.map. Simplify teoria<commit_after>var vows = require('vows');
var assert = require('assert');

var seq = require('../lib/sequence.js')();

vows.describe('Sequence').addBatch({
  "constructor" : {
    "always return score instance": function() {
      assert(seq() instanceof seq);
    },
    "time is 4/4 by default": function() {
      assert(seq().time.beats, 4);
      assert(seq().time.sub, 4);
    },
  },
  "parse no plugins": function() {
    var s = seq('a b');
    assert.equal(s.value(0), 'a');
    assert.equal(s.value(1), 'b');
  },
  "map": {
    "returns a sequence": function() {
      var s = seq('a b').map(function(a) { return a; });
      assert(s instanceof seq);
    },
    "apply the interatee": function() {
      var s = seq('a b').map(function(e) {
        return e.clone({ value: e.value().toUpperCase() })
      });
      assert.equal(s.events[0].value(), 'A');
      assert.equal(s.events[1].value(), 'B');
    },
    "compact the result": function() {
      var s = seq('a b c').map(function(e) {
        if(e.value() == 'b') return e;
      });
      assert.equal(s.events.length, 1);
    }
  },
  "morph": function() {
    var s = seq('a b').morph(function(event, newSeq) {
      newSeq.add(event, {value: event.value().toUpperCase() });
    });
    assert.equal(s.events[0].value(), 'A');
    assert.equal(s.events[1].value(), 'B');
  },
  "toString": function() {
{'fraction_non_alphanumeric': 0.22230710466004583, 'fraction_numerical': 0.008021390374331552, 'mean_word_length': 2.8857566765578637, 'pattern_counts': {'":': 17, '<': 3, '<?xml version=': 0, '>': 3, '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': '7102743', 'n_tokens_mistral': 918, 'n_tokens_neox': 905, 'n_words': 192}