npm.io
0.0.1 • Published 13 years ago

toarray

Licence
BSD
Version
0.0.1
Deps
0
Vulns
0
Weekly
0
Stars
2

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