aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorAnthony Van de Gejuchte <anthonyvdgent@gmail.com>2016-09-03 23:26:31 +0200
committerAnthony Van de Gejuchte <anthonyvdgent@gmail.com>2016-09-06 17:54:45 +0200
commit0111497fc98d5098f81bc749f77da5734add37bb (patch)
treec0d7e4da363639a4c68457d2f90e2eebc61796e8 /bin
parent7d8dea3b2675f9d86ea15bb031b7fe166858d67e (diff)
downloadtracifyjs-0111497fc98d5098f81bc749f77da5734add37bb.tar.gz
tracifyjs-0111497fc98d5098f81bc749f77da5734add37bb.zip
Make all comment options in cli available in js api
Also removing more code within "loop" while at it.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/uglifyjs23
1 files changed, 4 insertions, 19 deletions
diff --git a/bin/uglifyjs b/bin/uglifyjs
index 3f0c8254..8d7bd759 100755
--- a/bin/uglifyjs
+++ b/bin/uglifyjs
@@ -250,25 +250,10 @@ if (ARGS.keep_fnames) {
if (BEAUTIFY)
UglifyJS.merge(OUTPUT_OPTIONS, BEAUTIFY);
-if (ARGS.comments != null) {
- if (/^\/.*\/[a-zA-Z]*$/.test(ARGS.comments)) {
- try {
- OUTPUT_OPTIONS.comments = extractRegex(ARGS.comments);
- } catch (e) {
- print_error("ERROR: Invalid --comments: " + e.message);
- }
- } else if (ARGS.comments == "all") {
- OUTPUT_OPTIONS.comments = true;
- } else {
- OUTPUT_OPTIONS.comments = function(node, comment) {
- var text = comment.value;
- var type = comment.type;
- if (type == "comment2") {
- // multiline comment
- return /@preserve|@license|@cc_on/i.test(text);
- }
- }
- }
+if (ARGS.comments === "") {
+ OUTPUT_OPTIONS.comments = "some";
+} else {
+ OUTPUT_OPTIONS.comments = ARGS.comments;
}
var files = ARGS._.slice();