format: prettify entire project

This commit is contained in:
Rim
2025-04-02 06:50:39 -04:00
parent 86f0782a98
commit 7ccc0be712
1711 changed files with 755867 additions and 235931 deletions

View File

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