npm

Check out our latest tech talk, "JavaScript Supply Chain Security" presented by VP of Security, Adam Baldwin.Watch it here »

arfy

1.0.1 • Public • Published

arfy

Ensures that something is array

Build Status NPM version

Install

npm i arfy

Usage

const arfy = require('arfy');
 
console.log(arfy('test'));               // ['test']
console.log(arfy(['test']));             // ['test']
console.log(arfy(['test1', 'test2']));   // ['test1', 'test2']
console.log(arfy());                     // []
console.log(arfy(null));                 // []
 
console.log(arfy('test1', 'test2'));               // ['test1', 'test2']
console.log(arfy(['test1'], ['test2']));           // ['test1', 'test2']
console.log(arfy('test1', ['test2', 'test3']));    // ['test1', 'test2', 'test3']
console.log(arfy(['test1', 'test2'], [], null));   // ['test1', 'test2']
console.log(arfy(['test', ['test']]));             // ['test', ['test']]
 
console.log(arfy(123));            // [123]
console.log(arfy({a: 1, b: 2}));   // [{a: 1, b: 2}]
console.log(arfy(true));           // [true]
console.log(arfy(false));          // [false]

License

MIT

Keywords

install

npm i arfy

Downloadsweekly downloads

12

version

1.0.1

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability