1.0.2 • Published 4 months ago
javascriptzz1 v1.0.2
Array Utils
A simple utility package for working with arrays in JavaScript. This package provides functions to deduplicate, sort, and reverse arrays.
Installation
You can install this package via npm:
Usage
Here is how you can use this package:
const { deduplicate, sort, reverse } = require('array-utils');
let arr = [5, 3, 8, 3, 2, 5];
// Deduplicate the array
let uniqueArr = deduplicate(arr);
console.log(uniqueArr); // Output: [5, 3, 8, 2]
// Sort the array in ascending order
let sortedArr = sort(arr);
console.log(sortedArr); // Output: [2, 3, 5, 8]
// Reverse the array
let reversedArr = reverse(arr);
console.log(reversedArr); // Output: [5, 2, 3, 8, 3, 5]