UNPKG

nodry

Version:

A CLI tool and Node.js library that warns about repetitive code to help you stay DRY.

72 lines (46 loc) 1.36 kB
````markdown # nodry ![npm version](https://img.shields.io/npm/v/nodry.svg) ![license](https://img.shields.io/npm/l/nodry.svg) **nodry** is a simple and effective tool—available both as a CLI and as a module—that detects repetitive code blocks in your JavaScript files. It helps you follow the **DRY (Don't Repeat Yourself)** principle, making your code cleaner and easier to maintain. --- ## Installation Install globally to use the CLI: ```bash npm install -g nodry ```` Or install locally as a dependency to use programmatically: ```bash npm install nodry ``` --- ## Usage ### CLI Analyze a JavaScript file directly from your terminal: ```bash nodry myfile.js ``` You will get a report highlighting repeated code blocks and suggestions. --- ### As a module in your Node.js project Import and use the `analyzeFile` function programmatically: ```js const { analyzeFile } = require('nodry'); analyzeFile('myfile.js') .then(report => { console.log(report); }) .catch(err => { console.error('Analysis failed:', err); }); ``` --- ## Features * Automatically detects repeated code blocks in JavaScript files * Works as both a command-line tool and a programmatic API * Provides clear reports to help you refactor and keep your code DRY * Easy to install and integrate into existing workflows --- ## License ISC ```