<commit_before>"use strict";

var through = require('through2');
var report = require('./report');
var extra = require('./extra_api');
var notifier = require('node-notifier');

module.exports = function (options) {
  var reporter;
  var lastFile = null;

  options = options || {};
  var templateOptions = options.templateOptions || {};

  if (options.notifier) {
    reporter = options.notifier;
  } else {
    reporter = notifier.notify.bind(notifier);
  }

  function notify (file, enc, callback) {
    var stream = this;

    report(reporter, file, options, templateOptions, function (err) {
      logError(err, stream);

      if (options.emitError) {
        stream.push(file);
        return callback();
      }
    });

    if (!options.emitError) {
      stream.push(file);
      return callback();
    }
  }

  if (!options.onLast) {
    return through.obj(notify);
  }<commit_msg>Adds support for overriding host/appName/port for Growl<commit_after>"use strict";

var through = require('through2');
var report = require('./report');
var extra = require('./extra_api');
var notifier = require('node-notifier');

module.exports = function (options) {
  var reporter;
  var lastFile = null;

  options = options || {};
  var templateOptions = options.templateOptions || {};

  if (options.notifier) {
    reporter = options.notifier;
  } else {
    if (options.host || options.appName || options.port) {
      notifier = new notifier.Notification({
        host: options.host,
        appName: options.appName,
        port: options.port
      });
    }
    reporter = notifier.notify.bind(notifier);
  }

  function notify (file, enc, callback) {
    var stream = this;

    report(reporter, file, options, templateOptions, function (err) {
      logError(err, stream);

      if (options.emitError) {
        stream.push(file);
        return callback();
      }
    });

    if (!options.emitError) {
      stream.push(file);
      return callback();
    }
  }

  if (!options.onLast) {
    return through.obj(notify);
  }
{'fraction_non_alphanumeric': 0.14166256763403837, 'fraction_numerical': 0.000983767830791933, 'mean_word_length': 2.9342359767891684, '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': '4252345', 'n_tokens_mistral': 614, 'n_tokens_neox': 600, 'n_words': 147}