Skip to content

Commit

Permalink
Merge pull request javascript-obfuscator#547 from javascript-obfuscat…
Browse files Browse the repository at this point in the history
…or/exponentiation-operator-fix

Fixed support of exponentiation operator
  • Loading branch information
sanex3339 authored Feb 7, 2020
2 parents b95455f + e987a8f commit 43b8fc9
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ Change Log

v0.24.6
---
* Fixed support of exponentiation operator. Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/534
* Added file path to the error message during directory obfuscation. Fixed https://github.com/javascript-obfuscator/javascript-obfuscator/issues/513

v0.24.5
Expand Down
4 changes: 2 additions & 2 deletions dist/index.browser.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"chance": "1.1.4",
"class-validator": "0.11.0",
"commander": "4.1.1",
"escodegen": "1.13.0",
"escodegen": "1.14.1",
"eslint-scope": "5.0.0",
"estraverse": "4.3.0",
"eventemitter3": "4.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,30 @@ describe('JavaScriptObfuscator', () => {
});
});

/**
* https://github.com/estools/escodegen/pull/407
*/
describe('valid exponentiation operator precedence', () => {
const regExp: RegExp = /var foo *= *\( *0x1 *- *0x2 *\) *\*\* *0x2;/;

let obfuscatedCode: string;

beforeEach(() => {
const code: string = readFileAsString(__dirname + '/fixtures/exponentiation-operator-precedence.js');

obfuscatedCode = JavaScriptObfuscator.obfuscate(
code,
{
...NO_ADDITIONAL_NODES_PRESET
}
).getObfuscatedCode();
});

it('should support exponentiation operator', () => {
assert.match(obfuscatedCode, regExp);
});
});

describe('mangled identifier names generator', () => {
const regExp: RegExp = /var c *= *0x1/;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var foo = (1-2) ** 2;
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1714,10 +1714,10 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2, escape-string-regexp@^1
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=

escodegen@1.13.0:
version "1.13.0"
resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.13.0.tgz#c7adf9bd3f3cc675bb752f202f79a720189cab29"
integrity sha512-eYk2dCkxR07DsHA/X2hRBj0CFAZeri/LyDMc0C8JT1Hqi6JnVpMhJ7XFITbb0+yZS3lVkaPL2oCkZ3AVmeVbMw==
escodegen@1.14.1:
version "1.14.1"
resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.14.1.tgz#ba01d0c8278b5e95a9a45350142026659027a457"
integrity sha512-Bmt7NcRySdIfNPfU2ZoXDrrXsG9ZjvDxcAlMfDUgRBjLOWTuIACXPBFJH7Z+cLb40JeQco5toikyc9t9P8E9SQ==
dependencies:
esprima "^4.0.1"
estraverse "^4.2.0"
Expand Down

0 comments on commit 43b8fc9

Please sign in to comment.