import { SortDescriptor } from './sort-descriptor'; import { State } from './state'; import { DataResult } from './data-result.interface'; import { Predicate, Preprocessors } from './common.interfaces'; /** * Orders the specified array according to the provided sort descriptors. * * @param {T[]} data - The data to be sorted. * @param {SortDescriptor[]} descriptors - The descriptors by which the data will be sorted. * @returns {T[]} - The sorted data. * * @example * ```ts-no-run * import { orderBy } from '@progress/kendo-data-query'; * * const data = [ * { name: "Pork", category: "Food", subcategory: "Meat" }, * { name: "Pepper", category: "Food", subcategory: "Vegetables" }, * { name: "Beef", category: "Food", subcategory: "Meat" } * ]; * * const result = orderBy(data, [{ field: "name", dir: "asc" }]); * ``` */ export declare const orderBy: (data: T[], descriptors: SortDescriptor[], preprocessors?: Preprocessors) => T[]; declare type Comparer = (a: T, b: T) => boolean; /** * Reduces the provided array so it contains only unique values. * * @param {T[]} data - The array that will be reduced. * @param {(Comparer | string)} comparer - An optional custom comparer function or the field name that will be used for comparison. * @returns {T[]} - The reduced data. * * @example * ```ts-no-run * import { distinct } from '@progress/kendo-data-query'; * * const data = [ * { name: "Pork", category: "Food", subcategory: "Meat" }, * { name: "Pepper", category: "Food", subcategory: "Vegetables" }, * { name: "Beef", category: "Food", subcategory: "Meat" } * ]; * * const result = distinct(data, "subcategory"); * * // output: * // result => [ * // { name: "Pork", category: "Food", subcategory: "Meat" }, * // { name: "Pepper", category: "Food", subcategory: "Vegetables" } * // ]; * ``` */ export declare const distinct: (data: T[], comparer?: Comparer | string) => T[]; /** * @hidden */ export declare const count: (data: T[], predicate: Predicate) => number; /** * @hidden */ export declare const limit: (data: T[], predicate: Predicate) => T[]; /** * Applies the specified operation descriptors to the data. * * @param {T[]} data - The data to be processed. * @param {State} state - The operation descriptors that will be applied to the data. * @returns {DataResult} - The processed data. * * @example * ```ts-no-run * * const result = process(data, { * skip: 10, * take: 20, * group: [{ * field: 'category.categoryName', * aggregates: [ * { aggregate: "sum", field: "unitPrice" }, * { aggregate: "sum", field: "unitsInStock" } * ] * }], * sort: [{ field: 'productName', dir: 'desc' }], * filter: { * logic: "or", * filters: [ * { field: "discontinued", operator: "eq", value: true }, * { field: "unitPrice", operator: "lt", value: 22 } * ] * } * }); * * ``` */ export declare const process: (data: T[], state: State, preprocessors?: Preprocessors) => DataResult; export {}; //# sourceMappingURL=array.operators.d.ts.map