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.

Logic error when using spread operator

See original GitHub issue

Minimal working example that will help to reproduce issue

const demo = { active: true, name: 'demo' }
console.log({
      active: false,
      ...demo
})

Expected Behavior

Output: { active: true, name: ‘demo’ }

Current Behavior

Output: { active: false, name: ‘demo’ }

Your Environment

  • Obfuscator version used: 2.6.3
  • Node version used: v12.13.1

Code After Obfuscation:

const _0x41674a={..._0x5b345c};
_0x41674a[_0x22a0ec('0x17')]=![], console['log'](_0x41674a);}

Clearly, the order of assignment is wrong.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
sanex3339commented, Nov 3, 2020

Seems I fixed it. PR will be ready in 30 minutes. After the fix, all object members previous to spread element will be ignored.

0reactions
sanex3339commented, Nov 3, 2020

Released

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spread syntax (...) - JavaScript - MDN Web Docs - Mozilla
Spread syntax can be used when all elements from an object or array need to be included in a new array or object,...
Read more >
Explain spread operator in ES6 with an Example
The spread operator eventually takes any iterable object such as an array or any other iterable object and expands the values of that...
Read more >
Using ES6 spread operator on an object that is returned from ...
It's a syntax error. You can only use spread in the places where spread is defined (that's part of why it's notation/syntax, not...
Read more >
Conditional Object Properties Using Spread in JavaScript
The line 2 expression omits a name from being applied if the condition fails. This works because the spread operator ignores values without...
Read more >
A Simple Guide to Destructuring and ES6 Spread Operator
The Spread Operator has more than one function. In a sense, it is overloaded. It can also be used as rest operator in...
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