Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/CodePen/InfiniteLoopBuster

Using Esprima to stop infinite loops before they happen.
https://github.com/CodePen/InfiniteLoopBuster

Last synced: 3 months ago
JSON representation

Using Esprima to stop infinite loops before they happen.

Awesome Lists containing this project

README

        

# Infinite Loop Buster!

Stop infinite loops before they happen.

This takes a string of JavaScript and alters it to ensure that infinite loops are broken, but otherwise doesn't affect the code. The purpose is so you can run it without fear of freezing the browser. Online code editors like CodePen are the use-case.

This uses Esprima to create an abstract syntax tree out of the JavaScript and do the instrumenting. Esprima is the only dependency, it doesn't require any additional libraries to output back to a string of JavaScript.

[Ariya Hidayat](https://ariya.io/) is the creator of Esprima, and largely wrote this version of the Infinite Loop Buster as well. Thanks so much, Ariya!