Changements dans les modules (nouvelle version Express, mysql, ..)
This commit is contained in:
15
node_modules/array-flatten/array-flatten.js
generated
vendored
15
node_modules/array-flatten/array-flatten.js
generated
vendored
@@ -1,10 +1,3 @@
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Expose `arrayFlatten`.
|
||||
*/
|
||||
module.exports = arrayFlatten
|
||||
|
||||
/**
|
||||
* Recursive flatten function with depth.
|
||||
*
|
||||
@@ -13,12 +6,12 @@ module.exports = arrayFlatten
|
||||
* @param {Number} depth
|
||||
* @return {Array}
|
||||
*/
|
||||
function flattenWithDepth (array, result, depth) {
|
||||
function flattenDepth (array, result, depth) {
|
||||
for (var i = 0; i < array.length; i++) {
|
||||
var value = array[i]
|
||||
|
||||
if (depth > 0 && Array.isArray(value)) {
|
||||
flattenWithDepth(value, result, depth - 1)
|
||||
flattenDepth(value, result, depth - 1)
|
||||
} else {
|
||||
result.push(value)
|
||||
}
|
||||
@@ -55,10 +48,10 @@ function flattenForever (array, result) {
|
||||
* @param {Number} depth
|
||||
* @return {Array}
|
||||
*/
|
||||
function arrayFlatten (array, depth) {
|
||||
module.exports = function (array, depth) {
|
||||
if (depth == null) {
|
||||
return flattenForever(array, [])
|
||||
}
|
||||
|
||||
return flattenWithDepth(array, [], depth)
|
||||
return flattenDepth(array, [], depth)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user