
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@utilify/array
Advanced tools
A collection of utility functions for array manipulation and transformation. Simplifies common operations like chunking, flattening, shuffling, finding differences, and more.
Array utility functions provide a variety of methods for manipulating and transforming arrays. They help simplify common operations, such as splitting, flattening, shuffling, and finding differences between arrays, among others.
To install the array utility functions, use one of the following commands, depending on your package manager:
npm install @utilify/array
yarn add @utilify/array
pnpm add @utilify/array
Once installed, you can import the functions into your project, using either ESM or CJS.
This library supports both the ESM and CJS module systems.
import { shuffle } from '@utilify/array';
const { shuffle } = require('@utilify/array');
Here’s an overview of the functions available in the array utility package:
function after(array: any[], n: number): any[]
Returns the elements of the array after the index n.
function before(array: any[], n: number): any[]
Returns the elements of the array before the index n.
function chunk(array: any[], size: number): any[][]
Divides the array into smaller chunks of size size.
function difference(array: any[], values: any[]): any[]
Returns the elements of the array that are not present in the second array.
function first(array: any[], n?: number): any[]
Returns the first n elements of the array.
function flattenArr(array: any[], depth?: number): any[]
Flattens the array to the specified depth.
function getRandom(array: any[]): any
Returns a random element from the array.
function isIterable(obj: any): boolean
Checks if the object is iterable.
function last(array: any[], n?: number): any[]
Returns the last n elements of the array.
function rotate(array: any[], n: number): any[]
Rotates the elements of the array by n positions.
function sanitizeArr(array: any[], values: any[], replaceValue?: any): any[]
Removes or replaces specified values in the array.
function shuffle(array: any[]): any[]
Shuffles the elements of the array.
function swap(array: any[], index1: number, index2: number): any[]
Swaps the elements at positions index1 and index2.
function union(...arrays: any[][]): any[]
Returns the union of multiple arrays.
function unique(array: any[]): any[]
Returns an array with unique elements.
FAQs
A collection of utility functions for array manipulation and transformation. Simplifies common operations like chunking, flattening, shuffling, finding differences, and more.
The npm package @utilify/array receives a total of 7 weekly downloads. As such, @utilify/array popularity was classified as not popular.
We found that @utilify/array demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.