Код: Выделить всё
var testobject = {
gravity: 43,
speed: 15,
};
Код: Выделить всё
const JavaScriptObfuscator = require('javascript-obfuscator');
const code = `
var testobject = {
gravity: 43,
speed: 15,
}`
const obfuscatedCode = JavaScriptObfuscator.obfuscate(code, {
compact: true,
controlFlowFlattening: true,
propertyObfuscation: true,
renameProperties: true,
numbersToExpressions: true
}).getObfuscatedCode();
console.log(obfuscatedCode);
Код: Выделить всё
function _0x3acb(){var _0x1ac351=['2760280IEzvOn','42271920mbSknR','6237585fiycOv','4GrwPHf','1DTjXQq','8424680oYutVC','2462139fWvfDb','51846AmwgQS','2486766AEKKog','637CGOPon'];_0x3acb=function(){return _0x1ac351;};return _0x3acb();}function _0x587d(_0x45a2a5,_0x1d70a4){_0x45a2a5=_0x45a2a5-(0x109c*-0x2+0x19aa+0x906);var _0x5366c3=_0x3acb();var _0x458b7e=_0x5366c3[_0x45a2a5];return _0x458b7e;}(function(_0x25b3f0,_0x268ac7){var _0x2a83b8=_0x587d,_0x3b9551=_0x25b3f0();while(!![]){try{var _0xadf8b4=parseInt(_0x2a83b8(0x17b))/(0x25ef+-0x17a7+0x11*-0xd7)*(-parseInt(_0x2a83b8(0x17f))/(0x4f*0x63+-0x1aba+-0x3d1*0x1))+parseInt(_0x2a83b8(0x17d))/(-0xe3*0x29+-0xb0f+0x13*0x27f)+-parseInt(_0x2a83b8(0x17a))/(0x1901+-0x59f*0x1+-0x135e)*(parseInt(_0x2a83b8(0x181))/(0x1*-0x35f+0x5*0x599+-0x1899))+-parseInt(_0x2a83b8(0x17e))/(0x1741+0x1*-0x226d+-0x1*-0xb32)*(parseInt(_0x2a83b8(0x180))/(0x5ae+-0xcc5*-0x2+-0x1f31))+-parseInt(_0x2a83b8(0x17c))/(0x1*0x243d+-0x60*-0x21+0x3095*-0x1)+-parseInt(_0x2a83b8(0x179))/(0x1*0x2543+-0xeb+0x37*-0xa9)+parseInt(_0x2a83b8(0x178))/(0x76*-0x2+-0x1e30+0x1f26);if(_0xadf8b4===_0x268ac7)break;else _0x3b9551['push'](_0x3b9551['shift']());}catch(_0x4e1a2f){_0x3b9551['push'](_0x3b9551['shift']());}}}(_0x3acb,0x31610*-0x2+0x1*-0x39a15+-0x6a4b*-0x32));var testobject={'_0x27f844':0x2b,'speed':0xf};
Код: Выделить всё
var { minify_sync } = require("terser");
var code = `
var testobject = {
gravity: 43,
speed: 15,
};
`;
var result = minify_sync(code, {
sourceMap: true,
mangle: {
toplevel: true,
properties: {
regex: /^.+$/,
}
}
});
Код: Выделить всё
var a={v:43,speed:15};
Подробнее здесь: https://stackoverflow.com/questions/798 ... properties
Мобильная версия