freeCodeCamp/client/commonFramework/add-loop-protect.js

18 lines
376 B
JavaScript

window.common = (function(global) {
const {
loopProtect,
common = { init: [] }
} = global;
loopProtect.hit = function hit(line) {
var err = `Error: Exiting potential infinite loop at line ${line}.`;
console.error(err);
};
common.addLoopProtect = function addLoopProtect(code = '') {
return loopProtect(code);
};
return common;
})(window);