<commit_before>'use strict'

var WriteStream = require('multi-write-stream')
var ReadStream = require('multi-read-stream')
var Duplexify = require('duplexify')
var inherits = require('inherits')

var miss = require('mississippi')

inherits(MultiDuplex, Duplexify)
function MultiDuplex (streams, opts) {
  if (!(this instanceof MultiDuplex)) return new MultiDuplex(streams, opts)
  if (!streams) streams = []

  if (streams && !Array.isArray(streams)) {
    opts = streams
    streams = []
  }

  if (!opts) opts = {}

  this._multiWrite = new WriteStream(streams, opts)
  this._multiRead = new ReadStream(streams, opts)

  Duplexify.call(this, this._multiWrite, this._multiRead, opts)

  this.streams = streams
}

MultiDuplex.prototype.add = function (stream) {
  this._multiWrite.add(stream)
  this._multiRead.add(stream)
}
MultiDuplex.prototype.remove = function (stream) {
  this._multiWrite.add(stream)
  this._multiRead.add(stream)
}

MultiDuplex.prototype.finalize = function () {
  this._multiRead.finalize()
}

MultiDuplex.obj = function (streams, opts) {
  if (streams && !Array.isArray(streams)) return MultiDuplex.obj([], streams)<commit_msg>Pass on copy of streams array, and manage the original itself<commit_after>'use strict'

var WriteStream = require('multi-write-stream')
var ReadStream = require('multi-read-stream')
var Duplexify = require('duplexify')
var inherits = require('inherits')

var miss = require('mississippi')

inherits(MultiDuplex, Duplexify)
function MultiDuplex (streams, opts) {
  if (!(this instanceof MultiDuplex)) return new MultiDuplex(streams, opts)
  if (!streams) streams = []

  if (streams && !Array.isArray(streams)) {
    opts = streams
    streams = []
  }

  if (!opts) opts = {}

  this.streams = streams
  this._multiWrite = new WriteStream(this.streams.slice(), opts)
  this._multiRead = new ReadStream(this.streams.slice(), opts)

  Duplexify.call(this, this._multiWrite, this._multiRead, opts)
}

MultiDuplex.prototype.add = function (stream) {
  this._multiWrite.add(stream)
  this._multiRead.add(stream)
}
MultiDuplex.prototype.remove = function (stream) {
  var i = this.streams.indexOf(stream)
  if (i === -1) return
  this.streams.splice(i, 1)

  this._multiWrite.remove(stream)
  this._multiRead.remove(stream)
}

MultiDuplex.prototype.finalize = function () {
  this._multiRead.finalize()
}

MultiDuplex.obj = function (streams, opts) {
  if (streams && !Array.isArray(streams)) return MultiDuplex.obj([], streams)
{'fraction_non_alphanumeric': 0.13691437802907916, 'fraction_numerical': 0.0008077544426494346, 'mean_word_length': 4.911694510739856, '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': '3759503', 'n_tokens_mistral': 839, 'n_tokens_neox': 826, 'n_words': 178}