array-flatten
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -0,2 +1,9 @@ | ||
'use strict' | ||
/** | ||
* Expose `arrayFlatten`. | ||
*/ | ||
module.exports = arrayFlatten | ||
/** | ||
* Recursive flatten function with depth. | ||
@@ -9,3 +16,3 @@ * | ||
*/ | ||
function flattenDepth (array, result, depth) { | ||
function flattenWithDepth (array, result, depth) { | ||
for (var i = 0; i < array.length; i++) { | ||
@@ -15,3 +22,3 @@ var value = array[i] | ||
if (depth > 0 && Array.isArray(value)) { | ||
flattenDepth(value, result, depth - 1) | ||
flattenWithDepth(value, result, depth - 1) | ||
} else { | ||
@@ -53,3 +60,3 @@ result.push(value) | ||
*/ | ||
module.exports = function (array, depth) { | ||
function arrayFlatten (array, depth) { | ||
if (depth == null) { | ||
@@ -59,3 +66,3 @@ return flattenForever(array, []) | ||
return flattenDepth(array, [], depth) | ||
return flattenWithDepth(array, [], depth) | ||
} |
{ | ||
"name": "array-flatten", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "Flatten an array of nested arrays into a single flat array", | ||
@@ -5,0 +5,0 @@ "main": "array-flatten.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4422
55