# array-back

> Guarantees an array back

Latest version **6.2.3** (published 2026-03-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install array-back
pnpm add array-back
yarn add array-back
bun add array-back
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 6.2.3 |
| Published | 2026-03-19 |
| First published | 2015-07-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Node | >=12.17 |
| Dependencies | 0 |
| Unpacked size | 9.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 82 |
| Author | Lloyd Brookes |
| Maintainers | 75lb |
| Keywords | to, convert, return, array, arrayify |

## Links

- npm: https://www.npmjs.com/package/array-back
- Repository: https://github.com/75lb/array-back
- Homepage: https://github.com/75lb/array-back#readme
- Issues: https://github.com/75lb/array-back/issues
- npm.io page: https://npm.io/package/array-back

## Alternatives

- [update-check](https://npm.io/package/update-check.md) — 4.0M weekly downloads
- [react-native-onesignal](https://npm.io/package/react-native-onesignal.md) — 134.5K weekly downloads
- [react-redux-toastr](https://npm.io/package/react-redux-toastr.md) — 33.7K weekly downloads
- [@nocobase/plugin-notification-manager](https://npm.io/package/@nocobase/plugin-notification-manager.md) — 2.0K weekly downloads
- [react-simple-toasts](https://npm.io/package/react-simple-toasts.md) — 1.9K weekly downloads

## Recent versions

- 6.2.3 (latest) — 2026-03-19
- 6.2.2 — 2022-01-14
- 6.2.1 — 2022-01-14
- 6.2.0 — 2021-07-24
- 6.1.2 — 2021-07-04
- 6.1.1 — 2021-06-29
- 6.1.0 — 2021-06-29
- 6.0.1 — 2021-05-16
- 4.0.2 — 2021-05-16
- 6.0.0 — 2021-04-22
- 5.0.0 — 2020-08-29
- 4.0.1 — 2019-11-12
- 4.0.0 — 2019-08-30
- 3.1.0 — 2019-04-06
- 3.0.1 — 2018-11-24
- … 7 more at https://npm.io/package/array-back/versions

## README

[![view on npm](https://badgen.net/npm/v/array-back)](https://www.npmjs.org/package/array-back)
[![npm module downloads](https://badgen.net/npm/dt/array-back)](https://www.npmjs.org/package/array-back)
[![Gihub repo dependents](https://badgen.net/github/dependents-repo/75lb/array-back)](https://github.com/75lb/array-back/network/dependents?dependent_type=REPOSITORY)
[![Gihub package dependents](https://badgen.net/github/dependents-pkg/75lb/array-back)](https://github.com/75lb/array-back/network/dependents?dependent_type=PACKAGE)
[![Node.js CI](https://github.com/75lb/array-back/actions/workflows/node.js.yml/badge.svg)](https://github.com/75lb/array-back/actions/workflows/node.js.yml)

<a name="module_array-back"></a>

## array-back
Takes any input and guarantees an array back.

- Converts array-like objects (e.g. `arguments`, `Set`) to a real array.
- Converts `undefined` to an empty array.
- Converts any another other, singular value (including `null`, objects and iterables other than `Set`) into an array containing that value.
- Ignores input which is already an array.

**Example**  
```js
> const arrayify = require('array-back')

> arrayify(undefined)
[]

> arrayify(null)
[ null ]

> arrayify(0)
[ 0 ]

> arrayify([ 1, 2 ])
[ 1, 2 ]

> arrayify(new Set([ 1, 2 ]))
[ 1, 2 ]

> function f(){ return arrayify(arguments); }
> f(1,2,3)
[ 1, 2, 3 ]
```
<a name="exp_module_array-back--arrayify"></a>

### arrayify(input) ⇒ <code>Array</code> ⏏
**Kind**: Exported function  

| Param | Type | Description |
| --- | --- | --- |
| input | <code>\*</code> | The input value to convert to an array |


### Load anywhere

This library is compatible with Node.js, the Web and any style of module loader. It can be loaded anywhere, natively without transpilation.

Node.js:

```js
const arrayify = require('array-back')
```

Within Node.js with ECMAScript Module support enabled:

```js
import arrayify from 'array-back'
```

Within an modern browser ECMAScript Module:

```js
import arrayify from './node_modules/array-back/index.js'
```

* * *

&copy; 2015-26 [Lloyd Brookes](https://github.com/75lb) \<opensource@75lb.com\>.

Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).

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