
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.
As funções utilitárias para arrays fornecem uma variedade de métodos para manipular e transformar arrays. Elas ajudam a simplificar operações comuns, como dividir, achatar, embaralhar e encontrar diferenças entre arrays, entre outras.
Para instalar as funções utilitárias para arrays, use um dos seguintes comandos, dependendo do seu gerenciador de pacotes:
::: code-group
npm install @utilify/array
yarn add @utilify/array
pnpm add @utilify/array
:::
Após a instalação, você pode importar as funções no seu projeto, utilizando ESM ou CJS.
Esta biblioteca suporta tanto o sistema de módulos ESM quanto CJS. Use o método de importação que corresponda à configuração do seu projeto.
::: code-group
import { shuffle } from '@utilify/array';
const { shuffle } = require('@utilify/array');
:::
Aqui está uma visão geral das funções disponíveis no pacote de utilitários para arrays:
function after(array: any[], n: number): any[]
Retorna os elementos do array após o índice n.
function before(array: any[], n: number): any[]
Retorna os elementos do array antes do índice n.
function chunk(array: any[], size: number): any[][]
Divide o array em pedaços menores de tamanho size.
function difference(array: any[], values: any[]): any[]
Retorna os elementos do array que não estão presentes no segundo array.
function first(array: any[], n?: number): any[]
Retorna os primeiros n elementos do array.
function flattenArr(array: any[], depth?: number): any[]
Achata o array até a profundidade especificada.
function getRandom(array: any[]): any
Retorna um elemento aleatório do array.
function isIterable(obj: any): boolean
Verifica se o objeto é iterável.
function last(array: any[], n?: number): any[]
Retorna os últimos n elementos do array.
function rotate(array: any[], n: number): any[]
Rotaciona os elementos do array n posições.
function sanitizeArr(array: any[], values: any[], replaceValue?: any): any[]
Remove ou substitui os valores especificados no array.
function shuffle(array: any[]): any[]
Embaralha os elementos do array.
function swap(array: any[], index1: number, index2: number): any[]
Troca os elementos nas posições index1 e index2.
function union(...arrays: any[][]): any[]
Retorna a união de múltiplos arrays.
function unique(array: any[]): any[]
Retorna um array com elementos únicos.
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 11 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.