lazy-arrayify

We are lazy, also lazy-cached and browserify-ready - just arrayify, falsey values returns empty array. In bonus with
.isArray
method.
Install
npm i lazy-arrayify --save
Usage
For more use-cases see the tests
const lazyArrayify =
.isArray
Check if value is array using the isarray module.
Params
val
{Mixed}returns
{Boolean}
Example
var isArray = isArray console // => falseconsole // => falseconsole // => falseconsole // => falseconsole // => falseconsole // => falseconsole // => trueconsole // => trueconsole // => true
.arrayify
Returns empty array on falsey values.
Params
val
{Mixed}returns
{Array}
Example
var arrayify = arrayify console // => [1234]console // => ['str']console // => []console // => []console // => []console // => []console // => [null, 123]console // => [false]
Related
- arrify: Convert a value to an array | homepage
- isarray: Array#isArray for older browsers | homepage
- limon: The pluggable JavaScript lexer on per character basis. | homepage
- limon-prev-next: Plugin for limon pluggable lexer that adds
prev
andnext
methods. | homepage - postjson: Transforming JSON with plugins. | homepage
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.