
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@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 3 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.