DieselDepot-APP/node_modules/es-toolkit/dist/compat/array/flattenDepth.d.mts
SJCoetz def597c157 chore: add generated build artifacts and node module type files
add all Next.js build outputs and third-party dependency type declaration files
2026-07-20 01:18:42 +02:00

23 lines
No EOL
676 B
TypeScript

import { ListOfRecursiveArraysOrValues } from "../_internal/ListOfRecursiveArraysOrValues.mjs";
//#region src/compat/array/flattenDepth.d.ts
/**
* Recursively flattens array up to depth times.
*
* @template T
* @param array - The array to flatten.
* @param [depth=1] - The maximum recursion depth.
* @returns 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]
*/
declare function flattenDepth<T>(array: ListOfRecursiveArraysOrValues<T> | null | undefined, depth?: number): T[];
//#endregion
export { flattenDepth };