arrify
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

arrify

Convert a value to an array

Install

$ npm install arrify

Usage

import arrify from 'arrify';

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

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

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

arrify(null);
//=> []

arrify(undefined);
//=> []

Specifying null or undefined results in an empty array.


Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Package Sidebar

Install

npm i arrify

Weekly Downloads

27,241,475

Version

3.0.0

License

MIT

Unpacked Size

3.5 kB

Total Files

5

Last publish

Collaborators

  • sindresorhus