<commit_before>"use strict";

var _ = require("./utils");

var INIT  = 0;
var START = 1;
var STOP  = 2;

function NeuUnit(spec) {
  this._spec   = spec;
  this._state  = INIT;
  this.$outlet  = spec.outlet || null;
  this.$methods = spec.methods || {};
}

NeuUnit.prototype.start = function(t) {
  if (this._state === INIT && _.isFunction(this._spec.start)) {
    this._state = START;
    this._spec.start(_.finite(t));
  }
};

NeuUnit.prototype.stop = function(t) {
  if (this._state === START && _.isFunction(this._spec.stop)) {
    this._state = STOP;
    this._spec.stop(_.finite(t));
  }
};

NeuUnit.prototype.apply = function(method, args) {
  if (this.$methods[method]) {
    this.$methods[method].apply(null, args);
  }
};

module.exports = NeuUnit;
<commit_msg>fix NeuUnit coverage<commit_after>"use strict";

var _ = require("./utils");

var INIT  = 0;
var START = 1;
var STOP  = 2;

function NeuUnit(spec) {
  this._spec   = spec;
  this._state  = INIT;
  this.$outlet  = _.defaults(spec.outlet, null);
  this.$methods = _.defaults(spec.methods, {});
}

NeuUnit.prototype.start = function(t) {
  if (this._state === INIT && _.isFunction(this._spec.start)) {
    this._state = START;
    this._spec.start(_.finite(t));
  }
};

NeuUnit.prototype.stop = function(t) {
  if (this._state === START && _.isFunction(this._spec.stop)) {
    this._state = STOP;
    this._spec.stop(_.finite(t));
  }
};

NeuUnit.prototype.apply = function(method, args) {
  if (this.$methods[method]) {
    this.$methods[method].apply(null, args);
  }
};

module.exports = NeuUnit;

{'fraction_non_alphanumeric': 0.18506700701978301, 'fraction_numerical': 0.0038289725590299937, 'mean_word_length': 3.467236467236467, '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': '4684916', 'n_tokens_mistral': 594, 'n_tokens_neox': 576, 'n_words': 104}