array_utils_node

1.1.0 • Public • Published

Array Utils

Array Utils is a simple utility package that extends JavaScript's Array prototype with several helpful methods for manipulating arrays.

This package adds 10 useful higher-order functions (HOFs) to arrays, enabling common operations like calculating sums, removing duplicates, and more with ease.

Table of Contents

Installation

To install array_utils_node in your project, run the following command:

npm install array_utils_node


```How to use

// Import the array-utils package
require('array-utils');

// Example usage:
const arr = [1, 2, 3, 4, 5, 1, 2];

console.log(arr.sum());        // 18
console.log(arr.unique());     // [1, 2, 3, 4, 5]
console.log(arr.average());    // 3
console.log(arr.allEven());    // false
console.log(arr.allOdd());     // false
console.log(arr.max());        // 5
console.log(arr.min());        // 1
console.log(arr.filterBelow(3)); // [3, 4, 5]
console.log(arr.clean());      // [1, 2, 3, 4, 5, 1, 2]
console.log(arr.mergeUnique([3, 6, 7])); // [1, 2, 3, 4, 5, 1, 2, 6, 7]

Package Sidebar

Install

npm i array_utils_node

Weekly Downloads

4

Version

1.1.0

License

ISC

Unpacked Size

3.56 kB

Total Files

3

Last publish

Collaborators

  • vishnusingh