Revert "Changements dans les modules (nouvelle version Express, mysql, ..)"

This reverts commit bdab795506.
This commit is contained in:
2023-11-23 16:13:50 +01:00
parent 756f928ced
commit 5b0d68d66f
818 changed files with 35968 additions and 82263 deletions

View File

@@ -1,3 +1,10 @@
'use strict'
/**
* Expose `arrayFlatten`.
*/
module.exports = arrayFlatten
/**
* Recursive flatten function with depth.
*
@@ -6,12 +13,12 @@
* @param {Number} depth
* @return {Array}
*/
function flattenDepth (array, result, depth) {
function flattenWithDepth (array, result, depth) {
for (var i = 0; i < array.length; i++) {
var value = array[i]
if (depth > 0 && Array.isArray(value)) {
flattenDepth(value, result, depth - 1)
flattenWithDepth(value, result, depth - 1)
} else {
result.push(value)
}
@@ -48,10 +55,10 @@ function flattenForever (array, result) {
* @param {Number} depth
* @return {Array}
*/
module.exports = function (array, depth) {
function arrayFlatten (array, depth) {
if (depth == null) {
return flattenForever(array, [])
}
return flattenDepth(array, [], depth)
return flattenWithDepth(array, [], depth)
}