@aappddeevv/dynamics-client-ui
Version:
## What is it? A library to help you create great dynamics applications.
17 lines (16 loc) • 743 B
TypeScript
/** Type of change. */
export declare type ChangeType = "add" | "remove" | "change";
/** Return a mutated map. */
export declare function changeMap<T>(m: {
[pname: string]: T;
}, changeType: ChangeType, item: T, getId: (t: T) => any): typeof m;
/**
* Add, remove or change list entries. If change indicated and
* the element is not found, it is added to the end. Uses
* strict equals by default.
*/
export declare function changeListBase<T>(input: Array<T>, changeType: ChangeType, change: T, getId: (t: T) => any, equals?: (t: T, t2: T) => boolean): T[];
/** Change a last assuming it has an "id" property. */
export declare function changeList<T extends {
id: string;
}>(input: Array<T>, changeType: ChangeType, change: T): T[];