Skip to content

Commit cfd5443

Browse files
committed
1st
1 parent ef13713 commit cfd5443

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
# no-console
1+
# noconsolejs

index.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
(function (global) {
2+
function disableConsole() {
3+
if (typeof console !== "undefined") {
4+
const methods = ["log", "warn", "error", "info", "debug", "table"];
5+
methods.forEach(function (method) {
6+
console[method] = function () {};
7+
});
8+
}
9+
}
10+
if (typeof module !== "undefined" && module.exports) {
11+
module.exports = disableConsole;
12+
} else {
13+
disableConsole();
14+
}
15+
})(typeof window !== "undefined" ? window : global);

index.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "noconsolejs",
3+
"version": "1.0.0",
4+
"description": "Disable all console statements in production.",
5+
"main": "index.js",
6+
"author": "Druhin Tarafder",
7+
"license": "MIT"
8+
}

0 commit comments

Comments
 (0)