Project Init

This commit is contained in:
Muluhabt
2026-05-29 15:23:46 +03:00
commit 2fbc557aac
67387 changed files with 6063341 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
import { flatten } from "./flatten.mjs";
//#region src/compat/array/flattenDepth.ts
/**
* Recursively flattens array up to depth times.
*
* @template T
* @param {ArrayLike<T> | null | undefined} array - The array to flatten.
* @param {number} [depth=1] - The maximum recursion depth.
* @returns {T[]} Returns the new flattened array.
*
* @example
* const array = [1, [2, [3, [4]], 5]];
*
* flattenDepth(array, 1);
* // => [1, 2, [3, [4]], 5]
*
* flattenDepth(array, 2);
* // => [1, 2, 3, [4], 5]
*/
function flattenDepth(array, depth = 1) {
return flatten(array, depth);
}
//#endregion
export { flattenDepth };