# @ultraq/array-utils

> A collection of utilities for JavaScript arrays

Latest version **3.1.1** (published 2023-12-24) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @ultraq/array-utils
pnpm add @ultraq/array-utils
yarn add @ultraq/array-utils
bun add @ultraq/array-utils
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.1.1 |
| Published | 2023-12-24 |
| First published | 2017-05-04 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=18 |
| Dependencies | 0 |
| Unpacked size | 24.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Emanuel Rabina |
| Maintainers | ultraq |
| Keywords | array, utilities, flatten, range, remove |

## Links

- npm: https://www.npmjs.com/package/@ultraq/array-utils
- Repository: https://github.com/ultraq/array-utils
- Homepage: https://github.com/ultraq/array-utils#readme
- Issues: https://github.com/ultraq/array-utils/issues
- npm.io page: https://npm.io/package/@ultraq/array-utils

## Recent versions

- 3.1.1 (latest) — 2023-12-24
- 3.1.0 — 2023-12-23
- 3.0.1 — 2023-09-06
- 3.0.0 — 2023-09-05
- 2.1.0 — 2020-08-09
- 2.0.0 — 2020-05-10
- 1.1.0 — 2017-10-07
- 1.0.0 — 2017-05-04

## README

array-utils
===========

[![Build Status](https://github.com/ultraq/array-utils/actions/workflows/build.yml/badge.svg)](https://github.com/ultraq/array-utils/actions)
[![codecov](https://codecov.io/gh/ultraq/array-utils/branch/main/graph/badge.svg?token=FWOPN1XXZW)](https://codecov.io/gh/ultraq/array-utils)
[![npm](https://img.shields.io/npm/v/@ultraq/array-utils.svg?maxAge=3600)](https://www.npmjs.com/package/@ultraq/array-utils)
[![Bundlephobia minified size](https://img.shields.io/bundlephobia/min/@ultraq/array-utils)](https://bundlephobia.com/result?p=@ultraq/array-utils)

A collection of array utilities, meant as a zero-dependency way of working with
arrays.


Installation
------------

Via npm:

```
npm install @ultraq/array-utils
```


API
---

### flatten(array)

Flattens an array of arrays of infinite depth into a single-dimension array.

> This method is deprecated as it is now natively in JavaScript as the `flat`
> method on an Array instance:
> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat

 - **array**: The array of arrays to flatten

### range(start, end, step)

Creates an array of numbers from the starting value (inclusive) to the end
(exclusive), with an optional step (the gap between values).

 - **start**: The value to start at, the first item in the returned array.
 - **end**: The value to end with, the last item in the returned array.
 - **step**: The increment/gap between values, defaults to 1.

### remove(array, predicate)

Remove and return the first item from `array` that matches the predicate
function.

 - **array**: The array to search and remove an item from
 - **predicate**: Function to test each item of the array with.  If it returns a
   truthy value for the item, then that item is removed and returned.

---
_Source: https://npm.io/package/@ultraq/array-utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
