# arrify

> Convert a value to an array

Latest version **3.0.0** (published 2021-04-28) · MIT license · 0 weekly downloads

> **Better alternative:** Use (v == null ? [] : Array.isArray(v) ? v : [v]) — Consider using a lighter alternative

## Install

```sh
npm install arrify
pnpm add arrify
yarn add arrify
bun add arrify
```

## Health

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

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.0 |
| Published | 2021-04-28 |
| First published | 2015-02-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/arrify) |
| Module format | ESM |
| Node | >=12 |
| Dependencies | 0 |
| Unpacked size | 3.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 132 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | array, arrify, arrayify, convert, value, ensure |

## Links

- npm: https://www.npmjs.com/package/arrify
- Repository: https://github.com/sindresorhus/arrify
- Homepage: https://github.com/sindresorhus/arrify#readme
- Issues: https://github.com/sindresorhus/arrify/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/arrify

## Recent versions

- 3.0.0 (latest) — 2021-04-28
- 2.0.1 — 2019-04-09
- 2.0.0 — 2019-04-05
- 1.0.1 — 2015-12-09
- 1.0.0 — 2015-02-16

## README

# arrify

> Convert a value to an array

## Install

```
$ npm install arrify
```

## Usage

```js
import arrify from 'arrify';

arrify('🦄');
//=> ['🦄']

arrify(['🦄']);
//=> ['🦄']

arrify(new Set(['🦄']));
//=> ['🦄']

arrify(null);
//=> []

arrify(undefined);
//=> []
```

*Specifying `null` or `undefined` results in an empty array.*

---

<div align="center">
	<b>
		<a href="https://tidelift.com/subscription/pkg/npm-arrify?utm_source=npm-arrify&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
	</b>
	<br>
	<sub>
		Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
	</sub>
</div>

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