diff --git a/docs/array/flat.mdx b/docs/array/flat.mdx index 2bd17b6f..6c0e7abd 100644 --- a/docs/array/flat.mdx +++ b/docs/array/flat.mdx @@ -1,8 +1,14 @@ --- -title: flat (deprecated) +title: flat description: Flatten an array of arrays into a single dimension --- +:::caution[Deprecated] +This function is deprecated. Use `Array.prototype.flat` instead, which is widely available and supports both deep and shallow flattening. + +[MDN: Array.prototype.flat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat) +::: + ### Usage Given an array that contains many arrays, return a new array where all items from the children are present at the top level. @@ -16,9 +22,3 @@ _.flat(gods) // => [ra, loki, zeus] ``` Note, `_.flat` is not recursive and will not flatten children of children of children ... of children. It will only flatten `T[][]` an array of arrays. - -:::caution -The `_.flat` function has been deprecated and will be removed in the next major release. Please use `Array.prototype.flat` which is widely available and supports both deep and shallow flattening. - -[MDN Documentation for Array.prototype.flat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat) -::: diff --git a/src/array/flat.ts b/src/array/flat.ts index 3558faf0..cf0f46a9 100644 --- a/src/array/flat.ts +++ b/src/array/flat.ts @@ -9,7 +9,7 @@ * // [1, 2, [3], 4, 5] * ``` * - * @deprecated - use [Array.prototype.flat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat) insted + * @deprecated Use [Array.prototype.flat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat) instead. */ export function flat(lists: readonly T[][]): T[] { return lists.flat()