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.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 3.0.0
    566,034
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 3.0.0
    566,034
  • 2.0.1
    11,800,307
  • 2.0.0
    100
  • 1.0.1
    13,155,320
  • 1.0.0
    1,654

Package Sidebar

Install

npm i arrify

Weekly Downloads

20,742,697

Version

3.0.0

License

MIT

Unpacked Size

3.5 kB

Total Files

5

Last publish

Collaborators

  • sindresorhus