mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 09:55:15 +00:00
14 lines
319 B
JavaScript
14 lines
319 B
JavaScript
|
const { minify } = require("terser");
|
||
|
|
||
|
const transform = (code, optionsString) => {
|
||
|
const options = eval(`(${optionsString})`);
|
||
|
const result = minify(code, options);
|
||
|
if (result.error) {
|
||
|
throw result.error;
|
||
|
} else {
|
||
|
return { result, nameCache: options.nameCache };
|
||
|
}
|
||
|
};
|
||
|
|
||
|
exports.transform = transform;
|