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 7 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 (7 years ago)

2 Versions

  • 0.0.1                                ...           7 years ago
  • 0.0.0                                ...           7 years ago

Copyright 2014 - 2016 © taobao.org |