<commit_before>// ==========================================
// BOWER: CacheClean API
// ==========================================
// Copyright 2012 Twitter, Inc
// Licensed under The MIT License
// http://opensource.org/licenses/MIT
// ==========================================

var Emitter     = require('events').EventEmitter;
var async       = require('async');
var nopt        = require('nopt');
var rimraf      = require('rimraf');
var path        = require('path');
var glob        = require('glob');
var _           = require('lodash');

var help        = require('./help');
var config      = require('../core/config');
var template    = require('../util/template');
var fileExists  = require('../util/file-exists');

var optionTypes = { help: Boolean, force: Boolean };
var shorthand   = { 'h': ['--help'], 'S': ['--save'], 'f': ['--force'] };

var removePkg = function (pkg, emitter, next) {
  var folder = path.join(config.cache, pkg);

  fileExists(folder, function (exists) {
    if (!exists) return emitter.emit('error', new Error('Package ' + pkg + ' is not installed.'));

    rimraf(folder, function (err) {
      if (err) emitter.emit('error', err);
      else {
        emitter.emit('data', template('action', { name: 'cleared', shizzle: pkg }, true));
        next();
      }
    });
  });<commit_msg>Remove dot from error message.<commit_after>// ==========================================
// BOWER: CacheClean API
// ==========================================
// Copyright 2012 Twitter, Inc
// Licensed under The MIT License
// http://opensource.org/licenses/MIT
// ==========================================

var Emitter     = require('events').EventEmitter;
var async       = require('async');
var nopt        = require('nopt');
var rimraf      = require('rimraf');
var path        = require('path');
var glob        = require('glob');
var _           = require('lodash');

var help        = require('./help');
var config      = require('../core/config');
var template    = require('../util/template');
var fileExists  = require('../util/file-exists');

var optionTypes = { help: Boolean, force: Boolean };
var shorthand   = { 'h': ['--help'], 'S': ['--save'], 'f': ['--force'] };

var removePkg = function (pkg, emitter, next) {
  var folder = path.join(config.cache, pkg);

  fileExists(folder, function (exists) {
    if (!exists) return emitter.emit('error', new Error('Package ' + pkg + ' is not installed'));

    rimraf(folder, function (err) {
      if (err) emitter.emit('error', err);
      else {
        emitter.emit('data', template('action', { name: 'cleared', shizzle: pkg }, true));
        next();
      }
    });
  });
{'fraction_non_alphanumeric': 0.2667167543200601, 'fraction_numerical': 0.003005259203606311, 'mean_word_length': 3.274478330658106, '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': '5366533', 'n_tokens_mistral': 772, 'n_tokens_neox': 729, 'n_words': 202}