toarray

0.0.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i toarray

Weekly Downloads

41,596

Version

0.0.1

License

BSD

Last publish

Collaborators

  • architectd
  • crcn