<commit_before>/**
 * Node.js REPL Waiting Console
 * Simple stream module for tapping REPL input/output
 * Copyright (c) 2016 <NAME>
 */

const Writable = require('stream').Writable
const Readable = require('stream').Readable

class StringWritable extends Writable {
  constructor (options) {
    // Set default encoding
    options = options || {}
    options.encoding = 'utf8'
    // Pass options to base class
    super(options)
    // Create simple string buffer
    this._buffer = ''
    // Add new listener handler
    this.on('newListener', function(event, listener) {
      if (event === 'data') {
        // Flush all data to receiver
        listener(null, this.read())
      }
    })
  }

  // Store chunk from internal buffer to string buffer
  _write (chunk, encoding, callback) {
    this._buffer += chunk.toString()
    if (this.emit('data', null, this._buffer)) {
      // Flush buffer if data event listened
      this.flush()
    }
    if (typeof callback === 'function') callback()
  }

  flush () {
    this._buffer = ''
  }

  read () {
    // Copy string to temporary buffer
    let buf = this._buffer
    // Empty current buffer
    this.flush()
    // Return copied buffer
    return buf
  }
}

class StringReadable extends Readable {
  constructor (options) {
    // Set default encoding
    options = options || {}
    options.encoding = 'utf8'
    // Call parent constructor
    super(options)
  }

  _read () {
    
  }

  write (string) {
    // Directly push input to internal buffer
    this.push(string)
  }
}

module.exports = {
  StringWritable: StringWritable,
  StringReadable: StringReadable
}
<commit_msg>Add strict directive to string-stream<commit_after>/**
 * Node.js REPL Waiting Console
 * Simple stream module for tapping REPL input/output
 * Copyright (c) 2016 <NAME>
 */

'use strict'

const Writable = require('stream').Writable
const Readable = require('stream').Readable

class StringWritable extends Writable {
  constructor (options) {
    // Set default encoding
    options = options || {}
    options.encoding = 'utf8'
    // Pass options to base class
    super(options)
    // Create simple string buffer
    this._buffer = ''
    // Add new listener handler
    this.on('newListener', function(event, listener) {
      if (event === 'data') {
        // Flush all data to receiver
        listener(null, this.read())
      }
    })
  }

  // Store chunk from internal buffer to string buffer
  _write (chunk, encoding, callback) {
    this._buffer += chunk.toString()
    if (this.emit('data', null, this._buffer)) {
      // Flush buffer if data event listened
      this.flush()
    }
    if (typeof callback === 'function') callback()
  }

  flush () {
    this._buffer = ''
  }

  read () {
    // Copy string to temporary buffer
    let buf = this._buffer
    // Empty current buffer
    this.flush()
    // Return copied buffer
    return buf
  }
}

class StringReadable extends Readable {
  constructor (options) {
    // Set default encoding
    options = options || {}
    options.encoding = 'utf8'
    // Call parent constructor
    super(options)
  }

  _read () {
    
  }

  write (string) {
    // Directly push input to internal buffer
    this.push(string)
  }
}

module.exports = {
  StringWritable: StringWritable,
  StringReadable: StringReadable
}

{'fraction_non_alphanumeric': 0.11515333734215273, 'fraction_numerical': 0.0036079374624173183, 'mean_word_length': 2.573576799140709, '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': '5753017', 'n_tokens_mistral': 970, 'n_tokens_neox': 946, 'n_words': 296}