dastal
Version:
Data Structures & Algorithms implementations
33 lines (32 loc) • 1.22 kB
TypeScript
/**
* Check if a value is an Array or TypedArray.
*
* @param obj - The value to check.
*
* @returns `true` if an Array or TypedArray, otherwise `false`.
*/
export declare function isArray<T = any>(obj: unknown): obj is T[];
/**
* Check if a value is a TypedArray.
*
* See [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray)
* for more details.
*
* @param obj - The value to check.
*
* @returns `true` if a TypedArray, otherwise `false`.
*/
export declare const isTypedArray: <T = any>(obj: unknown) => obj is T[];
/**
* Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
*
* Contrary to Array.splice, this will not throw an error if too many new elements are given as arguments.
*
* @param array - The array to splice.
* @param start - The zero-based location in the array from which to start removing elements.
* @param count - The number of elements to remove.
* @param elements - The new elements to splice in.
*
* @returns - An array containing the deleted elements.
*/
export declare function splice<T>(array: T[], start?: number, count?: number, elements?: T[]): T[];