@newdash/newdash
Version:
javascript/typescript utility library
25 lines (24 loc) • 736 B
TypeScript
/**
* Creates a slice of `array` from `start` up to, but not including, `end`.
*
* **Note:** This method is used instead of
* [`Array#slice`](https://mdn.io/Array/slice) to ensure dense arrays are
* returned.
*
* @since 5.6.0
* @category Array
* @param array The array to slice.
* @param start The start position. A negative index will be treated as an offset from the end.
* @param end The end position. A negative index will be treated as an offset from the end.
* @returns Returns the slice of `array`.
* @example
*
* ```js
* var array = [1, 2, 3, 4]
*
* slice(array, 2)
* // => [3, 4]
* ```
*/
export declare function slice<T>(array: ArrayLike<T>, start?: number, end?: number): Array<T>;
export default slice;