Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

arr-flatten

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

arr-flatten - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

21

index.js
/*!
* arr-flatten <https://github.com/jonschlinkert/arr-flatten>
*
* Copyright (c) 2014-2015, 2017, Jon Schlinkert.
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.

@@ -10,19 +10,14 @@ */

module.exports = function flatten(arr) {
module.exports = function (arr) {
return flat(arr, []);
};
function flat(arr, acc) {
function flat(arr, res) {
var i = 0, cur;
var len = arr.length;
var idx = -1;
while (++idx < len) {
var cur = arr[idx];
if (Array.isArray(cur)) {
flat(cur, acc);
} else {
acc.push(cur);
}
for (; i < len; i++) {
cur = arr[i];
Array.isArray(cur) ? flat(cur, res) : res.push(cur);
}
return acc;
return res;
}
{
"name": "arr-flatten",
"description": "Recursively flatten an array or arrays.",
"version": "1.0.3",
"version": "1.1.0",
"homepage": "https://github.com/jonschlinkert/arr-flatten",
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
"contributors": [
"Jon Schlinkert (http://twitter.com/jonschlinkert)",
"Luke Edwards (https://lukeed.com)"
],
"repository": "jonschlinkert/arr-flatten",

@@ -62,6 +66,6 @@ "bugs": {

"list": [
"arr-filter",
"arr-union",
"array-unique",
"array-each",
"arr-filter"
"array-unique"
]

@@ -68,0 +72,0 @@ },

@@ -1,2 +0,2 @@

# arr-flatten [![NPM version](https://img.shields.io/npm/v/arr-flatten.svg?style=flat)](https://www.npmjs.com/package/arr-flatten) [![NPM monthly downloads](https://img.shields.io/npm/dm/arr-flatten.svg?style=flat)](https://npmjs.org/package/arr-flatten) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/arr-flatten.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/arr-flatten) [![Windows Build Status](https://img.shields.io/appveyor/ci/jonschlinkert/arr-flatten.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/jonschlinkert/arr-flatten)
# arr-flatten [![NPM version](https://img.shields.io/npm/v/arr-flatten.svg?style=flat)](https://www.npmjs.com/package/arr-flatten) [![NPM monthly downloads](https://img.shields.io/npm/dm/arr-flatten.svg?style=flat)](https://npmjs.org/package/arr-flatten) [![NPM total downloads](https://img.shields.io/npm/dt/arr-flatten.svg?style=flat)](https://npmjs.org/package/arr-flatten) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/arr-flatten.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/arr-flatten) [![Windows Build Status](https://img.shields.io/appveyor/ci/jonschlinkert/arr-flatten.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/jonschlinkert/arr-flatten)

@@ -13,8 +13,2 @@ > Recursively flatten an array or arrays.

Install with [yarn](https://yarnpkg.com):
```sh
$ yarn add arr-flatten
```
## Install

@@ -54,2 +48,9 @@

### Contributors
| **Commits** | **Contributor** |
| --- | --- |
| 20 | [jonschlinkert](https://github.com/jonschlinkert) |
| 1 | [lukeed](https://github.com/lukeed) |
### Building docs

@@ -87,2 +88,2 @@

_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.5.0, on April 16, 2017._
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 05, 2017._

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc