toarray

I find myself writing `item = item instanceof Array ? item : [item]` a lot, so I decided to make a simple library to does it for me. A few examples:


License
BSD-3-Clause
Install
npm install toarray@0.0.0

Documentation

I find myself writing item = item instanceof Array ? item : [item] a lot, so I decided to make a simple library to does it for me. A few examples:

toArray = require("toarray");

console.log(toArray("hello-world!")); //["hello-world!"]
console.log(toArray(["hello-world!"])); //["hello-world!"]
console.log(toArray(undefined)); //[]