Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
minifyJs(input: string, opts?: any) {
if (opts && opts.mangle && opts.mangle.properties && opts.mangle.properties.regex) {
opts.mangle.properties.regex = new RegExp(opts.mangle.properties.regex);
}
const result: d.MinifyJsResult = Terser.minify(input, opts);
const diagnostics: d.Diagnostic[] = [];
loadMinifyJsDiagnostics(input, result, diagnostics);
return {
output: (result.code as string),
sourceMap: result.sourceMap,
diagnostics: diagnostics
};
}