<commit_before>var through = require('through2')
var test = require('tape')
var cuid = require('cuid')
var _ = require('underscore')

// attach a cuid like a mini cargo in bricoleur

// trace commands as they flow through bricoleur!

var cmds = [ // no objects 
  ['+@edit nimoy', cuid()],
  ['+gooshter', cuid()],
  ['+pumicle', cuid()],
  ['+gooshter|pumicle', cuid()],
  ['-gooshter|pumicle', cuid()],
  ['-gooshter', cuid()],
  ['-pumicle', cuid()],
  ['-@edit', cuid()]
]

module.exports = function ClientTest (opts) {
  var p = through.obj()

  test('bricoleur api', function (t) {
    t.plan(cmds.length) 

    cmds.forEach(function (c) {
      s.push(c[0]+':'+c[1])
    })

    p.on('data', function (d) {
      if (typeof d === 'object' && d.key && d.value) {
        var i = (d.key.split(':').length>1) 
          ? dex(d.key.split(':')[1],cmds) 
          : dex(d.key,cmds)

        if (typeof i === 'string') i = Math.abs(i)

        var c = cmds[i]
        if (i!==0&&i!==7) t.ok(isCuid(d.value), 'cmd: '+c[0])
        else t.ok(d.value, 'cmd: '+c[0])
      } else {
        console.log(JSON.stringify(d))
      }
    })
  })

  var s = through.obj(function (d, enc, next) { 
    p.write(d)
    next()
  })

  return s
}

function dex (str, arr) { 
  var res = null
  for (var i=0;i<arr.length;i++) {
    arr[i].forEach(function (item) { if (item === str) res = i })
  }
  return res.toString()
}

function isCuid (id) {
  var r = (typeof id==='string' && id.length===25 && id[0]==='c') 
    ? true 
    : false
<commit_msg>comment out call set window.location.hash to @ in tests<commit_after>var through = require('through2')
var _ = require('underscore')
var test = require('tape')
var cuid = require('cuid')

var cmds = [
  ['+@edit nimoy', cuid()],
  ['+gooshter', cuid()],
  ['+pumicle', cuid()],
  ['+gooshter|pumicle', cuid()],
  ['-gooshter|pumicle', cuid()],
  ['-gooshter', cuid()],
  ['-pumicle', cuid()],
  ['-@edit', cuid()]
]

// update gooshter / pumicle to use dombii / dex / etc!
// actual use cases!

module.exports = function ClientTest (opts) {
  var p = through.obj()

  test('bricoleur api', function (t) { // add omni tests!
    t.plan(cmds.length) 

    cmds.forEach(function (c) {
      s.push(c[0]+':'+c[1])
    })

    p.on('data', function (d) {
      if (typeof d === 'object' && d.key && d.value) {

        var i = (d.key.split(':').length>1) 
          ? dex(d.key.split(':')[1], cmds) 
          : dex(d.key, cmds)

        if (typeof i === 'string') i = Math.abs(i)

        var c = cmds[i]

        if (i !== 0 && i !== 7) t.ok(isCuid(d.value), 'cmd: '+c[0])
        // if (i==7) winodw.location.hash = '@'
        else t.ok(d.value, 'cmd: '+c[0])
      } 
    })
  })

  var s = through.obj(function (d, enc, next) { 
    p.write(d)
    next()
  })

  return s
}

function dex (str, arr) { 
  var res = null
  for (var i=0;i<arr.length;i++) {
    arr[i].forEach(function (item) { if (item === str) res = i })
  }
  return res.toString()
}

// MUTATIONS!

document.body.addEventListener("DOMNodeInserted", function (ev) {
  var el = ev.target
}, false)

document.body.addEventListener("DOMNodeRemoved", function (ev) {
  var el = ev.target
}, false)

// HELPERS!

function isCuid (id) {
  var r = (typeof id==='string' && id.length===25 && id[0]==='c') 
    ? true 
    : false

{'fraction_non_alphanumeric': 0.21767889356584486, 'fraction_numerical': 0.008117859290438966, 'mean_word_length': 2.7048997772828507, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '797960', 'n_tokens_mistral': 1362, 'n_tokens_neox': 1310, 'n_words': 299}