array-occurrences-219
v1.0.0
Published
A utility function to count occurrences of elements in an array.
Readme
Array Occurrences
A simple and lightweight npm package to provide utility functions for working with arrays. This package currently includes the countOccurrences function to count the occurrences of each element in an array.
Features
- countOccurrences: Counts the occurrences of elements in an array and returns the result as an object.
Installation
Install the package using npm:
npm i array-occurrences-219
Usage
const { countOccurrences } = require('array-occurrences-219');
const numbers = [1, 2, 2, 3, 3, 3];
const result = countOccurrences(numbers);
console.log(result);
// Output: { 1: 1, 2: 2, 3: 3 }
License
This project is licensed under the MIT License. See the LICENSE file for details.
Author
Praveen Email: [email protected] GitHub: Praveen
