declare global { interface Array { /** * Returns the first element of a the array, or the first element that satisfies the condition (by predicateFunc), or defaultValue if no element is found. * @param predicateFunc A optional function to test each element for a condition. If function is not specified, the first element is returend or defaultValue. * @param defaultValue A default value that will be returned if the element is not found. If this parameter is not specified, null is returned. * @example items.FirstOrDefault((item) => item.name === "SPFx-App.dev";); * @returns null|defaultValue if Array is empty or if no element passes the test specified by predicate; otherwise, the first element in source Array that passes the test specified by predicate. * @since 1.0.0 * @since 1.1.0 predicateFunc is optional, if not set the first element or null|defaultValue is returned */ FirstOrDefault(predicateFunc?: (item: T) => boolean, defaultValue?: T | null): T | null; /** * Returns the first index of element of a sequence, or -1 if no element is found. * @param predicateFunc A function to get the index for a condition. * @example items.IndexOf((item) => { return item.name === "SPFx-App.dev"; }); * @returns null if Array is empty or if no element passes the test specified by predicate; otherwise, the first element in source Array that passes the test specified by predicate. * @since 1.0.0 */ IndexOf(predicateFunc: (item: T) => boolean): number; /** * Filters a sequence of values based on a predicate. * @param predicateFunc A function to test each element for a condition. * @example items.Where((item) => { return item.Active === true; }); * @returns An Array that contains elements from the input sequence that satisfy the condition. * @since 1.0.0 */ Where(predicateFunc: (item: T) => boolean): Array; /** * Sorts the elements of a sequence in ascending order. * @param keySelector A function to extract a key from an element. * @example items.OrderBy((item) => item.name); * @returns An Array whose elements are sorted according to a key. * @since 1.0.0 */ OrderBy(keySelector: (item: T) => any): Array; /** * Sorts the elements of a sequence in descending order. * @param keySelector A function to extract a key from an element. * @example items.OrderByDescending((item) => item.name); * @returns An Array whose elements are sorted descending to a key. * @since 1.0.0 */ OrderByDescending(keySelector: (item: T) => any): Array; /** * Sorts the elements of a sequence in ascending order (first by a then by b then by c etc.). * @param keySelectors An array of functions to extract a key from an element. * @example items.OrderByMultiple([(item) => item.name, (item) => item.id]); * @returns An Array whose elements are sorted ascending to multiple keys. * @since 1.0.0 */ OrderByMultiple(keySelectors: Array<(item: T) => any>): Array; /** * Sorts the elements of a sequence in descending order (first by a then by b then by c etc.). * @param keySelectors An array of functions to extract a key from an element. * @example items.OrderByMultipleDescending([(item) => item.name, (item) => item.id]); * @returns An Array whose elements are sorted descending to multiple keys. * @since 1.0.0 */ OrderByMultipleDescending(keySelectors: Array<(item: T) => any>): Array; /** * Determines whether an array contains a particular element that satisfies the condition * @param predicateFunc A function to test each element for a condition. * @returns true if the Array contains the element, otherwise false * @since 1.1.0 */ Contains(predicateFunc: (item: T) => boolean): boolean; /** * Returns the number of elements that satisfies the condition * @param predicateFunc A function to test each element for a condition. * @returns The number of elements * @since 1.1.0 */ Count(predicateFunc: (item: T) => boolean): number; /** * Returns the last element of a the array, or the last element that satisfies the condition (by predicateFunc), or defaultValue if no element is found. * @param predicateFunc A optional function to test each element for a condition. If function is not specified, the last element is returend or defaultValue. * @param defaultValue A default value that will be returned if the element is not found. If this parameter is not specified, null is returned. * @returns defaultValue if no element is found, otherwise the last element last element of a the array, or the last element that satisfies the condition (by predicateFunc) * @since 1.1.0 */ LastOrDefault(predicateFunc?: (item: T) => boolean, defaultValue?: T | null): T | null; /** * Add one or more items at specified index * @param index The index at which to add the new item(s). If greater than the length of the array or negative, the item(s) are added at the end. * @param itemToAdd One or more elements to add to the array * @since 1.1.0 */ AddAt(index: number, ...itemToAdd: any[]): void; /** * Remove the item(s) at specified index * @param index The index at which to remove the item(s) * @param totalItemsToRemove Number of elements to be removed from the specified index. Default: 1 * @since 1.1.0 */ RemoveAt(index: number, totalItemsToRemove?: number): void; } } export {}; //# sourceMappingURL=ArrayExtensions.d.ts.map