Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce lodash usage #422

Merged
merged 1 commit into from Jul 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -17,7 +17,7 @@
},
"dependencies": {
"chalk": "^1.0.0",
"lodash": "^4.0.1",
"lodash.assign": "^4.0.9",
"maxmin": "^1.1.0",
"uglify-js": "~2.6.2",
"uri-path": "^1.0.0"
Expand Down
20 changes: 10 additions & 10 deletions tasks/lib/uglify.js
Expand Up @@ -11,7 +11,7 @@
// External libs.
var path = require('path');
var UglifyJS = require('uglify-js');
var _ = require('lodash');
var assign = require('lodash.assign');
var uriPath = require('uri-path');
var getOutputOptions;

Expand Down Expand Up @@ -66,8 +66,8 @@ exports.init = function(grunt) {

// Wrap code in closure with configurable arguments/parameters list.
if (options.enclose) {
var argParamList = _.map(options.enclose, function(val, key) {
return key + ':' + val;
var argParamList = Object.keys(options.enclose).map(function(key) {
return key + ':' + options.enclose[key];
});

topLevel = topLevel.wrap_enclose(argParamList);
Expand Down Expand Up @@ -247,29 +247,29 @@ exports.init = function(grunt) {
}
}

if (!_.isUndefined(options.indentLevel)) {
if (typeof options.indentLevel !== 'undefined') {
outputOptions.indent_level = options.indentLevel;
}

if (!_.isUndefined(options.maxLineLen)) {
if (typeof options.maxLineLen !== 'undefined') {
outputOptions.max_line_len = options.maxLineLen;
}

if (!_.isUndefined(options.ASCIIOnly)) {
if (typeof options.ASCIIOnly !== 'undefined') {
outputOptions.ascii_only = options.ASCIIOnly;
}

if (!_.isUndefined(options.quoteStyle)) {
if (typeof options.quoteStyle !== 'undefined') {
outputOptions.quote_style = options.quoteStyle;
}

if (!_.isUndefined(options.preserveComments)) {
if (typeof options.preserveComments !== 'undefined') {
outputOptions.comments = options.preserveComments;
}

if (options.beautify) {
if (_.isObject(options.beautify)) {
_.assign(outputOptions, options.beautify);
if (typeof options.beautify === 'object') {
assign(outputOptions, options.beautify);
} else {
outputOptions.beautify = true;
}
Expand Down