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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.1
    96,159
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.1
    96,159
  • 0.0.0
    2

Package Sidebar

Install

npm i toarray

Weekly Downloads

96,161

Version

0.0.1

License

BSD

Last publish

Collaborators

  • architectd
  • crcn