Comments (4)
Please provide more details on the same
from cs-playground-react.
@mansisce right now there is an issue with the loop protection, for example, if you try to run the solution of Anagram Palindrome, the loop-protect babel transform is not working correctly and the tests don't run. This has to do with the fact that there was an issue with adding loop-protect to code that is unaffected by the babel transform (i.e. code that doesn't have loops, or loops that aren't recognized by loop-protect as having the potential to be infinite like for...of
and for...in
.
I've figured out the issue though, and essentially what is happening is that when loop-protect transforms code, it trims white space at either end of the code string, and thus is concatenating it with the tests
array undesirably.
So, what needs to happen, is starting here, lines 30 & 31 can be replaced with:
// apply loop-protect if not disabled by user
if (!DISABLE_LOOP_PROTECT.test(code))
code = loopProtect(code) + '\n'
this will make it so that all code is transformed by loop-protect unless the user has left a // DISABLE LOOP PROTECT
comment in their code.
Since we're not using HAS_LOOPS
any more, or trimComments
both of those imports can be removed, as well as the trim-code.js
file and the HAS_LOOPS
declaration in the regexp.js
file.
You can test that all of this works by running the anagram palindrome solution to make sure all the tests pass, and by going to the Sorting Algo Benchmarks repl and making sure that runs as well (toggle on and off the disable loop protect comment and make sure it runs both ways, when disable loop protect is enabled, it should throw a range error)
Let me know if all of this makes sense or if you have any questions!
from cs-playground-react.
Also, if you're working in these files, starting here, lines 41-44 can be replaced with console.log(e.toString())
as long as we change the error being thrown to a new RangeError
instead of just new Error
right here
from cs-playground-react.
Finally, I've also been thinking about changing the timeout from 500 to 200 ms for loop-protection. If you end up taking this on, let's go ahead and make that change as well (to both the timeout
declaration and the error message in the loop-protect.js
file
from cs-playground-react.
Related Issues (20)
- Fix "Flatten An Array" tests
- Add infinite loop protection
- cursor does not have enough contrast on light themes
- fix loop-protect bug
- Error (stack exhausted, infinite loop, reference error etc.) silences console.log HOT 3
- Add theme class to sidebar--menu--sub-header HOT 8
- add reverse vowels challenge
- [staging]: add user created repls HOT 2
- [staging]: add repl share feature & address ls overwrite problem
- track menu state HOT 4
- future feature: searchable menu
- future feature: settings menu
- add flow for static type checking
- add modal for move to forced https warning
- [future feature] add "save / share all state" feature
- add hamburger menu and keybindings modal HOT 9
- BST algo remove has small glitch HOT 6
- Add transition to dropdowns HOT 1
- Benchmark for native sort() flawed? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cs-playground-react.