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:
Last updated 13 years ago by architectd .
BSD · Repository · Original npm · Tarball · package.json
$ cnpm install toarray 
SYNC missed versions from official npm registry.

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

Current Tags

  • 0.0.1                                ...           latest (13 years ago)

2 Versions

  • 0.0.1                                ...           13 years ago
  • 0.0.0                                ...           13 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 1
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (2)

Copyright 2013 - present © cnpmjs.org | Home |