@dnyaneshwarrtaware/counter-package
v1.0.1
Published
A simple counter component
Downloads
23
Readme
Welcome to @dnyaneshwarrtaware/counter-package!
Hi! This is your first Markdown file in the counter-package.
Features
This package provides a simple counter functionality, allowing you to increment, decrement, and retrieve the current count.
Installation
You can install the package using npm:
npm install @dnyaneshwarrtaware/counter-package
Usage
To use the counter package, import it into your project:
import Counter from '@dnyaneshwarrtaware/counter-package';
// Example usage
const myCounter = new Counter();
myCounter.increment(); // Increment the counter
console.log(myCounter.getValue()); // Outputs: 1
myCounter.decrement(); // Decrement the counter
console.log(myCounter.getValue()); // Outputs: 0
Counter
Constructor: Creates a new instance of the counter.
Methods
increment(): Increments the counter by 1.
decrement(): Decrements the counter by 1.
getValue(): Returns the current value of the counter