DefinitelyTyped/types/uglify-js/uglify-js-tests.ts
2018-03-25 13:16:16 +02:00

41 lines
754 B
TypeScript

/// <reference types="node" />
import { OutputQuoteStyle, minify } from 'uglify-js';
let code: any;
code = {
"file1.js": "function add(first, second) { return first + second; }",
"file2.js": "console.log(add(1 + 2, 3 + 4));"
};
minify(code);
code = "function add(first, second) { return first + second; }";
minify(code);
minify(code, {
output: {
quote_style: OutputQuoteStyle.AlwaysDouble
}
});
const output = minify(code, {
warnings: 'verbose',
mangle: {
properties: {
regex: /reg/
}
},
sourceMap: {
filename: 'foo.map'
},
compress: {
arguments: true
}
});
if (output.warnings) {
output.warnings.filter(x => x === 'Dropping unused variable');
}