import { Selector, Predicate, ParsingOptions, FieldDescription, PrimitiveType, TableDto, DataTypeName, ScalarType } from './types'; import { JSONParser } from './utils'; export declare class DataPipe { private data; constructor(data?: any[]); fromCsv(content: string, options?: ParsingOptions): DataPipe; parseCsv(content: string, options?: ParsingOptions): DataPipe; /** * Loads dataPipe with Table information * @param rowsOrTable a datarows with 2 dimentional arrays or entire table. If you provide rows, then you have to specify fieldNames * @param fieldNames fieldNames what correspond to the rows * @param fieldDataTypes fieldNames what correspond to the rows */ fromTable(rowsOrTable: PrimitiveType[][] | TableDto, fieldNames?: string[], fieldDataTypes?: DataTypeName[]): DataPipe; /** * Get pipes currrent array data. */ toArray(): any[]; /** * Outputs Pipe value as CSV content * @param delimiter */ toCsv(delimiter?: string): string; /** * Outputs pipe value as JavaScript object. * @param keyField a key selector represented as a string (field name) or array of stringa (fieldNames) or custom selectors */ toObject(keyField: string | string[] | Selector): Record; /** * Convert array of items to into series array or series record. * @param propertyName optional parameter to define a property to be unpacked. * If it is string the array with values will be returned, otherwise an object with a list of series map */ toSeries(propertyName?: string | string[]): Record | ScalarType[]; /** * Gets table data from JSON type array. */ toTable(): TableDto; /** * This method allows you to examine a state of the data during pipe execution. * @param dataFunc */ tap(dataFunc: (d: any[]) => void): DataPipe; /** * Sum of items in array. * @param elementSelector Function invoked per iteration. * @example * dataPipe([1, 2, 5]).sum(); // 8 * * dataPipe([{ val: 1 }, { val: 5 }]).sum(i => i.val); // 6 */ sum(elementSelector?: Selector): number | null; /** * Average of array items. * @param elementSelector Function invoked per iteration. * @example * dataPipe([1, 5, 3]).avg(); // 3 */ avg(elementSelector?: Selector): number | null; average: (elementSelector?: Selector | undefined) => number | null; /** * Count of elements in array. * @param predicate Predicate function invoked per iteration. */ count(predicate?: Predicate): number | null; /** * Computes the minimum value of array. * @param elementSelector Function invoked per iteration. */ min(elementSelector?: Selector): number | Date | null; /** * Computes the maximum value of array. * @param elementSelector Function invoked per iteration. */ max(elementSelector?: Selector): number | Date | null; /** * Gets first item in array satisfies predicate. * @param predicate Predicate function invoked per iteration. */ first(predicate?: Predicate): any | undefined; /** * Gets last item in array satisfies predicate. * @param array The array to process. * @param predicate Predicate function invoked per iteration. */ last(predicate?: Predicate): any | undefined; /** * Get mean. * @param field Property name or Selector function invoked per iteration. */ mean(field?: Selector | string): number | null; /** * Get quantile of a sorted array. * @param field Property name or Selector function invoked per iteration. * @param p quantile. */ quantile(p: number, field?: Selector | string): number | null; /** * Get variance. * @param field Property name or Selector function invoked per iteration. */ variance(field?: Selector | string): number | null; /** * Get the standard deviation. * @param field Property name or Selector function invoked per iteration. */ stdev(field?: Selector | string): number | null; /** * Get median. * @param field Property name or Selector function invoked per iteration. */ median(field?: Selector | string): number | null; /** * Groups array items based on elementSelector function * @param elementSelector Function invoked per iteration. */ groupBy(elementSelector: Selector): DataPipe; /** * Joins two arrays together by selecting elements that have matching values in both arrays * @param rightArray array of elements to join * @param leftKey left Key * @param rightKey * @param resultSelector */ innerJoin(rightArray: any[], leftKey: string | string[] | Selector, rightKey: string | string[] | Selector, resultSelector: (leftItem: any, rightItem: any) => any): DataPipe; leftJoin(rightArray: any[], leftKey: string | string[] | Selector, rightKey: string | string[] | Selector, resultSelector: (leftItem: any, rightItem: any) => any): DataPipe; fullJoin(rightArray: any[], leftKey: string | string[] | Selector, rightKey: string | string[] | Selector, resultSelector: (leftItem: any, rightItem: any) => any): DataPipe; /** * Select data from array item. * @param elementSelector Function invoked per iteration. * @example * * dataPipe([{ val: 1 }, { val: 5 }]).select(i => i.val).toArray(); // [1, 5] */ select(elementSelector: Selector): DataPipe; map: (elementSelector: Selector) => DataPipe; merge(sourceArray: any[], targetKey: string | string[] | Selector, sourceKey: string | string[] | Selector): DataPipe; flattenObject(): any; unflattenObject(): any; flatten(): any; pivot(rowFields: string | string[], columnField: string, dataField: string, aggFunction?: (array: any[]) => any | null, columnValues?: string[]): DataPipe; transpose(): DataPipe; /** * Filters array of items. * @param predicate Predicate function invoked per iteration. */ where(predicate: Predicate): DataPipe; filter: (predicate: Predicate) => DataPipe; /** * Get unique values * @param elementSelector Function invoked per iteration. */ unique(elementSelector?: Selector): DataPipe; distinct: (elementSelector?: Selector | undefined) => DataPipe; /** * Sort array. * @param fields sorts order. * @example * dp.sort('name ASC', 'age DESC'); */ sort(...fields: string[]): DataPipe; /** * generates a field descriptions (first level only) that can be used for relational table definition. * if any properties are Objects, it would use JSON.stringify to calculate maxSize field. */ getFieldsInfo(): FieldDescription[]; JSONParser(): JSONParser; } //# sourceMappingURL=data-pipe.d.ts.map