console-log-counter
v1.0.0
Published
find console.log in files
Readme
README.md
Console Log Counter
A simple Node.js module to count the occurrences of console.log and console.table statements in a JavaScript file.
Installation
You can install the package via npm:
npm install console-log-counterUsage
- Import the
findConsoleCountfunction from the package:
const { findConsoleCount } = require("console-log-counter");- Call the
findConsoleCountfunction with the path to the JavaScript file you want to analyze:
const result = findConsoleCount("/path/to/your/file.js");- The function returns an object containing the count of
console.logandconsole.tablestatements, as well as an array of line numbers and corresponding lines where these statements occur:
console.log("Number of console.log and console.table statements:", result.countLines);
console.log("Lines with console.log and console.table:", result.consoleLogLines);Example
const { findConsoleCount } = require("console-log-counter");
const filePath = "/path/to/your/file.js";
const result = findConsoleCount(filePath);
console.log("Number of console.log and console.table statements:", result.countLines);
console.log("Lines with console.log and console.table:", result.consoleLogLines);License
This project is licensed under the MIT License - see the LICENSE file for details.
This README provides an overview of the console-log-counter package, including installation instructions, usage examples, and license information. Feel free to customize it further to fit your needs or add more detailed documentation as required.
