Debian Codegraph @

util/build/transforms/optimizer/stripConsole.js

raw symbols SCIP
1 define(["../../buildControl"], function(bc){
2 if(bc.stripConsole){
3 var consoleMethods = "assert|count|debug|dir|dirxml|group|groupEnd|info|profile|profileEnd|time|timeEnd|trace|log";
4 if(bc.stripConsole === "warn"){
5 consoleMethods += "|warn";
6 }else if(bc.stripConsole === "all"){
7 consoleMethods += "|warn|error";
8 }
9 // Match on "window.console" and plain "console" but not things like "myconsole" or "my.console"
10 var stripConsoleRe = new RegExp("([^\\w\\.]|^)((window.)?console\\.(" + consoleMethods + ")\\s*\\()", "g");
11 return function(text){
12 return text.replace(stripConsoleRe, "$1 0 && $2");
13 };
14 }else{
15 return function(text){
16 return text;
17 };
18 }
19 });