Merge pull request #9167 from FreeCodeCamp/revert-8894-FIX/Comment-your-JavaScript-Code

Revert "FIX Unfinished Function Declaration in Comments"
pull/9174/head
Berkeley Martinez 2016-06-15 18:54:24 -07:00 committed by GitHub
commit 6fdf5c61a7
1 changed files with 1 additions and 5 deletions

View File

@ -5,9 +5,6 @@ window.common = (function(global) {
} = global;
const detectFunctionCall = /function\s*?\(|function\s+\w+\s*?\(/gi;
const detectInComment = new RegExp(['\\/\\/[\\W\\w\\s]*?function.|',
'\\/\\*[\\s\\w\\W]*?function',
'[\\s\\W\\w]*?\\*\\/'].join(''), 'gi');
const detectUnsafeJQ = /\$\s*?\(\s*?\$\s*?\)/gi;
const detectUnsafeConsoleCall = /if\s\(null\)\sconsole\.log\(1\);/gi;
@ -38,8 +35,7 @@ window.common = (function(global) {
if (
code.match(/function/g) &&
!code.match(detectFunctionCall) &&
!code.match(detectInComment)
!code.match(detectFunctionCall)
) {
return Observable.throw(
new Error('SyntaxError: Unsafe or unfinished function declaration')