UNPKG

@arrows/array

Version:
25 lines (24 loc) 658 B
declare type Curry1<T> = (arr: T[]) => T[]; declare type Curry2<T> = { (index: number): Curry1<T>; (index: number, arr: T[]): T[]; }; declare type Curry3 = { <T>(value: T): Curry2<T>; <T>(value: T, index: number): Curry1<T>; }; declare type _Set_ = <T>(value: T, index: number, arr: T[]) => T[]; declare type Set_ = _Set_ & Curry3; /** * Creates a new array with a new value at the provided index. * * If the index is out of bound of the array throws an error. * * @param value New value * @param index Specific index * @param arr Initial array * @returns New array */ declare const set_: Set_; export { set_ }; export default set_;