@arrows/array
Version:
Functional tools for JS arrays
15 lines (14 loc) • 442 B
TypeScript
declare type _Prepend_ = <T>(value: T, arr: T[]) => T[];
declare type _Prepend2_ = <T>(value: T) => (arr: T[]) => T[];
declare type Prepend_ = _Prepend_ & _Prepend2_;
/**
* Adds a value at the beginning of the array.
* Similar to Array.prototype.unshift, but immutable.
*
* @param value Additional value
* @param arr Initial array
* @returns New array
*/
declare const prepend_: Prepend_;
export { prepend_ };
export default prepend_;