🚀 Big News:Socket Has Acquired Secure Annex.Learn More
Socket
Book a DemoSign in
Socket

lazy-arrayify

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lazy-arrayify - npm Package Compare versions

Comparing version
0.1.0
to
0.2.0
+24
-0
index.js

@@ -42,2 +42,26 @@ /*!

/**
* > Returns empty array on falsey values.
*
* **Example**
*
* ```js
* var arrayify = require('lazy-arrayify')
*
* console.log(arrayify(1234)) // => [1234]
* console.log(arrayify('str')) // => ['str']
* console.log(arrayify(null)) // => []
* console.log(arrayify()) // => []
* console.log(arrayify(0)) // => []
* console.log(arrayify(false)) // => []
* console.log(arrayify([null, 123])) // => [null, 123]
* console.log(arrayify([false])) // => [false]
* ```
*
* @name lazyArrayify
* @param {Mixed} `val`
* @return {Array}
* @api public
*/
utils.arrayify = function arrayify (val) {

@@ -44,0 +68,0 @@ if (!val) return []

+6
-6
{
"name": "lazy-arrayify",
"version": "0.1.0",
"description": "We are lazy, also lazy-cached and browserify ready - just arrayify, falsey values returns empty array.",
"version": "0.2.0",
"description": "We are lazy, also [lazy-cache][]-d and [browserify][]-ready - just arrayify, falsey values returns empty array.",
"repository": "tunnckoCore/lazy-arrayify",

@@ -52,10 +52,10 @@ "author": "Charlike Mike Reagent <@tunnckoCore> (http://www.tunnckocore.tk)",

"limon-prev-next",
"posttjson",
"isarray",
"lazy-cache",
"arrayify",
"arrify"
"arrify",
"postjson"
]
},
"reflinks": [
"lazy-cache",
"browserify",
"limon"

@@ -62,0 +62,0 @@ ],

@@ -1,4 +0,4 @@

# [lazy-arrayify][author-www-url] [![npmjs.com][npmjs-img]][npmjs-url] [![The MIT License][license-img]][license-url]
# [lazy-arrayify][author-www-url] [![npmjs.com][npmjs-img]][npmjs-url] [![The MIT License][license-img]][license-url] [![npm downloads][downloads-img]][downloads-url]
> We are lazy, also lazy-cached and browserify ready - just arrayify, falsey values returns empty array.
> We are lazy, also [lazy-cache][]-d and [browserify][]-ready - just arrayify, falsey values returns empty array.

@@ -19,7 +19,31 @@ [![code climate][codeclimate-img]][codeclimate-url] [![standard code style][standard-img]][standard-url] [![travis build status][travis-img]][travis-url] [![coverage status][coveralls-img]][coveralls-url] [![dependency status][david-img]][david-url]

### [.lazyArrayify](index.js#L66)
> Returns empty array on falsey values.
**Params**
* `val` **{Mixed}**
* `returns` **{Array}**
**Example**
```js
var arrayify = require('lazy-arrayify')
console.log(arrayify(1234)) // => [1234]
console.log(arrayify('str')) // => ['str']
console.log(arrayify(null)) // => []
console.log(arrayify()) // => []
console.log(arrayify(0)) // => []
console.log(arrayify(false)) // => []
console.log(arrayify([null, 123])) // => [null, 123]
console.log(arrayify([false])) // => [false]
```
## Related
* [arrify](https://www.npmjs.com/package/arrify): Convert a value to an array | [homepage](https://github.com/sindresorhus/arrify)
* [isarray](https://www.npmjs.com/package/isarray): Array#isArray for older browsers | [homepage](https://github.com/juliangruber/isarray)
* [lazy-cache](https://www.npmjs.com/package/lazy-cache): Cache requires to be lazy-loaded when needed. | [homepage](https://github.com/jonschlinkert/lazy-cache)
* [limon](https://www.npmjs.com/package/limon): The pluggable JavaScript lexer on per character basis. | [homepage](https://github.com/limonjs/limon)
* [limon-prev-next](https://www.npmjs.com/package/limon-prev-next): Plugin for [limon][] pluggable lexer that adds `prev` and `next` methods. | [homepage](https://github.com/limonjs/limon-prev-next)
* [postjson](https://www.npmjs.com/package/postjson): Transforming JSON with plugins. | [homepage](https://github.com/postjson/postjson)

@@ -34,4 +58,5 @@ ## Contributing

[isarray]: https://github.com/juliangruber/isarray
[lazy-cache]: https://github.com/jonschlinkert/lazy-cache
[browserify]: https://github.com/substack/node-browserify
[limon]: https://github.com/limonjs/limon

@@ -42,4 +67,7 @@ [npmjs-url]: https://www.npmjs.com/package/lazy-arrayify

[license-url]: https://github.com/tunnckoCore/lazy-arrayify/blob/master/LICENSE
[license-img]: https://img.shields.io/badge/license-MIT-blue.svg
[license-img]: https://img.shields.io/npm/l/lazy-arrayify.svg
[downloads-url]: https://www.npmjs.com/package/lazy-arrayify
[downloads-img]: https://img.shields.io/npm/dm/lazy-arrayify.svg
[codeclimate-url]: https://codeclimate.com/github/tunnckoCore/lazy-arrayify

@@ -46,0 +74,0 @@ [codeclimate-img]: https://img.shields.io/codeclimate/github/tunnckoCore/lazy-arrayify.svg