<commit_before>var demo = {}

demo.controller = function(p) {
  p.data = [{
    name: 'joe'
  }, {
    name: 'bob'
  }]
}

demo.view = function(s, p) {

  s.h2 = {
    _onclick: function() {
      s.count = s.count + 1 || 1
      p.data.push({
        name: "--" + s.count
      })
    }
  }

  mag.module('CommentList', CommentList, {
    data: p.data
  })

}

var CommentList = {
  view: function(s, p) {
    console.log('view', p.data.length)

    var promises = p.data.map(function(comment) {
      console.log('name: ', comment.name)
      return mag.module('Comment', Comment, {
        name: comment.name
      }, 1)


    })


    Promise.all(promises).then(function(d) {
      console.log(d, d.length)
      s.commentList = d
    })


  }
}

var Comment = {
  view: function(s, p) {<commit_msg>Update test.js<commit_after>// hookin to create an element if does not exist at the root level
mag.hookin('elementMatcher', 'testme', function(data) {
  // data.key, data.node, data.value

  var fragment = document.createDocumentFragment(),
    el = document.createElement('div');
  el.setAttribute('class', data.key)
  fragment.appendChild(el);

  var nodelist = fragment.childNodes;
  data.node.appendChild(fragment)

  data.value = nodelist
})

var demo = {}

demo.controller = function(p) {
  p.data = [{
    name: 'joe'
  }, {
    name: 'bob'
  }]
}

demo.view = function(s, p) {

  s.testme = 'tester'

  s.h2 = {
    _onclick: function() {
      s.count = s.count + 1 || 1
      p.data.push({
        name: "--" + s.count
      })
    }
  }

  mag.module('CommentList', CommentList, {
    data: p.data
  })

}

var CommentList = {
  view: function(s, p) {
    //console.log('view', p.data.length)

    var promises = p.data.map(function(comment) {
      //console.log('name: ', comment.name)
      return mag.module('Comment', Comment, {
        name: comment.name
      }, 1)


    })


    Promise.all(promises).then(function(d) {
      // console.log(d, d.length)
      s.commentList = d
    })


  }
}

var Comment = {
  view: function(s, p) {
{'fraction_non_alphanumeric': 0.1706368497812348, 'fraction_numerical': 0.003889158969372873, 'mean_word_length': 2.3247172859450727, 'pattern_counts': {'":': 0, '<': 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': '7343485', 'n_tokens_mistral': 771, 'n_tokens_neox': 737, 'n_words': 145}