Socket
Socket
Sign inDemoInstall

array-flatten

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

array-flatten - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

10

array-flatten.js

@@ -9,8 +9,6 @@ /**

*/
var flatten = function (array, result, depth) {
depth--;
function flatten (array, result, depth) {
for (var i = 0; i < array.length; i++) {
if (depth > -1 && Array.isArray(array[i])) {
flatten(array[i], result, depth);
if (depth > 0 && Array.isArray(array[i])) {
flatten(array[i], result, depth - 1);
} else {

@@ -22,3 +20,3 @@ result.push(array[i]);

return result;
};
}

@@ -25,0 +23,0 @@ /**

18

package.json
{
"name": "array-flatten",
"version": "1.0.0",
"version": "1.0.1",
"description": "Flatten a multi-dimensional array.",
"main": "array-flatten.js",
"files": [
"array-flatten.js",
"LICENSE"
],
"scripts": {

@@ -15,5 +19,10 @@ "test": "istanbul cover _mocha -- -R spec"

"array",
"flatten"
"flatten",
"arguments"
],
"author": "Blake Embrey",
"author": {
"name": "Blake Embrey",
"email": "hello@blakeembrey.com",
"url": "http://blakeembrey.me"
},
"license": "MIT",

@@ -25,5 +34,6 @@ "bugs": {

"devDependencies": {
"istanbul": "^0.2.6",
"mocha": "^1.18.0",
"istanbul": "^0.2.6"
"pre-commit": "0.0.9"
}
}

@@ -6,5 +6,4 @@ # Array Flatten

[![Test coverage][coveralls-image]][coveralls-url]
[![Gittip][gittip-image]][gittip-url]
Flatten an array of nested arrays into a single flat array.
Flatten an array of nested arrays into a single flat array. Accepts an optional depth argument.

@@ -27,2 +26,6 @@ ## Installation

//=> [1, 2, 3, [4, [5], 6], 7, 8, 9]
(function () {
flatten(arguments); //=> [1, 2, 3]
})(1, [2, 3]);
```

@@ -40,3 +43,1 @@

[coveralls-url]: https://coveralls.io/r/blakeembrey/array-flatten?branch=master
[gittip-image]: https://img.shields.io/gittip/blakeembrey.svg?style=flat
[gittip-url]: https://www.gittip.com/blakeembrey
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