window.common = (function(global) {
  const {
    Rx: { Observable },
    common = { init: [] }
  } = global;

  const detectFunctionCall = /function\s*?\(|function\s+\w+\s*?\(/gi;
  const detectUnsafeJQ = /\$\s*?\(\s*?\$\s*?\)/gi;
  const detectUnsafeConsoleCall = /if\s\(null\)\sconsole\.log\(1\);/gi;

  common.detectUnsafeCode$ = function detectUnsafeCode$(code) {
    const openingComments = code.match(/\/\*/gi);
    const closingComments = code.match(/\*\//gi);

    // checks if the number of opening comments(/*) matches the number of
    // closing comments(*/)
    if (
      openingComments &&
      (
        !closingComments ||
        openingComments.length > closingComments.length
      )
    ) {

      return Observable.throw(
        new Error('SyntaxError: Unfinished multi-line comment')
      );
    }

    if (code.match(detectUnsafeJQ)) {
      return Observable.throw(
        new Error('Unsafe $($)')
      );
    }

    if (
      code.match(/function/g) &&
      !code.match(detectFunctionCall)
    ) {
      return Observable.throw(
        new Error('SyntaxError: Unsafe or unfinished function declaration')
      );
    }

    if (code.match(detectUnsafeConsoleCall)) {
      return Observable.throw(
        new Error('Invalid if (null) console.log(1); detected')
      );
    }

    return Observable.just(code);
  };

  return common;
}(window));

@@ -170,24 +170,238 @@
 +%5Cs*?%5C(/gi;%0A
+  const detectInComment = new RegExp(%5B'%5C%5C/%5C%5C/%5B%5C%5CW%5C%5Cw%5C%5Cs%5D*?function.%7C',%0A                                    '%5C%5C/%5C%5C*%5B%5C%5Cs%5C%5Cw%5C%5CW%5D*?function',%0A                                    '%5B%5C%5Cs%5C%5CW%5C%5Cw%5D*?%5C%5C*%5C%5C/'%5D.join(''), 'gi');%0A
   const dete
@@ -1230,16 +1230,54 @@
 ionCall)
+ &&%0A      !code.match(detectInComment)
 %0A    ) %7B

FIX Unfinished Function Declaration in Comments