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

Dependents (3)

Package Sidebar

Install

npm i arfy

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

4.11 kB

Total Files

8

Last publish

Collaborators

  • astur