<commit_before>/*!
 * node-minify
 * Copyright(c) 2011-2016 <NAME>
 * MIT Licensed
 */

'use strict';

/**
 * Module dependencies.
 */

var Promise = require('bluebird');
var uglifyJS = require('uglify-js');
var utils = require('../utils');

/**
 * Expose `compressUglifyJS()`.
 */

module.exports = compressUglifyJS;

/**
 * Run uglifyJS.
 *
 * @param {Object} settings
 * @param {String} content
 */

function compressUglifyJS(settings, content) {
  return new Promise(function(resolve) {
    var options = settings.options;
    options.fromString = true;
    var contentMinified = uglifyJS.minify(content, options);
    utils.writeFile(settings.output, contentMinified.code);
    resolve(contentMinified.code);
  });
}<commit_msg>Fix #129 UglifyJS source map file<commit_after>/*!
 * node-minify
 * Copyright(c) 2011-2016 <NAME>
 * MIT Licensed
 */

'use strict';

/**
 * Module dependencies.
 */

var Promise = require('bluebird');
var uglifyJS = require('uglify-js');
var utils = require('../utils');

/**
 * Expose `compressUglifyJS()`.
 */

module.exports = compressUglifyJS;

/**
 * Run uglifyJS.
 *
 * @param {Object} settings
 * @param {String} content
 */

function compressUglifyJS(settings, content) {
  return new Promise(function(resolve) {
    var options = settings.options;
    options.fromString = true;
    var contentMinified = uglifyJS.minify(content, options);
    utils.writeFile(settings.output, contentMinified.code);
    if (contentMinified.map && options.outSourceMap) {
      utils.writeFile(options.outSourceMap, contentMinified.map);
    }
    resolve(contentMinified.code);
  });
}
{'fraction_non_alphanumeric': 0.15127092374457532, 'fraction_numerical': 0.011779293242405457, 'mean_word_length': 3.996904024767802, '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': '6858275', 'n_tokens_mistral': 539, 'n_tokens_neox': 523, 'n_words': 110}