Bytenode breaking JSON.parse() and localStorage.getItem() functions.
See original GitHub issueHi there, my code breaks after compiling with bytenode and that it also breaks with javascript-obfuscator. And after long hours of debugging, I’ve come into conclusion that JSON."parse()"
and localStorage."getItem()"
cannot be altered in any way as it will not function at all. So my question is whether bytenode allows like some sort of exclusion to exclude certain codes/functions from being compiled/obfuscated in which javascript-obfuscator has like /* javascript-obfuscator:disable */
to do so.
PS: These codes/functions are being used with Puppeteer.
localStorages = await page.evaluate(() => JSON.parse(localStorage.getItem('websiteLocalStorage')));
Issue Analytics
- State:
- Created 3 years ago
- Comments:9
Top Results From Across the Web
LocalStorage and JSON.stringify JSON.parse - Stack Overflow
localStorage stores key value pairs as strings only (you can use integer for keys but they get converted to string automatically).
Read more >How To Store JSON Data In Local Storage — JS, React, Angular
You can store some data in the browser by using localStorage. ... Note that using the JSON.parse() method is not always necessary!
Read more >Introduction to localStorage and sessionStorage - DigitalOcean
This tutorial features localStorage , but the syntax for ... To read and return stringified values, use the JSON.parse() method.
Read more >CS 204 Local Storage
getItem (key) returns a value from local storage or null if it doesn't exist. ... JSON.parse() takes a string of JSON and (re-)creates...
Read more >bytenode - Bountysource
Bytenode breaking JSON.parse() and localStorage.getItem() functions. $ 0 ... getItem()" cannot be altered in any way as it will not function at all....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Another solution is to pass your statements as a string to
.evaluate()
function. It should work too.I’m closing the issue now. It you still have a problem feel free to comment and ask for re-opening it.
My proposed workaround is to separate the functions that need to be sent to
.evaluate()
(and similar functions) into a separate.js
file.Something like this:
I hope this solves your issue.