/** * It flattens an array of objects * * @typedef T generic type parameter * @param {T[]} arr - The array to be flattened. * @param {string} [children=children] - The name of the key that contains the children. * @returns {T[]}An array of all the children of the array of items. */ export declare const flattenChildren: (arr: T[], children?: string) => T[]; /** * The function checks if two arrays are equal, either in order or ignoring order with specific comparator. * * @param {T[]} array1 - An array of type T, which is the first array to compare. * @param {T[]} array2 - `array2` is the second array that is being compared for equality with the * first array (`array1`). * @param {boolean} [ignoreOrder=false] - The `ignoreOrder` parameter is a boolean flag that determines * whether the order of elements in the arrays should be taken into account when comparing them. If * `ignoreOrder` is set to `true`, the function will return `true` if the two arrays contain the same * elements, regardless of their order * @param {boolean} [comparator=(a: T, b: T) => number] - The `comparator` parameter is the specific custom method used to compare the two arrays. * @returns {boolean} The function `isArrayEqual` returns a boolean value indicating whether the two input arrays * are equal or not. If the arrays are equal, it returns `true`, otherwise it returns `false`. The * equality of the arrays can be determined either by comparing the elements in the same order or by * ignoring the order of the elements. */ export declare const isArrayEqual: (array1: T[], array2: T[], ignoreOrder?: boolean, comparator?: (a: T, b: T) => number) => boolean; /** * Return true if all the keys of the object are numbers since it's an array-like object, false otherwise. * * @param {Record} obj - The object to check. * @returns {boolean} boolean indicating if the object is array-like */ export declare const isObjectArrayLike: (obj: Record) => boolean; /** * Return the longest text length In a string array * * @param {string[]} textArray string array * @returns {number} text length */ export declare function getLongestTextLengthFromArray(textArray: string[]): number; /** * Convert the single array to nested array base on the lengths of sub-arrays provided, will return the self array if length array not provided * * @example * // return [[1,2],[3,4,5,6]] * revertArrayFromFlatArray([1,2,3,4,5,6],[2,4]) * @example * // return [1,2,3,4,5,6] * revertArrayFromFlatArray([1,2,3,4,5,6],[]) * @param {T[]} flatArr - an array of elements that have been flattened into a single array. * @param {T[]} lengthArr - `lengthArr` is an array of numbers that specifies the length of each sub-array that the `flatArr` * @returns {T[] | T[][]} The function `revertArrayFromFlatArray` returns either a single-dimensional array of type `T[]` or a two-dimensional array of type `T[][]` */ export declare function convertArrayToNestedArray(flatArr: T[], lengthArr: number[]): T[] | T[][]; /** * Convert nested array to simple array. the array only handle the directly children array * * @param {T[] | T[][]} arr the array data source * @returns {T[]} result simple array */ export declare function flatNestedArray(arr: T[] | T[][]): T[]; /** * sort number object array by given property, and the given property must be a number * * @param {T[] | T[][]} data data source * @param {(data: T) => number} sortBy the object item used to sort by * @returns {T[] | T[][]} result array */ export declare function sortArrayOrNestedArray(data: T[] | T[][], sortBy: (data: T) => number): T[] | T[][]; /** * This function sorts an array or nested array based on a provided accessor function and an existing array of strings. * * @param {unknown[] | unknown[][]} needSortArray - The array or nested array that needs to be sorted. * @param {(item: T) => string} [accessor] - The accessor parameter is an optional function that takes an item from the * needSortArray and returns a string value that will be used for sorting. If not provided, the * function assumes that the items in the array are already strings. * @param {(item:string,nextItem:string)=>number} [existArraySorter] - the sort function for the exist array * @param {string[]} [existArray] - The `existArray` parameter is an optional array of strings that * represents the desired order of the elements in the `needSortArray`. If provided, the function will * sort the elements in `needSortArray` based on their position in `existArray`. If not provided, the default exist array will use the default order of the array * @returns {T[] | T[][]} The function `sortAsExistArray` returns a sorted array or nested array of type `T[] | * T[][]`. The sorting is based on the order of elements in the `existArray` parameter, or if * `existArray` is not provided, it is based on the order of appearance of elements in the input array * or nested array. The sorting is done using the `sortArrayOrNested */ export declare function sortAsExistArray(needSortArray: T[] | T[][], accessor?: (item: T) => string, existArraySorter?: (item: string, nextItem: string) => number, existArray?: string[]): T[] | T[][]; /** * The function `findNodeList` iterates through a NodeList and returns the first node that satisfies a * given callback function. * * @param {NodeList} nodeList - NodeList is an array-like object that represents a collection of nodes. * It is typically returned by methods like `querySelectorAll` or `childNodes` in the DOM API. Each * element in the NodeList is a Node object. * @param {(node: Node) => boolean }callBack - The `callBack` parameter is a function that takes a `Node` as an argument and * returns a boolean value. It is used to filter and find a specific node within the `NodeList` based * on certain criteria defined in the callback function. * @returns {Node | undefined} The `findNodeList` function returns a `Node` object if the `callBack` function returns * `true` for any node in the `nodeList`. If none of the nodes satisfy the condition, it returns * `undefined`. */ export declare function findNodeList(nodeList: NodeList, callBack: (node: Node) => boolean): Node | undefined;