import { Props } from "./Objects"; /** * A class which provides some operations on Array * @export * @class Arrays */ export default class Arrays { /** * Checks the given array is exist or not or index is exist or not. * @param src {any[]} * @param index? { number } * @return {boolean} */ static has(src: any[], index?: number): boolean; /** * Gets length of the given array. * @param src {any[]} * @returns {number} */ static getLength(src: any[]): number; /** * Provides to add the given item to the given array by index. * @param src * @param value * @param index * @return {boolean} */ static add(src: any[], value: any, index: number): boolean; /** * Removes value by the given index from the given array * @param src {any[]} * @param index {number} * @return {any[]} */ static remove(src: any[], index: number): any[]; /** * Removes value from the given array * @param src {any[]} * @param value {any} * @return {any[]} */ static removeValue(src: any[], value: any): any[]; /** * Provides to push the given src array to the destination array. * @param {any[]} src * @param {any[]} destination * @return {any[]} */ static pushAll(src: any[], destination: any[]): any[]; /** * Provides to removes the given source array to the given destination array. * @param src * @param dest * @return {any} */ static removeAll(src: T[], dest: T[]): T[]; /** * Provides to navigate in the given Object and create an array from the result of the callback function. * if the result of the callback is empty then ignores it. * @param {any[]} array * @param {(item: any, index?: number, obj?: Object) => T} callback * @returns {Array} */ static map(array: any[], callback: (item: any, index?: number, obj?: Props) => T): T[]; /** * Provides to navigate in the given Object and can broken if return false from callback function. * @param {any[]} array * @param {(item: any, index?: number, obj?: Object) => boolean | void} callback * @returns {boolean} */ static forEach(array: any[], callback: (item: any, index?: number, obj?: Props) => boolean | void): boolean; /** * * Merges the given arrays. * @param {Array[]} arrays * @return {T[]} */ static merge(...arrays: any[][]): any[]; /** * Returns the index of the last occurrence of a specified value in an array. * @param data The given array to be searched. * @param searchElement The value to locate in the array. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array. */ static indexOf>(data: T[], searchElement: T, fromIndex?: number): number; /** * Returns the index of the first occurrence of a value in an array. * @param data The given array to be searched. * @param searchElement The value to locate in the array. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. */ static lastIndexOf>(data: T[], searchElement: T, fromIndex?: number): number; }