@newdash/newdash
Version:
javascript/typescript utility library
27 lines (26 loc) • 547 B
TypeScript
/**
* Creates a slice of `array` with `n` elements dropped from the end.
*
* @since 5.16.0
* @category Array
* @param array The array to query.
* @param n The number of elements to drop.
* @returns Returns the slice of `array`.
* @example
*
* ```js
* dropRight([1, 2, 3])
* // => [1, 2]
*
* dropRight([1, 2, 3], 2)
* // => [1]
*
* dropRight([1, 2, 3], 5)
* // => []
*
* dropRight([1, 2, 3], 0)
* // => [1, 2, 3]
* ```
*/
export declare function dropRight<T>(array: Array<T>, n?: number): Array<T>;
export default dropRight;