UNPKG

cubus

Version:
42 lines (41 loc) 1.02 kB
export declare type Index = { [key: string]: string[]; }; export declare type Bucket<T> = { [key: string]: T; }; export declare type CubusJSON<T> = { dimensions: string[]; index: Index; data: Bucket<T>; splitter: string; }; export declare type Query = { [key: string]: string[]; }; export declare type Result<T> = { value: T; property: { name: string; value: string; }[]; }; export default class Cubus<T> { private $$dimensions; private $$index; private $$bucket; private $$splitter; constructor(dimensions: string[], splitter?: string); query(query: Query): Result<T>[]; query(query: Query, raw: boolean): T[]; addDimensionValue(d: string, v: string): number; add(raw: T, property: { [key: string]: string; }, force?: boolean): this; remove(property: { [key: string]: string[]; }): this; clear(): this; toJSON(splitter?: string): CubusJSON<T>; fromJSON<T>(json: CubusJSON<T>): this; }