1.0.1 • Published 6 years ago

arfy v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

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