0.0.1 • Published 11 years ago

toarray v0.0.1

Weekly downloads
4,945
License
BSD
Repository
github
Last release
11 years ago

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)); //[]