UNPKG

fabric8-planner

Version:
50 lines (49 loc) 1.2 kB
export interface modelUI { id?: string; name?: string; } export declare class modelService { id?: string; type: string; } export interface CommonSelectorUI { key: string; value: string; selected: boolean; cssLabelClass?: string | undefined; icon?: string; } export interface MapTree { [index: number]: { fromPath?: string[]; toPath?: string[]; toValue?: any; toFunction?: any; }; length: number; push: any; } export interface Mapper<I, O> { uiToServiceMapTree: MapTree; serviceToUiMapTree: MapTree; toUIModel(data: I): O; toServiceModel(data: O): I; } export declare function switchModel<I, O>(input: I, mapTree: MapTree): O; /** * * @param obj the object to be cleaned * @param keys the keys in the object to be clened * * Any property with value null will be deleted * Any property mentioned in the key array will be deleted */ export declare function cleanObject(obj: any, keysToRemove?: string[]): any; /** * This function normalize the array to * a key value paired dictionary * @param arr */ export declare function normalizeArray<I>(arr: I[], id?: string): { [id: string]: I; };