diff --git a/src/compat/array/dropRight.ts b/src/compat/array/dropRight.ts index 608e2aa9e..accbe39d3 100644 --- a/src/compat/array/dropRight.ts +++ b/src/compat/array/dropRight.ts @@ -10,9 +10,8 @@ import { toInteger } from '../util/toInteger.ts'; * of elements removed from the end. * * @template T - The type of elements in the array. - * @param collection - The array from which to drop elements. + * @param array - The array from which to drop elements. * @param itemsCount - The number of elements to drop from the end of the array. - * @param [guard] - Enables use as an iteratee for methods like `_.map`. * @returns A new array with the specified number of elements removed from the end. * * @example @@ -20,30 +19,13 @@ import { toInteger } from '../util/toInteger.ts'; * const result = dropRight(array, 2); * // result will be [1, 2, 3] since the last two elements are dropped. */ -export function dropRight(array: ArrayLike | null | undefined, n?: number): T[]; +export function dropRight(array: ArrayLike | null | undefined, itemsCount?: number): T[]; -/** - * Removes a specified number of elements from the end of an array and returns the rest. - * - * This function takes an array and a number, and returns a new array with the specified number - * of elements removed from the end. - * - * @template T - The type of elements in the array. - * @param collection - The array from which to drop elements. - * @param itemsCount - The number of elements to drop from the end of the array. - * @param [guard] - Enables use as an iteratee for methods like `_.map`. - * @returns A new array with the specified number of elements removed from the end. - * - * @example - * const array = [1, 2, 3, 4, 5]; - * const result = dropRight(array, 2); - * // result will be [1, 2, 3] since the last two elements are dropped. - */ -export function dropRight(collection: ArrayLike | null | undefined, itemsCount = 1, guard?: unknown): T[] { - if (!isArrayLike(collection)) { +export function dropRight(array: ArrayLike | null | undefined, itemsCount = 1, guard?: unknown): T[] { + if (!isArrayLike(array)) { return []; } itemsCount = guard ? 1 : toInteger(itemsCount); - return dropRightToolkit(toArray(collection), itemsCount); + return dropRightToolkit(toArray(array), itemsCount); }