question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Object initializer with computed property names does not work

See original GitHub issue

Hi, everyone. I found that this obfuscator breaks the following code.

in.js:

const key = 'bar';
const obj = {
    [key]: 1
};
console.log(obj);
$ node in.js
{ bar: 1 }
$
$ javascript-obfuscator in.js --output out.js
$ node out.js
{ key: 1 }

Could you fix it?

ref. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#New_notations_in_ECMAScript_2015

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
sanex3339commented, Sep 19, 2017

Fixed in javascript-obfuscator@0.11.2

0reactions
lock[bot]commented, Jun 6, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Object initializer - JavaScript - MDN Web Docs - Mozilla
An object initializer is a comma-delimited list of zero or more pairs of property names and associated values of an object, ...
Read more >
Initialize a JavaScript/TypeScript object with computed ...
I'm trying to initialize a JavaScript/TypeScript object with computed property names from an enum (or, from the values of an array).
Read more >
Object initializer - Javascript
An object initializer is a list of zero or more pairs of property names and associated values of an object, enclosed in curly...
Read more >
Object initializer - JavaScript - UDN Web Docs: MDN Backup
An object initializer is a comma-delimited list of zero or more pairs of property names and associated values of an object, enclosed in...
Read more >
ES6 Computed Properties · Issue #1082
All computed names must be of type string, number, or any (or eventually symbol); No property will be added to the containing type...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found